Ming

Declare model before create connection in ming

大城市里の小女人 提交于 2019-12-23 03:48:08
问题 I want delcare my models before make connection with database (for some reason like multi-threading, and dynamic load of database config uri). Documentation say to use like that: from ming import create_datastore from ming.odm import ThreadLocalODMSession from ming import schema from ming.odm import FieldProperty from ming.odm.declarative import MappedClass session = ThreadLocalODMSession( bind=create_datastore('odm_welcome') ) class WikiPage(MappedClass): class __mongometa__: session =

WSGI post-process cleanup

放肆的年华 提交于 2019-12-13 05:59:19
问题 I'm running a TurboGears app with mod_wsgi and apache, using pymongo wrapped with Ming for persistence. To failproof and scale my app I was interested in using mongo's support for replica sets through a pymongo ReplicaSetConnection. However, as specified in the above links, one must call close() when done with every pymongo ReplicaSetConnection object, otherwise it will leave a bunch of zombie processes floating around (wtf pymongo). This sort of behavior isn't supported very well in Ming (it

_BitScanForward64 returns wrong answer in c++.exe (rubenvb-4.7.2-release)

Deadly 提交于 2019-12-10 20:44:58
问题 Long time MSVC user, new to gcc (so bear with me). I am using the rubenvb version of c++ (see version in subject, yes I'm building for 64bit) on Windows 7 and I'm having a problem using _BitScanForward64. Some sample code looks like this: int __cdecl main(int argc, char* argv[]) { DWORD d = (DWORD)atoi(argv[1]); DWORD ix, ix2; ix2 = _BitScanForward64(&ix, d); printf("bsf %u %u\n", ix, ix2); } I am compiling with: "C:\Program Files\gcc2\mingw64\bin\c++.exe" -o iTot.exe -mno-ms-bitfields -march

【0917】Linux shell基础知识2

一个人想着一个人 提交于 2019-11-29 23:49:09
【0917】Linux shell基础知识2 8.7/8.8 shell变量 8.9 环境变量配置文件 8.10 shell特殊符号cut命令 8.11 sort_wc_uniq命令 8.12 tee_tr_split命令 8.13 shell特殊符号 一、shell变量 1、使用env获取系统常用环境变量(名称通常为大写的英文字母) 2、set不仅查看系统环境变量,也可查看用户自定的环境变量 3变量名规则 字母、数字下划线,首位不能为数字:ming_05 4、变量的值有特殊符号需要用单引号:a=‘a b c’ 5、变量的累加 6、全局变量 查看当前登录的终端。 使用pstree查看当前bash 设置全局环境变量时,先输入export 设置全局变量,则该bash下所有子bash都能使用该变量 7、unset + 变量名 取消变量 二、环境变量配置文件 1、两大维度:系统层次(etc),用户层次(~) 2、profile 用户登录时自动加载,bashrc执行脚本是,用户不需要登录,就会自动调用bashrc中的脚本。 3、bash_logout 用来定义用户退出时执行的操作,例如每次用户退出都要删除命令历史,将该命令放到bash_logout即可。 4、PS1变量设置,可设置登录时用户、主机名、当前目录的颜色、括号调整等。 三、shell特殊符-cut命令 1、特殊符号 (1)*