03 2011 档案

摘要: PySide website : http://www.pyside.org/onlinedoc :http://www.pyside.org/docs/pyside/wiki:http://developer.qt.nokia.com/wiki/PySideDocumentation/ sourcecode:http://qt.gitorious.org/pyside/example :http://qt.gitorious.org/pyside/pyside-examples/trees/master (看了example后一切就都太简单了)The PySide project provi阅读全文
posted @ 2011-03-29 17:01 iTech 阅读(587) | 评论 (1) 编辑
摘要: 一 Python3 中字符串的类型bytearray([source[, encoding[, errors]]]) Return a new array of bytes. The bytearray type is a mutable sequence of integers in the range 0 <= x < 256. bytes([source[, encoding[, errors]]]) Return a new “bytes” object, which is an immutable sequence of integers in the range 0..阅读全文
posted @ 2011-03-28 17:38 iTech 阅读(851) | 评论 (0) 编辑
摘要: 转自: http://www.javaeye.com/topic/560229一 预备知识字符集1, 常用字符集分类ASCII及其扩展字符集作用:表语英语及西欧语言。位数:ASCII是用7位表示的,能表示128个字符;其扩展使用8位表示,表示256个字符。范围:ASCII从00到7F,扩展从00到FF。ISO-8859-1字符集作用:扩展ASCII,表示西欧、希腊语等。位数:8位,范围:从00到FF,兼容ASCII字符集。GB2312字符集作用:国家简体中文字符集,兼容ASCII。位数:使用2个字节表示,能表示7445个符号,包括6763个汉字,几乎覆盖所有高频率汉字。范围:高字节从A1到F7阅读全文
posted @ 2011-03-28 15:47 iTech 阅读(1038) | 评论 (0) 编辑
摘要: 一 python2.6中的字符串1) 字符串的种类和关系 (在2.x中,默认的string为str)2) python的全局函数中basestring,str和unicode的描述如下basestring() This abstract type is the superclass for str and unicode. It cannot be called or instantiated, but it can be used to test whether an object is an instance of str or unicode. isinstance(obj, bases阅读全文
posted @ 2011-03-27 22:00 iTech 阅读(820) | 评论 (0) 编辑
摘要: 一 LVS (Linux Virtual Server)针对高可伸缩、高可用网络服务的需求,我们给出了基于IP层和基于内容请求分发的负载平衡调度解决方法,并在Linux内核中实现了这些方法,将一组服务器构成一个实现可伸缩的、高可用网络服务的虚拟服务器。虚拟服务器的体系结构如图2所示, 和 一组服务器通过高速的局域网或者地理分布的广域网相互连接,在它们的前端有一个负载调度器(Load Balancer)。负载调度器能无缝地将网络请求调度到真实服务器上,从而使得服务器集群的结构对客户是透明的,客户访问集群系统提供的网络服务就像访问一台高性能、高可用的服务器一样。客户程序不受服务器集群的影响不需作任阅读全文
posted @ 2011-03-24 14:58 iTech 阅读(718) | 评论 (0) 编辑
摘要: 有些时候某些文件夹下的文件路径太长,超出了windows系统的限制,导致此文件夹不能被删除。 此时我们需要先subst此文件夹然后再删除,以下脚本帮你自动完成。代码:importosimportsysimportshutilimportsubprocessdefrunCommand(cmd):returnsubprocess.call(cmd)defsubstDriveForPath(drive,path):substcmd="subst"+""+drive+""+pathreturnrunCommand(substcmd)defun阅读全文
posted @ 2011-03-22 21:04 iTech 阅读(525) | 评论 (0) 编辑
摘要: 清除指定目录下的子文件, 只保留与给定的正则表达式匹配且最后创建的N个。代码:importosimportsysimportreimportshutildefcleanUp(dir,regrex,num):ifnotos.path.exists(dir)andnotos.path.isdir(dir):print'path%sisnotexistedorisnotadirectory'%dirreturnFalsesubfolderdict={}forsubIinos.listdir(dir):sf=os.path.join(dir,subI)ifos.path.isdir(s阅读全文
posted @ 2011-03-22 18:36 iTech 阅读(441) | 评论 (0) 编辑
摘要: 用来copy文件和目录,当文件或文件夹已经存在时,自动增加.r1,.r2......来重命名新copy的文件。 代码:importosimportsysimportshutildefcopyWithRename(source,dest,rename=True):ifos.path.exists(dest)andrename==True:dir,name=os.path.split(dest)newdest=destifos.path.isfile(dest):namewithoutext,ext=os.path.splitext(name)i=1while(1):newdest=os.path阅读全文
posted @ 2011-03-22 18:09 iTech 阅读(436) | 评论 (1) 编辑
摘要: Author :Jeffrey My Blog:http://blog.csdn.net/gueter/ 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/gueter/archive/2007/03/08/1524447.aspx引言 HTTP是一个属于应用层的面向对象的协议,由于其简捷、快速的方式,适用于分布式超媒体信息系统。它于1990年提出,经过几年的使用与发展,得到不断地完善和扩展。目前在WWW中使用的是HTTP/1.0的第六版,HTTP/1.1的规范化工作正在进行之中,而且HTTP-NG(Next Generation of HTTP)的建议已经提出。阅读全文
posted @ 2011-03-21 22:04 iTech 阅读(1353) | 评论 (1) 编辑
摘要: 一 读取excel这里介绍一个不错的包xlrs,可以工作在任何平台。这也就意味着你可以在Linux下读取Excel文件。首先,打开workbook; import xlrdwb = xlrd.open_workbook('myworkbook.xls')检查表单名字: wb.sheet_names()得到第一张表单,两种方式:索引和名字 sh = wb.sheet_by_index(0)sh = wb.sheet_by_name(u'Sheet1')递归打印出每行的信息: for rownum in range(sh.nrows): print sh.row_v阅读全文
posted @ 2011-03-18 12:22 iTech 阅读(2174) | 评论 (0) 编辑
摘要: 代码如下:fromhashlibimportmd5defcalMD5(str):m=md5()m.update(str)returnm.hexdigest()defcalMD5ForFile(file):m=md5()a_file=open(file,'rb')m.update(a_file.read())a_file.close()returnm.hexdigest()defcalMD5ForFolder(dir,MD5File):importosoutfile=open(MD5File,'w')forroot,subdirs,filesinos.walk(d阅读全文
posted @ 2011-03-17 13:20 iTech 阅读(569) | 评论 (0) 编辑
摘要: docstring: docstring表示源代码的注释,可以被help()函数识别。以''' axxxx'''的形式存在,可以为多行。可以给module,class,function增加docstring。但是docstring必须在所有的内容的最前面,例如如果给module增加docstring,该docstring必须位于文件的最前面。实例:'''#prerequisite:#basedonPython2.x#needPythonXXXmodule#makeXXXXXcommandisinPATH#usage:1)c阅读全文
posted @ 2011-03-08 18:33 iTech 阅读(580) | 评论 (0) 编辑
摘要: perl中的INC变量中包含了所有的perl module的查找路径。可以使用perl -V 来查看INC的值。1)默认地INC如下:@INC: C:/Perl/site/lib C:/Perl/lib .2)设置环境变量PERL5LIB来增加到INC,例如: set perl5lib=c:\perllibs 在设置perl5lib后如下, %ENV: PERL5LIB="c:\perllibs" @INC: c:\perllibs C:/Perl/site/lib C:/Perl/lib .3)在perl程序中修改INC, 例如:#!/usr/bin/perl -w pu阅读全文
posted @ 2011-03-08 16:04 iTech 阅读(1618) | 评论 (0) 编辑
摘要: 以下几种方法来模拟enum:(感觉方法一简单实用)#way1classDirections:up=0down=1left=2right=3printDirections.down#way2dirUp,dirDown,dirLeft,dirRight=range(4)printdirDown#way3importcollectionsdircoll=collections.namedtuple('directions',('UP','DOWN','LEFT','RIGHT'))directions=dircoll(0阅读全文
posted @ 2011-03-08 14:37 iTech 阅读(896) | 评论 (0) 编辑
摘要: google C++编码规范: [英文]http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml[中文]http://yangyubo.com/google-cpp-styleguide/C++多线程编程:1)http://www.threadingbuildingblocks.org/ 2)http://www.cilk.com/ 3) http://openmp.org/wp/ 完!阅读全文
posted @ 2011-03-08 12:35 iTech 阅读(670) | 评论 (0) 编辑
摘要: 修改自:原文 : Working with Python subprocess - Shells, Processes, Streams, Pipes, Redirects and More地址 : http://jimmyg.org/blog/2009/working-with-python-subprocess.html一 程序的stdin,stdout,stderr+redirect+pipe程序的stdin,stdout,stderr:通常地一个应用程序默认地连接有3个io流,分别为stdin标准输入流,stdout标准输出流,stderr标准错误输出流。在程序中我们可以使用它们的句柄阅读全文
posted @ 2011-03-06 18:20 iTech 阅读(1236) | 评论 (0) 编辑