`
hanyh
  • 浏览: 241168 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
这个不是Python的问题,不管你用那个编程语言都会碰到这个问题。也没有统一的解决方案。前面诸位提到的编辑器折叠代码的功能确实能部分解决问题, 但是从根子上讲,还是得靠合理地设计程序结构。我这里讲一些我自己的心得,供你作参考。 首先要合理使用Py的sub function def outer():    def inner():        foobarblahdah 然后把很多nasty的东西放到inner里面。很多时候这种方法能解决很多问题。 此外,要合理使用generator。Py的generator是一个非常强大的工具,用得好,能让你的代码非常赏心悦目。比方说,很多时候,多层的 ...

下一步计划?

应用开发继续待3个月     兼产品 系统开发待3个月 数据库小组得3个月 运维小组待3个月
http://blog.chinaunix.net/u2/79621/showart_1210923.html #!/bin/python from socket import * from time import time,ctime host = "" port = 12345 bufsize = 1024 addr = (host,port) socket = socket(AF_INET,SOCK_STREAM) socket.bind(addr) socket.listen(5) try: while 1: print ...

最大目录深度

#!/bin/sh count=0 while true do mkdir deep-well if [ $? -ne 0 ]; then echo "max dir deepth :$count" break fi count=$((count+1)) cd deep-well done hanyh@hanyh-sina:/boot$ sudo sh mkdeep.sh cd: 13: can't cd to deep-well mkdir: 无法创建目录 “de ...

udp server

#!/usr/bin/env python import socket,traceback,time,struct host = "" port = 1234 s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,1) s.bind((host,port)) while 1: try: msg,add = s.recvfrom(8192) secs = int(time.time() ...
新浪的空间没有达到足够的业界影响力 新浪内测的“新浪朋友”停止开发 新浪的微博如火测试 为什么不同产品命运那么不一样?新浪的核心竞争力是:媒体,名人。如果不在新浪这个大平台上做事情,新浪朋友的这种产品和中关村普通的创业公司作的产品有什么两样? 在大的公司,要尽力借助于大的平台,尽量借力.....

惶惶的

健康的惶惶的生存 努力而有策略的奋斗..
warning: incompatible implicit declaration of built-in function 'exit' 少了#include <stdlib.h> is by far the best solution. 1)man who 2)info coreutils 'who invocation' 3)man -k utmp 4)man 5 utmp 5)read utmp.h 从文件中读取数据结构 把结构中的信息展示出来 man -k file | grep read man 2 read man 2 open struct utmp ...
一个简单的more程序实现代码不到100行 看linux下more源码实现2000多行 错误处理 功能设置 环境设置 ...
python的sendall和c的send对比 python的文件对象:只要实现了文件对象必须的几个方法,就可以当作“文件”一样操作,duck type,有文件对象,也有file-like ojbect,后者并不一定有文件对象的全部方法和属性。 File Objects ==================== File objects are implemented using C's stdio package. 1, can be created with the built-in open() function 2, returned by some methods,such as ...
http://www.spread.org/ 有时间可以研究下,核心是组织的思想
一,态度是指引到优秀的基础 二,方法和策略是达到优秀的条件      因为现实情况是:需求会经常变革,设计不到位,增加功能,人员流失,团队士气...这 让我们并不是在一个”舒适“的环境怡然自得的开发,而是在战场,所以需要一些战斗的技巧和策略,需要聪明的战斗。      所以:我们学习自己过去的错误从中获得智慧,我们学习他人的错误教训,我们跟随他人的成功之道。 三,我们必须热爱代码,热爱这一份创造的事业      以前:是算法,软硬件精通的英雄      现在:是组合的大师,平衡的大师      未来:是平衡 四,基于著名的:凡是可能出错的,一定会出错 基于要做一名优秀程序员的目标 我们彼此 ...
为什么有32000限制? ext2/ext3有此限制,xfs无,reiserfs限制数量要大些. mkdir: cannot create directory `test`: Too many links。 I already talked to Drew, there is a limit of 32,000 links in an inode, which in turn limits the number of directories in a single place to 31,998 There is no way to increase this  in ext2 witho ...

inotify使用

注意: There are race conditions in the recursive directory watching code which can cause events to be        missed if they occur in a directory immediately after that directory is created.  This is prob-        ably not fixable. 适合少量文件监控 #!/bin/sh src=/home/hanyh/workspace/shell inotifywait -mrq --t ...
1,The Proc psuedo file system is a real time, memory resident file system that tracks the processes running on your machine and the state of your system. 2, certain parts of the /proc file system can be read only by the owner of the process and of course root. 3,Dmesg helps us determine the devices ...
Global site tag (gtag.js) - Google Analytics