共享内存主要用于进程间通信php中的共享内存有两套扩展可以实现1、shmop 编译时需要开启--enable-shmop 参数实例: $shm_key = ftok(__FILE__, 't');/** 开辟一块共享内存 int $key , string $flags , int $mode ,....
分类:
Web程序 时间:
2014-09-28 02:16:10
阅读次数:
200
错误是多种多样的,在 except 语句中,可以捕获指定的异常修改代码如下: 1 import io 2 3 path = r'' 4 mode = 'w' 5 6 try: 7 file = open(path,mode) 8 str = file.read() 9 p...
分类:
编程语言 时间:
2014-09-28 02:08:20
阅读次数:
352
1、brctl addbr br02、brctl addif br0 eth0 这时候用ssh应该会断网。。。3、设置interfaces# This file describes the network interfaces available on your system# and how .....
分类:
其他好文 时间:
2014-09-28 00:37:30
阅读次数:
613
虽然叫错误,但跟 C# 中的异常是一回事。只不过 Python 中叫错误(Error)而 C# 中叫异常(Exception)。先手工产生一个异常:1 file = open('','r')上面一句由于路径是空路径,因此文件肯定是不存在的,执行这一句会引发 FileNotFoundError 这个错...
分类:
编程语言 时间:
2014-09-28 00:32:10
阅读次数:
315
Cocos2D对音乐/音效播放的封装已经很好了,下边是例子:
定义2个文件:
[cpp] view
plaincopy
#define MUSIC_FILE "LOLBgMusic.mp3"
#define EFFECT_FILE "Attack.wav"
在初始化的时候预加载音乐/音效文件:
...
分类:
其他好文 时间:
2014-09-27 22:31:50
阅读次数:
209
在Python中写文件也是得先打开文件的。1 file=open(r'E:\temp\test.txt','a')2 file.write('append to file')3 file.close()第一行使用追加模式打开文件,第二行则将内容写入文件,第三行关闭文件。除了write方法外,还有wr...
分类:
编程语言 时间:
2014-09-27 20:37:50
阅读次数:
152
在Python中,读取文件使用open函数1 file=open(r'E:\temp\test.txt','r')2 var = file.read()3 print(var)4 file.close()第一行打开E:\temp\test.txt文件,注意字符串开头使用了r,r表明字符串内的内容不转...
分类:
编程语言 时间:
2014-09-27 20:05:20
阅读次数:
143
#!/usr/bin/envpython2.7
importsys
fromosimportpath
importos
importMySQLdb
DIRNAME=path.dirname(__file__)
OPSTOOLS_DIR=path.abspath(path.join(DIRNAME,‘..‘))
sys.path.append(OPSTOOLS_DIR)
fromlibrary.mysqlimportMySQLDConfig,getMyVariables
fromoptparseimport..
分类:
数据库 时间:
2014-09-27 18:37:50
阅读次数:
329
Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"click to show corner cas...
分类:
其他好文 时间:
2014-09-27 17:21:00
阅读次数:
188