摘要: Gdb调试多进程程序程序经常使用fork/exec创建多进程程序。多进程程序有自己独立的地址空间,这是多进程调试首要注意的地方。Gdb功能强大,对调试多线程提供很多支持。方法1:调试多进程最土的办法:attach pidAttach是调试进程的常用办法,只要有可执行程序以及相应PID,即可工作。当然,为方便调试,可以在进程启动后,设定sleep一段时间,如30s,这样即可有充足的时间来attach。方法2: set follow-fork-mode child + main断点当设置set follow-fork-mode child,gdb将在fork之后直接执行子进程,知道碰到断点后停止。 阅读全文
posted @ 2014-04-03 13:21 Me.thinking 阅读(169) 评论(0) 推荐(0) 编辑
摘要: void printInteger(int n) { if (n>=10) { printInteger(n/10); } printf("%d,",(n%10));} 阅读全文
posted @ 2014-01-09 22:56 Me.thinking 阅读(140) 评论(0) 推荐(0) 编辑
摘要: R1. [数据结构与算法分析–C.描述(第3版)](美)Mark.Allen.Weiss 阅读全文
posted @ 2014-01-09 22:39 Me.thinking 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 提供以下功能:automatic notification of new threads‘thread threadno’, a command to switch among threads‘info threads’, a command to inquire about existing threads‘thread apply [threadno] [all] args’, a command to apply a command to a list of threadsthread-specific breakpoints‘set print thread-events’, whic 阅读全文
posted @ 2013-09-25 17:01 Me.thinking 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 从语言的使用上来看,python类似于shell,或者javascript,是个脚本语言,所以纷繁的类就比较乱,没有java那样直观。1. 命名方式可以稍微改善一点。比如所有对象都以类名打头,比如genHtml_obj = genHtml()2. 尽量把一个类写一个文件或者一个模块 阅读全文
posted @ 2013-04-17 13:16 Me.thinking 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 把自己写的模块加入到python默认就有的搜索路径:在python/lib/python2.5/site-packages目录下建立一个 xxx.pth的文件,写入自己写的模块所在的路径即可sys.path.remove("路径")或者方法一:临时加入模块载入目录:sys.path.append('/storage01')import post_wap=================方法二:(1)主程序与模块程序在同一目录下:如下面程序结构:`-- src |-- mod1.py `-- test1.py 若在程序test1.py中导入模块mod1, 则直 阅读全文
posted @ 2013-04-10 17:37 Me.thinking 阅读(351) 评论(0) 推荐(0) 编辑
摘要: Project Overview:This purpose of this project is to write the contents of a csv file to an html file in the form of a table. The first row of the csv file is assumed to be a header row. The table will have predefined css styles applied to it. The styles will customize the header as well as alternate 阅读全文
posted @ 2013-04-07 21:52 Me.thinking 阅读(1114) 评论(0) 推荐(0) 编辑
摘要: 在 Python 中, 当需要对一个 list 排序时, 一般可以用 list.sort() 或者 sorted(iterable[, cmp[, key[, reverse]]]).其中:cmp(e1, e2) 是带两个参数的比较函数, 返回值: 负数: e1 < e2, 0: e1 == e2, 正数: e1 > e2. 默认为 None, 即用内建的比较函数.key 是带一个参数的函数, 用来为每个元素提取比较值. 默认为 None, 即直接比较每个元素.reverse 是一个布尔值, 表示是否反转比较结果.我以前在做比较复杂的排序时, 喜欢写一个定制的 cmp 函数. 当我 阅读全文
posted @ 2013-04-07 12:43 Me.thinking 阅读(277) 评论(0) 推荐(0) 编辑
摘要: python的中文问题一直是困扰新手的头疼问题,Python的发行版至今尚未包括任何中文支持模块。当然,几乎可以确定的是,在将来的版本中,python会彻底解决此问题,不用我们这么麻烦了。 笔者使用的是2.5版本。Python的版本可以通过调用sys模块的sys.version查看。在几个月的学习中,主要遇到以下问题:1. print打印中文的问题:在编辑器中输入一段测试代码:s=’测试’print s运行结果如下:Non-ASCII character '\xb2' in file c:\Documents and Settings\Administrator\桌面\2.py 阅读全文
posted @ 2013-04-06 21:17 Me.thinking 阅读(2904) 评论(0) 推荐(0) 编辑
摘要: In this post I’m going to explain how to create a simple Python CGI Server. To illustrate the concepts involved more clearly I will not attempt to make this server extensible, rather I will try to keep the code as simple and clear as possible.To start with we need to create a directory for our serve 阅读全文
posted @ 2013-04-04 19:09 Me.thinking 阅读(1230) 评论(0) 推荐(0) 编辑