VB中的Unicode 和 Ansi 格式
Visual Basic 32-bit 版本的字串处理采用 Unicode,也就是说字串在 VB 内部是以Unicode 的格式来存放。何谓 Unicode?简单的说,就是每一个字符都是以 2-byte 的形式表示,而每个「实体字符」就是一个「字符」。因此,
Len("大家好")
Len("abc")
所返回的值都是 3,因为「大」和「a」都是一个字符。
但是这对一些中文字串处理,例如纯文字的数据文件,却是一个大灾难,因为你必须以byte 来定位每个字符,可是 Unicode 却把一切的处理全搞砸了。例如:
Len("Good Morning") 返回 12,而
Len("今天天气很好") 返回 6
对初学者而言,好不容易能使用 VB 来写程序已经是件了不起的事了,却马上在中文处理上挨了一记闷棍,所受到的打击实在不小。但是不要怕,事实上只要再多了解一些指令,就可以把中文处理的问题解决了。
是什么指令呢?最重要的莫过于 StrConv 了。StrConv 函数的语法为:StrConv(待转换字串, 转换格式)
其中转换格式在这里用到的是:
vbU ......
3,Return without GoSub
5,Invalid procedure call
6,Overflow
7,Out of memory
9,Subscript out of range
10,This array is fixed or temporarily locked
11,Division by zero
13,Type mismatch
14,Out of string space
16,Expression too complex
17,Cant perform requested operation
18,User interrupt occurred
20,Resume without error
28,Out of stack space
35,Sub Function or Property not defined
47,Too many DLL application clients
48,Error in loading DLL
49,Bad DLL calling convention
51,Internal error
52,Bad file name or number
53,File not found
54,Bad file mode
55,File already open
57,Device I/O error
58,File already exists
59,Bad record length
61,Disk full
62,Input past end of file
63,Bad record number
67,Too many files
68,Device unavailable
70,Permission denied
71,Disk not ready
74,Cant rename with different drive
75,Path/File access error
76,Path not found
91,Object variable or With block variable not set
92,For loop not initia ......
目前为止,据我所知,在python中对象持久化有以下几种方法:
1. 使用(dbhash/bsddb, dbm, gdbm, dumbdbm 等)以及它们的"管理器"( anydbm )。只提供了 Python 字
符串的永久性储存. 提供一个类似字典和文件的对象,可以完成字符串的永久性存储。
2. 使用marshal和pickle来序列化python对象,并具备存储到介质上的功能。两者的区别在于:marshal只能处理简单的Python对象,包括数字、序列、映射、以及代码对象;而pickle还可以处理递归对象,被不同地方多次引用的对象,以及用户定义的类和实例。其中,pickle有一个C语言实现的版本——cPickle,具有更高的效率,建议使用cPickle。
3. 虽然pickle提供非常强大的功能了,已经可以满足我们大部分的需求了,但是,人类的需求是无止境的,光序列化不行啊,只用 pickle 不能解决命名和查找 pickle 文件这样的问题,要是可以对序列化的对象提供管理功能,支持并发访问就好了。因此,人们发明了shelve模块,它是前两者的综合。shelve模块使用 anydbm模块寻找合适的DBM模块,然后使用cPickle来完成对象存储转换过程。shelve模块允许对数据库文件进行并发的读访问,但不允许共享读/写访问。
4. 还有一种方案,是在I ......
由subprocess创建一个进程,然后进行监视
每一秒钟查看一次,如果正在运行,打印pid和running,如果已停止,,继续执行任务并打印Termined
shell和stdout均设置为False
也许这对做病毒的守护进程很好
#!/usr/bin/env python
import subprocess , sys , time
p=subprocess.Popen(['ping','127.0.0.1','-n','10'], shell=False,stdout=False)
while 1:
time.sleep(1)
ret=subprocess.Popen.poll(p)
if ret is None:
print p.pid,"running"
else:
print "Termined!"
p=subprocess.Popen(['ping','127.0.0.1','-n','10'], shell=False,stdout=False)
......
一 安装ruby
$sudo apt-get install ruby irb rdoc
二 安装gem
1.到这里下载 ,最好是最新版本,我的1.3.5
解压,切换到当前目录,执行$sudo ruby setup.rb
或者这样:
$ tar xzvf rubygems-1.3.5.tgz (解压)
$ cd rubygems-1.3.5 (切换到此目录)
$ sudo ruby setup.rb
2.gem -v 检测
如果遇到一下错误
/usr/bin/gem:10: undefined method `manage_gems' for Gem:Module (NoMethodError)
就gem1.8 -v
或者执行此命令
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem (要确保你的ruby是1.8的,还要确保你装的地方,看自己而定)
后再尝试gem -v
三 安装rails
sudo gem install rails
四 安装mysql驱动
安装此驱动时要确保三个包已安装(libmysql-ruby1.8,libmysqlclient15-dev,ruby1.8-dev)
下载mysql-ruby-2.8.tar.gz ,
$ tar xvzf mysql-ruby-2.8.tar.gz
$ cd mysql-ruby-2.8
&nb ......
Take Equity Collection System as an example, Some other office collegues want to access it from home without VPN, The way to check is:
1. Check if it's limited in network, this needs to confirm with network people
2. If the step 1 passed, get the external IP address of the system, map the system to the domain name, such as Edgar.**.com. Then the domain should can be access from external. ......