摘要://主键 alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);//增加一个新列 alter table t2 add d timestamp;alter table infos add ex tinyint not null default '0';//删除列 alter table t2 drop column c;//重命名列 alter table t1 change a b inte
        
阅读全文
 
        
            
            
摘要:在进行 python 套接字编程时,服务端程序要判断客户端是否异常断开【由于断电或者其他突发情况导致链接中断】,可以通过以下几种方式判断:1、如果通信协议中,设有心跳包,则可记录上次收到时间,将服务端epoll 设为水平触发,这样就会有不断的可读事件触发,在判断读到的字符为空字符时,通过当前时间与上次收到数据时间的时间差,来判断客户端存活否;2、将服务端epoll 设为水平触发,这样就会有不断的可读事件触发,在判断读到的字符为空字符时,向客户端尝试写数据,通过捕捉异常 IOError,来判断客户端的链路是否已断开。3、构造链接类,包含链接句柄和时间字段[客户端最近活跃时间],然后开一个看门狗线
        
阅读全文
 
        
            
            
摘要:1、查看文件 /proc/${pid}/status2、pstree -p ${pid}3、输入 top -bH -d 3 -p ${pid}top -H手册中说:-H : Threads toggle 加上这个选项启动top,top一行显示一个线程,否则,它一行显示一个进程。4、ps xH手册中说:H Show threads as if they were processes 这样可以查看所有存在的线程。5、ps -mp 手册中说:m Show threads after processes 这样可以查看一个进程起的线程数。
        
阅读全文