<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3602674777707139629</id><updated>2011-11-28T08:35:09.132+08:00</updated><category term='android'/><category term='me'/><category term='java'/><category term='basketball'/><category term='symbian'/><category term='C/C++'/><category term='programming'/><category term='Design Pattern'/><category term='music'/><category term='ubuntu'/><category term='motion planning'/><category term='google'/><category term='life'/><title type='text'>lui</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>54</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-9155642374730524762</id><published>2010-04-28T23:57:00.003+08:00</published><updated>2010-04-29T00:09:17.741+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Design Pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>Singleton Pattern</title><content type='html'>Singleton Pattern帶來的是保證一個class只有一個實體，無法產生第二個第三個...　使用這種模式的概念是系統中永遠只會唯一存在，如OS kernal、program core或hardward controller等。C++實作如下：&lt;br /&gt;
&lt;pre class="cpp" name="code"&gt;class IOController {
private:
    IOController() { /*implement*/ }
    IOController(const Core&amp;);
    IOController&amp; operator=(const IOController&amp;);
    virtual ~IOController();

public:
    static IOController&amp; getIOController() {
        static IOController IOController;
        return IOController;
    }

    void memberFunctionA() {}
    void memberFunctionA() {}

private:
    MemberData A;
    MemberData B;
};
&lt;/pre&gt;一個正確的Singleton應該確保&lt;b&gt;唯一性&lt;/b&gt;，C++確保唯一的保護措施有三點：&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;1.&lt;/span&gt;&lt;/b&gt; default constructor宣告為private並實作（空內容也沒關係）。因此實體只能在內部產生，外部無法取得建構子。&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;2.&lt;/span&gt;&lt;/b&gt; copy constructor and operator=宣告為private並不實作。宣告為private使得外部無法取得函式原型，不實作它是因為不需要，並且令編譯失敗（若使用到copy constructor or operator=，因為沒有實作，會產生連結錯誤，確保不能複製物件）&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;3.&lt;/span&gt;&lt;/b&gt; destructor宣告為private，防止外部刪除實體。（這一點可商議。若getIOController()回傳IOController*，則destructor必須宣告為private；若getIOController回傳IOController&amp;，那這點可忽略）&lt;br /&gt;
&lt;br /&gt;
另外值得注意的是getIOController()中宣告static IOController IOController物件，這樣寫法是依賴編譯器的一個規則，&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;"函式內的靜態物件在該函式第一次執行時被初始化"&lt;/span&gt;&lt;/b&gt;，所以getIOController從末被呼叫時，IOController沒有被初始化，效能並沒有降低。&lt;br /&gt;
&lt;br /&gt;
提到唯一性一定會想起靜態函式和靜態物件，那Singleton可以利用靜態來實作嗎&lt;br /&gt;
&lt;pre class="cpp" name="code"&gt;class IOController {
public:
    static void memberFunctionA() {}
    static void memberFunctionA() {}
    // ...

private:
    static MemberData A;
    static MemberData B;
    // ...
};
&lt;/pre&gt;這樣看似沒甚麼問題，也不需要宣告private之類有的沒的。但是這情況下會缺乏擴充性，假如現在需要第二代IOController2，且保留IOController，視不同情況選擇使用。這樣實作IOController2會很困難，因為靜態函式不能成為虛擬函式，所以IOController和IOController2不能使用多型。若以原來的範例則可以輕鬆解決。&lt;br /&gt;
&lt;pre class="cpp" name="code"&gt;class IOController2 : public IOController {
private:
    IOController2() { /*implement*/ }
    IOController2(const IOController2&amp;);
    IOController2&amp; operator=(const IOController2&amp;);
    virtual ~IOController2();

public:
    static IOController2&amp; getIOController2() {
        static IOController2 IOController2;
        return IOController2;
    }

    void memberFunctionA() {}
    void memberFunctionB() {}

private:
    MemberData C;
    MemberData D;
};
&lt;/pre&gt;&lt;pre class="cpp" name="code"&gt;void main {
    bool condition = true;
    Core&amp; core = condition? IOController2::getIOController2(): IOController::getIOController();

    core.memberFunctionA();
    core.memberFunctionB();
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-9155642374730524762?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/9155642374730524762/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=9155642374730524762' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/9155642374730524762'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/9155642374730524762'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2010/04/singleton-pattern.html' title='Singleton Pattern'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-5977659404969030603</id><published>2010-04-21T22:45:00.003+08:00</published><updated>2010-04-22T18:22:24.794+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='music'/><title type='text'>陀飛輪</title><content type='html'>主誯：陳奕迅&lt;br /&gt;
作曲：Vincent Chow　填詞：黃偉文&lt;br /&gt;
編曲：Gary Tong　監製：Alvin Leong&lt;br /&gt;
&lt;br /&gt;
過去十八歲　沒戴錶　不過有時間&lt;br /&gt;
夠我　沒有後顧　野性貪玩&lt;br /&gt;
&lt;br /&gt;
霎眼廿七歲　時日無多　方不敢偷惰&lt;br /&gt;
宏願縱未了　奮鬥總不太晚&lt;br /&gt;
&lt;br /&gt;
然後突然今秋&lt;br /&gt;
望望身邊　應該有　已盡有&lt;br /&gt;
我的美酒　跑車　相機　金錶　也講究&lt;br /&gt;
直到世間　個個也妒忌　仍不怎麼富有&lt;br /&gt;
用我尚有　換我沒有　其實已用盡所擁有&lt;br /&gt;
&lt;br /&gt;
曾付出　幾多心跳&lt;br /&gt;
來換取　一堆堆的發票&lt;br /&gt;
人值得　命中減少幾秒　多買一隻錶&lt;br /&gt;
秒速　捉得緊了&lt;br /&gt;
而皮膚竟偷偷鬆了&lt;br /&gt;
為何用到盡了　至知哪樣緊要&lt;br /&gt;
&lt;br /&gt;
勞力是　無止境&lt;br /&gt;
活著多好　不需要　靠物證&lt;br /&gt;
也不以高薪　高職　高級品　搏尊敬　wo~&lt;br /&gt;
就算搏到　伯爵那地位　和蕭邦的雋永&lt;br /&gt;
賣了任性　日拼夜拼　忘掉了為甚麼高興&lt;br /&gt;
&lt;br /&gt;
曾付出　幾多心跳&lt;br /&gt;
來換取　一堆堆的發票&lt;br /&gt;
人值得　命中減少幾秒　多買一隻錶&lt;br /&gt;
秒速　捉得緊了&lt;br /&gt;
而皮膚竟偷偷鬆了&lt;br /&gt;
為何用到盡了　至知哪樣緊要&lt;br /&gt;
&lt;br /&gt;
記住那關於光陰的教訓&lt;br /&gt;
回頭走天已暗&lt;br /&gt;
你獻出了十吋　時和分&lt;br /&gt;
可有換到十吋金&lt;br /&gt;
&lt;br /&gt;
還剩低　幾多心跳&lt;br /&gt;
人面跟水晶錶面對照&lt;br /&gt;
連自己　亦都分析不了　得到多與少&lt;br /&gt;
也許　真的瘋了&lt;br /&gt;
那個倒影多麼可笑&lt;br /&gt;
靈魂若變賣了　上鏈也沒心跳&lt;br /&gt;
&lt;br /&gt;
銀或金　都不緊要&lt;br /&gt;
誰造機芯　一樣了&lt;br /&gt;
計劃了　照做了　得到了　時間卻太少　no~&lt;br /&gt;
&lt;br /&gt;
還剩低　幾多心跳&lt;br /&gt;
還在數　趕不及了&lt;br /&gt;
昂貴是這刻　我覺悟了&lt;br /&gt;
在時計裏　看破一生　渺渺&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-5977659404969030603?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/5977659404969030603/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=5977659404969030603' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/5977659404969030603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/5977659404969030603'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2010/04/blog-post.html' title='陀飛輪'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-2433811445001601609</id><published>2010-04-21T01:40:00.008+08:00</published><updated>2010-04-21T01:52:02.116+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Design Pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>Memento Pattern</title><content type='html'>&lt;b&gt;Mememto Pattern&lt;/b&gt;是一個簡單輕量的模式，基本上它十分簡單，也沒有必要複雜化。故名思義，這種模式是記錄一些回憶，過去資訊，目的是為了備份。在大型軟體中功能複雜而彈性，必定會提供使用者進行設定，在設定途中，總會有使用者想反悔不想執行改變設定，這種模式就是為了取消還原設定而存在的。&lt;br /&gt;
&lt;pre class="cpp" name="code"&gt;class CoreMemento {
    friend class Core;

private:
    CoreMemento() {}
    CoreMemento(const CoreMemento&amp;);
    CoreMemento&amp; operator=(const CoreMemento&amp;);

    // member data
};

class Core {
public:
    // member function, getter/setter function

    CoreMemento　getMemento();
    bool recovery(const CoreMemento&amp;);
};

class ConfigDialog {
public:
    ConfigDialog(Core&amp; core) : m_core(core) {
        m_memento = m_core.getMemento();
    }

    void OnCancel() {
        core. recovery(m_backup);
    }

    // member function, setting core function

private:
    Core&amp; m_core;
    CoreMemento　m_backup;
};
&lt;/pre&gt;Memento class的實作如上所示，它沒有成員函式，只有成員變數記錄資料，亦沒有任何資料對外公開，甚至宣告copy constructor和operator=為私有不讓programmer複製物件，只宣告friend class讓Core作存取。因為實際上Memento class的用途只為了記錄Core的資料供還原使用，過多的公開是不必的，還可能誤導programmer認為Memento是可修改的，良好的設計應該在編譯期就檢查出來。&lt;br /&gt;
&lt;br /&gt;
假設ConfigDialog是一個供使用者設定Core的UI介面，當使用者修改途中按取消鍵，會呼叫OnCancel()，這函式就把一開始的CoreMemento提供給Core作還原。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-2433811445001601609?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/2433811445001601609/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=2433811445001601609' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/2433811445001601609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/2433811445001601609'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2010/04/memento-pattern.html' title='Memento Pattern'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-1304771484278324688</id><published>2010-04-17T02:58:00.044+08:00</published><updated>2011-11-07T14:35:02.922+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Design Pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>Policy-Based Class Design</title><content type='html'>在C++新增template功能的初期，大家普遍認為template只是為物件導向設計得到更好的重用性，不單單將重複使用的程式碼設計成物件類別(class)，連類別也重用，經由編譯器幫programmer把不同型別但功能完全相同的程式碼複製。如standard template library裡的vector，宣告vector就是一個存intergerarray的向量，宣告vector就是一個存character pointer array的向量，各自均在insert, earse等功能相同的介面。&lt;br /&gt;
&lt;br /&gt;
其後有意無意間大家發現template能做的事情不單單如此，甚至出乎意料之外的強大，如使用LISP之類的技巧令編譯器幫你在編譯期運算，或編譯期才組合產生你所需要的程式碼。&lt;br /&gt;
&lt;br /&gt;
在大型長期開發的軟體中，保持&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;架構&lt;/span&gt;&lt;/b&gt;、&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;效能&lt;/span&gt;&lt;/b&gt;、&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;延展性&lt;/span&gt;&lt;/b&gt;和&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;介面一致&lt;/span&gt;&lt;/b&gt;十分重要，可是軟體設計必定不斷變動，功能的擴充、模組的更換尤其繁甚，為了加插功能、修改模組，結果往往就是架構變型，效能降低，介面不一致，元件肥大。（更可怕的是為求擴充，不斷新增介面，混亂不堪，日後維護困難，難以接手）&lt;br /&gt;
&lt;br /&gt;
Policy-Based Class Design是一種新思維的設計方法，藉由template把各種小行為在編譯期組合成為功能複雜的元件，具有高度的效能和彈性。這種設計分為兩部份 ── policies, host class。&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;policies&lt;/span&gt;&lt;/b&gt;是一些小型的類別，只單純負責某一核心功能，獨立運作的「策略」，如設計模式 (Design Pattern) 中的行為模式 (behavioral pattern) 或結構模式 (structural pattern)，而&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;host class&lt;/span&gt;&lt;/b&gt;像是一個外殼，由多個policies組成，針對特定主題，定義通用介面和錯綜複雜的邏輯流程，核心功能的細節完全經由組合的policies來實現。這種程式設計就像現實生活中的大公司，主管就是host class，為了完成專案找了幾個小將(policies)回來，排行程，分配資源，協調工作，開會擋箭，追殺廠商等，小將只要完成專案裡的需求就好了。（真完美）&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
現在來看看軟體裡經常會遇到的案例，假設軟體需要存儲設定，一開始決定使用ini格式，因此普遍會寫一個ConfigManager，提供寫入、擷取和操作介面。&lt;br /&gt;
&lt;pre class="cpp" name="code"&gt;class ConfigManager {
public:
    BOOL Load(char* path);
    void Write(char* path);

    BOOL Add(char* columeName, char* columeValue);
    char* columeValue Query(char* columeName);
};
&lt;/pre&gt;如果考慮到延展性，ConfigManager將會繼承Load()和Write()這兩個單獨功能的類別。但這樣有一個缺點ConfigManager會繼承IniLoader和IniWriter裡所有公開介面，介面被破壞。&lt;br /&gt;
&lt;pre class="cpp" name="code"&gt;class ConfigManager : public IniLoader, public IniWriter {
public:
    BOOL Add(char* columeName, char* columeValue);
    char* columeValue Query(char* columeName);
};

class IniLoader {
public:
    virtual BOOL Load(char* path);
};

class IniWriter {
public:
    virtual BOOL Write(char* path);
};
&lt;/pre&gt;除了使用多重繼承外，也可使用組合物件方式。&lt;br /&gt;
&lt;pre class="cpp" name="code"&gt;class ConfigManager {
public:
    BOOL Load(char* path) {
        if (IsExist(path))
            m_iniLoader.Load(path);
    }
    void Write(char* path) {
        if (IsExist(path))
            m_iniWriter.Write(path);
    }

    BOOL Add(char* columeName, char* columeValue);
    char* columeValue Query(char* columeName);

private:
    IniLoader m_iniLoader;
    IniWriter m_iniWriter;
};
&lt;/pre&gt;其後軟體需要更換模組，假設由Ini改為Xml，還需要自動從Ini升級到Xml喔。所以可能會設計抽象類別BaseLoader和BaseWriter，IniLoader, XmlLoader, IniWriter, XmlWriter分別繼承抽象，並傳入ConfigManager中，讓上層去決定使用那種Loader和Writer。&lt;br /&gt;
&lt;pre class="cpp" name="code"&gt;class ConfigManager {
public:
    ConfigManager(BaseLoader* pLoader, BaseWriter* pWriter) {
        m_pLoader = pLoader; m_pWriter = pWriter;
    }

    BOOL Load(char* path) {
        if (IsExist(path))
            m_iniLoader.Load(path);
    }
    void Write(char* path) {
        if (IsExist(path))
            m_iniWriter.Write(path);
    }

    BOOL Add(char* columeName, char* columeValue);
    char* columeValue Query(char* columeName);

private:
    BaseLoader* m_pLoader;
    BaseWriter* m_pWriter;
};

class BaseLoader {
public:
    virtual BOOL Load(char* path) = 0;
};

class BaseWriter {
public:
    virtual BOOL Write(char* path) = 0;
};
&lt;/pre&gt;現在的設計看起來一切都很好，可怕的事情發生了，針對Xml的讀入處理，ConfigManager需要提供一個介面Fix()，這時介面的一致性就被破壞了，如果使用一開始所說的多重繼承，則必須宣告四個不同的類別才能令介面保持一致性。如果未來還新增網路讀取功能NetLoader, NetWriter，就必須宣告 2 * 2 * 2 個不同類別了，這不就正好是template的能力嗎。&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;”令軟體存在數種不同版本的設計實作方案，每次只從中選擇其一的方案，而又需要保持切換與擴充的彈性”&lt;/span&gt;&lt;/b&gt;就是Policy-Based Class Design的中心思想。Policy-Based Class Design的設計如下，ConfigManager是host class，IniLoader, IniWriter, XmlLoader和XmlWriter是policies。&lt;br /&gt;
&lt;pre class="cpp" name="code"&gt;template&amp;lt;class Loader, class Writer&amp;gt;
class ConfigManager : public Loader, public Writer {
public:
    BOOL Load(char* path) {
        if (IsExist(path))
            m_iniLoader.Load(path);
    }
    void Write(char* path) {
        if (IsExist(path))
            m_iniWriter.Write(path);
    }

    BOOL Add(char* columeName, char* columeValue);
    char* columeValue Query(char* columeName);
};

class XmlLoader {
public:
    BOOL Load(char* path);
    BOOL Fix();
};
&lt;/pre&gt;&lt;pre class="cpp" name="code"&gt;void main() {
    ConfigManager&amp;lt;Xmlloader, Iniwriter&amp;gt; c1;
    ConfigManager&amp;lt;Iniloader, Xmlwriter&amp;gt; c2;
    ConfigManager&amp;lt;Xmlloader, Netwriter&amp;gt; c3;

    c1.Load("xxx");
    c1.Fix();
    c2.Load("xxx");
    c2.Fix(); &amp;nbsp; &amp;nbsp;// compile error
    c3.Load("xxx");
    c1.Write("xxx");
    c2.Write("xxx");
    c3.Write("xxx");
}
&lt;/pre&gt;看到這裡總會有點點卡住，到底Polymorphism Design和Policy-Based Class Design有甚麼差別呢。其實兩者之間有著極大的差異，如果說繼承體系是上而下 (top down)構成，介面由Base class定義，由Derived class實作，那麼Policy-Based Class就是下而上 (bottom up)構成，介面由Host class定義，由Policy class實作。Host class會繼承它所需的policies，並且在Host class中定義出操作行為的骨架流程，至於真正的實作細節，則全權委派 (delegate)給policies進行處理。&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;架構恰好完全與繼承體系方向相反&lt;/span&gt;&lt;/b&gt;。&lt;br /&gt;
&lt;br /&gt;
上述例子中還不算最終形式的Policy-Based Class Design，就像遞迴一樣的概念，tempate也可以是多層的，經由Host class傳遞template parameter給polices來逹到，能組合出更多的功能。（這種組合可是次方級數成長的喔），如下，現在不再統一一起寫設定檔，改為每個元件單獨讀寫。&lt;br /&gt;
&lt;pre class="cpp" name="code"&gt;template&amp;lt;class Loader, class Writer, class Componet&amp;gt;
class ConfigManager : public Loader&amp;lt;Componet&amp;gt;, public Writer&amp;lt;Componet&amp;gt; {
public:
    BOOL Load(char* path) {
        if (IsExist(path))
            m_iniLoader.Load(path);
    }
    void Write(char* path) {
        if (IsExist(path))
            m_iniWriter.Write(path);
    }

    BOOL Add(char* columeName, char* columeValue);
    char* columeValue Query(char* columeName);
};

template&amp;lt;class Componet&amp;gt;
class IniLoader {
public:
    BOOL Load(char* path) {
        Componet::GetConfigInfo();
        // do something
    }
};
&lt;/pre&gt;&lt;pre class="cpp" name="code"&gt;void main() {
    ConfigManager&amp;lt;XmlLoader, IniWriter, Schedular&amp;gt; c1;
    ConfigManager&amp;lt;IniLoader, XmlWriter, Recorder&amp;gt; c2;
    ConfigManager&amp;lt;IniLoader, NetWriter, RemoteServer&amp;gt; c3;

    c1.Load("xxx");
    c1.Fix();
    c2.Load("xxx");
    c2.Fix(); &amp;nbsp; &amp;nbsp;// compile error
    c3.Load("xxx");
    c1.Write("xxx");
    c2.Write("xxx");
    c3.Write("xxx");
}
&lt;/pre&gt;說穿了Policy-Based Class Design的基本原理就是Strategy Pattern，如果現在需要的策略只有一個，那整個Host class就跟Strategy Pattern十分類似，也沒有必要使用Policy Design了。但是，如果現在需要的策略是兩個以上，還繼續使用Strategy Pattern反而會降低效能，元件肥大，日後難以維護。而Policy-Based Class Design就是使用template幫你組合程式碼，把多個Strategy Pattern組合成為一個類別，同時減低設計的相依性。&lt;br /&gt;
&lt;br /&gt;
總結一下Policy-Based Class Design的優缺處&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;1.&lt;/span&gt;&lt;/b&gt; 高顆粒性 (granularity)，核心功能獨立運作，方便unit test。&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;2.&lt;/span&gt;&lt;/b&gt; 高延展性。只要架構不變，新增功能、更換模組和小修改，只要寫Policy class就可以了。&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;3.&lt;/span&gt;&lt;/b&gt; 高擴充性。這是進階主題，下回再說。&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;4.&lt;/span&gt;&lt;/b&gt; 介面一致。每一個ConfigManger有一致的共用介面，定義在Host class裡，同時，對於特定某種ConfigManager能從繼承中獲得額外的介面，別與其他ConfigManager，又能保持介面完整。&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;5.&lt;/span&gt;&lt;/b&gt; 介面高彈性。這是進階主題，下回再說。&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;6.&lt;/span&gt;&lt;/b&gt; 高效能。每一個ConfigManager的介面和實作由繼承而來，避免透過成員變數中的抽象類別間接呼叫。值得注意的是Host, Policy class基本上是不用(也不需要)虛擬函式，直接免除virtual table的間接呼叫和記憶體使用量。&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;7.&lt;/span&gt;&lt;/b&gt; Host class實作技巧高。Host class使用到template，比直接寫一般的C++難。&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;8.&lt;/span&gt;&lt;/b&gt; 實作思想需要改變。Policy class非常獨立，常常是沒有任何成員變數，只實作行為，資料由參數傳入，回傳結果。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-1304771484278324688?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/1304771484278324688/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=1304771484278324688' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/1304771484278324688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/1304771484278324688'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2010/04/policy-based-class-design.html' title='Policy-Based Class Design'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-1970355352455579538</id><published>2009-12-11T13:47:00.047+08:00</published><updated>2009-12-15T02:50:35.390+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>Invoke pure virtual function</title><content type='html'>沒錯　你沒看錯&lt;br/&gt;
這篇的標題是呼叫純虛擬函式&lt;br/&gt;
一個沒有實作的純虛擬函式是有可能被呼叫起來的&lt;br/&gt;
&lt;pre class="cpp" name="code"&gt;
class A {
public:
    virtual void f(void) = 0;
};
class B : public A {
    virtual void f(void) {}
};
&lt;/pre&gt;
在系統開發中　這是一個很常出現的程式片斷&lt;br/&gt;
在多型體系中&lt;br/&gt;
A* a = new B;&lt;br/&gt;
a-&gt;f();&lt;br/&gt;
因為vtable的存在　程式會為f找尋合適的function pointer並呼叫&lt;br/&gt;
這例子中從vtable中會找到class B中的f()&lt;br/&gt;
這並沒有甚麼問題&lt;br/&gt;
那麼如果vtable中沒有class B的資訊時會怎麼樣　那就會找到class A的f()&lt;br/&gt;
就會呼叫純虛擬函式了&lt;br/&gt;
&lt;br/&gt;
這會發生嗎？&lt;br/&gt;
會的&lt;br/&gt;
&lt;pre class="cpp" name="code"&gt;
class A;
class A {
public:
    virtual ~A() { m_pA-&gt;Close(); }
    virtual void Close(void) = 0;
    A* m_pA;
};
class B : public A {
    virtual void Close(void) {}
};
&lt;/pre&gt;
像這樣的程式&lt;br/&gt;
一般人會想說把所有的CloseXXX, DeleteXXX, DestoryXXX寫在解構子&lt;br/&gt;
解構子被呼叫的順序是從下而上&lt;br/&gt;
所以B的解構子先呼叫　把vtable清掉&lt;br/&gt;
A的解構子再呼叫　這時vtable中只有class A　所以就呼叫一個純虛擬函式了&lt;br/&gt;
&lt;br/&gt;
當然　Effective C++裡提到　不應該在解構子呼叫虛擬函式　會有類似的問題出現&lt;br/&gt;
而在多執行緒中　也可能發生&lt;br/&gt;
&lt;pre class="cpp" name="code"&gt;
class B : public A {
    virtual void f(void) {}
    void ThreadProc() {
        while(1)
            f();
    }
};

void main() {
    A* a = new B();

    while(1) {
        if (...)
            a-&gt;Create();
        if (exception == true)
            break;
    }
    delete a;
}
&lt;/pre&gt;
我們把class B改為一個thread　它會不斷的呼叫f()&lt;br/&gt;
當一個執行緒因為例外發生或其他原因　使物件的解構子被呼叫&lt;br/&gt;
呼叫到一半的時候　另一個執行緒呼叫該物件的虛擬函式&lt;br/&gt;
剛好解構到vtable只剩下Base class時　就會呼叫純虛擬函式了&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-1970355352455579538?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/1970355352455579538/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=1970355352455579538' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/1970355352455579538'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/1970355352455579538'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2009/12/invoke-pure-virtual-function.html' title='Invoke pure virtual function'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-8802539224717637577</id><published>2009-11-19T21:06:00.005+08:00</published><updated>2009-12-15T02:51:33.746+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='music'/><title type='text'>說謊</title><content type='html'>主唱：林宥嘉&lt;br/&gt;
詞：施人誠&lt;br/&gt;
曲：李雙飛&lt;br/&gt;
&lt;br/&gt;
是有過幾個不錯對象 說起來並不寂寞孤單&lt;br/&gt;
可能我浪蕩 讓人家不安&lt;br/&gt;
才會 結果都陣亡&lt;br/&gt;
&lt;br/&gt;
我沒有什麼陰影魔障 妳千萬不要放在心上&lt;br/&gt;
我又不脆弱 何況那算什麼傷&lt;br/&gt;
反正愛情不就都這樣&lt;br/&gt;
&lt;br/&gt;
我沒有說謊 我何必說謊&lt;br/&gt;
妳懂我的 我對妳從來就不會假裝&lt;br/&gt;
我哪有說謊&lt;br/&gt;
請別以為妳有多難忘 笑是真的不是我逞強&lt;br/&gt;
&lt;br/&gt;
我好久沒來這間餐廳 沒想到已經換了裝潢&lt;br/&gt;
角落那窗口 聞得到玫瑰花香&lt;br/&gt;
被妳一說是有些印象&lt;br/&gt;
&lt;br/&gt;
我沒有說謊 我何必說謊&lt;br/&gt;
妳知道的 我缺點之一就是很健忘&lt;br/&gt;
我哪有說謊&lt;br/&gt;
是很感謝今晚的相伴 但我竟然有些不習慣&lt;br/&gt;
&lt;br/&gt;
我沒有說謊 我何必說謊&lt;br/&gt;
愛一個人 沒愛到難道就會怎麼樣&lt;br/&gt;
別說我說謊&lt;br/&gt;
人生已經如此的艱難 有些事情就不要拆穿&lt;br/&gt;
&lt;br/&gt;
我沒有說謊 是愛情說謊&lt;br/&gt;
它帶妳來 騙我說 渴望的有可能有希望&lt;br/&gt;
我沒有說謊&lt;br/&gt;
祝妳做個幸福的新娘 我的心事請妳就遺忘&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-8802539224717637577?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/8802539224717637577/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=8802539224717637577' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8802539224717637577'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8802539224717637577'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2009/11/blog-post.html' title='說謊'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-8668013136681063507</id><published>2009-07-28T00:56:00.004+08:00</published><updated>2009-12-15T02:52:08.447+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>C/C++ with MySQL</title><content type='html'>最近一直找一個bug  找很久都找不出來&lt;br/&gt;
&lt;br/&gt;
狀況是這樣子&lt;br/&gt;
&lt;br/&gt;
在一台linux上裝上 MySQL 5.0, Apache 2.0, django 1.0, openssl 5.5.2&lt;br/&gt;
&lt;br/&gt;
建立一台有網頁  有cgi  有ssl的平台&lt;br/&gt;
&lt;br/&gt;
之後複製另一台成master and slave  同時使用 MySQL Replication&lt;br/&gt;
&lt;br/&gt;
令兩台資料庫保持一致狀態  作為master掛掉時自動起來的back up server&lt;br/&gt;
&lt;br/&gt;
問題來了  它們總是不一致&lt;br/&gt;
&lt;br/&gt;
測了很久發現我c++的cgi使用Connector/C++ 1.0 Preview來連接MySQL  但不會產生MySQL的binary log&lt;br/&gt;
&lt;br/&gt;
沒有binary log就沒辨法使用MySQL Replication&lt;br/&gt;
&lt;br/&gt;
後來&lt;br/&gt;
&lt;br/&gt;
花了個晚上把Connector/C++換成MySQL++&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
看來兩套功能相同的東西  還是選版本比較大的好  = ="&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-8668013136681063507?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/8668013136681063507/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=8668013136681063507' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8668013136681063507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8668013136681063507'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2009/07/cc-with-mysql.html' title='C/C++ with MySQL'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-8992015832794472743</id><published>2009-07-27T01:36:00.009+08:00</published><updated>2009-12-15T02:52:22.426+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>摸索</title><content type='html'>半年來&lt;br/&gt;
每天不斷的上班　上班　除了上班還剩甚麼&lt;br/&gt;
每天趨於平淡　盲目&lt;br/&gt;
我想要的生命似乎漸漸地從手中流失&lt;br/&gt;
就這樣嗎?&lt;br/&gt;
我的生活需要點不一樣的　需要點衝擊&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-8992015832794472743?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/8992015832794472743/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=8992015832794472743' title='5 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8992015832794472743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8992015832794472743'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2009/07/blog-post.html' title='摸索'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-9182229431249058545</id><published>2009-07-25T23:41:00.007+08:00</published><updated>2009-12-15T02:58:01.520+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='music'/><title type='text'>The Show</title><content type='html'>&lt;a href="http://www.youtube.com/watch?v=hnN30rs5NkQ" style="text-decoration: none;"&gt;http://www.youtube.com/watch?v=hnN30rs5NkQ&lt;/a&gt;&lt;br/&gt;十分值得聽的歌  澳洲的創作女歌生 lenka&lt;br/&gt;
The Show&lt;br/&gt;
&lt;br/&gt;
I'm just a little bit&lt;br/&gt;
caught in the middle&lt;br/&gt;
Life is a maze&lt;br/&gt;
and love is a riddle&lt;br/&gt;
I don't know where to go&lt;br/&gt;
I can't do it alone&lt;br/&gt;
(I've tried)&lt;br/&gt;
and I don't know why&lt;br/&gt;
its cuz jollys cool&lt;br/&gt;
&lt;br/&gt;
Slow it down&lt;br/&gt;
make it stop&lt;br/&gt;
or else my heart is going to pop&lt;br/&gt;
'cuz it's too much&lt;br/&gt;
Yeah, it's a lot&lt;br/&gt;
to be something I'm not&lt;br/&gt;
&lt;br/&gt;
I'm a fool&lt;br/&gt;
out of love&lt;br/&gt;
'cuz I just can't get enough&lt;br/&gt;
&lt;br/&gt;
I'm just a little bit&lt;br/&gt;
caught in the middle&lt;br/&gt;
Life is a maze&lt;br/&gt;
and love is a riddle&lt;br/&gt;
I don't know where to go&lt;br/&gt;
I can't do it alone&lt;br/&gt;
(I've tried)&lt;br/&gt;
and I don't know why&lt;br/&gt;
&lt;br/&gt;
I am just a little girl&lt;br/&gt;
lost in the moment&lt;br/&gt;
I'm so scared&lt;br/&gt;
but I don't show it&lt;br/&gt;
I can't figure it out&lt;br/&gt;
it's bringing me down&lt;br/&gt;
I know&lt;br/&gt;
I've got to let it go&lt;br/&gt;
and just enjoy the show&lt;br/&gt;
&lt;br/&gt;
The sun is hot&lt;br/&gt;
in the sky&lt;br/&gt;
just like a giant spotlight&lt;br/&gt;
The people follow the sign&lt;br/&gt;
and synchronize in time&lt;br/&gt;
It's a joke&lt;br/&gt;
Nobody knows&lt;br/&gt;
they've got a ticket to that show&lt;br/&gt;
Yeah&lt;br/&gt;
&lt;br/&gt;
I'm just a little bit&lt;br/&gt;
caught in the middle&lt;br/&gt;
Life is a maze&lt;br/&gt;
and love is a riddle&lt;br/&gt;
I dont know where to go&lt;br/&gt;
I can't do it alone&lt;br/&gt;
(I've tried)&lt;br/&gt;
and I don't know why&lt;br/&gt;
&lt;br/&gt;
I am just a little girl&lt;br/&gt;
lost in the moment&lt;br/&gt;
I'm so scared&lt;br/&gt;
but don't show it&lt;br/&gt;
I can't figure it out&lt;br/&gt;
it's bringing me down&lt;br/&gt;
I know&lt;br/&gt;
I've got to let it go&lt;br/&gt;
and just enjoy the show&lt;br/&gt;
&lt;br/&gt;
oh oh&lt;br/&gt;
Just enjoy the show&lt;br/&gt;
oh oh&lt;br/&gt;
&lt;br/&gt;
I'm just a little bit&lt;br/&gt;
caught in the middle&lt;br/&gt;
life is a maze&lt;br/&gt;
and love is a riddle&lt;br/&gt;
I dont know where to go&lt;br/&gt;
I can't do it alone&lt;br/&gt;
(I've tried)&lt;br/&gt;
and I don't know why&lt;br/&gt;
&lt;br/&gt;
I am just a little girl&lt;br/&gt;
lost in the moment&lt;br/&gt;
I'm so scared&lt;br/&gt;
but I don't show it&lt;br/&gt;
I can't figure it out&lt;br/&gt;
it's bringing me down&lt;br/&gt;
I know&lt;br/&gt;
I've got to let it go&lt;br/&gt;
and just enjoy the show&lt;br/&gt;
&lt;br/&gt;
dum de dum&lt;br/&gt;
dudum de dum&lt;br/&gt;
&lt;br/&gt;
Just enjoy the show&lt;br/&gt;
&lt;br/&gt;
dum de dum&lt;br/&gt;
dudum de dum&lt;br/&gt;
&lt;br/&gt;
Just enjoy the show&lt;br/&gt;
&lt;br/&gt;
I want my money back&lt;br/&gt;
I want my money back&lt;br/&gt;
I want my money back&lt;br/&gt;
Just enjoy the show&lt;br/&gt;
&lt;br/&gt;
I want my money back&lt;br/&gt;
I want my money back&lt;br/&gt;
I want my money back&lt;br/&gt;
Just enjoy the show&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-9182229431249058545?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/9182229431249058545/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=9182229431249058545' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/9182229431249058545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/9182229431249058545'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2009/07/show.html' title='The Show'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-8268493564310197199</id><published>2008-12-09T13:43:00.004+08:00</published><updated>2010-04-21T22:46:45.644+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='music'/><title type='text'>you and i both</title><content type='html'>演唱:jason mraz&lt;br /&gt;
&lt;br /&gt;
Was it you who spoke the words that things would happen but not to me?&lt;br /&gt;
All things are gonna happen naturally&lt;br /&gt;
Oh, taking your advice and I'm looking on the bright side&lt;br /&gt;
And balancing the whole thing.&lt;br /&gt;
&lt;br /&gt;
Oh, but at often times those words get tangled up in a lines&lt;br /&gt;
And the bright light turns to night&lt;br /&gt;
Oh, until the dawn it brings&lt;br /&gt;
Another day to sing about the magic that was you and me&lt;br /&gt;
&lt;br /&gt;
Cause you and I both loved&lt;br /&gt;
What you and I spoke of&lt;br /&gt;
And others just read of&lt;br /&gt;
Others only read of, of the love&lt;br /&gt;
Of the love that I loved&lt;br /&gt;
&lt;br /&gt;
lova lova!&lt;br /&gt;
&lt;br /&gt;
See I'm all about them words&lt;br /&gt;
Over numbers, unencumbered numbered words;&lt;br /&gt;
Hundreds of pages, pages, pages for words.&lt;br /&gt;
More words than I had ever heard, and I feel so alive.&lt;br /&gt;
&lt;br /&gt;
Cause you and I both loved&lt;br /&gt;
What you and I spoke of&lt;br /&gt;
And others just read of&lt;br /&gt;
And if you could see me now&lt;br /&gt;
Oh, love love&lt;br /&gt;
You and I, You and I&lt;br /&gt;
Not so little you and I anymore&lt;br /&gt;
&lt;br /&gt;
And with this silence brings a moral story&lt;br /&gt;
More importantly evolving is the glory of a boy&lt;br /&gt;
&lt;br /&gt;
Cause you and I both loved&lt;br /&gt;
What you and I spoke of (of, of)&lt;br /&gt;
And others just read of&lt;br /&gt;
And if you could see me now&lt;br /&gt;
Well, then I'm almost finally out of&lt;br /&gt;
I'm finally out of&lt;br /&gt;
Finally deedeedeedeedeedee&lt;br /&gt;
Well I'm almost finally, finally&lt;br /&gt;
Well I am free&lt;br /&gt;
Oh, I'm free&lt;br /&gt;
&lt;br /&gt;
And it's okay if you had to go away&lt;br /&gt;
Oh, just remember that telephones&lt;br /&gt;
Well, they work out of both ways&lt;br /&gt;
But if I never ever hear them ring&lt;br /&gt;
If nothing else I'll think the bells inside&lt;br /&gt;
Have finally found you someone else and that's okay&lt;br /&gt;
Cause I'll remember everything you sang&lt;br /&gt;
&lt;br /&gt;
Cause you and I both loved&lt;br /&gt;
What you and I spoke of (of,)&lt;br /&gt;
And others just read of&lt;br /&gt;
and if you could see me now&lt;br /&gt;
Well, then I'm almost finally out of&lt;br /&gt;
I'm finally out of&lt;br /&gt;
Finally deedeedeedeedeede&lt;br /&gt;
Well I'm almost finally, finally&lt;br /&gt;
Out of words&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-8268493564310197199?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/8268493564310197199/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=8268493564310197199' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8268493564310197199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8268493564310197199'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/12/you-and-i-both.html' title='you and i both'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-8389252723262904361</id><published>2008-11-15T15:58:00.015+08:00</published><updated>2009-12-15T03:30:29.746+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Apache+MySQL+PHP+OpenSSL in Ubuntu</title><content type='html'>&lt;span style="font-weight: bold;font-size:130%;" &gt;SSL介紹&lt;/span&gt;
SSL(Secure Socket Layer)是Netscape所提出來的資料保密協定，採用了RC4、MD5，以及RSA等加密演算法。&lt;br/&gt;
&lt;br/&gt;
網路上需要確定網站真的是那個網站，所以SSL也具備認證的機能。SSL是以金字塔的結構
組成，最下層的是一般的伺服器，它們經由向上跟CA申請取得SSL的憑證，CA會在SSL相關檔案上簽名，CA是具有公信力和認證能力的機構，CA必須向上跟RootCA(如政府機構等)申請。當使用者連結具SSL的服務時，伺服器會傳送憑證給使用者，使用端的程式接收到憑證後會向CA確認憑證，若CA確認這個憑是它們簽發的則會回傳給使用端正確的訊息。
具有SSL功能的網站可以向 世界少數幾個發證機構（例如目前最大的VeriSign或第二大的Thawte兩家認證公司）申請，經過嚴格的文件證明確認後，才能取得國際認可（較新版 的MSIE或Netscape瀏覽軟體會自動認得）的電子認證。&lt;br/&gt;
&lt;br/&gt;
  所有 SSL憑證都是發給公司或是法人，典型的 SSL 憑證將包括您的網域名稱(domain                  name)、您的公司名稱(company                  name)、您的住址(address)、您的所在城市(city)、您的省份(state)和您的國家(country)，它也包含了憑證的到期日和負責核發此憑證的發證中心詳細資料。當一個瀏覽器連結到一個安全網站時，它將收到這個網站的SSL憑證並且檢驗它是否過期、它是否是已經被瀏覽器信任的發證中心所核發的，以及它是否如核發時 所登記的內容被該網站使用，假如有任何一項檢查不通過，瀏覽器將顯示一個警告訊息給使用者。&lt;br/&gt;
&lt;br/&gt;
&lt;span style="font-weight: bold;font-size:130%;" &gt;在Ubuntu上安裝 apache+mysql+php+openssl&lt;/span&gt;
&lt;pre class="bash" name="code"&gt;
sudo tasksel install lamp-server
安裝 lamp (apache mysql php)

sudo apt-get install mysql-admin mysql-gui-tools-common mysql-query-browser
安裝mysql的管理介面

sudo apt-get install -y php5-gd
安裝GD庫

sudo apt-get install -y openssl
安裝Openssl

sudo apt-get install -y ssl-cert
安裝簽署憑證的工具

sudo a2enmod ssl
安裝ssl模組

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl
sudo ln -s /etc/apache2/sites-available/ssl /etc/apache2/sites-enabled/ssl
複製一份預設擋供ssl用，並且用ln建立連結（捷徑）至sites-enabled/ssl

sudo vim /etc/apache2/sites-enabled/ssl
在以下位置後面加入紅色的設定值

NameVirtualHost *:443


sudo vim /etc/apache2/sites-enabled/default
在以下位置後面加入紅色的設定值

NameVirtualHost *:80
SSLEngine On
SSLCerficationFile /etc/apache2/etc/apache.pem


sudo vim /usr/sbin/make-ssl-cert
將"-keyout $output"改成"-keyout $output -days 3650"即可將憑證有效時間改成10年

sudo mkdir /etc/apache2/ssl
建立ssl憑證所擺放目錄

sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/etc/apache.pem
make-ssl-cert is a wrapper of OpenSSL
依照指示輸入憑證相關訊息，即可產生自簽的電子證書！

sudo /etc/init.d/apache2 force-reload
重新載入配置

sudo /etc/init.d/apache2 restart
重新啟動Apache2
&lt;/pre&gt;
&lt;span style="font-weight: bold;font-size:130%;" &gt;產生自簽的CA&lt;/span&gt;
產生自簽的CA的意義是，自己架設一個CA，並為自己的伺服器的憑證簽名。則使用端收到憑證時，會向CA確定，這時就用自己架的CA去確認說憑證是有效的。當然這樣是沒有公信力的，而且把自己架的伺服器登記為CA需要手動加入，一般這樣做都是為了測試用。&lt;br/&gt;
&lt;br/&gt;
參考以下連結&lt;br/&gt;
&lt;a href="http://wiki.ubuntu.org.cn/OpenSSL"&gt;http://wiki.ubuntu.org.cn/OpenSSL&lt;/a&gt;
主要做兩件事情&lt;br/&gt;
第一件是架CA：Creating the Certificate Authority&lt;br/&gt;
第二件是架server：Creating a Self-Signed Server Certificate&lt;br/&gt;
並使用自己的CA為它簽名&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-8389252723262904361?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/8389252723262904361/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=8389252723262904361' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8389252723262904361'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8389252723262904361'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/11/apachemysqlphpopenssl.html' title='Apache+MySQL+PHP+OpenSSL in Ubuntu'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-7283356867570110406</id><published>2008-11-09T23:53:00.009+08:00</published><updated>2009-12-15T02:58:38.252+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Reverse Engineering Tools</title><content type='html'>&lt;h3&gt;Microsoft Windows&lt;/h3&gt;Three tools pervade the warchest of the contemporary analyst on the Windows platform: &lt;a href="http://www.datarescue.com/" target="_blank"&gt;IDA&lt;/a&gt;, SoftICE, and &lt;a href="http://freewareapp.com/pe-tools_download/" target="_blank"&gt;PE Tools&lt;/a&gt;. IDA is the Interactive Disassembler from Data Rescue. IDA is used to examine the executable on-disk. IDA provides useful features such as call graphs for analyzing program flow and automatic library detection.&lt;br/&gt;
&lt;br/&gt;
SoftICE is a &lt;a href="http://en.wikipedia.org/wiki/Ring_%28computer_security%29" target="_blank"&gt;Ring 0&lt;/a&gt; debugger from Compuware. Though SoftICE is no longer an offering from Compuware, it's use is still very common. While the author now uses &lt;a href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx" target="_blank"&gt;WinDbg&lt;/a&gt; in place of SoftICE, some analysts have turned to &lt;a href="http://www.ollydbg.de/" target="_blank"&gt;OllyDbg&lt;/a&gt;. It is presumed that once Compuware decides to sell SoftICE, the debugger will regain it's previous popularity.&lt;br/&gt;
&lt;br/&gt;
PE Tools is used to dump either a partial (region) or full in-memory image of an executable. It also includes the ability to automatically remove "Anti Dump Protection", and find the original OEP (&lt;a href="http://www.csn.ul.ie/%7Ecaolan/publink/winresdump/winresdump/doc/pefile.html" target="_blank"&gt;AddressOfEntryPoint&lt;/a&gt; value of the &lt;code&gt;IMAGE_OPTIONAL_HEADER&lt;/code&gt; structure). This tool would be used with a packed or encrypted executable. After the decompression or decryption occurs, PE Tools would be used to copy the image from memory for further analysis.&lt;br/&gt;
&lt;br/&gt;
IDA is used to perform a static analysis on-disk, while a debugger is used to interrogate the executing program while in-memory. Based on the tools, this leads to the observation that a Protection Scheme must be functional in two environments - on-disk and in-memory. In the virus research community, challenging disassembly occurs in the anti-disassembly layer, while the implementation deterring dynamic analysis is known as a anti-debug layer.&lt;br/&gt;
&lt;br/&gt;
&lt;h3&gt;Unix and Linux&lt;/h3&gt;For Unix and Linux, &lt;a href="http://www.gnu.org/software/binutils/manual/html_chapter/binutils_4.html" target="_blank"&gt;objdump&lt;/a&gt; (with it's PERL based wrapper &lt;a href="http://packetstormsecurity.org/linux/reverse-engineering/dasm" target="_blank"&gt;dasm&lt;/a&gt;) and &lt;a href="http://sources.redhat.com/gdb/" target="_blank"&gt;gdb&lt;/a&gt; are two available tools. gdb supports debugging of C, C++, Java, Fortran and Assembly among other languages. In addition, gdb is designed to work closely with the GNU Compiler Collection (GCC). objdump and dasm collectively act as full disassembler. Alternately, one can run Windows applications such as IDA on Linux using &lt;a href="http://www.winehq.org/" target="_blank"&gt;Wine&lt;/a&gt;, which acts as a compatibility layer for running Windows programs on Linux. Kris Kaspersky introduces additional tools and details procedures specific to the ELF file format in &lt;em&gt;Hacker Disassembling Uncovered&lt;/em&gt;.&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-7283356867570110406?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/7283356867570110406/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=7283356867570110406' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/7283356867570110406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/7283356867570110406'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/11/reverse-engineering-tools.html' title='Reverse Engineering Tools'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-3621828859963686679</id><published>2008-11-06T23:41:00.003+08:00</published><updated>2009-12-15T03:00:39.820+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>人生第一筆薪水</title><content type='html'>就在今天&lt;br/&gt;
我拿到人生第一筆薪水了&lt;br/&gt;
真是莫名的感動&lt;br/&gt;
&lt;br/&gt;
因為八九十月沒收入　債台高築&lt;br/&gt;
償還債務後也剩不下來&lt;br/&gt;
但我還是要好好記念今天　哈&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-3621828859963686679?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/3621828859963686679/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=3621828859963686679' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3621828859963686679'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3621828859963686679'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/11/blog-post.html' title='人生第一筆薪水'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-5482380481174169289</id><published>2008-11-03T01:02:00.008+08:00</published><updated>2009-12-14T19:35:43.624+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>struct的特別用法</title><content type='html'>&lt;pre class="cpp" name="code"&gt;
#include &lt;stdio.h&gt;

typedef struct A {
    int up : 1;
    int down : 1;
    int left : 1;
    int right : 1;
}Cell;

int main(void) {
    Cell c;

    c.up = c.down = c.left = c.right = 0;
    c.down = 1;
    printf("%d %d\n", sizeof(Cell), sizeof c);
    printf("%d %d %d %d\n", c.up &amp;amp; 1, c.down &amp;amp; 1, c.left &amp;amp; 1, c.right &amp;amp; 1);
    printf("%d %d %d %d\n", c.up, c.down, c.left, c.right);
    return 0;
}
&lt;/pre&gt;
結果:&lt;br/&gt;
4 4&lt;br/&gt;
0 1 0 0&lt;br/&gt;
0 -1 0 0&lt;br/&gt;
&lt;br/&gt;
宣告的變數會變成bit-field　struct因padding大小是4個byte.&lt;br/&gt;
裡面的變數都是bit　只能做bit operator　否則結果不是你想要的.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-5482380481174169289?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/5482380481174169289/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=5482380481174169289' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/5482380481174169289'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/5482380481174169289'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/11/struct.html' title='struct的特別用法'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-166781760134912778</id><published>2008-10-27T22:36:00.003+08:00</published><updated>2009-12-15T03:04:49.671+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='music'/><title type='text'>Bizarre Love Triangle</title><content type='html'>Every time I think of you&lt;br/&gt;
I get a shot right through into a bolt of blue&lt;br/&gt;
It's no problem of mine but it's a problem I find&lt;br/&gt;
Living a life that I can't leave behind&lt;br/&gt;
There's no sense in telling me&lt;br/&gt;
The wisdom of a fool won't set you free&lt;br/&gt;
But that's the way that it goes&lt;br/&gt;
And its what nobody knows&lt;br/&gt;
And every day my confusion grows&lt;br/&gt;
Every time I see you falling&lt;br/&gt;
I get down on my knees and pray&lt;br/&gt;
I'm waiting for that final moment&lt;br/&gt;
You'll say the words that I can't say&lt;br/&gt;
&lt;br/&gt;
I feel fine and I feel good&lt;br/&gt;
I feel like I never should&lt;br/&gt;
Whenever I get this way, I just don't know what to say&lt;br/&gt;
Why cant we be ourselves like we were yesterday&lt;br/&gt;
I'm not sure what this could mean&lt;br/&gt;
I don't think youre what you seem&lt;br/&gt;
I do admit to myself&lt;br/&gt;
That if I hurt someone else&lt;br/&gt;
Then wed never see just what were meant to be&lt;br/&gt;
Every time I see you falling&lt;br/&gt;
I get down on my knees and pray&lt;br/&gt;
I'm waiting for that final moment&lt;br/&gt;
You'll say the words that I cant say&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-166781760134912778?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/166781760134912778/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=166781760134912778' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/166781760134912778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/166781760134912778'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/10/bizarre-love-triangle.html' title='Bizarre Love Triangle'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-1189726076601813755</id><published>2008-10-17T23:16:00.003+08:00</published><updated>2009-12-15T03:05:23.837+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='symbian'/><title type='text'>Symbian S60 5th Edition</title><content type='html'>Symbian的第五版在10/3 released&lt;br/&gt;
這版中主要加強的部份是多媒體、網路、可靠度和觸控介面&lt;br/&gt;
&lt;br/&gt;
第五版中優化攝影機的codec(宽螢幕影相儲存能力)。使用者設定參數來調控照片的balance, color and sharpness。次外，第五版包含照片和影片的編攝功能，讓使用者直接在mobile上修改並分享。&lt;br/&gt;
&lt;br/&gt;
隨著寬螢幕 nHD的支援，現在可以使用寬螢幕模式來看照片或影片，支援的影片格式包括MP3, AAC, H.264, Windows Media, Flash Video等。&lt;br/&gt;
&lt;br/&gt;
內建瀏覽器和支援Flash Lite，加上寬螢幕和觸控介面的支援可以令瀏覽網頁更方便。&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-1189726076601813755?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/1189726076601813755/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=1189726076601813755' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/1189726076601813755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/1189726076601813755'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/10/symbian-s60-5th-edition.html' title='Symbian S60 5th Edition'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-5897223587977241241</id><published>2008-10-04T00:43:00.003+08:00</published><updated>2009-12-15T03:02:20.508+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>英名一世?</title><content type='html'>沒想到現在這麼囧&lt;br/&gt;
&lt;br/&gt;
一直都是學最新的東西&lt;br/&gt;
&lt;br/&gt;
現在居然要學MFC MFC  MFC   MFC    MFC     MFC      MFC&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-5897223587977241241?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/5897223587977241241/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=5897223587977241241' title='3 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/5897223587977241241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/5897223587977241241'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/10/blog-post.html' title='英名一世?'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-7049713007978788694</id><published>2008-10-01T23:39:00.003+08:00</published><updated>2009-12-15T03:01:55.728+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>default constructor</title><content type='html'>C++中預設建構子就是沒有參數的建構子&lt;br/&gt;
&lt;br/&gt;
一般大多數人都有以下&lt;span style="font-size:130%;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;錯誤&lt;/span&gt;&lt;/span&gt;觀念：&lt;br/&gt;
1.class沒有定義預設建構子　compiler就會自動產生一個&lt;br/&gt;
2.compiler產生出來的預設建構子中　會為member data設預設值&lt;br/&gt;
&lt;br/&gt;
在C++ standard(ISO/IEC 14882)中說明：&lt;br/&gt;
"The implementation will implicitly declare these member functions for a class type when the program does not explicitly declare them, except as noted in 12.1. The implementation will implicitly define them if they are used"&lt;br/&gt;
&lt;br/&gt;
當compiler有需要而又沒有時才會產生出來　所以沒需要時就不會產生&lt;br/&gt;
&lt;br/&gt;
那甚麼時候需要呢!　文件中說明：&lt;br/&gt;
"If there is no user-declared constructor for class X, a default constructor is implicitly declared. An &lt;span style="font-style: italic;"&gt;implicitly-declared&lt;/span&gt; default constructor is an inline public member of its class. A constructor is &lt;span style="font-style: italic; font-weight: bold;"&gt;trivial&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;if it is an implicitly-declared default constructor and if:
— its class has no virtual functions (10.3) and no virtual base classes (10.1), and
— all the direct base classes of its class have trivial constructors, and
— for all the nonstatic data members of its class that are of class type (or array thereof), each such class has a trivial constructor.
Otherwise, the constructor is non-trivial."&lt;br/&gt;
&lt;br/&gt;
所以說需要的定義取決於 1.virtual functions, 2.virtual inherited, 3.base class and 4.data members.&lt;br/&gt;
&lt;br/&gt;
1.virtual functions&lt;br/&gt;
當一個類別定義virtual functions後，每一個物件都必須有一個virtual function table記錄virtual function的位址，因此compiler會自動擴張物件的data member，產生這個table並且加入一個指標指向這個table。&lt;br/&gt;
&lt;br/&gt;
2.virtual inherited&lt;br/&gt;
(待補)&lt;br/&gt;
&lt;br/&gt;
3.base class&lt;br/&gt;
當一個class沒有&lt;span style="font-weight: bold;"&gt;任何&lt;/span&gt;預設建構子而它的base class有預設建構子時，那麼必須需呼叫base class的預設建構子，所以compiler自動擴張一個預設建構子，其中呼叫bass class的建構子。&lt;br/&gt;
&lt;br/&gt;
如果存在建構子的話，compiler會擴張建構子做上述事情而不擴張一個預設建構子。文件的解析是由於使用者定義的建構子存在下就不會隱含產生預設建構子。&lt;br/&gt;
&lt;br/&gt;
4.data members&lt;br/&gt;
同理。當data member中，存在至少一個物件有預設建構子時。&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-7049713007978788694?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/7049713007978788694/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=7049713007978788694' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/7049713007978788694'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/7049713007978788694'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/10/default-constructor.html' title='default constructor'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-3870664167064878610</id><published>2008-10-01T22:11:00.002+08:00</published><updated>2009-12-15T03:06:14.354+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>18</title><content type='html'>記念一下&lt;br/&gt;
&lt;br/&gt;
我將是公司的第18位RD&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-3870664167064878610?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/3870664167064878610/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=3870664167064878610' title='3 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3870664167064878610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3870664167064878610'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/10/18.html' title='18'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-2786050965091773276</id><published>2008-09-26T15:53:00.002+08:00</published><updated>2009-12-15T03:06:57.148+08:00</updated><title type='text'>創業成功的必要條件</title><content type='html'>規則#1：擁有一個具爭議性的策略。尋找反直覺的構想，然後執行。如果你照規矩來，你只會流於一般。區別才是關鍵。困難的是，你必須判斷正確。&lt;br/&gt;
&lt;br/&gt;
規則#2：打破商業陳規，但不可用詐騙、說謊或偷竊的方式。這麼做，你將落得眾叛親離，失去忠誠員工對你的信賴。&lt;br/&gt;
&lt;br/&gt;
規則#3：想辦法籌得一些錢，但不要太多。小數目的創業資本會迫使你錙銖必較、節省支出、追求效率，並且努力尋找新的生產途徑。&lt;br/&gt;
&lt;br/&gt;
規則#4：具備一個理想。McNealy說：「人類大都是金錢驅動的，但他們也喜歡有一點精神上的收入。」例如，昇陽創造的開放原始碼學科維基Curriki，就解決了McNealy和他兒子作小學報告所碰到的問題。&lt;br/&gt;
&lt;br/&gt;
規則#5：放手去作，但慎選伴侶。投入你全副的心力和靈魂去開創事業，但請在結婚之前。McNealy直到39歲才結婚，但婚後四個兒子接連出生。他建議：「你一生中最重要的決定就是和誰結婚生子。挑選一個配偶或重要的另一半，或任何你喜歡的伴侶。只要確定你挑了一個好人。這是一個創業者給你的一些實在的技術性建議。」&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-2786050965091773276?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/2786050965091773276/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=2786050965091773276' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/2786050965091773276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/2786050965091773276'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/09/blog-post_26.html' title='創業成功的必要條件'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-1153336036247219444</id><published>2008-09-25T17:55:00.004+08:00</published><updated>2009-12-15T03:03:21.592+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>tricky skill (1) in C</title><content type='html'>&lt;pre class="cpp" name="code"&gt;
struct rumble {
  char c[1];
};

struct rumble *p = (struct rumble*) malloc(sizeof(struct rumble) + 5);
&lt;/pre&gt;
在C裡　有一個技巧就是在struct最後宣告一個單一元素的陣列&lt;br/&gt;
於是在malloc時就能擁有可變大小的struct rumble了&lt;br/&gt;
&lt;br/&gt;
當然這個技巧也能用在C++　但這會與compiler有關&lt;br/&gt;
因為雖然宣告在最後　compile時可能會產生額外的資料在最尾端&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-1153336036247219444?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/1153336036247219444/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=1153336036247219444' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/1153336036247219444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/1153336036247219444'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/09/tricky-skill-1-in-c.html' title='tricky skill (1) in C'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-9037987785554433676</id><published>2008-09-24T13:08:00.005+08:00</published><updated>2009-12-15T03:04:08.318+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>預設值和多型的陷阱</title><content type='html'>&lt;pre class="cpp" name="code"&gt;
class A {
  virtual void f(int i = 10);
};

class B: public A {
  void f(int i = 20);
};

A* a = B();
a-&gt;f();
&lt;/pre&gt;
這題多型很簡單　a-&gt;f()會呼叫class B裡的f()&lt;br/&gt;
但問題是如果印i出來　值會是多少呢&lt;br/&gt;
&lt;br/&gt;
答案是i = 10&lt;br/&gt;
原因是預設引數是在編譯時期根據a的型別確定了&lt;br/&gt;
所以i就被初始為10&lt;br/&gt;
最後印出來就是10了&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-9037987785554433676?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/9037987785554433676/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=9037987785554433676' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/9037987785554433676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/9037987785554433676'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/09/blog-post_24.html' title='預設值和多型的陷阱'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-6159144450694035901</id><published>2008-09-10T00:48:00.003+08:00</published><updated>2010-04-21T22:47:03.966+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='music'/><title type='text'>last order</title><content type='html'>演唱:陳奕迅&lt;br /&gt;
作曲:Eric Kwok,  編曲:Eric Kwok&lt;br /&gt;
監製:Eric Kwok,  填詞:黃偉文&lt;br /&gt;
&lt;br /&gt;
沒關係　真的沒關係　我也許　早就該回去&lt;br /&gt;
再一杯　我告訴自己　到此為止　乾了不再續&lt;br /&gt;
麻煩你　加冰威士忌　對不起　來個DOUBLE的&lt;br /&gt;
喝到這裡　終於夠勇氣　說一個經歷&lt;br /&gt;
&lt;br /&gt;
＊那晚下雨　在這店裡　也放著這首曲&lt;br /&gt;
　有個男子　搭上一個女子　反正失戀　他當然不介意　有段艷遇&lt;br /&gt;
　只是回到　他的家裡　十幾坪　家徒四壁&lt;br /&gt;
　一聲不響　那女的　掉頭離去&lt;br /&gt;
　就像　三個小時前　未婚妻　初次到來　嫌棄的樣子&lt;br /&gt;
（就像　我的未婚妻　對不起　好像說成是我的樣子　我是沒關係）&lt;br /&gt;
&lt;br /&gt;
沒關係　真的沒關係　一晚上　就失戀兩次&lt;br /&gt;
那男子　還不懂懷疑　到底自己是否沒出息&lt;br /&gt;
不客氣　別給我ICE TEA 客人們不是我嚇跑的&lt;br /&gt;
別看著我　這個不過是　我朋友的經歷&lt;br /&gt;
&lt;br /&gt;
Repeat ＃()&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-6159144450694035901?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/6159144450694035901/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=6159144450694035901' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/6159144450694035901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/6159144450694035901'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/09/last-order.html' title='last order'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-2219950567406201033</id><published>2008-09-07T15:54:00.002+08:00</published><updated>2009-12-15T03:25:51.087+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>誰才是主人呀</title><content type='html'>我的貓每天都跟我爭椅子座&lt;br/&gt;
有沒有搗錯&lt;br/&gt;
&lt;br/&gt;
每次一從電腦前離開&lt;br/&gt;
牠馬上坐上去　趕也不走&lt;br/&gt;
分明是要爭主人位咩&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-2219950567406201033?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/2219950567406201033/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=2219950567406201033' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/2219950567406201033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/2219950567406201033'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/09/blog-post_07.html' title='誰才是主人呀'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-5145309598787836134</id><published>2008-09-01T12:39:00.004+08:00</published><updated>2009-12-15T03:18:39.710+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='me'/><title type='text'>弱雞</title><content type='html'>前天被說是弱雞&lt;br/&gt;
我卻一點都不能反駁&lt;br/&gt;
唉...&lt;br/&gt;
&lt;br/&gt;
我的右手呀&lt;br/&gt;
自從五月一場籃球比賽受傷後&lt;br/&gt;
超過一公斤的東西都不太能拿&lt;br/&gt;
拿了就受傷了&lt;br/&gt;
搬東西也不行&lt;br/&gt;
&lt;br/&gt;
幹~~~&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-5145309598787836134?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/5145309598787836134/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=5145309598787836134' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/5145309598787836134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/5145309598787836134'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/09/blog-post.html' title='弱雞'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-565828480119654396</id><published>2008-08-28T14:17:00.003+08:00</published><updated>2009-12-15T03:09:16.533+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>多型的陷阱</title><content type='html'>&lt;pre class="cpp" name="code"&gt;
class A {...};
class B {...};
class C: public A, private B {...};

A a = new C();
B b = new C();
&lt;/pre&gt;
在C++中，繼承有public, protected and private&lt;br/&gt;
如果使用private的話　第6行編譯是不會過的　因為privated下是看不到的&lt;br/&gt;
如果是protected　則在可視scope下才能用&lt;br/&gt;
&lt;br/&gt;
這點是java或其他OO語言沒有的&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-565828480119654396?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/565828480119654396/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=565828480119654396' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/565828480119654396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/565828480119654396'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/08/blog-post_28.html' title='多型的陷阱'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-3473792215561357584</id><published>2008-08-27T12:42:00.005+08:00</published><updated>2009-12-15T03:10:05.854+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>差點被考到的程式碼</title><content type='html'>昨天面試　其中一個主管很在意coding能力&lt;br/&gt;
我也跟他說我coding很好&lt;br/&gt;
他就要考考我&lt;br/&gt;
考了兩題後　他發現太無趣了　就從一堆題目中找了一題出來&lt;br/&gt;
說這題過去沒幾個人講的出來&lt;br/&gt;
&lt;pre class="cpp" name="code"&gt;
#define fun(A, b) (int)(&amp;(((A *)0)-&gt;b))

typedef struct {
  char str[40];
  int type;
  int maxLen;
} intf;
&lt;/pre&gt;
問題是fun(intf, maxLen)的值為多少&lt;br/&gt;
&lt;br/&gt;
看到第一眼時　先假裝鎮定　但不解 A * 的作用&lt;br/&gt;
因為腦殘沒看到typedef　想說A替換後只是變數不是型別&lt;br/&gt;
所以就靠推理的方式理解成強制轉型為pointer　並以此位置為0&lt;br/&gt;
所以b的位置就是 sizeof(char) * 40 + sizeof(int)&lt;br/&gt;
答案是對的　還告訴我它叫offset　差點被他唬到&lt;br/&gt;
&lt;br/&gt;
回家查了一下&lt;br/&gt;
原來這個code是在stddef.h裡&lt;br/&gt;
目的是做出泛型計算變數在struct的offset&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-3473792215561357584?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/3473792215561357584/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=3473792215561357584' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3473792215561357584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3473792215561357584'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/08/blog-post.html' title='差點被考到的程式碼'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-695903867184313230</id><published>2008-08-01T23:29:00.004+08:00</published><updated>2009-12-15T03:24:26.182+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='music'/><title type='text'>100種生活</title><content type='html'>詞 鍾成虎 曲 盧廣仲&lt;br/&gt;
*&lt;br/&gt;
整個世界 停止 不轉動 很寂寞&lt;br/&gt;
走在海邊 數著 螢火蟲 好困惑&lt;br/&gt;
想要的生活怎麼有一百種&lt;br/&gt;
不想掉進這深深 漩渦&lt;br/&gt;
&lt;br/&gt;                                                           
整個海浪 擺動 柔軟地 舉起我&lt;br/&gt;
孤獨給我 自由 猶豫得 好感動&lt;br/&gt;
想要的生活怎麼有一百種&lt;br/&gt;
該怎麼走 誰來告訴我 wow&lt;br/&gt;
&lt;br/&gt;                                                       
每當我背對星空&lt;br/&gt;
抱著地球&lt;br/&gt;
發現自己其實脆弱 不敢說&lt;br/&gt;
當我背對星空 不段摸索&lt;br/&gt;
愛情漸漸萎縮 我猜不透&lt;br/&gt;
無邊的宇宙 哪裡有我想要的生活&lt;br/&gt;
&lt;br/&gt;
repeat *&lt;br/&gt;
&lt;br/&gt;
原來一百種 要在很久很久&lt;br/&gt;
以後才會懂 我的一百種生活&lt;br/&gt;
&lt;br/&gt;
&lt;div class="Sidebody"&gt;
  &lt;embed hidden="false" width="160" src="http://plum.cs.nccu.edu.tw/~g9506/music/100_kinds_live.mp3" autostart="false" height="16"&gt;
  &lt;/embed&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-695903867184313230?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/695903867184313230/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=695903867184313230' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/695903867184313230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/695903867184313230'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/08/100.html' title='100種生活'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-6925418916482016721</id><published>2008-07-26T12:02:00.003+08:00</published><updated>2009-12-15T03:13:54.201+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>google code jam第三題</title><content type='html'>google code jam今天早上比了第一場&lt;br/&gt;
看了一下第三題&lt;br/&gt;
問題是 3 + 5^0.5 取n次方後　求整數前三位數字&lt;br/&gt;
&lt;br/&gt;
看起來很簡單　但一看就知道是誤差問題&lt;br/&gt;
看到解出來的人的解答　真的突然覺得自己數學變好差&lt;br/&gt;
早知道平常應該繼續唸的&lt;br/&gt;
&lt;br/&gt;
這題n取很大時會有誤差　所以不能硬幹&lt;br/&gt;
使用數學方法　設：&lt;br/&gt;
3 + 5^0.5  = x&lt;br/&gt;
         5 = x^2 - 6x + 9&lt;br/&gt;
         0 = x^2 - 6x + 4&lt;br/&gt;
根據n對公式取次方&lt;br/&gt;
最後再解方程&lt;br/&gt;
這樣誤差就消失了&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-6925418916482016721?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/6925418916482016721/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=6925418916482016721' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/6925418916482016721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/6925418916482016721'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/07/google-code-jam.html' title='google code jam第三題'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-5699274290698923738</id><published>2008-07-25T16:34:00.003+08:00</published><updated>2009-12-15T03:14:06.456+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>內積與外積</title><content type='html'>&lt;a href="http://csm01.csu.edu.tw/0166/Math3/53.htm"&gt;內積、外積定義&lt;/a&gt;&lt;br/&gt;
&lt;br/&gt;
內積:&lt;br/&gt;
物理學中求功的公式，數學上是v投影在u上的長度之積。&lt;br/&gt;
&lt;br/&gt;
外積:&lt;br/&gt;
外積是求一個相關的向量，外積出來的向量垂直於原向量。&lt;br/&gt;
在幾何中，外積的大小等於兩向量所成的矩形的面積。&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-5699274290698923738?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/5699274290698923738/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=5699274290698923738' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/5699274290698923738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/5699274290698923738'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/07/blog-post.html' title='內積與外積'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-3997224715532399533</id><published>2008-06-27T23:21:00.001+08:00</published><updated>2009-12-15T03:25:56.864+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>心 情</title><content type='html'>聽完畢業公演&lt;br/&gt;
&lt;br/&gt;
心情跌到谷底&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-3997224715532399533?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/3997224715532399533/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=3997224715532399533' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3997224715532399533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3997224715532399533'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/06/blog-post_27.html' title='心 情'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-4697071240156854703</id><published>2008-06-25T00:25:00.001+08:00</published><updated>2008-06-25T00:28:47.585+08:00</updated><title type='text'>Ten Rules for Web Startups</title><content type='html'>&lt;strong&gt;#1: Be Narrow&lt;/strong&gt;
Focus on the smallest possible problem you could solve that would potentially be useful. Most companies start out trying to do too many things, which makes life difficult and turns you into a me-too. Focusing on a small niche has so many advantages: With much less work, you can be the best at what you do. Small things, like a microscopic world, almost always turn out to be bigger than you think when you zoom in. You can much more easily position and market yourself when more focused. And when it comes to partnering, or being acquired, there's less chance for conflict. This is all so logical and, yet, there's a resistance to focusing. I think it comes from a fear of being trivial. Just remember: If you get to be #1 in your category, but your category is too small, then you can broaden your scope—and you can do so with leverage.

&lt;strong&gt;#2: Be Different&lt;/strong&gt;
Ideas are in the air. There are lots of people thinking about—and probably working on—the same thing you are. And one of them is Google. Deal with it. How? First of all, realize that no sufficiently interesting space will be limited to one player. In a sense, competition actually is good—especially to legitimize new markets. Second, see #1—the specialist will almost always kick the generalist's ass. Third, consider doing something that's not so cutting edge. Many highly successful companies—the aforementioned big G being one—have thrived by taking on areas that everyone thought were done and redoing them right. Also? Get a good, non-generic name. Easier said than done, granted. But the most common mistake in naming is trying to be too descriptive, which leads to lots of hard-to-distinguish names. How many blogging companies have "blog" in their name, RSS companies "feed," or podcasting companies "pod" or "cast"? Rarely are they the ones that stand out.

&lt;strong&gt;#3: Be Casual&lt;/strong&gt;
We're moving into what I call the era of the "Casual Web" (and casual content creation). This is much bigger than the hobbyist web or the professional web. Why? Because people have lives. And now, people with lives also have broadband. If you want to hit the really big home runs, create services that fit in with—and, indeed, help—people's everyday lives without requiring lots of commitment or identity change. Flickr enables personal publishing among millions of folks who would never consider themselves personal publishers—they're just sharing pictures with friends and family, a casual activity. Casual games are huge. Skype enables casual conversations.

&lt;strong&gt;#4: Be Picky&lt;/strong&gt;
Another perennial business rule, and it applies to everything you do: features, employees, investors, partners, press opportunities. Startups are often too eager to accept people or ideas into their world. You can almost always afford to wait if something doesn't feel just right, and false negatives are usually better than false positives. One of Google's biggest strengths—and sources of frustration for outsiders—was their willingness to say no to opportunities, easy money, potential employees, and deals.

&lt;strong&gt;#5: Be User-Centric
&lt;/strong&gt;User experience is everything. It always has been, but it's still undervalued and under-invested in. If you don't know user-centered design, study it. Hire people who know it. Obsess over it. Live and breathe it. Get your whole company on board. Better to iterate a hundred times to get the right feature right than to add a hundred more. The point of Ajax is that it can make a site more responsive, not that it's sexy. Tags can make things easier to find and classify, but maybe not in your application. The point of an API is so developers can add value for users, not to impress the geeks. Don't get sidetracked by technologies or the blog-worthiness of your next feature. Always focus on the user and all will be well.

&lt;strong&gt;#6: Be Self-Centered
&lt;/strong&gt;Great products almost always come from someone scratching their own itch. Create something you want to exist in the world. Be a user of your own product. Hire people who are users of your product. Make it better based on your own desires. (But don't trick yourself into thinking you are your user, when it comes to usability.) Another aspect of this is to not get seduced into doing deals with big companies at the expense or your users or at the expense of making your product better. When you're small and they're big, it's hard to say no, but see #4.

&lt;strong&gt;#7: Be Greedy&lt;/strong&gt;
It's always good to have options. One of the best ways to do that is to have income. While it's true that traffic is now again actually worth something, the give-everything-away-and-make-it-up-on-volume strategy stamps an expiration date on your company's ass. In other words, design something to charge for into your product and start taking money within 6 months (and do it with PayPal). Done right, charging money can actually accelerate growth, not impede it, because then you have something to fuel marketing costs with. More importantly, having money coming in the door puts you in a much more powerful position when it comes to your next round of funding or acquisition talks. In fact, consider whether you need to have a free version at all. The TypePad approach—taking the high-end position in the market—makes for a great business model in the right market. Less support. Less scalability concerns. Less abuse. And much higher margins.

&lt;strong&gt;#8: Be Tiny&lt;/strong&gt;
It's standard web startup wisdom by now that with the substantially lower costs to starting something on the web, the difficulty of IPOs, and the willingness of the big guys to shell out for small teams doing innovative stuff, the most likely end game if you're successful is acquisition. Acquisitions are much easier if they're small. And small acquisitions are possible if valuations are kept low from the get go. And keeping valuations low is possible because it doesn't cost much to start something anymore (especially if you keep the scope narrow). Besides the obvious techniques, one way to do this is to use turnkey services to lower your overhead—Administaff, ServerBeach, web apps, maybe even Elance.

&lt;strong&gt;#9: Be Agile&lt;/strong&gt;
You know that old saw about a plane flying from California to Hawaii being off course 99% of the time—but constantly correcting? The same is true of successful startups—except they may start out heading toward Alaska. Many dot-com bubble companies that died could have eventually been successful had they been able to adjust and change their plans instead of running as fast as they could until they burned out, based on their initial assumptions. Pyra was started to build a project-management app, not Blogger. Flickr's company was building a game. Ebay was going to sell auction software. Initial assumptions are almost always wrong. That's why the waterfall approach to building software is obsolete in favor agile techniques. The same philosophy should be applied to building a company.

&lt;strong&gt;#10: Be Balanced&lt;/strong&gt;
What is a startup without bleary-eyed, junk-food-fueled, balls-to-the-wall days and sleepless, caffeine-fueled, relationship-stressing nights? Answer?: A lot more enjoyable place to work. Yes, high levels of commitment are crucial. And yes, crunch times come and sometimes require an inordinate, painful, apologies-to-the-SO amount of work. But it can't be all the time. Nature requires balance for health—as do the bodies and minds who work for you and, without which, your company will be worthless. There is no better way to maintain balance and lower your stress that I've found than David Allen's GTD process. Learn it. Live it. Make it a part of your company, and you'll have a secret weapon.

&lt;strong&gt;#11 (bonus!): Be Wary&lt;/strong&gt;
Overgeneralized lists of business "rules" are not to be taken too literally. There are exceptions to everything.

written by &lt;a href="http://evhead.com/2005/11/ten-rules-for-web-startups.asp"&gt;evan williams&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-4697071240156854703?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/4697071240156854703/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=4697071240156854703' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/4697071240156854703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/4697071240156854703'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/06/ten-rules-for-web-startups.html' title='Ten Rules for Web Startups'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-3658919607437177884</id><published>2008-06-20T15:36:00.008+08:00</published><updated>2009-12-15T03:23:15.278+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='motion planning'/><title type='text'>motion planning using probability roadmap</title><content type='html'>The probobility roadmap is widely used for autonomous mobile robot path planning. It focus on multi-qurey. Initially, build the roadmap in configuration space, after that we can search a path each query, in which we don't rebuild the roadmap.&lt;br/&gt;
&lt;br/&gt;
below is demo:&lt;br/&gt;
&lt;br/&gt;
&lt;object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase="http://java.sun.com/update/1.6.0/jinstall-6u40-windows-i586.cab#Version=6,0,0,12" width="500" height="370"&gt; &lt;param name="CODE" value="JAppletDemo_PRM.class"&gt; &lt;param name="codebase" value="http://plum.cs.nccu.edu.tw/~s9144/Planner/MP_PRM/bin/"&gt; &lt;param name="type" value="application/x-java-applet;version=1.6"&gt; &lt;param name="archive" value="lib/Environment.jar"&gt; &lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-3658919607437177884?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/3658919607437177884/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=3658919607437177884' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3658919607437177884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3658919607437177884'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/06/motion-planning-using-probobility.html' title='motion planning using probability roadmap'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-4693534082549421703</id><published>2008-06-17T14:44:00.005+08:00</published><updated>2009-12-15T03:20:18.213+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>why use android</title><content type='html'>星期六去了google developer day&lt;br/&gt;
聽了四場演講&lt;br/&gt;
分別是Gears, GData, Android Introduce, Android VM&lt;br/&gt;
&lt;br/&gt;
Gears跟GData算是比較冷門的&lt;br/&gt;
它們兩個可以說是很偏應用性的東西　可能知道一下　以後有需要再用就好了&lt;br/&gt;
&lt;br/&gt;
下午的Android在比較大的會場上&lt;br/&gt;
Android Introduce對我來說沒甚麼&lt;br/&gt;
因為網頁上的文件都看過了　他講的東西文件中也講了　所以沒聽到甚麼&lt;br/&gt;
都在練英聽&lt;br/&gt;
Android VM　是我覺得很有趣的　但大部份人應該會覺得很無趣吧&lt;br/&gt;
因為它是在講compiler and virtual machine&lt;br/&gt;
&lt;br/&gt;
之前問我為甚麼玩android　跟其他手機上寫程式差在那&lt;br/&gt;
其實不太知道　只覺得它有很多API而已&lt;br/&gt;
聽完這場演講我比較知道它的優勢在那&lt;br/&gt;
最主要是android它放棄了Java Standard VM　改用自己開發的Delvik VM&lt;br/&gt;
以前我都不相信java會比C慢很多&lt;br/&gt;
經過他說明後了解了　java比較慢不單是因為VM的存在&lt;br/&gt;
java's code編釋成bytecode的結果才是重點&lt;br/&gt;
java採用stack based的方式產生指令　所以任何變數必須push, pop到stack裡&lt;br/&gt;
所以往往一個儲取,迴圈就多了很多不必的指令&lt;br/&gt;
&lt;br/&gt;
而Delvik VM則改用register based的方式　變數記錄在register裡　再作儲取&lt;br/&gt;
所以產生的指令就比較少了&lt;br/&gt;
單單這個改變就可以令速度快好幾倍了&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-4693534082549421703?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/4693534082549421703/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=4693534082549421703' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/4693534082549421703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/4693534082549421703'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/06/why-use-android.html' title='why use android'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-2572940633600331465</id><published>2008-06-16T10:41:00.003+08:00</published><updated>2009-12-15T03:19:20.240+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='basketball'/><title type='text'>我完了</title><content type='html'>昨天打球　因為手腕還沒好　投球都歪歪的&lt;br/&gt;
只好一直切入&lt;br/&gt;
最近切入都很不錯　都抓到切入的點　身體也壓得下去&lt;br/&gt;
不錯不錯&lt;br/&gt;
&lt;br/&gt;
但我膝蓋真的爛掉了&lt;br/&gt;
今天早上起來一直在痛&lt;br/&gt;
看來是又韌帶發炎了　T____T&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-2572940633600331465?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/2572940633600331465/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=2572940633600331465' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/2572940633600331465'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/2572940633600331465'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/06/blog-post_16.html' title='我完了'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-8360012283253236141</id><published>2008-06-09T22:01:00.004+08:00</published><updated>2009-12-15T03:20:32.893+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Android's notebook</title><content type='html'>convert Java into android.&lt;br/&gt;
&lt;br/&gt;
android.app.Activity  &lt;--&gt; javax.swing.JFrame&lt;br/&gt;
android.app.AlarmManager &lt;--&gt; javax.swing.Timer&lt;br/&gt;
android.app.Dialog  &lt;--&gt; javax.swing.JDialog&lt;br/&gt;
android.app.AlertDialog&lt;br/&gt;
android.app.DatePickerDialog&lt;br/&gt;
android.app.ProgressDialog&lt;br/&gt;
android.app.TimePickerDialog&lt;br/&gt;
android.app.ZoomDialog&lt;br/&gt;
android.awt.AndroidGraphics2D &lt;--&gt; java.awt.Graphics2D&lt;br/&gt;
android.content.Intent  &lt;--&gt; java.awt.ActionListener&lt;br/&gt;
package android.graphics &lt;--&gt; package java.awt.geom &amp; java.awt&lt;br/&gt;
android.view.View  &lt;--&gt; javax.swing.JPanel&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-8360012283253236141?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/8360012283253236141/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=8360012283253236141' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8360012283253236141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8360012283253236141'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/06/androids-notebook.html' title='Android&apos;s notebook'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-2883210488956155632</id><published>2008-06-07T17:37:00.005+08:00</published><updated>2009-12-15T03:23:07.860+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='motion planning'/><title type='text'>motion planning using potential fileds</title><content type='html'>The potential field method is widely used for autonomous mobile robot path planning. The most researches have been focused on solving the motion planning problem in a stationary environment where both targets and obstacles are stationary.(as same as our example)&lt;br/&gt;
&lt;br/&gt;
in our example&lt;br/&gt;
the bitmap shows the potential field in left upper corner, dark region represents higher potential, light region represents lower potential.&lt;br/&gt;
&lt;br/&gt;
below is demo:&lt;br/&gt;
&lt;br/&gt;
&lt;object classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase = "http://java.sun.com/update/1.6.0/jinstall-6u40-windows-i586.cab#Version=6,0,0,12" WIDTH = "500" HEIGHT = "370" &gt; &lt;PARAM NAME = CODE VALUE = JAppletDemo_PF.class &gt; &lt;PARAM NAME = "codebase" VALUE="http://plum.cs.nccu.edu.tw/~s9144/Planner/MP_PotentialField/bin/"&gt; &lt;PARAM name = "type" VALUE = "application/x-java-applet;version=1.6"&gt; &lt;PARAM name = "archive" VALUE="lib/Environment.jar"&gt; &lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-2883210488956155632?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/2883210488956155632/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=2883210488956155632' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/2883210488956155632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/2883210488956155632'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/06/motion-planning-using-potential-fileds.html' title='motion planning using potential fileds'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-8586849467163205862</id><published>2008-06-06T12:16:00.007+08:00</published><updated>2009-12-15T03:15:23.194+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='google'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>overview of android</title><content type='html'>&lt;a href="http://code.google.com/android/documentation.html"&gt;android documentation&lt;/a&gt;
in this web page, it overview the android platform, and support all information if you want.(but i think it's not enough ^^") install SDK is easy, just set up the path of OS.i think install SDK isn't problem, so let me see the API.&lt;br/&gt;
&lt;br/&gt;
the API rough separate in three parts: &lt;ol&gt;&lt;li&gt;java.*; and javax.*;&lt;/li&gt;&lt;li&gt;android.*;&lt;/li&gt;&lt;li&gt;com.apache.http.*;&lt;/li&gt;&lt;/ol&gt;the first part(java.*; and javax.*;) import from java SDK. so it's not new package, however, pay attention to these are not awt and swing package, because android platform exericse other UI Design, so we should use android package to do UI Design. after that, the third part import from com.apache for parsing html document.&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-8586849467163205862?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/8586849467163205862/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=8586849467163205862' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8586849467163205862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8586849467163205862'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/06/overview-of-android.html' title='overview of android'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-4585201208648368666</id><published>2008-06-05T23:11:00.003+08:00</published><updated>2009-12-15T03:26:04.699+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>掙扎</title><content type='html'>最近我一直重複著一個動作&lt;br/&gt;
就是打開eclipse關掉它　又打開它關掉它 ...&lt;br/&gt;
寫程式對我來說並不難&lt;br/&gt;
但畢業的程式每看到它都不想寫　視窗不是馬上切換到kkman　就是切換到我想寫的程式&lt;br/&gt;
寫這種為畢業而寫的程式　寫完再也不會用的程式　真不知道寫來幹麻&lt;br/&gt;
看來&lt;br/&gt;
在解決研究題目前　要先解決寫程式的題目&lt;br/&gt;
我到底要for畢業還是for理想？&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-4585201208648368666?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/4585201208648368666/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=4585201208648368666' title='3 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/4585201208648368666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/4585201208648368666'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/06/blog-post.html' title='掙扎'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-2626724014774200176</id><published>2008-05-16T16:40:00.003+08:00</published><updated>2009-12-15T03:19:27.923+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='basketball'/><title type='text'>舊傷好不了</title><content type='html'>昨天晚上跟系隊去打球&lt;br/&gt;
球技倒沒甚麼退步&lt;br/&gt;
但膝蓋跟背就真的是...&lt;br/&gt;
今天一整天膝蓋都酸酸的　背也帶一點點痛&lt;br/&gt;
吼　趕快好起來呀&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-2626724014774200176?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/2626724014774200176/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=2626724014774200176' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/2626724014774200176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/2626724014774200176'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/05/blog-post_16.html' title='舊傷好不了'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-8567460598099926556</id><published>2008-05-14T16:15:00.013+08:00</published><updated>2010-04-21T22:47:34.794+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='music'/><title type='text'>The best is yet to come</title><content type='html'>演唱: 林一峰&lt;br /&gt;
作曲: 林一峰, 編曲: 李端嫻＠人山人海&lt;br /&gt;
監製: , 填詞: 林一峰&lt;br /&gt;
&lt;br /&gt;
永遠有一個吻未嘗　有些燭光未燃亮&lt;br /&gt;
若愛太苦要落糖　結他斷線亦無恙&lt;br /&gt;
To hug someone To kiss someone&lt;br /&gt;
The best is yet to come&lt;br /&gt;
若要錯失永不能守 得到也不代表長久&lt;br /&gt;
假使快樂有盡頭 痛苦也未會不朽&lt;br /&gt;
寂寞半點假如不能承受&lt;br /&gt;
這生命註定過得不易&lt;br /&gt;
笑與淚　亦有時候&lt;br /&gt;
To hug someone To kiss someone&lt;br /&gt;
The best is yet to come&lt;br /&gt;
若你說不再聽情歌 不想再經歷這漩渦&lt;br /&gt;
假使抱住你拳頭 到底也沒法牽手&lt;br /&gt;
就是為了追求一時平靜&lt;br /&gt;
將感情隔離半點感動都扼殺　沒法承受&lt;br /&gt;
永遠有不妥協傷口　有些憾事不放手&lt;br /&gt;
若你太刻意淡忘　越會補不到缺口&lt;br /&gt;
Why don't you just hug someone&lt;br /&gt;
Just kiss someone&lt;br /&gt;
The best is yet to come&lt;br /&gt;
最好的尚未來臨&lt;br /&gt;
&lt;div class="Sidebody"&gt;  &lt;embed hidden="false" width="160" src="http://plum.cs.nccu.edu.tw/~g9506/music/TheBestisYettoCome.mp3" autostart="false" height="16"&gt;   &lt;/embed&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-8567460598099926556?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/8567460598099926556/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=8567460598099926556' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8567460598099926556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8567460598099926556'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/05/best-is-yet-to-come.html' title='The best is yet to come'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-3292539254302810716</id><published>2008-05-11T01:09:00.008+08:00</published><updated>2009-12-15T03:13:12.953+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>editor and swing</title><content type='html'>最近要寫一個editor　是要給非資訊系的人用&lt;br/&gt;
基本文字編輯和一些跟XML相關的功能&lt;br/&gt;
需要簡單美觀彈性　總之就是要user friendly就是了&lt;br/&gt;
找了一下有沒有開放的package拿來改&lt;br/&gt;
&lt;br/&gt;
eclipse的介面很好　但是看了一下要用eclipse api弄一個出來真是天殺的麻煩&lt;br/&gt;
而且它的功能是以寫程式導向的編輯器　我只需要純文字　有點大材小用&lt;br/&gt;
&lt;br/&gt;
&lt;a href="http://www.jedit.org/"&gt;jEdit&lt;/a&gt;由一群人開發出來的編輯器　功能非常強大　在網頁中寫提供以下功能
&lt;ul&gt;&lt;li&gt;Written in Java, so it runs on Mac OS X, OS/2, Unix, VMS and Windows.&lt;/li&gt;
&lt;li&gt;Built-in macro language; extensible plugin architecture. Dozens of macros and plugins available.&lt;/li&gt;
&lt;li&gt;Plugins can be downloaded and installed from within jEdit using the "plugin manager" feature.&lt;/li&gt;
&lt;li&gt;Auto indent, and syntax highlighting for more than 130 languages.&lt;/li&gt;
&lt;li&gt;Supports a large number of character encodings including UTF8 and Unicode.&lt;/li&gt;
&lt;li&gt;Folding for selectively hiding regions of text.&lt;/li&gt;
&lt;li&gt;Word wrap.&lt;/li&gt;
&lt;li&gt;Highly configurable and customizable.&lt;/li&gt;
&lt;li&gt;Every other feature, both basic and advanced, you would expect to find in a text editor. See the Features page for a full list. &lt;/li&gt;&lt;/ul&gt;
只要了解一下　寫些plugin就可以了　但它功能太強大　給非資訊系的人用會不知道怎麼用　所以放棄了&lt;br/&gt;
&lt;br/&gt;
&lt;a href="http://www.hexidec.com/ekit.php"&gt;ekit&lt;/a&gt;另一套開放且很好用的編輯器　可惜它是提供給HTML　能讓我更改的可能性很低&lt;br/&gt;
&lt;br/&gt;
找不到下只好用java swing開發　java swing很強大　如果只是普普通通弄個介面　用netbeans很不錯有好用的視覺化介面　但它只能視覺化大部份"J"開頭的元件　如果要做的得更好更炫就必須轉到寫程式
swing上有很多大家都不知道　也不常用的package和class&lt;br/&gt;
&lt;br/&gt;
如果想拖拉　可以參考java.awt.dnd　在&lt;a href="http://java.sun.com/docs/books/tutorial/uiswing/dnd/defaultsupport.html"&gt;how to use dnd&lt;/a&gt;中可以查到那些元件本身已提供拖拉功能　如果想要用的元件有提供dnd的話只要呼叫setDragEnabled(true)就有拖拉功能了　沒有的話就必須實作DragSource, DragTarger等class&lt;br/&gt;
&lt;br/&gt;
如果想剪貼簿　可以參考javax.swing.text.DefaultEditorKit　它已經寫好Copy, Cut, Paste的action　只要在元件的建構子以action為參數加到元件裡就好了&lt;br/&gt;
&lt;br/&gt;
如果想讓視窗沒有框框　就不要用JFrame　用JWindow&lt;br/&gt;
&lt;br/&gt;
還有很多很多　其他有空再補...&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-3292539254302810716?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/3292539254302810716/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=3292539254302810716' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3292539254302810716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3292539254302810716'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/05/editor-and-swing.html' title='editor and swing'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-8962962183495870041</id><published>2008-05-08T15:35:00.015+08:00</published><updated>2009-12-15T03:22:57.124+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='motion planning'/><title type='text'>motion planning environment</title><content type='html'>I have a plan to arrange what i have leared in motion planning up to the present.
I think i'll show some planning methods, like potential field, PRM and RRT.
These methods are so common.&lt;br/&gt;
&lt;br/&gt;
Before i show some demo, i think i should build a simple environment for all methods.
So i had wrotten a environment which support to read Objects(Robot or Obstacle) in txt file, to show the objects in screen, to build BitMap and C-Space for planning.&lt;br/&gt;
&lt;br/&gt;
Below is my environment demo. The red objects are robots and the blue are obstacles, you can click and drag each one, a event of left-click drag represents translating the click object, the event of right-click drag represents rotating the object, pay attention to the right-click event, because the robot is combined from several polygons, you can local or global rotation.&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
&lt;OBJECT  classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="500" height="500" align="baseline"  codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0"&gt; &lt;PARAM NAME="code" VALUE="JAppletDemo.class"&gt; &lt;PARAM NAME="codebase" VALUE="http://plum.cs.nccu.edu.tw/~s9144/Planner/Environment/bin/"&gt; &lt;PARAM NAME="type" VALUE="application/x-java-applet;version=1.2.2"&gt; &lt;/OBJECT&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-8962962183495870041?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/8962962183495870041/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=8962962183495870041' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8962962183495870041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8962962183495870041'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/05/motion-planning-environment.html' title='motion planning environment'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-734785176874686247</id><published>2008-05-06T15:48:00.003+08:00</published><updated>2009-12-15T03:15:45.724+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Google Cloud Computing 教學計畫將在台，交大實施</title><content type='html'>全球搜尋引擎龍頭Google昨天宣布，將和台灣大學、交通大學合作推廣「雲端運算學術計畫」，幫助台灣學子學習這項網路開發主流技術。台灣是Google在美國本土外，第一個可望輸出快速運算模式的國家，有助台灣開發更多有創意的網路服務。&lt;br/&gt;
&lt;br/&gt;
Google台灣工程研究所所長簡立峰說，網路資料日漸增多且龐雜，Google開發所謂「雲端運算」（cloud computing）的模式，可讓數百台、數千台電腦同時運作，這項運算概念充斥在日常生活各種網路服務中。&lt;br/&gt;
&lt;br/&gt;
舉例來說，當網友登入Google的帳號及密碼，全球有數百台的電腦會同時運作，幾秒內即能確認。而且上千封郵件不是放在用戶的個人電腦裡，而是儲放在世界各地的伺服器中，這些伺服器就像一朵朵的雲，使用者不知道自己的郵件躲在哪朵雲中。&lt;br/&gt;
&lt;br/&gt;
他表示，在Google搜尋關鍵字，可在不到一秒時間，搜尋出超過十億個網頁，這也和雲端運算有關，原理是將龐大運算作業拆成千百個較小的作業，在多部伺服器上同時動作。Google其他線上服務如Google Docs、Google Talk、iGoogle、Google Calendar都充分應用到這項技術。&lt;br/&gt;
&lt;br/&gt;
他說，只要運算功能是在遠端、多部伺服器進行，本機只負責單純操作的技術，都可以稱為雲端運算。不只Google靠雲端運算起家，Yahoo!、Amazon、微軟也都採用這項技術提升網路服務功能。微軟創辦人比爾蓋茲曾說，未來是雲端運算的時代。&lt;br/&gt;
&lt;br/&gt;
去年十月Google先在美國麻省理工學院、史丹佛、柏克萊加大、卡內基梅隆、馬里蘭和西雅圖華盛頓大學首度推廣，成效不錯。華盛頓大學學生甚至因此編寫出可掃描內容龐大的維基百科，以辨識垃圾條目程式，及根據地理位置編排全球新聞標題。&lt;br/&gt;
&lt;br/&gt;
台灣是這項計畫的第二站，也是Google在美國本土以外的第一站。Google軟體工程師葉平說，Google將提供教材給台灣教授，並協助學校在現有運算資源上建置相關軟體系統，台灣Google還會派六名工程師到大學當學生的小師父。&lt;br/&gt;
&lt;br/&gt;
目前Google已計畫和台大劉邦鋒教授開設的「平行運算」，以及交大教授彭文志和黃俊龍的「Web Services and Application」課程合作。&lt;br/&gt;
&lt;br/&gt;
以上引用自&lt;a href="http://mag.udn.com/mag/digital/storypage.jsp?f_MAIN_ID=319&amp;amp;f_SUB_ID=2941&amp;amp;f_ART_ID=108944"&gt;http://mag.udn.com/mag/digital/storypage.jsp?f_MAIN_ID=319&amp;amp;f_SUB_ID=2941&amp;amp;f_ART_ID=108944&lt;/a&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-734785176874686247?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/734785176874686247/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=734785176874686247' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/734785176874686247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/734785176874686247'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/05/google-cloud-computing.html' title='Google Cloud Computing 教學計畫將在台，交大實施'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-9217324809767678989</id><published>2008-05-06T15:25:00.002+08:00</published><updated>2009-12-15T03:26:26.331+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>醜陋的程式</title><content type='html'>我真的對程式有潔癖&lt;br/&gt;
&lt;br/&gt;
現在寫研究的程式　只要一直嘗試方法&lt;br/&gt;
&lt;br/&gt;
沒甚麼架構可言　還一直改來改去&lt;br/&gt;
&lt;br/&gt;
寫到我越來越討厭看到它&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-9217324809767678989?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/9217324809767678989/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=9217324809767678989' title='3 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/9217324809767678989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/9217324809767678989'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/05/blog-post_06.html' title='醜陋的程式'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-500359414757999371</id><published>2008-05-05T02:00:00.001+08:00</published><updated>2009-12-15T03:26:36.116+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>暴走的廁所</title><content type='html'>林小藤你這個...&lt;br/&gt;
居然把廁所的蓮篷頭弄壞了&lt;br/&gt;
&lt;br/&gt;
重要的是不管它放在那邊&lt;br/&gt;
&lt;br/&gt;
吼　我們都要變成日本人洗澡了　開一盆水在那邊一杯杯倒在身上&lt;br/&gt;
&lt;br/&gt;
氣死我了&lt;br/&gt;
&lt;br/&gt;
你你你...　我不能用笨蛋來罵你　這樣太污辱了笨蛋了&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-500359414757999371?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/500359414757999371/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=500359414757999371' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/500359414757999371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/500359414757999371'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/05/blog-post.html' title='暴走的廁所'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-7487413657500547723</id><published>2008-04-28T15:57:00.000+08:00</published><updated>2008-04-30T19:52:29.768+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>details of inheritance in Java</title><content type='html'>Everyone knows everything is object in Java. sometime if you inherit or create an object, you must keep &lt;b  style="color:blue;"&gt;&lt;span style="color:#3333ff;"&gt;the general contracts&lt;/span&gt;,&lt;/b&gt; else you may make bugs.
equals(), hashCode(), clone(), finalize(). those are non-final methods, we will discuss below.
&lt;ol&gt;&lt;li&gt;Override equals() method is simple, but it will also make mistakes, the best solution is don't override it possibly. if you must override it must keep the below conditions.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Reflexive : for all x, x.equals(x) must true. &lt;/li&gt;
&lt;li&gt;Symmetric : for all x, y, if x.equals(y) is true, then y.equals(x) is true. &lt;/li&gt;
&lt;li&gt;Transitive : for all x, y, z, if x.equals(y) and y.equals(z) are true, then x.equals(z) is true.
&lt;/li&gt;&lt;li&gt;Consistent : for all x, y, x.equals(y) == y.equals(x) is forever true. &lt;/li&gt;
&lt;li&gt;Non nullity : x.equals(null) is false at all time. &lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span style="color:#3333ff;"&gt;hashCode() be override coincide with equals().&lt;/span&gt; if you don't do that, you violate the constracts and can't work normally with HashMap, HashSet, HashTable...
If and only if x.equals(y) is true, then x.hashCode() must equal y.hashCode().

sample code:
Map m = new HashMap();
m.put(new MyObject("hihi"), "lui");
m.get(new MyObject("hihi"));

Usually you believe "m.get(new MyObject("hihi"))" will return the String "lui", but it also return null. it's because the two MyObject is the same in our opinion, but is not the same in program, it has different hashCode, so, for the same object must has the same hashCode.&lt;/li&gt;

&lt;li&gt;clone() method is like create a object, you must know &lt;span style="color:#3333ff;"&gt;clone() is not deep copy&lt;/span&gt;, so, it may share member data in two objects, but it isn't you want. So, one solution is don't support clone() method, others is make clone() as like as copy constructor in C++.
&lt;/li&gt;
&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-7487413657500547723?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/7487413657500547723/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=7487413657500547723' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/7487413657500547723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/7487413657500547723'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/04/details-of-inheritance-in-java.html' title='details of inheritance in Java'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-6637630678961283569</id><published>2008-04-27T01:07:00.001+08:00</published><updated>2009-12-15T03:16:15.851+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Android</title><content type='html'>The Android platform is a software stack for mobile devices including an operating system, middleware and key applications. Developers can create applications for the platform using the Android SDK. Applications are written using the Java programming language and run on Dalvik, a custom virtual machine designed for embedded use which runs on top of a Linux kernel.&lt;br/&gt;
&lt;br/&gt;
&lt;a href="http://code.google.com/android/documentation.html"&gt;android documentation&lt;/a&gt;&lt;br/&gt;
&lt;br/&gt;
The core Android APIs will be available on every Android phone, but there are a few APIs which have special concerns: the "optional" APIs.&lt;br/&gt;
&lt;br/&gt;
These APIs are "optional" for two reasons. First, they're optional in the sense that you don't need to use them. For example, you can't write an application without using the Activity and Intent APIs, but your application may not need to know where the user is, and so you may not need the Location-Based Services API. In this sense, the LBS API is optional where the Activity API is not. &lt;p&gt;&lt;/p&gt;&lt;br/&gt;
&lt;ol&gt;&lt;li&gt;Location-Based Services
&lt;li&gt;Media APIs&lt;/li&gt;
&lt;li&gt;3D Graphics with OpenGL&lt;/li&gt;
&lt;li&gt;Low-Level Hardware Access&lt;/li&gt;
&lt;/ol&gt;
&lt;br/&gt;
Google APIs and Services in Android&lt;br/&gt;
&lt;ol&gt;&lt;li&gt;MapView&lt;/li&gt;
&lt;li&gt;P2P Services Using XMPP&lt;/li&gt;
&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-6637630678961283569?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/6637630678961283569/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=6637630678961283569' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/6637630678961283569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/6637630678961283569'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/04/android.html' title='Android'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-9059719300017067223</id><published>2008-04-24T21:43:00.001+08:00</published><updated>2009-12-15T03:17:11.827+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>PageRank</title><content type='html'>google這麼好用大多是因為它準確率高&lt;br/&gt;
也就是PageRank這個方法&lt;br/&gt;
&lt;br/&gt;
簡單講就是每個網頁都有自己的分數　網頁本身的每一個link都會將自己的分數影響別的網頁&lt;br/&gt;
所以網頁的排名就是自身的分數加上所有別人link到本網頁的分數&lt;br/&gt;
被link越多rank越高　被高rank的網頁link到rank升更快&lt;br/&gt;
&lt;br/&gt;
一般一個新網頁出來　google大約兩個內會找到　然後建index&lt;br/&gt;
然後每隔一段時間更新一次&lt;br/&gt;
&lt;br/&gt;
所以它的方法主要分兩個部份　　一內容分析　二link分析&lt;br/&gt;
&lt;br/&gt;
內容分析&lt;br/&gt;
google會看meta title來了解這是一個大概甚麼網頁　會看keyword的density　
會看keyword在甚麼tag中　字型大小　顏色...　還有很多很多&lt;br/&gt;
所以說並不是keyword多就高分　google也一直修改它的判分方法　方向是以人為主&lt;br/&gt;
使用者想看到甚麼資料　所以meta tag或字型大小為0的內容影響極少&lt;br/&gt;
&lt;br/&gt;
link分析&lt;br/&gt;
主要是每個網頁都有個PR值　值越高越重要　被PR值高的網頁連結到　本身增加的分數&lt;br/&gt;
就比較多　想法是認為PR值高的網頁認為你的網頁有用　就像被大人物推薦一樣&lt;br/&gt;
但是　這樣網頁管理者就會想瘋狂的相互連結來增加rank&lt;br/&gt;
google當然沒這麼笨&lt;br/&gt;
一個網址的向外連結會將分數share　一個PR值高的網頁只有一個link連結網頁A&lt;br/&gt;
和有100個link其中只有一個link連結網頁A是有差別的&lt;br/&gt;
&lt;br/&gt;
以上都是對google的初步了解&lt;br/&gt;
google單單在07年　一年中更新了四百多次&lt;br/&gt;
現在的計算考慮到甚麼程式已經不知道了&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-9059719300017067223?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/9059719300017067223/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=9059719300017067223' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/9059719300017067223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/9059719300017067223'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/04/pagerank.html' title='PageRank'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-1299875995737593870</id><published>2008-04-22T01:28:00.001+08:00</published><updated>2009-12-15T03:26:47.419+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>世界末日</title><content type='html'>回到家發現我的巧克力冰琪淋在冰箱裡溶掉了&lt;br/&gt;
&lt;br/&gt;
幹　好傷心喔&lt;br/&gt;
&lt;br/&gt;
溶掉的冰琪淋要怎麼吃呀&lt;br/&gt;
&lt;br/&gt;
google了一下知道冰箱不冷很有可能是電風扇被冰住了&lt;br/&gt;
&lt;br/&gt;
放電打開讓它掉冰就可了&lt;br/&gt;
&lt;br/&gt;
可是　冰箱沒電我冰琪淋溶得更快呀&lt;br/&gt;
&lt;br/&gt;
幹幹幹&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-1299875995737593870?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/1299875995737593870/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=1299875995737593870' title='3 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/1299875995737593870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/1299875995737593870'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/04/blog-post_21.html' title='世界末日'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-8647702807637643112</id><published>2008-04-20T18:30:00.002+08:00</published><updated>2009-12-15T03:21:25.404+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='motion planning'/><title type='text'>研究 moiton planning 的人</title><content type='html'>國外motion planning的幾位大人物&lt;br/&gt;
&lt;br/&gt;
&lt;a href="http://robotics.stanford.edu/~latombe/"&gt;Jean-Claude Latombe &lt;/a&gt;&lt;br/&gt;
&lt;a href="http://people.cs.uu.nl/markov/"&gt;Mark Oversmars&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://msl.cs.uiuc.edu/~lavalle/"&gt;Steven M. LaValle&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://emotion.inrialpes.fr/fraichard/"&gt;Thierry Fraichard &lt;/a&gt;&lt;br/&gt;
&lt;a href="http://www.kuffner.org/james/papers/"&gt;James Kuffner&lt;/a&gt;&lt;br/&gt;
&lt;br/&gt;
motion planning的問題目前可以走的方向大概有：&lt;br/&gt;
robot path planning --- environment&lt;br/&gt;
　　　　　　　　　　 multi-goal&lt;br/&gt;
　　　　　　　　　　 multi-robot&lt;br/&gt;
　　　　　　　　　　 visibility&lt;br/&gt;
　　　　　　　　　　 path quality&lt;br/&gt;
humaniod animation --- kinematic (inverse, forward)&lt;br/&gt;
　　　　　　　　　　　controller&lt;br/&gt;
　　　　　　　　　　　behavior planning&lt;br/&gt;
　　　　　　　　　　　composition motion&lt;br/&gt;
navigation&lt;br/&gt;
manipulation&lt;br/&gt;
collision detection&lt;br/&gt;
&lt;br/&gt;
很明顯的　我比較知道第一二個領域　第三四五還不是很熟&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-8647702807637643112?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/8647702807637643112/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=8647702807637643112' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8647702807637643112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8647702807637643112'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/04/motion-planning-jean-claude-latombe.html' title='研究 moiton planning 的人'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-8166059803711302408</id><published>2008-04-19T21:05:00.001+08:00</published><updated>2009-12-15T03:19:36.712+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='basketball'/><title type='text'>SBL 第五戰</title><content type='html'>幹　這場太high了&lt;br/&gt;
兩隊一直反超前　大家的三分球像不好錢的&lt;br/&gt;
公主鼎也進一顆&lt;br/&gt;
陳世念這個裕辣三分球100%&lt;br/&gt;
台啤輸了也好&lt;br/&gt;
這樣明天還有得看&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-8166059803711302408?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/8166059803711302408/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=8166059803711302408' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8166059803711302408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/8166059803711302408'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/04/sbl.html' title='SBL 第五戰'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-3255909601091834425</id><published>2008-04-19T12:42:00.001+08:00</published><updated>2009-12-15T03:26:58.583+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>終生學習</title><content type='html'>小時候大家都會說　讀大學讀完大學生活就很好了&lt;br/&gt;
過了沒多久就改為讀完碩士生活就很好了&lt;br/&gt;
電影據裡都會演某某某國外讀完回來就是某公司的高層。。。&lt;br/&gt;
&lt;br/&gt;
這些都是長輩們的幻想&lt;br/&gt;
&lt;br/&gt;
越往上爬越發現腳步停不下來&lt;br/&gt;
因為你就變成一部發動機　發動後可以一直往前走　只要你不停下來多遠都能走到&lt;br/&gt;
一旦停下來就再也不會移動了&lt;br/&gt;
&lt;br/&gt;
不管在公司在學校或其他地方&lt;br/&gt;
一旦失去動力就會變得庸碌　只有不斷的進步　就會找到人生的意義&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-3255909601091834425?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/3255909601091834425/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=3255909601091834425' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3255909601091834425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3255909601091834425'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/04/blog-post.html' title='終生學習'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3602674777707139629.post-3159758700252149240</id><published>2008-04-18T23:00:00.001+08:00</published><updated>2009-12-15T03:18:45.187+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='me'/><title type='text'>resume</title><content type='html'>here is my resume&lt;br/&gt;
&lt;a href="http://plum.cs.nccu.edu.tw/~g9506"&gt;http://plum.cs.nccu.edu.tw/~g9506&lt;/a&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3602674777707139629-3159758700252149240?l=kc-lui.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kc-lui.blogspot.com/feeds/3159758700252149240/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3602674777707139629&amp;postID=3159758700252149240' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3159758700252149240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3602674777707139629/posts/default/3159758700252149240'/><link rel='alternate' type='text/html' href='http://kc-lui.blogspot.com/2008/04/resume.html' title='resume'/><author><name>lui</name><uri>http://www.blogger.com/profile/08679538620572861199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
