刚学python,学到了有关于类和对象的地方。对一个概念有点模糊,后来通过实践编码找到一定规律
在python中
class test(object):
id=2
name='tt' list=['tt','dd']
def change(self,newA,new_id):
self.id=new_id
self.age=new...
分类:
编程语言 时间:
2014-06-25 19:29:20
阅读次数:
267
mysql-5.5 for linux源码安装
1.使用Yum安装依赖软件包
# yum install -y gcc gcc-c++ gcc-g77 autoconf automake bison zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
2.安装cmake
# yum instal...
分类:
数据库 时间:
2014-06-24 23:45:46
阅读次数:
260
【问题】
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /.
Each operand may be an integer or another expression.
Some examples:
...
分类:
编程语言 时间:
2014-06-24 23:22:53
阅读次数:
331
Python中一切皆是对象,每个对象都可以有多个属性。Python是如何管理这些属性呢?我们来探讨一下。
属性的__dict__系统
对象的属性包含两部分:类属性和对象属性。对象的属性可能来自于其类的定义,叫做类属性。类属性可能来自于类的定义自身,也可能来自父类。一个对象的属性还可能是该对象实例定义的,叫做对象属性。
对象的属性存储在对象的__dict__属性中。__dict__为一...
分类:
编程语言 时间:
2014-06-24 21:03:01
阅读次数:
218
【问题】
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
【代码】
class Solution:
# @param s, a string
# @retu...
分类:
其他好文 时间:
2014-06-24 21:00:30
阅读次数:
168
1. 判断一文件是不是块或字符设备文件,如果是将其拷贝到 /dev 目录下
read -p "input a file:" filename
if [ -b $filename -o -c $filename ]
then
cp $filename /dev/
fi
2.编写一个脚本,进行简单的减法运算,要求提示输入变量
#!/bin/bash
read -...
分类:
系统相关 时间:
2014-06-24 20:59:09
阅读次数:
434
三种IPC被称作XSI IPC,分别是:
消息队列信号量共享存储器
下面分别介绍三种IPC的用法。
1、消息队列
消息队列是消息的链接表,具有如下函数接口:
msgget:创建一个新队列或打开一个现存的队列。msgsnd:将消息添加到队列尾端。msgrcv:从队列中取消息。
我们可以自行定义一个表示消息的结构体,它由类型字段和实际数据组成:
struct ...
分类:
系统相关 时间:
2014-06-24 20:45:32
阅读次数:
319
排序算法有不少,当然,一般的语言中都提供某个排序函数,比如Python中,对list进行排序,可以使用sorted(或者list.sort()),关于这方面的使用,在我的github代码库algorithm中有几个举例,有兴趣的看官可以去那里看看(顺便告知,我在Github中的账号是qiwsir,欢迎follow me)。但是,在某些情况下,语言中提供的排序方法或许不适合,必须选择某种排序算法。
...
分类:
其他好文 时间:
2014-06-24 18:33:33
阅读次数:
205
如果单纯只想在传输数据时加密传输,那么ssl证书是不需要认证的,但是浏览器打开时会有警告信息。假设我们做的不是一个公众产品那么也还好啦。
如下是今天学习时的一个笔记,其实我用的是真实环境。
环境:CentOS 64, 32bit;Apache 2.2.15;
1.检查apache是否安装了mod_ssl.so模块。
检查方法是查看是否在modules(/etc/httpd/modules/...
分类:
系统相关 时间:
2014-06-24 18:25:40
阅读次数:
278
一:勘误
classifier类中: def fprob(self, f, cat):
if self.catcount(cat) == 0:
return 0
#notice: rember change int to double or float
# + 0.0 or *1.0 is ok, other wise, may get 0.
return self.fc...
分类:
其他好文 时间:
2014-06-24 17:49:42
阅读次数:
211