Monday, September 19, 2011

How to highlight #if 0 in emacs

In vim, the editor can highlight the #if 0 ... #endif block, which emacs lacks. I did some digs in the web, and find a solution, with some slight modifications.
Here are the Original Post.
Just add the below code snippet to your ~/.emacs:
(defun my-cpp-highlight ()
  "highlight c/c++ #if 0 #endif macros"
  ;; (interactive)
  (setq cpp-known-face 'default)
  (setq cpp-unknown-face 'default)
  (setq cpp-known-writable 't)
  (setq cpp-unknown-writable 't)
  (setq cpp-edit-list '(("0" font-lock-comment-face default both)
                        ("1" default font-lock-comment-face both)))
  (cpp-highlight-buffer t))

(add-hook 'c-mode-common-hook 'my-cpp-highlight)

And your emacs will highlight the #if 0 ... #endif block for you.:)

Monday, October 18, 2010

SunPinyin、Novel Pinyin和iBus-Pinyin展开全面合作

SunPinyin、Novel Pinyin和iBus-Pinyin社区决定长期合作,联手创建libpinyin子项目。libpinyin致力于为中文拼音输入法提供智能整句输入的算法核心,将试图合并novel-pinyin和sunpinyin中的智能拼音整句输入算法部分,争取实现目前SunPinyin和Novel Pinyin的功能超集。

在不久的将来,libpinyin将为ibus-pinyin和sunpinyin提供智能拼音整句输入功能的支持。

Project Wiki: http://github.com/libpinyin/libpinyin/wiki
Project SCM: http://github.com/libpinyin/libpinyin
Mailing List: http://groups.google.com/group/libpinyin

另见SunPinyin的官方声明:http://yongsun.me

Tuesday, June 29, 2010

novel-pinyin 0.2.5 released.

Here are the new change log for novel-pinyin:
* Fixes train factor.
* Fixes file open/close bug in utils.
* Fixes a bug in winner tree,
which may potentially lower the correct rate.

And this package is uploaded to sourceforge today.
The source control system for novel-pinyin has been switched from CVS to SVN. If you want to check out the newest code, please use the new SVN repository.

Friday, November 20, 2009

博客网址镜像

由于blogger.com被GFW防火墙屏蔽掉了,为了方便大家访问,novel-pinyin的blog已经被镜像到了sourceforge的WordPress上。
同时新申请了一个mailing list (novel-pinyin-devel@lists.sourceforge.net)专为 novel-pinyin 开发和讨论使用。
本人博客的最新内容请见http://alex-epico.blogspot.com/
由此引起的不便,敬请谅解,谢谢。

Monday, July 06, 2009

How to prepare a Mozilla Building and Debuging Environment.

The following information is about Firefox 3.0 and mozilla-xulrunner 1.9.0 on SUSE Linux. Please following the steps below:

  1. Grab MozillaFirefox 3.0.x and mozilla-xulrunner 1.9.0.x packages, and extract their contents to directory MozillaFirefox and mozilla-xulrunner190.
  2. Use quilt to apply patches to mozilla-xulrunner190:

    1. use quilt -v setup mozilla-xulrunner190.spec to setup the xulrunner 1.9.0 source tree.
    2. change directory to mozilla-xulrunner190/mozilla, using quilt push -a, to apply all xulrunner 1.9.0 patches.
    3. use quilt import to import all patches in MozillaFirefox packages, as we put Firefox patches in two seperate packages containing different patches.

  3. Put a mozconfig in directory mozilla-xulrunner190/mozilla, contains the following informations:

    . $topsrcdir/browser/config/mozconfig
    mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-debug
    ac_add_options --enable-debug
    ac_add_options --disable-optimize

  4. Type the command "make -f client.mk build" in directory mozilla-xulrunner190/mozilla.
  5. Wait for compiling finished, go to directory objdir-ff-debug/dist/bin, using "./firefox" to run the built Firefox 3.0.

In SUSE Mozilla Team now.

Since February 2009, I was transfered from i18n team to Mozilla team in Novell.
Although it is a tough task, but it is also interesting to me.

Recent months I am very busy, thanks for the help from Wolfgang. Later maybe I can spend more time on making patches. :)

As I spend lots of time about how to debug Firefox bugs on SUSE Linux. I will write some series of articles to ease others to join developing Mozilla Firefox on SUSE Linux.

Sunday, March 08, 2009

Make Intel 82845G/GL/GE card 3D Acceleration work on openSUSE 11.1.

This weekend I decided to update my home PC from openSUSE 10.2 to openSUSE 11.1.
After finishing the update, when X server starts, the OS stuck.
Re-configure my card using sax2, got vesa driver, without any 3D acceleration.

Using my card vendor id and device id searching on google, found a bug on launchpad, and it recommended to add this to xorg.conf in device section:
Option "NoAccel" "true" # works around LPB 304871 - probably disables the next two.

And the driver prints "failed to init memory manager", using git clone to get intel driver code, find the message in code:
if (!xf86InitFBManager(pScreen, &(pI810->FbMemBox))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to init memory manager\n");
return FALSE;
}

And google xf86InitFBManager, found it was related to XAA. Reading man intel, find:
Option "AccelMethod" "string"
Choose acceleration architecture, either "XAA" or "EXA".
So I tried to remove "NoAccel", and add the following line to xorg.conf:
Option "AccelMethod" "XAA".

Last more than 20 changes to xorg.conf, failed to start Xserver, but for this time, the Xserver starts normally, and running glxgears, the performance is the same as before.
Oh, I got the 3D acceleration back again.

After the Xserver is OK, I checked the src/i810_driver.c file again. I found that it doesn't include exa.h. So it seems not support EXA, but by default, the EXA is chosen instead of XAA, so this is the cause of the problem.

PS: my card id:
Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device [8086:2562] (rev 01)

Switch Editor from Vim to Emacs.

Recently I begin to maintain a new project in SUSE Linux, glad to return the C++ world. The new project is tough, but more challenging, so the last month is very busy.

On Feb 10, I am trying to switch editor to emacs. In the past, I use emacs for my own project, and use vim to make patches for SUSE Linux. But I still feel uncomfortable on mode editor like vim, already get used to mode-less editor. But I didn't know how to use emacs to browse function definitions in large projects before, finally I settled this.

First, turn cua-mode on, by which you can use Ctrl-X, Ctrl-C, Ctrl-V, for cut, copy, paste, and Ctrl-Z for undo.

Then use ctags or etags to generate TAGS files.
And enable emacs to browse multiple function definitions in C++ by using etags-select.el.
Here are the URL:
http://www.emacswiki.org/emacs/EtagsSelect.

Now browsing C++ code is easy, but the code completion still does not work. It doesn't matter I don't rely on code completion much now.

PS: command examples for generating TAGS file.
$ctags -eR .
or
$find \( -name '*.h' -or -name '*.cpp' \) -print | etags -

Monday, August 25, 2008

Sorry, for the bugs of novel-pinyin 0.2.3 release.

As the first release of 0.2.x series, I put the novel-pinyin on sourceforge. But later I withdraw the package, because some serious bug has been found.
During the Beijing Olympics, I finally released the novel-pinyin 0.2.3 package.
Thank lyman for feedbacking the bug in initializing code.
As novel-pinyin has been released, the fix code is relatively small, so I decide to release the fix as a seperate patch.
using the following command in novel-pinyin-0.2.3 directory:
patch -p2 < ../../urgent-patch-fix-novel-pinyin-first-load.patch

PS:
顺便提一句,输入法的中文名称变为了新智能拼音,英文名称为Novel Pinyin不变。