Skip navigation.

云舒云卷

----我醉欲眠卿且去,明朝有意抱琴来

STICKY POST

DesktopAngel

,

小巧的桌面工具,提高工作效率。:smile:
Newest Version:
DeskAngel

Read more...

政府是人民的政府

很多人都比较容易上当。比如说“我们针对的是政府,而不是中国人民”,然后有人说,“法国人民是好的,可恶的是政府”。如果真的这么想,就入了圈套了。看待一个国家,不要把政府和人民切割开来。没有“人民”这只老虎在后面撑腰,“政府”这个狐狸怎么敢肆意妄为?

政府是人民的政府,人民是政府的人民!侮辱政府,就是侮辱她的人民。而政府的错,就是她的人民的过错。只有这样想,政府和人民才会感受到切实的压力,才会有真正的进步。

Toggle ecb in emacs

,

不知道最新版是否已经可以使用一个键绑定来开关ecb,我的是一年前的版本,没有找到方法。最近写了一点点代码来做这件事:
(defun toggle-ecb-active()
  "Toggle ecb active and deactive"
  (interactive)
  (if ecb-minor-mode
      (ecb-deactivate)
    (ecb-activate))
  )

(global-set-key [f6] 'toggle-ecb-active)

微笑

走着走着
突然 张开手掌
风从手指的边缘划过
仿佛就触摸到流淌的 时间

紧一紧衣服

那些留在后面的脚印
转身 才能看见

MiniHex v1.2.0.5 release

MiniHex is a hex editor for Windows. It is small, portable, powerful, and easy to use.

It is designed to deal with huge file in Exbibyte+ size. With creative virtual file technology, it can insert, remove and modify data very fast.

MiniHex introduces Save workspace feature to save your work before you complete all editing. It keep your original file without changed so that you important file will never be corrupted.

It also provides you full control to colors and shotcuts.

Feel free to dowload the last version and try it right now!

CD sectors to MM:SS:FF

In CD disc, 1 second can play about 75 frames.
So, if we have a disc with 3,697,696 sectors, what MM:SS:FF is?
  1. How many frames?
    frames = sectors = 3,697,696
  2. How many interge seconds, and how many frames left?
    s = 3697696 / 75 = 49302
    f = 3697696 % 75 = 46
  3. Add two second lead in time
    s = 49304
  4. How many interge minutes, and how many seconds left?
    m = 49304 / 60 = 821
    s = 49304 % 60 = 44

MM:SS:FF = 821:44:46

Get rid of Notepad++ from my all PCs

虽然觉得notepad++是个还不错的软件,但是它的作者在其网站上表达的政治观点让我感到有点恶心。

wildcard search with source code (C language)

Using recursive procedure to deal with the wildcard search. It is too easy to comment.

#include <stdio.h>
#include <string.h>

//
// b_full means the whole string matching
//
bool WildSearch(char *psz_buf, int n_buflen, char *psz_sub, int n_sublen, bool b_full, char sz_prechar)
{
    if (n_buflen == 0 && n_sublen != 0)
    {
        if (n_sublen == 1 && psz_sub[0] == '*')
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    else if (n_buflen != 0 && n_sublen == 0)
    {
        if (b_full)
        {
            return false;
        }
        else
        {
            return true;
        }
    }
    else if (n_buflen == 0 && n_sublen == 0)
    {
        return true;
    }

    if (psz_sub[0] == '*')
    {
        psz_sub++;
        n_sublen--;
        if (n_sublen == 0)
        {
            return true;
        }
        return WildSearch(psz_buf, n_buflen, psz_sub, n_sublen, b_full, '*');
    }
    else if (psz_sub[0] == '?')
    {
        psz_buf++;
        n_buflen--;
        psz_sub++;
        n_sublen--;
        return WildSearch(psz_buf, n_buflen, psz_sub, n_sublen, b_full, '?');
    }
    else
    {
        char *psz_star_pos = strchr(psz_sub, '*');
        char *psz_question_pos = strchr(psz_sub, '?');
        int n_len_to_star = (psz_star_pos == NULL) ? (int)strlen(psz_sub) : (int)(psz_star_pos - psz_sub);
        int n_len_to_question = (psz_question_pos == NULL) ? (int)strlen(psz_sub) : (int)(psz_question_pos - psz_sub);

        int n_compare_len = n_len_to_question > n_len_to_star ? n_len_to_star : n_len_to_question;
        if (_strnicmp(psz_buf, psz_sub, n_compare_len) == 0)
        //if (psz_buf[0] == psz_sub[0])
        {
            sz_prechar = psz_sub[0];
            psz_buf++;
            n_buflen--;
            psz_sub++;
            n_sublen--;
            return WildSearch(psz_buf, n_buflen, psz_sub, n_sublen, b_full, sz_prechar);
        }
        else
        {
            if (sz_prechar != '*')
            {
                return false;
            }
            psz_buf++;
            n_buflen--;
            return WildSearch(psz_buf, n_buflen, psz_sub, n_sublen, b_full, sz_prechar);
        }
    }
    return true;
}

int main(int argc, char** argv)
{
    char sz_buf[] = "abcdefghijk";
    char sz_sub[] = "abc?e*fg?i?*k*";
    //char sz_sub[] = "ae";

    bool b_result = WildSearch(sz_buf, (int)strlen(sz_buf), sz_sub, (int)strlen(sz_sub), false, ' ');

    printf("%d\n", b_result);

return 0;
}

minirun

, ,

采用主程序和配置程序分离的设计。让运行程序更小巧。包含主程序minirun.exe, tool_add.exe和tool_setting.exe。

minirun是快速启动程序的小工具。
通过预定义的快捷键scroll lock,启动minirun界面。
输入程序路径或别名即可启动程序,无需在快捷方式堆或浏览器中寻找。
输入时会自动匹配别名并自动完成。
TAB键可在匹配的多个别名中进行切换。

tool_add是minirun的辅助工具,用于收集程序并生成配置文件。
启动后选择搜索目录,点击‘add all’,会添加该目录下(包括子目录)所有的可执行文件,并自动创建别名。

tool_setting是配置工具。可以设置呼出主窗口的快捷键和选择语言,设置主窗口颜色等。

minirun.zip

Enable vista style for common controls

, ,

In visual studio 2005, they are several ways to enable it, but all are related to manifest file.
  1. Create a manifest manually with following codes, and input its path to the 'project setting'->'Manifest tool'->'Input and output'->'Additional manifest files':
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <dependency>
        <dependentAssembly>
            <assemblyIdentity
                type="win32"
                name="Microsoft.Windows.Common-Controls"
                version="6.0.0.0"
                processorArchitecture="X86"
                publicKeyToken="6595b64144ccf1df"
                language="*"
            />
        </dependentAssembly>
    </dependency>
    </assembly>

  2. Put the following code in the source file:
    #pragma comment(linker, "\"/manifestdependency:type='Win32' name='Test.Research.SampleAssembly' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='0000000000000000' language='*'\"")
    

  3. Put the following code to 'project setting'->'liker'->'Manifest file'->'Additional Manifest Dependencies':
    "name='Microsoft.Windows.Common-Controls' processorArchitecture='x86' version='6.0.0.0' type='win32' publicKeyToken='6595b64144ccf1df'"
    


All in all, DO NOT put the following codes into 'project setting'->'Manifest tool'->'General'->'Assembly Identity':
Microsoft.Windows.Common-Controls, processorArchitecture=x86, version=6.0.0.0, type=win32, publicKeyToken=6595b64144ccf1df