上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 29 下一页
摘要: 原文:http://www.vimer.cn/?p=1465#!/usr/bin/python# -*- coding: utf-8 -*-import sys, os, time, atexitfrom signal import SIGTERM class Daemon: """ A generic daemon class. Usage: subclass the Daemon class and override the _run() method """ def __init__(self, pidfile, stdin=& 阅读全文
posted @ 2012-11-29 21:39 Leo Forest 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 原文:http://blog.chinaunix.net/uid-7396950-id-2056484.html最近做预料处理,使用bash脚本,需要在脚本的sed和awk使用shell变量以控制循环,出现一些问题后找到解决办法如下:1.sed使用shell变量这个比较好办,sed命令中可以用单引号和双引号,一般我们习惯用单引号,如下:sed -i 's/pattern1/pattern2/g' inputfile如果要使用shell变量,就需要使用双引号pattern1=XXXpattern2=XXXsed -i "s/$pattern1/$pattern2/g&q 阅读全文
posted @ 2012-11-29 20:37 Leo Forest 阅读(313) 评论(0) 推荐(0) 编辑
摘要: 原文:http://www.cnblogs.com/lancidie/archive/2011/06/30/2094924.html用函数access,头文件是io.h,原型:int access(const char *filename, int amode);amode参数为0时表示检查文件的存在性,如果文件存在,返回0,不存在,返回-1。这个函数还可以检查其它文件属性:06 检查读写权限04 检查读权限02 检查写权限01 检查执行权限00 检查文件的存在性在UNIX和VC下实验成功。好处是 fopen(..,"r")不好,当无读权限时一不行了。而这个就算这个文件没有 阅读全文
posted @ 2012-11-29 18:40 Leo Forest 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 原文:http://www.cnblogs.com/duzouzhe/archive/2009/10/24/1589348.html文件的基本概念 所谓“文件”是指一组相关数据的有序集合。 这个数据集有一个名称,叫做文件名。 实际上在前面的各章中我们已经多次使用了文件,例如源程序文件、目标文件、可执行文件、库文件 (头文件)等。文件通常是驻留在外部介质(如磁盘等)上的, 在使用时才调入内存中来。从不同的角度可对文件作不同的分类。从用户的角度看,文件可分为普通文件和设备文件两种。 普通文件是指驻留在磁盘或其它外部介质上的一个有序数据集,可以是源文件、目标文件、可执行程序; 也可以是一组待输入.. 阅读全文
posted @ 2012-11-29 11:22 Leo Forest 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 原文链接:http://rokin.iteye.com/blog/475274转载自:LeeMonCC说明:本文是作者在完全按照著名的《手把手教你把Vim改装成一个IDE编程环境》一文,在Windows XP上用gvim建立IDE环境时所作的备忘。原作地址:http://blog.csdn.net/wooin/archive/2007/10/31/1858917.aspx。0.准备软件及插件。(a)gvim72.exe地址ftp://ftp.vim.org/pub/vim/pc/gvim72.exe。(b)vimcdoc-1.7.0-setup.exe地址http://prdownloads. 阅读全文
posted @ 2012-11-29 10:38 Leo Forest 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 原文:http://blog.sina.com.cn/s/blog_46fb85920100mi1m.html貌似有很多方法,先记了再说...1.限制输入数字用法 textfield.setDocument(new IntegerDocument());class IntegerDocument extends PlainDocument{public void insertString(int offset, String s,AttributeSet attributeSet) throws BadLocationException{try{Integer.parseInt(s);}cat 阅读全文
posted @ 2012-11-28 23:23 Leo Forest 阅读(490) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/pythonimport sys, osdef main(): """ A demo deamon main routine, write a datestamp to /tmp/deamon-log every 10 seconds. """ import time f = open("/tmp/deamon-log", "w") while True: f.write('%s\n' % time.ctime(time.time())) f.flush() 阅读全文
posted @ 2012-11-28 20:18 Leo Forest 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 原文:http://www.letuknowit.com/topics/20120429/vim-s-python-syntax-indent-plugin.htmlVim/gVim在默认配置情况下,对于某些Python代码的缩进不是很合适,看起来很不舒服,具体表现如下,其中左右两边分别列出了默认缩进方式和理想的缩进方式,哪种情况看起来更舒服一目了然:1、list的语法缩进# 不合理的缩进val1 = [ 1, 2, 3 ]# 合理的缩进val2 = [ 1, 2, 3]2、dict的语法缩进# 不合理的缩进val2 =... 阅读全文
posted @ 2012-11-27 23:28 Leo Forest 阅读(606) 评论(0) 推荐(0) 编辑
摘要: 原文:http://www.hulufei.com/post/201004161735Posted@2010-04-16 5:35 p.m.CategoriespythonPython的字典和JSON在表现形式上非常相似#这是Python中的一个字典dic = { 'str': 'this is a string', 'list': [1, 2, 'a', 'b'], 'sub_dic': { 'sub_str': 'this is sub str', 'su 阅读全文
posted @ 2012-11-27 18:58 Leo Forest 阅读(760) 评论(0) 推荐(0) 编辑
摘要: 原文:http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.htmlPython正则表达式指南本文介绍了Python对于正则表达式的支持,包括正则表达式基础以及Python正则表达式标准库的完整介绍及使用示例。本文的内容不包括如何编写高效的正则表达式、如何优化正则表达式,这些主题请查看其他教程。注意:本文基于Python2.4完成;如果看到不明白的词汇请记得百度谷歌或维基,whatever。尊重作者的劳动,转载请注明作者及原文地址 >.<html1. 正则表达式基础1.1. 简单介绍正则表达式并不是Python的一部分。正则表 阅读全文
posted @ 2012-11-27 09:44 Leo Forest 阅读(123) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 29 下一页