socket编程原理1、问题的引入1) 普通的I/O操作过程:UNIX系统的I/O命令集,是从Maltics和早期系统中的命令演变出来的,其模式为打开一读/写一关闭(open-write-read-close)。在一个用户进程进行I/O操作时,它首先调用“打开”获得对指定文件或设备的使用权,并返回称...
分类:
其他好文 时间:
2015-06-05 20:55:24
阅读次数:
189
一般采用显示关闭文件:f = open('./weibo.py','r')print f.read()f.close()with open('./weibo.py') as f: for line in f: print line退出with代码块时文件自动关闭,不需显示关闭。
分类:
编程语言 时间:
2015-06-05 15:15:55
阅读次数:
115
Valid Parentheses
题目:
Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.
The brackets must close in the correct order, “()”...
分类:
其他好文 时间:
2015-06-05 14:07:10
阅读次数:
117
总原则:开闭原则(Open Close Principle)开闭原则就是说对扩展开放,对修改关闭。在程序需要进行拓展的时候,不能去修改原有的代码,而是要扩展原有代码,实现一个热插拔的效果。所以一句话概括就是:为了使程序的扩展性好,易于维护和升级。想要达到这样的效果,我们需要使用接口和抽象类等,后面的...
分类:
其他好文 时间:
2015-06-05 09:59:06
阅读次数:
135
代码MainWindow mwin = new MainWindow();Application.Current.MainWindow = mwin;this.Close();mwin.Show();参考:http://bbs.csdn.net/topics/370266691
Given a string containing just the characters '(', ')',
'{', '}', '[' and ']', determine if the input string is valid.
The brackets must close in the correct order, "()" and "()[]{}" are all valid b...
分类:
其他好文 时间:
2015-06-03 10:02:51
阅读次数:
141
如activityA代码: activityB = new ActivtyB(mHandler,CLOSE_SEARCH_MSG);//新建对像B传递,一个handler和Message,然后在activityB中发送即可触发activityA的方法:activityB代码: if (mHandle...
分类:
移动开发 时间:
2015-06-02 10:52:59
阅读次数:
147
#coding=utf-8import jsondef writeJSON(filaName="test.json"): f=open(filaName, "wb") testDic={"key":"value"} json.dump(testDic,f) f.close()def ...
分类:
编程语言 时间:
2015-06-02 08:06:18
阅读次数:
165
STDIN_FILENO与STDIN的区别:STDIN_FILENO:1).数据类型:int2).层次:系统级的API,是一个文件句柄,定义在<unistd.h>中。3).相应的函数:open(),close(),read(),write(),lseek()等系统级别的函数。SDTIN:1).数据类型:FILE*2).层次:c语言的提供的标准输入流。c语..
分类:
其他好文 时间:
2015-06-01 20:37:59
阅读次数:
173
环境: Win7 VC 6.0 VS2008 VS2013在Win7操作系统下,如果是以Administrator登陆,则VC6.0打开工程文件的时候,默认使用VS2013强转工程, 并且使用VC 6.0拖拽打开不能同时打开多个工程文件,后打开的工程会将前一个工程close掉,这样,VC...