PostgreSQL Debian 安装
postgres 有官方提供的源 https://www.postgresql.org/download/linux/debian/。以 Debian 7 为例,在 /etc/apt/source.list 文件中添加
deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main
安装
aptitude install postgresql
aptitude …装饰符函数的传入变量为:使用装饰符的函数(目标函数)。其本质是:在调用目标函数之前,插入调用装饰符函数,然后由装饰 …
代码
import datetime, calendar, time
def timestamp2datetime(timestamp):
    return datetime.datetime.fromtimestamp(timestamp)
def date2timestamp(date):
    """local time"""
    return calendar.timegm(date.timetuple())
def date2timestamp_utc(date):
    """utc time"""
    return int(time.mktime(date.timetuple()))
def datetime2timestamp(year, month, day):
    return calendar.timegm(datetime.datetime(year, month, day).timetuple())
def …查找比对的时候是数值类型,性能还是很不错的
from collections import namedtuple
def MakeEnum(enumList):
    return namedtuple('Enum', enumList)._make(range(len(enumList)))
USER_AT = MakeEnum(['noLogined', 'logined', 'hall', 'room'])
print USER_AT, type(USER_AT)
print USER_AT.noLogined, type(USER_AT …#!/usr/bin/env python
#coding=utf-8
#----------------------------------------------------------------------
def obj2map(obj):
    """"""
    return vars(obj)
########################################################################
class obj:
    def __init__(self):
        self.a = 1
        self.b = 2
########################################################################
class map2struct:
    def __init__(self, **entries):
        self.__dict__.update(entries)
o = obj()
print '~~~~~~~~~~~~~~ obj -> map ~~~~~~~~~~~~~~'
m = vars(o)
print type(m), m
print '~~~~~~~~~~~~~~ map -> obj ~~~~~~~~~~~~~~'
o2 = map2struct …当前 Debian V7.6 内置的 mongodb 未 v2.4 版本, v2.6 有一个很不错的 Aggregation Pipeline 特性。如果想使用 Debian 自己的包管理仓库就需要使用 backports 机制使 …
安装 apache 的 svn 支持
aptitude install libapache2-svn
svn.apache.conf 配置文件内容
<Location /svnroot>
  DAV svn
  SVNParentPath /home/rex/svnroot
  # Authentication: Basic
  AuthName "Subversion repository"
  AuthType Basic
  AuthBasicProvider file
  AuthUserFile /home/rex/trac.htpasswd
  # Authorization: Authenticated users only
  Require valid-user
  # Authorization: Path-based access …virtualbox 4.3.10 用 Mac OSX 做宿主 Linux 做客户机时无法装载共享文件夹,提示如下
mount: wrong fs type, bad option, bad superblock on hunterServer,
       missing codepage or helper program, or other error
       (for several filesystems …获得符号表的方法
nm libfoo.so
演示工程目录结构
~/projectRoot
    bin
        libfoo.so
    script
        build.sh
    src
        libfoogo
            libforgo.go
        libfoogo_test
            main.go
构建脚本 build.sh
#!/bin/bash
cd ../bin
export GOPATH=~/projectRoot
go build libfoogo_test
cd …很多时候用 Python 写的小工具需要打包成一个可执行文件交给使用者,比如:
- 使用者没有安装 Python 或者第三方库环境
- 为了便于 …
