自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(65)
  • 资源 (4)
  • 收藏
  • 关注

转载 线程安全及Python中的GIL

线程安全及Python中的GIL 本博客所有内容采用 Creative Commons Licenses 许可使用. 引用本内容时,请保留 朱涛, 出处 ,并且 非商业 . 点击 订阅 来订阅本博客.(推荐使用 google reader, 如果你的浏览器不支持直接订阅,请直接在 google reader 中手动添加). 抱歉,在正文中加入很多本博客的链接,主要是发现很多转载的朋友并未

2012-10-18 14:26:52 703

转载 python中_get_getattr_getattribute_的差别

python中__get__,__getattr__,__getattribute__的区别 __get__,__getattr__和__getattribute都是访问属性的方法,但不太相同。 object.__getattr__(self, name) 当一般位置找不到attribute的时候,会调用getattr,返回一个值或AttributeError异常。 object.__

2012-10-09 13:34:58 2050 1

转载 nc指令用法

一、版本 通常的Linux发行版中都带有NetCat(简称nc),甚至在拯救模式光盘中也由busybox提供了 简版的nc工具。但不同的版本,其参数的使用略有差异。 NetCat 官方地址:http://netcat.sourceforge.net/ 引用 [root@hatest1 ~]# cat /etc/asianux-release Asianux release 2.0

2012-06-19 17:25:09 1368

nc指令用法

一、版本 通常的Linux发行版中都带有NetCat(简称nc),甚至在拯救模式光盘中也由busybox提供了 简版的nc工具。但不同的版本,其参数的使用 略有差异。 NetCat 官方地址: http://netcat.sourceforge.net/ 引用 [root@hatest1 ~]# cat /etc/asianux-release Asi...

2012-06-19 17:25:00 417

转载 利用shell命令操作Memcached

原文链接:http://blog.s135.com/post/384/] 首先,需要了解Memcached协议,如果不清楚可参考《Memcached 协议中英文对照》。   1、数据存储(假设key为zhangyan,value为12345) printf "set zhangyan 0 0 5\r\n12345\r\n" | nc 127.0.0.1 11211  STORE

2012-06-19 17:17:28 754

利用shell命令操作Memcached

原文链接:http://blog.s135.com/post/384/ ] 首先,需要了解Memcached协议,如果不清楚可参考《Memcached 协议中英文对照 》。   1、数据存储(假设key为zhangyan,value为12345) printf "set zhangyan 0 0 5\r\n12345\r\n" | nc 127.0.0.1 11211 ...

2012-06-19 17:17:00 95

原创 RMI Load Balancing , Failover and High-Availability

最近我发布了一个在客户端实现RMI 负载均衡和支持故障转移的项目;地址在: http://code.google.com/p/rmi-lb-client/ 你可以用如下的方式使用它: JAVA: List serviceUrls = new ArrayList(); serviceUrls.add("rmi://localhost:8098/CalculatorRMIService

2012-06-07 16:41:54 1288 1

RMI Load Balancing , Failover and High-Availability

最近我发布了一个在客户端实现RMI 负载均衡和支持故障转移的项目;地址在: http://code.google.com/p/rmi-lb-client/ 你可以用如下的方式使用它: JAVA:   List<String> serviceUrls = new ArrayList<String>(); serviceUrls.add("rmi://loc...

2012-06-07 16:41:00 75

转载 date 命令的使用

date命令    date命令的功能是显示和设置系统日期和时间。    该命令的一般格式为: date [选项] 显示时间格式(以+开头,后面接格式)    date 设置时间格式    命令中各选项的含义分别为:    -d datestr, --date datestr 显示由datestr描述的日期    -s datestr, --set datestr 设置datestr

2012-05-16 14:57:04 584

date 命令的使用

date命令   date命令的功能是显示和设置系统日期和时间。   该命令的一般格式为:date[选项]显示时间格式(以+开头,后面接格式)   date设置时间格式   命令中各选项的含义分别为:   -ddatestr,--datedatestr显示由datestr描述的日期   -sdatestr,--setdatestr设置datestr描述的日期   -u,--unive...

2012-05-16 14:57:00 146

原创 Thundering Herd Mitigation (memcached redis)

"Modified memcached cache backend" import time from threading import local from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError from django.utils.hashcompat import sha_co

2012-04-25 16:38:12 775

Thundering Herd Mitigation (memcached redis)

"Modified memcached cache backend" import time from threading import local from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError from django.utils.hashcompat import sha_c...

2012-04-25 16:38:00 131

转载 python __getattribute__ 的优先级问题

The way__getattribute__() works needs to be covered, as it was implemented to behave in a very specific way. Thus it is very important to recognize this ordering: Class attributes Data descrip

2011-10-26 14:54:28 2486

python __getattribute__ 的优先级问题

The way __getattribute__() works needs to be covered, as it was implemented to behave in a very specific way. Thus it is very important to recognize this ordering: Class attributes D...

2011-10-26 14:54:00 178

原创 python 算法

http://code.activestate.com/recipes/577573-compare-algorithms-for-heapqsmallest/?in=user-178123

2011-10-21 17:14:10 612

python 算法

http://code.activestate.com/recipes/577573-compare-algorithms-for-heapqsmallest/?in=user-178123

2011-10-21 17:14:00 83

原创 python 常用类库

1.blist http://pypi.python.org/pypi/blist/ The blist is a drop-in replacement for the Python list the providesbetter performance when modifying large lists. The blist package alsoprovides sortedlist

2011-10-21 15:21:30 735

原创 一致性hash 原理与实现 (Consistent hashing implemented)

1.背景介绍 memcached的分布式 memcached虽然称为“分布式”缓存服务器,但服务器端并没有“分布式”功能。服务器端内存存储功能,其实现非常简单。至于memcached的分布式,则是完全由客户端程序库实现的。这种分布式是memcached的最大特点。分布的原则是由client端的api来决定的,api根据存储用的key以及已知的服务器列表,根据key的hash计算将指定的

2011-10-21 14:50:38 1310

一致性hash 原理与实现 (Consistent hashing implemented)

1.背景介绍 memcached的分布式   memcached虽然称为“分布式”缓存服务器,但服务器端并没有“分布式”功能。服务器端内存存储功能,其实现非常简单。至于memcached的分布式,则是完全由客户端程序库实现的。这种分布式是memcached的最大特点。分布的原则是由client端的api来决定的,api根据存储用的key以及已知的服务器列表,根据key的hash计算将指定...

2011-10-21 14:50:00 130

转载 How-To Guide for Descriptors

How-To Guide for Descriptors Author:  Raymond Hettinger Contact:  Copyright:  Copyright (c) 2003, 2004 Python Software Foundation.All rights reserved. Contents Abstr

2011-10-20 11:07:05 617

How-To Guide for Descriptors

How-To Guide for Descriptors Author: Raymond Hettinger Contact: <python at rcn dot com> Copyright: Copyright (c) 2003, 2004 Python Software Foundation.All rights reserved. ...

2011-10-20 11:07:00 127

原创 centos 编译安装时软件时,出错处理

1.configure: error: C++ preprocessor “/lib/cpp” fails sanity check See `config.log’ for more details 解决方式:#yum install glibc-headers   gcc-c++

2011-10-20 11:05:17 561

centos 编译安装时软件时,出错处理

1.configure: error: C++ preprocessor “/lib/cpp” fails sanity check See `config.log’ for more details 解决方式:#yum install glibc-headers gcc-c++  

2011-10-20 11:05:00 170

原创 python mysql 分页程序

#!/usr/bin/env python # -*- coding: utf-8 -*- #author:djangofan@163.com import MySQLdb import os import hashlib #DB parameter

2011-10-09 16:00:04 3741

python mysql 分页程序

#!/usr/bin/env python # -*- coding: utf-8 -*- #author:djangofan@163.comimport MySQLdb import os import hashlib #DB parameter strHost = 'localhost' strDB = 'bigo_db' strUser = 'root' strPas...

2011-10-09 16:00:00 365

原创 python lib 之 operator

operator module在使用内置函数如map,itertools.groupby,sorted排序使用DSU技巧时,经常用到;这里面最经常用到的两个函数是:operator.attrgetter(attr[, args...])这个函数返回一个可调用对象(Callable Objects),取此对象的attr属性值;如果参数是多个属性,则返回的是属性值tuple.例如:f=attrgetter('name'), 则 f(b) 返回的是 b.name.  f=attrgetter('name','da

2011-05-06 16:29:00 1246

python lib 之 operator

operator module在使用内置函数如map,itertools.groupby,sorted排序使用DSU技巧时,经常用到;这里面最经常用到的两个函数是: operator. attrgetter ( attr [ , args... ] ) 这个函数返回一个可调用对象(Callable Objects),取此对象的attr属性值;如果参数是多个属性,则...

2011-05-06 16:29:00 100

原创 MySQLdb for python 安装

<br />升级到了python2.7.1,没有吸取以前的教训,再一次的跌倒在这个上面,浪费了半个小时;<br />标准解决方案:<br />http://www.codegood.com/downloads去这里下载老外编译好的版本,直接安装,别费劲了;<br /> <br />如果有试图编译安装的,你可以会先遇到:<br />D:/MySQL-python-1.2.3/setup_windows.py", line 7, in get_config<br />    serverKey = _winre

2011-04-23 14:12:00 1106

MySQLdb for python 安装

升级到了python2.7.1,没有吸取以前的教训,再一次的跌倒在这个上面,浪费了半个小时; 标准解决方案: http://www.codegood.com/downloads 去这里下载老外编译好的版本,直接安装,别费劲了;   如果有试图编译安装的,你可以会先遇到: D:/MySQL-python-1.2.3/setup_windows.py", line 7, in get_...

2011-04-23 14:12:00 83

原创 centos 编译安装glib

下载最新的glib.2.28.2./configure --prefix=/usrmake clean && make && make install(1)遇到问题make的时候 缺少 magic.h头文件;这个头文件在centos的/usr/include/linux/里确实没有,我把http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/include/linux/magic.h这个,直接拷贝到/usr/include/linux/下,顺利通过;(2)make的时

2011-03-11 14:52:00 3728 1

centos 编译安装glib

下载最新的glib.2.28.2 ./configure --prefix=/usr make clean &amp;&amp; make &amp;&amp; make install   (1)遇到问题 make的时候 缺少 magic.h头文件;这个头文件在centos的/usr/include/linux/里确实没有,我把http://tomoyo.sourceforge.jp/...

2011-03-11 14:52:00 410

原创 Maven 使用问题解决 一

在使用maven中出现了两个问题:1.指定源文件编码,避免插件输出乱码问题http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding这个地址有详细的说明;Adding this element to the POM structure can only happen in Maven 3.x (tracked with MNG-2216 issue): ... UTF-8 ...

2010-08-19 13:17:00 886

Maven 使用问题解决 一

在使用maven中出现了两个问题: 1.指定源文件编码,避免插件输出乱码问题 http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding这个地址有详细的说明; Adding this element to the POM structure can only happen in Maven 3...

2010-08-19 13:17:00 103

转载 CentOS5.4上将Python版本升级到2.6.5

CentOS5.4上将Python版本升级到2.6.5 1.  背景       CentOS5.4自带的Python版本是2.4.3,但是目前许多基于Python的应用软件要求的Python版本应要高于2.4。(如Robot Framework2.5要求Python版本至少是2.5) 2.  目标      将CentOS自带的Python由2.4.3版本升级到2.6.5版本。

2010-08-12 16:07:00 633

CentOS5.4上将Python版本升级到2.6.5

CentOS5.4上将Python版本升级到2.6.5 1. 背景 CentOS5.4自带的Python版本是2.4.3,但是目前许多基于Python的应用软件要求的Python版本应要高于2.4。(如Robot Framework2.5要求Python版本至少是2.5) 2. 目标 将CentOS自带的Python由2.4.3版本升级到2.6.5版本。 3. ...

2010-08-12 16:07:00 98

转载 解决 2003 Can’t connect to MySQL server on ‘localhost’ (10048) 2003 Can’t connect to MySQL server on ‘localhost’ (10048)

解决 2003 Can’t connect to MySQL server on ‘localhost’ (10048)<br /> 2003 <br /> Can’t connect to MySQL server on ‘localhost’ (10048)<br /> 一般见于使用mysql 的windows 2003服务器.<br /> 错误的出现的原因:<br /><br /> 第一种原因:<br /> 应用程序需要快速释放和创建新连接, 但是由于 TIME_WAIT 中存在的连接

2010-08-06 16:55:00 2364

解决 2003 Can’t connect to MySQL server on ‘localhost’ (10048) 2003 Can’t connect to MySQL server on ‘...

解决 2003 Can’t connect to MySQL server on ‘localhost’ (10048) 2003 Can’t connect to MySQL server on ‘localhost’ (10048) 一般见于使用mysql 的windows 2003服务器. 错误的出现的原因: 第一种原因: 应用程序需要快速释放和创建新连接, 但...

2010-08-06 16:55:00 353

原创 RedHat Enterprise Linux 5 .3 64 位上安装oracle client

1.首先要确定linux是 32bit还是 64bit; 可以执行:file /sbin/init 或者lsb_release -a都可以看到; 2.下载版本 10201_client_linux_x86_64.cpio.gz 下载后执行 gunzip  10201_client_linux_x86_64.cpio.gz  cpio -idcmv 10201_client_linux_

2010-06-24 16:23:00 1958 2

RedHat Enterprise Linux 5 .3 64 位上安装oracle client

1.首先要确定linux是 32bit还是 64bit; 可以执行:file /sbin/init 或者lsb_release -a都可以看到; 2.下载版本 10201_client_linux_x86_64.cpio.gz 下载后执行 gunzip 10201_client_linux_x86_64.cpio.gz cpio -idcmv &lt; 10201_cli...

2010-06-24 16:23:00 86

原创 有道难题 之 有道搜索框 java实现

这个题目是5.29号第一场的第二题,先说句题外话,众多的参加的选手中,使用java的最终ac的人数不仅少,而且用时都比较长。尽管java可以是标准时间的3倍,不过,c/c++依然是参加这种比赛的首选。先把题目叙述下:描述 在有道搜索框中,当输入一个或者多个字符时,搜索框会出现一定数量的提示,如下图所示:现在给你N个单词和一些查询,请输出提示结果,为了简化这个问题,只需要输出以查询词为前缀的并且按字典序排列的最前面的8个单词,如果符合要求的单词一个也没有请只输出当前查询词。 输入 第一行是一个正整数N,表示词

2010-06-02 16:51:00 719

logback中文手册

logback中文手册,感谢翻译者,希望对大家有帮助吧

2010-12-30

Google Android 开发入门与实战 part2

Google Android 开发入门与实战 part2,需要先下载一个part1,然后再下载这个,两个一起解压;

2010-05-26

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除