8/30/2007

InnoDB supports Foreign keys im MySQL

But MyISAM won't support

8/28/2007

cast types in Postgre sql

cast(field as numeric)

8/23/2007

两个unicode strings相加竟然会出错

a = '每' [a' = unichr(255) then a'.encode('utf-8') == '每']
b = u'completed'
c = '%s %s' % (a, b) 或 c = a + b竟然会出现错误 UnicodeDecodeError,不知道是什么原因
原来python 试图把str转化为unicode, 这时候str 为 '每',是不可能用ascii来表示的,所以出现decode error.

8/17/2007

Function tips, calltip in scite

让SciTE能够和IDE一样进行成员提示


今天发现SciTE可以和IDE一样在输入"."之后显示系统API的成员.本文最后的英文介绍了怎样生成供SciTE使用的API文件.当然你也可以下载别人生成的API.我一般用SciTE编写Python代码,那么我就用怎么使用python.api为例来介绍.首先下载下面的生成python API的脚本,双击运行,运行完成之后会生成一个python.api的文件,将python.api拷贝到scite的目录中,然后在SciTE的选项菜单中选择User Options,将打开一个用户个人设置文件,然后将下面的代码拷贝到里面
api.*.py=$(SciteDefaultHome)/python.api
api.*.pyw=$(SciteDefaultHome)/python.api
autocomplete.choose.single=1
autocomplete.python.ignorecase=1
autocomplete.python.start.characters=.
autocomplete.python.fillups=(
#autocompleteword.automatic
calltip.python.ignorecase=1
calltip.python.word.characters=._$(chars.alpha)$(chars.numeric)

保存后重新打开SciTE就行了,另外这个用户配置文件一般在你个人主目录里面.可以看看我的效果.在这里可以下载C/C++ Windows API,Opengl API, java的API,以及其他很多语言的API文件.

The .api files can be generated by hand or by using a program. There are also downloadable ready-to-use .api files.

For C/C++ headers, an API file can be generated using ctags and then the tags2api Python script (which assumes C/C++ source) on the tags file to grab complete multiple line function prototypes. Some common headers surround parameter lists with a __P macro and may have comments. The cleanapi utility may be used on these files.

To generate an API file for Python modules, there is a gen_python script.

To generate an API file for Java classes, there is a ApiBuilder.java program.