defgetResult(cmd,timeout=2):#命令超时时间
deadline=time.time()+timeout
r=subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE)
whiletime.time()<deadlineandr.poll()isNone:
time.sleep(0.1)
ifr.poll()isNone:#检查子进程
r.kill()
r.wait()
return‘‘
r.wait()
..
分类:
编程语言 时间:
2014-05-07 22:30:17
阅读次数:
504
Given n points on a 2D plane, find the maximum
number of points that lie on the same straight line. 解题想法:
其实判断一个直线上最好的方法是判断斜率。如果在同一直线上,那么直线上一点与其他点的斜率相...
分类:
其他好文 时间:
2014-05-07 21:13:02
阅读次数:
323
1.在linux上可以找到哪些shell?哪个档案记录可用的shell?儿linux预设的shell是?
1./bin/bash,/bin/tcsh,/bin/csh 2./etc/shells
3.bash,亦即是/bin/bash2.在shell环境下,有个提示符(prompt),他可以修...
分类:
系统相关 时间:
2014-05-07 21:08:15
阅读次数:
720
使用findByPk()根据数据表主键查询的是对象,不需要使用foreach()循环出来但是使用findall()和find()查询的是对象类型的数组需要使用foreach()循环出来=======================================
public function...
分类:
其他好文 时间:
2014-05-07 20:32:35
阅读次数:
565
学习了一段时间的shell编程,发现还是比较容易上手的,果然有了一定的C语言基础其他都好办!某天突发奇想,想要用自己学过的shell语言来编写一个脚本,实现查看EI的FTP服务器是否在工作的功能。虽说可以直接登录试试就知道结果,但是也是为了好玩,也是顺便实践一下。PS:能够拿自己刚学会的知识来成功处...
分类:
其他好文 时间:
2014-05-07 17:06:15
阅读次数:
294
题目链接 Find the contiguous subarray within an array
(containing at least one number) which has the largest sum. For example, given
the array [?2,1,?3,4,...
分类:
其他好文 时间:
2014-05-07 16:42:42
阅读次数:
287
包括:i.任意进制转化为十进制((num=base#number))
【base和number必须一致,是同一种进制】ii.十进制转化为任意进制`echo "obase=进制;值"|bc` 和`echo "值 进制 o
p"|bc` 【这里的值代表十进制数字】iii.任意进制互转;有了i和ii就可以...
分类:
其他好文 时间:
2014-05-07 16:40:14
阅读次数:
272
find the most comfortable road
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3369 Accepted Submission(s): 1437
Problem Descriptio...
分类:
其他好文 时间:
2014-05-07 12:18:52
阅读次数:
306
在学习linux系统编程的时候,实现了ls命令的简化版本。
实现的功能如下:
1. 每种文件类型有自己的颜色 (- 普通文件, d 目录文件, l 链接文件, c 字符设备文件, b 快设备文件, p 管道文件, s socket文件。共7种)
2. 支持的参数有 -hali (a: 显示隐藏文件, i: 显示inode节点号,l: 以列表形式显示文件的详细信息,h: 人类可读的文件大小显示...
分类:
系统相关 时间:
2014-05-07 11:32:19
阅读次数:
592
Sum It UpTime Limit:1000MSMemory Limit:10000KTotal
Submissions:5684Accepted:2894DescriptionGiven a specified total t and a list of
n integers, find al...
分类:
其他好文 时间:
2014-05-07 10:45:02
阅读次数:
388