add by zhj: 上下文管理器是对try-except-finally的再封装而已,只能算是优化代码这一级别的feature原文:http://www.ibm.com/developerworks/cn/opensource/os-cn-pythonwith/#引言with 语句是从 Pyth...
分类:
编程语言 时间:
2015-04-09 19:20:50
阅读次数:
170
1对于服务端,privatevoidbindPort(intport){
EventLoopGroupworkGroup=newNioEventLoopGroup();
EventLoopGroupbossGroup=newNioEventLoopGroup();
try{
ServerBootstrapb=newServerBootstrap();
b.group(bossGroup,workGroup);
b.channel(NioServerSocketChannel.class)
.opt..
分类:
Web程序 时间:
2015-04-09 17:50:44
阅读次数:
187
1.把本机地址广播出去private void sendIP() { try { DatagramSocket dgSocket = new DatagramSocket(8989); byte[] by = _ipString.getBytes(); try { Data...
分类:
移动开发 时间:
2015-04-09 16:48:35
阅读次数:
157
#coding=gbkimportsysimportpymssql#尝试数据库连接try:conn=pymssql.connect(host="192.168.1.43",user="sa",password="sa01!",database="master")exceptpymssql.OperationalError,msg:print"error:CouldnotConnectionSQLServer!pleasecheckyourdblinkconfigure!"sys.exit()el..
分类:
数据库 时间:
2015-04-09 12:06:53
阅读次数:
170
告诉大家一个好消息,今天周四了,刚上完两天班,明天又放假了。 不过了,这天气就是有点冷,早晨一出门,那凉风飕飕的。这天气就像爱慕女孩那样子忽冷忽热的 @?胯下巨炮:广东的天气真会调戏人,看看昨天的温度...
分类:
其他好文 时间:
2015-04-09 10:45:08
阅读次数:
353
Rotate Array
Rotate an array of n elements to the right by k steps.
For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is
rotated to [5,6,7,1,2,3,4].
Note:
Try to come up as ma...
分类:
其他好文 时间:
2015-04-08 16:32:21
阅读次数:
97
一、文件或图片上传 try { if (!is_dir($this->uploadPath)) { throw new InvalidArgumentException(‘files.ourats.com还没搭建?‘); } if (!is_writable($this->uploadPath)) { throw new InvalidArgumentExcep...
分类:
Web程序 时间:
2015-04-08 15:14:56
阅读次数:
187
1 function jsonDateFormat(jsonDate) {//json日期格式转换为正常格式 2 try { 3 var date = new Date(parseInt(jsonDate.replace("/Date(", "").replace(")/", ""), 10));....
分类:
Web程序 时间:
2015-04-08 14:27:32
阅读次数:
131
1、 try{ return } - catch{}-finally{} 等价于 try{} - catch{ return }-finally{} 这种情况public class Test{
public static void main(String args[]){
int a = getObj() ;
System.out.print(a....
分类:
其他好文 时间:
2015-04-08 09:17:20
阅读次数:
99
Rotate an array ofnelements to the right byksteps.For example, withn= 7 andk= 3, the array[1,2,3,4,5,6,7]is rotated to[5,6,7,1,2,3,4].Note:Try to come...
分类:
其他好文 时间:
2015-04-08 07:55:21
阅读次数:
93