- 浏览: 241168 次
- 性别:
- 来自: 北京
-
最新评论
-
hnraysir:
必须登录评论下,谢谢。by elesos.com
分库和分表 -
化蝶自在飞:
命运使然.前生来世都注定了的.
贫穷是罪恶之源 -
Kidwind:
出现这样的错误ViewDoesNotExist at /con ...
django的jsCalendar的widget -
hanyh:
我的项目比较小,就直接写在views.py里面了。你出现的是什 ...
django的jsCalendar的widget -
Kidwind:
请问JsCalendarWidget应该放在哪个位置,我的是放 ...
django的jsCalendar的widget
文章列表
这个不是Python的问题,不管你用那个编程语言都会碰到这个问题。也没有统一的解决方案。前面诸位提到的编辑器折叠代码的功能确实能部分解决问题,
但是从根子上讲,还是得靠合理地设计程序结构。我这里讲一些我自己的心得,供你作参考。
首先要合理使用Py的sub function
def outer():
def inner():
foobarblahdah
然后把很多nasty的东西放到inner里面。很多时候这种方法能解决很多问题。
此外,要合理使用generator。Py的generator是一个非常强大的工具,用得好,能让你的代码非常赏心悦目。比方说,很多时候,多层的
...
- 2009-10-15 16:03
- 浏览 1661
- 评论(0)
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 ...
- 2009-10-14 23:20
- 浏览 5508
- 评论(0)
#!/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 ...
- 2009-10-14 11:20
- 浏览 1001
- 评论(0)
#!/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() ...
- 2009-10-13 23:14
- 浏览 1090
- 评论(0)
新浪的空间没有达到足够的业界影响力
新浪内测的“新浪朋友”停止开发
新浪的微博如火测试
为什么不同产品命运那么不一样?新浪的核心竞争力是:媒体,名人。如果不在新浪这个大平台上做事情,新浪朋友的这种产品和中关村普通的创业公司作的产品有什么两样?
在大的公司,要尽力借助于大的平台,尽量借力.....
- 2009-10-13 22:24
- 浏览 1060
- 评论(0)
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 ...
- 2009-10-12 17:59
- 浏览 890
- 评论(0)
一个简单的more程序实现代码不到100行
看linux下more源码实现2000多行
错误处理
功能设置
环境设置
...
- 2009-10-12 14:23
- 浏览 916
- 评论(0)
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 ...
- 2009-10-11 23:01
- 浏览 1325
- 评论(0)
http://www.spread.org/
有时间可以研究下,核心是组织的思想
- 2009-10-11 22:20
- 浏览 789
- 评论(0)
一,态度是指引到优秀的基础
二,方法和策略是达到优秀的条件
因为现实情况是:需求会经常变革,设计不到位,增加功能,人员流失,团队士气...这 让我们并不是在一个”舒适“的环境怡然自得的开发,而是在战场,所以需要一些战斗的技巧和策略,需要聪明的战斗。
所以:我们学习自己过去的错误从中获得智慧,我们学习他人的错误教训,我们跟随他人的成功之道。
三,我们必须热爱代码,热爱这一份创造的事业
以前:是算法,软硬件精通的英雄
现在:是组合的大师,平衡的大师
未来:是平衡
四,基于著名的:凡是可能出错的,一定会出错
基于要做一名优秀程序员的目标
我们彼此 ...
- 2009-10-11 18:35
- 浏览 1063
- 评论(0)
为什么有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 ...
- 2009-09-27 16:20
- 浏览 1667
- 评论(0)
注意:
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 ...
- 2009-09-27 10:43
- 浏览 846
- 评论(0)
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 ...
- 2009-09-27 10:11
- 浏览 831
- 评论(0)