云舒云卷

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

Subscribe to RSS feed

Sticky post

DesktopAngel

,

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

Read more...

Days and date

Wrote an application for my hero mobile phone to calculate the days between two dates. It is my first application for android system.

Download link: DaysAndDate.apk

醉死梦生

烈士追随公仆去
小姐簇拥二奶来

政府是人民的政府

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

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

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;
}
February 2012
S M T W T F S
January 2012March 2012
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29