#includeclock_t begin,stop;//开始记录时间 begin=clock();//你要测试时间的程序算法程序();stop=clock();//获得测试程序运行的时间printf("%ld",(stop-begin/CLOCKS_PER_SEC));//按照s,秒为...
分类:
编程语言 时间:
2014-11-15 21:47:26
阅读次数:
254
grep命令及基本正则表达式 grep NAME:名称 grep:Global search REgular expression and Print out the line 文本搜索工具,根据用户指定的"模式(pattern)"对目标文本进行过滤,显示被模式匹配到的行。 ...
分类:
其他好文 时间:
2014-11-15 21:28:51
阅读次数:
212
本函数是用来删除对象的属性,比如在函数setattr()里添加的属性,就可以利用这个函数来删除。参数object是一个对象,参数name是一个字符串,但这个字符串必须是对象的属性。比如delattr(x, ‘test’) 等价于 del x.test。例子:#delattr()
class test:
pass
a = test()
setattr(a, 'foo', 12)
print('...
分类:
编程语言 时间:
2014-11-15 20:15:16
阅读次数:
191
Socket
小型服务器:
#!/usr/bin/env python
import socket
s = socket.socket()
host = socket.gethostname()
port = 1234
s.bind((host,port))
s.listen(5)
while True:
c,addr = s.accept()
print 'Got connection ...
分类:
编程语言 时间:
2014-11-15 18:56:56
阅读次数:
174
#Python字符串操作'''1.复制字符串'''#strcpy(sStr1,sStr2)sStr1 = 'strcpy'sStr2 = sStr1sStr1 = 'strcpy2'print sStr2'''2.连接字符串'''#strcat(sStr1,sStr2)sStr1 = 'strcat...
分类:
编程语言 时间:
2014-11-15 18:47:43
阅读次数:
205
ubuntu下socket编程涉及到头文件sys/socket.h 和sys/types.h。我是用的codeblocks编辑器,当我想查看socket,h头文件时编辑器提示找不到头文件。
我就想可能是没有设置codeblocks头文件的搜索路径。好吧,那首先就找找这个文件藏在哪里吧
find / -name socket.h -print
或者locate sys/s...
分类:
其他好文 时间:
2014-11-15 17:06:58
阅读次数:
1357
文件方法
读写:
#!/usr/bin/env python
f = open('somefile.txt','w')
f.write('Hello,')
f.write('World!')
f.close()
f = open('somefile.txt','r')
print f.read(5)Hello使用基本文件方法:
#!/usr/bin/env python
f = open(r...
分类:
编程语言 时间:
2014-11-15 15:32:37
阅读次数:
218
1.CWnd 1.1.UpdateData() 作用: UpdateData() and Updatedata(TRUE) are the same. UpdateData(TRUE) is used to copy the contents of the controls into the ass...
分类:
编程语言 时间:
2014-11-15 15:30:40
阅读次数:
138
#!/bin/bash#analysisthemysqlslowlog#Writenbylandline#IPadd=`grep`hostname`/etc/hosts|awk-F‘‘‘END{print$1}‘`IPadd=`/sbin/ifconfigeth0|grepBcast|awk-F:‘{print$2}‘|awk‘{print$1}‘`serverday=`date-d‘-1day‘+%Y-%m-%d`nowday=`date"+%y%m%d"`yestoday=`date-d‘-1day‘+%..
分类:
数据库 时间:
2014-11-15 06:44:39
阅读次数:
290
作者:jostree转载请注明出处http://www.cnblogs.com/jostree/p/4098562.html题目链接:print neatly 整齐打印 算法导论考虑在一个打印机上整齐地打印一段文章的问题。输入的正文是$n$个长度分别为$L_1,L_2,\dots ,L_n$(以字符...
分类:
编程语言 时间:
2014-11-15 01:24:53
阅读次数:
292