Other articles


  1. OpenCV: strange return value of cvWaitKey()

    In OpenCV, cvWaitKey() might be one of most frequently used functions in interactive applications. For example (code in C++):

    while(true)
    {
        doSomething();
    
        if(cvWaitKey() == 27) // 27 is the key code of Escape
        {
            break;
        }
    }
    

    This works in Windows, but not work in Ubuntu. Both C++ version and python version can't catch …

    read more
  2. SFTP initial path

    Google "sftp default path",大多數是用chroot的方式。但我的需求是一開始先切換到某個home以外的目錄,而不是將user鎖在某個目錄底下。轉念一想,sftp-server也只是一個用user的身份執行的process,其實只要從.bashrc或.profile之類的檔案下手即可。

    首先看看Ubuntu的default .bashrc的前幾行(在/etc/skel/.bashrc):

    # ~/.bashrc: executed by bash(1) for non-login shells.
    # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
    # for examples
    
    # If not running interactively, don't do anything
    [ -z "$PS1" ] && return …
    read more
  3. Hello world!

    Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

    It's the second time I install WordPress on my Apache server. The first time is not long ago, but everything seems easier then ever! WordPress is primarily written in PHP, so a little knowledge for …

    read more

social