Unknown: It is not safe to rely on the system's timezone settings.

Ansible 回复了问题 1 人关注 1 个回复 3265 次浏览 2015-06-18 10:11 来自相关话题

configure: error: mysql configure failed. Please check config.log for more information

空心菜 回复了问题 1 人关注 1 个回复 4488 次浏览 2015-06-17 14:44 来自相关话题

pip install error: command ‘gcc’ failed with exit status 1

空心菜 回复了问题 1 人关注 1 个回复 4531 次浏览 2015-06-17 14:25 来自相关话题

sh: phpize: command not found ERROR: `phpize' failed

OpenSkill 发表了文章 0 个评论 5886 次浏览 2015-06-16 21:26 来自相关话题

[root@cjlx src]# pecl install SeasLog WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pe ...查看全部
[root@cjlx src]# pecl install SeasLog
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading SeasLog-1.1.8.tgz ...
Starting to download SeasLog-1.1.8.tgz (48,686 bytes)
.............done: 48,686 bytes
21 source files, building
running: phpize
sh: phpize: command not found
ERROR: `phpize' failed
Centos 解决如下:
# yum install php-devel

python中xrange和range的异同

OpenSkill 发表了文章 0 个评论 3461 次浏览 2015-06-15 00:48 来自相关话题

range函数说明:range([start,] stop[, step]),根据start与stop指定的范围以及step设定的步长,生成一个序列。range示例: ...查看全部

range

函数说明:range([start,] stop[, step]),根据start与stop指定的范围以及step设定的步长,生成一个序列。
range示例:

>>> range(5) 
[0, 1, 2, 3, 4]
[quote]>> range(1,5)
[1, 2, 3, 4]
>>> range(0,6,2)
[0, 2, 4]

xrange

函数说明:用法与range完全相同,所不同的是生成的不是一个数组,而是一个生成器。


xrange示例:


>>> xrange(5)
xrange(5)
>>> list(xrange(5))
[0, 1, 2, 3, 4]
>>> xrange(1,5)
xrange(1, 5)
>>> list(xrange(1,5))
[1, 2, 3, 4]
>>> xrange(0,6,2)
xrange(0, 6, 2)
>>> list(xrange(0,6,2))
[0, 2, 4]

由上面的示例可以知道:要生成很大的数字序列的时候,用xrange会比range性能优很多,因为不需要一上来就开辟一块很大的内存空间,这两个基本上都是在循环的时候用:


for i in range(0, 100): 
print i
for i in xrange(0, 100):
print i

这两个输出的结果都是一样的,实际上有很多不同,range会直接生成一个list对象:


a = range(0,100) 
print type(a)
print a
print a[0], a[1]

输出结果:


<type 'list'>
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]
0 1

而xrange则不会直接生成一个list,而是每次调用返回其中的一个值:


a = xrange(0,100) 
print type(a)
print a
print a[0], a[1]

输出结果:


<type 'xrange'>
xrange(100)
0 1

Centos下php5.4 编译常见错误解决

OpenSkill 发表了文章 0 个评论 3684 次浏览 2015-06-12 17:45 来自相关话题

configure: error: xml2-config not found. Please check your libxml2 installation. yum install libxml2-devel con ...查看全部
configure: error: xml2-config not found. Please check your libxml2 installation.
yum install libxml2-devel

configure: error: Cannot find OpenSSL’s
yum install openssl-devel

configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/
yum install curl-devel

configure: error: libjpeg.(a|so) not found
yum install libjpeg-devel

configure: error: libpng.(a|so) not found.
yum install libpng-devel

configure: error: libXpm.(a|so) not found.
yum install libXpm-devel

configure: error: freetype.h not found.
yum install freetype-devel

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
yum install libc-client-devel

configure: error: mcrypt.h not found. Please reinstall libmcrypt.
yum install libmcrypt-devel

configure: error: Please reinstall libmhash – I cannot find mhash.h
yum install mhash-devel

configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
yum install mysql-devel

configure: error: Please reinstall ming distribution. libming.(a|so) not found
[list]
[*]temp remove the config for ‘–with-ming=/opt/ming/’[/*]
[/list]
configure: error: Cannot find pspell
yum install pspell-devel

configure: error: cannot find mm library
Download from http://www.ossp.org/pkg/lib/mm/
wget ftp://ftp.ossp.org/pkg/lib/mm/mm-1.4.2.tar.gz
Extract it: tar -zxvf mm-1.4.2.tar.gz
./configure
make
make install

configure: error: Cannot find libtidy
yum install libtidy-devel
yum install libtidy
change path at configure: ‘–with-tidy=/usr’

configure: error: not found. Please reinstall the expat distribution.
yum install expat-devel

configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
yum install libxslt-devel

PHP随机生成token

OpenSkill 发表了文章 0 个评论 5786 次浏览 2015-06-12 16:33 来自相关话题

使用token的方式,可以控制用户在这个时间内的权限,代码如下: ...查看全部
使用token的方式,可以控制用户在这个时间内的权限,代码如下:

	function genToken( $len = 32, $md5 = true ) {
# Seed random number generator
# Only needed for PHP versions prior to 4.2
mt_srand( (double)microtime()*1000000 );
# Array of characters, adjust as desired
$chars = array(
'Q', '@', '8', 'y', '%', '^', '5', 'Z', '(', 'G', '_', 'O', '`',
'S', '-', 'N', '<', 'D', '{', '}', '[', ']', 'h', ';', 'W', '.',
'/', '|', ':', '1', 'E', 'L', '4', '&', '6', '7', '#', '9', 'a',
'A', 'b', 'B', '~', 'C', 'd', '>', 'e', '2', 'f', 'P', 'g', ')',
'?', 'H', 'i', 'X', 'U', 'J', 'k', 'r', 'l', '3', 't', 'M', 'n',
'=', 'o', '+', 'p', 'F', 'q', '!', 'K', 'R', 's', 'c', 'm', 'T',
'v', 'j', 'u', 'V', 'w', ',', 'x', 'I', '$', 'Y', 'z', '*'
);
# Array indice friendly number of chars;
$numChars = count($chars) - 1; $token = '';
# Create random token at the specified length
for ( $i=0; $i<$len; $i++ )
$token .= $chars[ mt_rand(0, $numChars) ];
# Should token be run through md5?
if ( $md5 ) {
# Number of 32 char chunks
$chunks = ceil( strlen($token) / 32 ); $md5token = '';
# Run each chunk through md5
for ( $i=1; $i<=$chunks; $i++ )
$md5token .= md5( substr($token, $i * 32 - 32, 32) );
# Trim the token
$token = substr($md5token, 0, $len);
} return $token;
}
//生成的32位随机数
echo genToken()
?>