2011年7月29日星期五

GIT 錯誤: Couldn't reserve space for Cygwin heap

今天在用 msysgit 的 PULL 時,莫名奇妙地遇到一個錯誤:

      0 [main] us 0 init_cheap: VirtualAlloc pointer is null, Win32 error 487
AllocationBase 0x0, BaseAddress 0x68550000, RegionSize 0x2C0000, State 0x10000
C:\Program Files (x86)\Git\bin\sh.exe: *** Couldn't reserve space for cygwin's h
eap, Win32 error 0


msysgit 上有此問題的討論與解法: issue 133

倒不難解決,到 http://www.madwizard.org/electronics/articles/winavrvista 下載 msys-rebase.zip ,解壓縮後將 msys-1.0.dll 覆蓋 C:\Program Files (x86)\Git\bin\ 裡的舊檔,mysysgit PULL 就正常了。

2011年7月4日星期一

Is a Bug of convex_hull of Boost.Geometry?

Input data: a set of 19 points:

(3, 3), (3, 5), (0, 1), (2, 5),(-2, 2),
(-3, 2), (6, 5), (-3, 4), (-5, 2), (-5, -1), 
(1, -2), (-3, -2), (4, 2), (5, 1), (-5, 1),
(3, -2), (0, 5), (0, 0), (7, 4)

Given the input data, the follow picture shows the generated convex hull of calling convex_hull() in Boost.Geometry 1.47.0 :


In contrast, the follow picture shows the correct convex hull:




2011年5月24日星期二

使用Application.AddMessageFilter實作Form的熱鍵 [C++版]

使用Application.AddMessageFilter實作Form的熱鍵 一文中,提到一個IMessageFilter 來實作hotkey的方式,但是該文提供的程式碼是 C# 版。

以下是我針對文中 HotKey class 的一份 C++ 實作。

__delegate void HotkeyEventHandler(System::Object __gc*, System::EventArgs __gc*);
__gc class HotKey : public IMessageFilter 
{
public: 
    HotkeyEventHandler __gc* OnHotkey;

    HotKey(Keys hotKey, Keys comboKey) {
        _hotKey = hotKey;
        _comboKey = comboKey; 
        OnHotkey = NULL;
        AddMessageFilter(this);
    }

    virtual bool PreFilterMessage( Message __gc* m ) {
        if(OnHotkey == NULL)
            return false;

        //const int WM_KEYDOWN = 0x100;
        const int WM_ALTKEYDOWN = 0x104;

        if(m->Msg == WM_KEYDOWN || m->Msg == WM_ALTKEYDOWN){
            if( ((int)m->WParam & Keys::KeyCode) != _hotKey )
                return false;

            if(ModifierKeys != _comboKey)
                return false;

            OnHotkey(this, NULL); 
            return true;
        }
        return false;
    }

private:
    Keys _hotKey;
    Keys _comboKey;
};

2011年5月19日星期四

Related papers of Intersection Detectors

Related papers of Intersection Detectors
  1. Automated correction and updating of roads from aerial ortho-images
  2. Utilizing road network data for automatic identification of road intersections from high resolution color orthoimagery
  3. Junction-aware extraction and regularization of urban road networks in high-resolution SAR images
  4. Detection of line junctions and line terminations using curvilinear features
  5. Automatic completion and evaluation of road networks

2011年5月2日星期一

[SHARE] 博士工廠

Education: The PhD factory (可以下載到原文pdf檔)


The world is producing more PhDs than ever before. Is it time to stop?