Archive for the ‘Python’ Category

PL/Proxy和PostgreSQL集群的结构关系可以用下图清楚地表示 以下操作是在三台不同机器上执行的情况,其中plproxy节点的机器名是P1,数据库节点的机器名分别是D1和D2。机器硬件配置如下,同时需要Linux-4.2、postgresql-8.3.0和plproxy-2.0.4,pgbouncer的安装过程略去。 plproxy节点: hostname: P1 inet addr:10.0.0.1 OS: Linux 2.6.9-42.ELsmp CPU:Intel(R) Xeon(R) CPU L5320 @ 1.86GHz MemTotal: 514440 kB node1节点: hostname:D1 inet addr:10.0.0.2 OS: Linux 2.6.9-42.ELsmp CPU:Intel(R) Xeon(R) CPU L5320 @ 1.86GHz MemTotal: 254772 kB node2节点: hostname:D2 inet addr:10.0.0.3 OS: Linux 2.6.9-42.ELsmp CPU:Intel(R) Xeon(R) CPU L5320 @ 1.86GHz MemTotal: 254772 kB 1. 在P1, D1,D2上安装postgresql-8.3.0,并创建URTCluster数据库 ## Compile and install gunzip postgre.......

More>>


Python基本安装: http://www.python.org/ 官方标准Python开发包和支持环境,同时也是Python的官方网站; http://www.activestate.com/ 集成多个有用插件的强大非官方版本,特别是针对Windows环境有不少改进; Python文档: http://www.python.org/doc/current/lib/lib.html Python库参考手册。 http://www.byteofpython.info/ 可以代替Tutorial使用,有中文译版的入门书籍。 http://diveintopython.org/ 一本比较全面易懂的入门书,中文版翻译最近进步为很及时的5.4了。 http://www.python.org/peps/pep-0008.html 建议采用的Python编码风格。 http://doc.zoomquiet.org/ 包括Python内容的一个挺全面的文档集。 常用插件: http://www.pfdubois.com/numpy/ Python的数学运算库,有时候一些别的库也会调用里面的一些功能,比如数组什么的; http://www.pythonware.com/products/pil/ Python下著名.......

More>>


Python中如果要使用线程的话,python的lib中提供了两种方式。一种是函数式,一种是用类来包装的线程对象。举两个简单的例子希望起到抛砖引玉的作用,关于多线程编程的其他知识例如互斥、信号量、临界区等请参考python的文档及相关资料。 1、调用thread模块中的start_new_thread()函数来产生新的线程,请看代码: python 代码 ###        thread_example.py import time import thread def timer(no,interval): #自己写的线程函数 while True: print ‘Thread :(%d) Time:%s’%(no,time.ctime()) time.sleep(interval) def test(): #使用thread.start_new_thread()来产生2个新的线程 thread.start_new_thread(timer,(1,1)) thread.start_new_thread(timer,(2,3)) if __name__==’__main__‘: test() 这个是thread.start_new_thread(function,arg.......

More>>


Hello, Beta 3 of plPHP has been released with full trigger support for PostgreSQL. PL/PHP - PHP Procedural Language Copyright 2003 Command Prompt, Inc. http://www.commandprompt.com/ +1 503 222 2783 info@commandprompt.com 1. PL/PHP language installation notes 2. PL/PHP functions and arguments 3. Data values in PL/PHP 4. Database Access from PL/PHP 5. Trigger Procedures in PL/PHP 6. Trusted and Untrusted PL/PHP 7. PL/PHP Procedure Names 8. Missing features PL/PHP is a loadable procedural language that enables you to write PostgreSQL functions in the PHP programming language. 1. PL/PHP language installation notes To install PL/PHP language Postgres DBA should have compiled shared library plphp.so i.......

More>>


pyPgSQL是PostgreSql数据库的python语言接口,其实现符合Python DB-API 2.0规范。大名鼎鼎的python网络框架twisted的企业级特性,如连接池、异步连接等就使用pyPgSQL支持PostgreSql数据库。 最近在使用Windows系统下的Python2.5,却发现pyPgSQL官方编译好的for win32的安装包只支持到Python2.4,网上也没找到编译好的安装包下载,只好自己动手编译。 在pyPgSQL官网下载了pyPgSQL-2.5.1的源代码,有在win32下的安装说明,支持VC++和MingW。VC要¥的,这里感谢开源的MingW(Minimalistic GNU for Windows)。 得益于那个setup.py,编译过程还是比较简单的。首 先,安装MingW编译环境,在http://www.mingw.org/下载binutils,gcc-core,gcc-g++,mingw32- make,mingw-runtime,mingw-utils,w32api等包,解压缩到同一目录即可;接下来设定环境变量: PATH - 把bin目录加入现有PATH LIBRARY_PATH - l.......

More>>


Python 3.0 beta 1 在跳票了很短的一段时间后,在 6 月 18 号发布了,其实北京时间应该是 19 号了(下载:http://www.python.org/download/releases/3.0/)。因为是第一个 beta 版本,所以从 what’s new 上可以看出做了很多更改,跟之前的 alpha 版本有较大的不同。最大的特点在于完全依照了更简洁、更统一的精神,修正了许多原有版本中遗留下来的缺陷。 win9x 算是走到了尽头了,py3.0 b1 已经去除了 winsound 模块对 win9x 的支持。除此之外,b1 版本修正了几十个 bugs。另外,值得一提的是生成器有了 gen.__name__ 属性,就像函数的 func.__name__ 属性一样,enumerate() 多了一个 start 参考,显然,这有一定的需要。 beta 1 的特色之一是许多标准模块以包的形式组织:比如 urllib 包,它包括了原来 urllib、urllib2、urlparse、robotparse等模块的内容;另外是多了一个 http 包,原来的 httplib 变.......

More>>