自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(78)
  • 资源 (1)
  • 收藏
  • 关注

原创 计算机协议

<br />在维基上看到,觉得解释得很到位,所转载到这里<br /> <br />http://en.wikipedia.org/wiki/Protocol_(computing)<br /> <br />In computing and telecommunications, a protocol or communications protocol is a formal description of message formats and the rules for exchanging those

2010-06-09 21:34:00 993

原创 和视频编解码相关的几个东西

<br />AVI: Audio Video Interleave 是一个container format<br /> <br />MPEG-4: 是视频编码技术<br /> <br />XviD: 实现了MPEG-4的程序库<br /> <br />DivX: 另一个实现了MPEG-4的程序库<br /> <br />libavcodec: 实现了MPEG-4及大量其他编码格式的程序库<br /> <br />FFmpeg:  一个项目名称,libavcodec是它的产品之一<br /> <br />me

2010-06-09 21:13:00 894

原创 ls 几个常用选项

做个笔记 按文件修改时间排序 ls -ltr按文件大小排序 ls -sSrh显示目录本身,而不是目录里的文件 ls -d

2010-04-03 11:01:00 2325

原创 deb包的格式

deb包其实是一个ar包命令ar tv *deb 可以查看一个deb包里有哪些文件 每个deb包的magic number 都是!.  (包括最后那个英文句号) deb包里的第一个文件是debian-binary,这是一个文本文件,目前里面只有一行,内容是2.0第二个文件是control.tar.gz, 包含的是deb文件特有的control文件和一个较验文件最后一个文

2010-04-03 10:25:00 2444

原创 BITS伪指令的作用

(以下ax和eax可同理换成bx,ebx等)mov ax, mem和mov eax mem的机器码是一样的,处理器为了区分这两条指令,要求在指令前面加前缀加以区分即,如果程序是32位的话,则mov ax, mem对应的机器码要加前缀,mov eax, mem对应的机器码不用加前缀反之,如果程序是16位的话,则mov ax, mem对应的机器码不用加前缀, mov eax, mem对应的

2010-03-28 18:31:00 1880

原创 ORG伪指令的作用

ORG伪指令告诉汇编器:  我的程序将来会被加载到某某地址A,所以在汇编*绝对地址*的时候请在当前偏移上加上A 以下是例子,是一个在屏幕上显示一个字符串的bootloader[bits 16][org 0x7c00]mov cx, 12 mov dx, 0 mov ax, 01301h mov bx, 0004h mov bp, msg int 10h

2010-03-28 18:14:00 7490 1

原创 vim 自定义命令

编辑 .vimrc 用command添加自己的命令, command相当于shell的alias如  command Lo TlistOpen command Lt TlistToggle 自定义命令必须以大写开头

2010-01-10 13:10:00 8145

原创 Python读写文件及文件指针定位

读文件用read,传递要读的字节数写文件用write,传递要写的字符串 1. 写文件 >>> f = open(e://test.txt,w)>>> a = [1, 2]>>> f.write(a);Traceback (most recent call last): File "", line 1, in f.write(a);Typ

2009-08-07 20:19:00 15845

原创 Python打开文件的模式

r 䣧以只读模式打开文件w  以只写模式打开文件,且先把文件内容清空(truncate the file first)a   以添加模式打开文件,写文件的时候总是写到文件末尾,用seek也无用。打开的文件也是不能读的r+  以读写方式打开文件,文件可读可写,可写到文件的任何位置w+ 和r+不同的是,它会truncate the file firsta+ 和r+不同的是,它只能写

2009-08-07 12:59:00 23536 1

原创 Python打开和关闭文件

用built-in的open和close>>> f = open(test, w+)>>> f.close()

2009-08-07 12:45:00 28807

原创 Python的repr和str有什么不同?

The str() function is meant to return representations of values which are fairlyhuman-readable, while repr() is meant to generate representations which can be read bythe interpreter (or will f

2009-08-06 22:11:00 10486

原创 Python异常处理

>>> try: raise Exception(1,2,3);except Exception as e: print(e); print(repr(e)); print(str(e)); print(e.args); (1, 2, 3)Exception(1, 2, 3)(1, 2, 3)(1, 2, 3)>>> 要特别注意的是为exc

2009-08-06 21:17:00 1190

原创 Python的私有函数

用两个下划线开头的函数是私有函数. 虽然说是私有的, 但是还是可以在类外引用>>> class test: def __private(): print("private"); >>> a = test()>>> a.__private()Traceback (most recent call last): File "", line 1, in

2009-08-06 12:59:00 5599 1

原创 Python统计字符串里某个字符出现的次数

用字符串的count函数就行了>>> 1,2,3.count(,)2>>> Hello world.count(l)3>>>

2009-08-05 12:42:00 86739 4

原创 用Python求阶乘

今天想起之前在argo看到的求1111!里有多少个1的题目, 有人回帖说用python求得结果是255, 于是搜了一下怎么做.最简单的当然是写递归了, 不过最简便的则是用reduce函数 >>> from functools import reduce>>> str(reduce(lambda x,y: x*y, range(1, 1112))).count(1)255

2009-08-05 12:37:00 10315

原创 Python的reduce

今天在搜用python求阶乘的时候, 搜出来的最简单的是用reduce这个built-in function, 但是我在用reduce的时候, 却报NameError: name reduce is not defined. 于是又搜了一下,发现在python 3.0.0.0以后, reduce已经不在built-in function里了, 要用它就得from functools impor

2009-08-05 12:24:00 19204 2

原创 PyQt4的程序结构

1. 有一个QApplication对象2. 消息循环(我是这样理解的), 即相当于Winows SDK的win proc的那个函数是QApplication的exec_()3. 窗口是widget 例子程序>>> import sys>>> from PyQt4 import QtGui>>> app = QtGui.QApplication(sys.argv)>

2009-08-03 21:32:00 1557

原创 在windows下搭建学习PyQt4的环境

下载安装Python 3.1 下载安装PyQt-Py3.1-gpl-4.5.4-1 测试程序>>> import sys>>> from PyQt4 import QtGui>>> app = QtGui.QApplication(sys.argv)>>> widget = QtGui.QWidget()>>> widget.show()>>> sy

2009-08-03 21:10:00 1531

原创 和GUI相关的几个概念

1. Interface Metaphor1.1 Desktop Metaphor1.2 Web Portal1.3 等等……Metaphor是隐喻的意思,在这里的意思就是用人们熟悉的概念(desktop,portal等等)来解释计算机里的一些概念(窗口,文件夹等等)。所以这几个概念只是用来概括这一系列比喻而创造出来的总结用的名词。 2. User Interface2

2009-07-31 20:17:00 1499

原创 Python的类变量和实例变量

类变量紧接在类名后面定义,相当于java和c++的static变量实例变量在__init__里定义,相当于java和c++的普通变量 >>> class test: count = 0; def __init__(self, c): self.count = c; self.__class__.count = self.__class__.count + 1;

2009-07-31 12:40:00 30819 2

原创 Python类的__getitem__和__setitem__特殊方法

>>> class testsetandget: kk = {}; def __getitem__(self, key): return self.kk[key]; def __setitem__(self, key, value): self.kk[key] = value; >>> a = testsetandget()>>> a[first] = 1

2009-07-30 21:13:00 19985

原创 Python的类

1. 最简单的类>>> class loaf: pass;>>> a = loaf()>>> a>>> 2. 继承与初始化>>> class loaf: pass;>>> class father: def __init__(self, str): print str;>>> class child(father, loaf): de

2009-07-30 12:29:00 1345

原创 Python的lambda函数

>>> add = lambda a, b: a + b>>> add(3,4)7>>> add2 = lambda a, b: add(a, b) + 3>>> add2(3, 4)10>>> add3 = lambda a, b=3: a + b>>> add3(5)8>>> add3(b=5, a=6)11>>> (lambda a, *b: pr

2009-07-29 14:21:00 1113

原创 Python的and和or

>>> a = >>> b = second>>> (1 and [a] or [b])[0]>>> 1 and a or bsecond>>> 将a放在[]内保证它为True

2009-07-27 19:59:00 773

原创 Python的filtering list

filtering list是增强型的mapping list >>> import types>>> list[1, 2, 3, kk]>>> l = [ i*2 for i in list if type(i) == types.IntType ]>>> l[2, 4, 6]>>>

2009-07-25 23:13:00 745

原创 Python的getattr函数

>>> list = [ 1, 2, 3]>>> append = getattr(list, append)>>> list[1, 2, 3]>>> append(kk)>>> list[1, 2, 3, kk]>>>

2009-07-25 23:08:00 1342

原创 Python的type, str, dir和callable函数

>>> type(1)>>> type(a)>>> type(list)>>> type([1,2])>>> str([1,2])[1, 2]>>> dir([1,2])[__add__, __class__, __contains__, __delattr__, __delitem__, __delslice__, _

2009-07-24 19:27:00 3934

原创 Python合并list和拆分字符串

>>> ;.join(list)first;second;third>>> ;.join(list).split(;)[first, second, third]>>>

2009-07-23 23:14:00 11322

原创 Python的Mapping list

>>> dict = { first : monday, second : tuesday }>>> [ "%s=%s" % (key, value) for key, value in dict.items() ][second=tuesday, first=monday]>>> list = [ 1, 2, 3 ]>>> [ 2*i for i in l

2009-07-22 21:10:00 3797

原创 Python的字典的items(), keys(), values()

Python的字典的items(), keys(), values()都返回一个list>>> dict = { 1 : 2, a : b, hello : world }>>> dict.values()[b, 2, world]>>> dict.keys()[a, 1, hello]>>> dict.items()[(a, b

2009-07-21 21:48:00 99864 6

原创 Python的tuple

1. 定义用括号>>> tuple = (1 ,2 ,3)>>> tuple(1, 2, 3)>>> 2. 引用用中括号>>> tuple(1, 2, 3)>>> tuple[2]3>>> tuple[0]1>>> 3. 修改不能修改!4. 一般是用在格式化字符串和作为字典的key>>> dict = { tupl

2009-07-20 19:35:00 2642

原创 Python的数组

1. 定义用中括号>>> li = [1, 2, str, abc]>>> li[1, 2, str, abc]>>>  2. 引用用中括号,和字典一样>>> li[1, 2, str, abc]>>> li[3]abc>>> li[2] = str-2>>> li[1, 2, str-2, abc]

2009-07-19 19:07:00 873

原创 Tomcat+Struts的hello world

1. 装好Tomcat2. 到http://struts.apache.org/download.cgi#struts1310 下载struts的Full distribution3. 把上面下载的文件解压出来4. 在上面解压出来的文件夹里有apps文件夹,文件夹里有一个struts-blank-1.3.10.war文件,把这个文件解压到struts-hello-world文件夹里(不

2009-07-19 15:41:00 1720 1

原创 在Tomcat中部署web应用

一、静态部署静态部署的web应用都必须重启服务器才能生效 1. 把web应用的目录复制到$CATALINA_HOME/webapps,然后重启tomcat服务就行了例如,复制aaa目录到$CATALINA_HOME/webapps,就可以通过http://localhost:8080/aaa访问这个web应用了2. 修改server.xml文件例如加一行(注意大小写) 

2009-07-18 21:36:00 1188

原创 将.jar文件解压到指定目录?

jar命令无法将.jar解压到指定目录,因为-C参数只在创建或更新包的时候可用要将.jar文件解压到指定目录可以用unzip命令unzip命令在windows下自带就有,不用另外下载安装下面是将一个.war文件解压到指定目录的例子unzip struts-blank-1.3.10.war -d struts-blank 

2009-07-18 19:44:00 36021

原创 Python的字典

1. 定义1.1 用大括号括起来1.2 key和value之间用冒号1.3 每对key和value之间用逗号>>> dict = { 1:2, 1:3, 5:str }>>> dict{1: 3, 1: 2, 5: str}>>>  2. 引用用中括号>>> dict = { 1:2, 1:3, 5:str }>>>

2009-07-18 19:09:00 877

原创 Python特性之格化化输出

>>> "%d + %d = %d" % (1 ,2, 3)1 + 2 = 3>>> params = { "one" : 1, "two" : 2, "three" : 3 }>>> "%(one)d + %(two)d = %(three)d" % params1 + 2 = 3>>>  

2009-07-18 13:14:00 795

原创 Tomcat的server.xml

参考资料: 1. http://blog.csdn.net/jubincn/archive/2009/06/20/4284788.aspx2. http://hi.baidu.com/ljmybfq/blog/item/0b751f6692e8922caa184ceb.html3. http://www.diybl.com/course/3_program/java/javashl/2

2009-07-17 21:25:00 888

原创 Python的函数

1. 最简单的情况:没有参数,没有返回值,没有使用任何特性的函数def func1(): print function;func1(); 2. 有返回值,有普通参数的函数def func2(a, b): return a + b;sum = func2(1, 2); 3. 有默认参数的函数def func3(a, b=3): retur

2009-07-16 20:13:00 831

原创 Python的if语句

i = 3;j = 4;if i > j: print i > j;elif i == j: print i == j;else: print i  注意第二个else if省略成了elif

2009-07-15 19:47:00 825

用OpenGL和阴影体积法实现阴影源码

用OpenGL和阴影体积法实现阴影的源码

2007-12-22

空空如也

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

TA关注的人

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