Subversion svn配置

$ yum install svn #安装svn,如果是ubuntu,apt-get install subversion
$ svn #检查svn是否安装
$ cd /var/www/html/
$ mkdir test
$ cd /home
$ mkdir code
$ svnserve -d -r /home/code #启动svn服务
$ cd code
$ svnadmin create test
$ cd test
$ cd conf
$ vim svnserve.conf
#原来:
#anon-access = read
#auth-access = write
#password-db = passwd
#更改:
anon-access = none  #none不允许匿名访问
auth-access = write  #write允许授权读写
password-db = passwd

#新建post-commit提交svn自动同步文件
$ cd ../hooks/
$ vim post-commit
#修改
#!/bin/sh
REPOS="$1"
REV="$2"
export LANG=en_US.UTF-8
svn update /var/www/html/test--username super --password 123456 --no-auth-cache
$ chmod 755 post-commit
$ ./post-commit

#SVN强制写注释要求
$ vim pre-commit
#修改
#!/bin/sh
REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook

# check that logmessage contains at least 10 alphanumeric characters
LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c`
if [ "$LOGMSG" -lt 5 ];
then
echo -e "Empty log message not allowed. Commit aborted!" 1>&2
exit 1
fi

成功…得瑟!!!

遇到问题:
1.直接在服务器端vim修改代码,导致服务器端与客户端svn不同步。解决方案:rm -rf 服务器端文件,然后在客户端再提交一次该文件。

p.s.特别感谢何总帮助

opengl es drawing primitives

There are two API calls in OpenGL ES that can be used to draw primitives:
glDrawArrays and glDrawElements.

void glDrawArrays(GLenum mode, GLint first, GLsizei count)

mode

specifies the primitive to render. Valid values are:
GL_POINTS
GL_LINES
GL_LINE_STRIP
GL_LINE_LOOP
GL_TRIANGLES
GL_TRIANGLE_STRIP
GL_TRIANGLE_FAN
first

specifies the starting vertex index in the enabled vertex arrays
count

specifies the number of indices to be drawn

lamp | linux+apache+mysql+php配置

linux+apache+mysql+php配置:
1.apache

$ cd /home
$ mkdir super
$ wget http://labs.renren.com/apache-mirror/httpd/httpd-2.2.17.tar.gz
$ tar -zxvf httpd-2.2.17.tar.gz
$ cd httpd-2.2.17
$ ./configure --prefix=/usr/local/apache2 --enable-vhost-alias --enable-deflate --enable-rewrite --with-mpm=worker --enable-ssl
# --prefix=/usr/local/apache 设置安装位置
# --enable-so 让apache核心装载DSO
# --enable-rewrite 启用重写功能
$ make && make install //编译并且安装
$ /usr/local/apache2/bin/apachectl start //启动apache服务
$ vim /usr/local/apache2/conf/httpd.conf
# prefork和worker模式的配置

ServerLimit         2048
StartServers         100
MinSpareServers      50
MaxSpareServers      150
MaxClients          1000  # 设定的是 Apache可以同时处理的请求
MaxRequestsPerChild 10000

ServerLimit 30
ThreadLimit 64
StartServers 20
MaxClients 1024
MinSpareThreads 75
MaxSpareThreads 250
ThreadsPerChild 64
MaxRequestsPerChild 10000

$ /usr/local/apache2/bin/apachectl restart //重启apache服务

注:在编译安装apache之前需要安装apr、apr-util、zlib

配置文件httpd.conf在php模块下面加一句:AddType application/x-httpd-php .php //执行php文件格式

遇到问题:

$ vim /etc/resolv.conf
> nameserver 8.8.8.8

2.mysql

$ cd /home/super
$ wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.35.tar.gz
$ tar -zxvf mysql-mysql-5.5.35.tar.gz
$ cd mysql-5.5.35.tar.gz
$ groupadd mysql
$ useradd -g mysql mysql
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
$ make && make install
$ chown mysql.mysql /usr/local/mysql/ -R
#把你编译目录的一个脚本COPY过去
$ cp support-files/mysql.server /etc/init.d/mysqld
#增加一项新的服务
$ chkconfig --add mysqld
#启动mysql
$ /etc/rc.d/init.d/mysqld start

成功启动!!!

3.php

$ cd /home/super
$ wget  http://cn.php.net/get/php-5.2.9.tar.gz/from/cn2.php.net/mirror
$ tar -zxvf php-5.2.9.tar.gz
$ cd php-5.2.9
$ ./configure --prefix=/usr/local/php/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-mysqli --with-zlib-dir --with-zlib --enable-ftp --enable-mbstring --enable-sockets --enable-soap --enable-fpm --with-curl --with-libxml-dir=/usr/local/libxml2 --with-openssl --with-mcrypt
#如果是64位系统:增加 --libdir=/usr/lib64
#配置php、生成可编译文件
$ make && make install
$ cd /home/super/php-5.2.9
$ cp php.ini-development /usr/local/php/lib/php.ini
$ cd /usr/local/php/lib
$ vim php.ini
> register_globals = On
$ vi /usr/local/apache/conf/httpd.conf
#查找
#在此范围添加
> AddType application/x-httpd-php .php
> AddType application/x-httpd-php-source .phps
$ /usr/local/apache2/bin/apachectl restart #重启apache服务
$ cd /usr/local/apache2/htdocs
$ vim phpinfo.php
> <?php
> phpinfo();
> ?>;
#访问phpinfo.php尝试正常哈哈!
$ cd /usr/local/apache2/lib
$ vim http.conf
#更改php执行目录,将#DocumentRoot "/usr/local/apache2/htdocs"改为
> DocumentRoot "/var/www/html/"
#增加扩展虚拟主机配置
> Include conf/extra/httpd-vhosts*.conf
$ cd extra
$ vim http-vhosts-pma.conf
#添加扩展pma配置文件
DocumentRoot   "/var/www/html/phpMyAdmin"
ServerName pma.zhouchao.com
ServerAlias pma.chaoji.com
ServerAdmin zhouchao@qeeka.com
DirectoryIndex index.php index.html index.htm index.shtml
#       LogLevel debug
HostNameLookups off

Options Includes FollowSymLinks
AllowOverride all
Allow from all
#                        AuthName "Auth Name :"
#                        AuthType Basic
#                        AuthUserFile /etc/phphtaccess.pwd
#                        require valid-user
Order allow,deny

CustomLog "logs/access_pma.log" combined

遇到问题:
php编译报错:/usr/local/ssl/lib/libcrypto.a: could not read symbols: Bad value
解决方案:
重新编译openssl:./config no-shared -fPIC

4.mcrypt //加密算法扩展库

$ wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download
$ tar -zxvf libmcrypt-2.5.8.tar.gz
$ cd libmcrypt-2.5.8
$ ./configure
$ make && make install

遇到问题:
进去phpMyAdmin时,缺少:mcrypt
然后再重新编译PHP,加上编译参数:–with-mcrypt
测试下是否编译成功:
$ /usr/local/php/bin/php -m | grep mcrypt
mcrypt
别忘了重新启动apache!!!!

5.phpmyadmin

$ cd /home/super
$ wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.3.9.2/phpMyAdmin-3.3.9.2-all-languages.tar.gz?r=http%3A%2F%2Fwww.phpmyadmin.net%2Fhome_page%2Fdownloads.php&ts=1298912166&use_mirror=ncu
$ tar -zxvf phpMyAdmin-3.3.9.2-all-languages.tar.gz
$ mkdir -p /var/www/html
$ mv phpMyAdmin-3.3.9.2-all-languages /var/www/html/phpMyAdmin
$ cd !$
$ cp -a config.sample.inc.php config.inc.php
#找到 /libraries/config.default.php文件(config.default.php复制到phpmyadmin目录下,然后更名为 config.inc.php)

遇到问题:
(1)配置好apache虚拟主机后若出现Wrong permissions on configuration file, should not be world writable! 则需要修改权限 chmod 755 config.* ;chmod 755 libraries/config.default.php
(2)若出现:配置文件现在需要绝密的短语密码(blowfish_secret) 要改配置文件里的:$cfg['blowfish_secret'] = ‘ ‘; 单引号里面随便写个数
(3)pma无法登陆,要在mysql中root用户授权(默认密码为空)#GRANT ALL PRIVILEGES ON *.* TO root@’localhost’ IDENTIFIED BY ’123456′;

php函数unserialize反序列化编码问题

有些时候由于序列化的编码问题,当反序列化时会出现retun false的情况,该情况的解决方案:


//UTF-8

function mb_unserialize($serial_str) {

$serial_str = str_replace("\r", "", $serial_str);
$serial_str = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $serial_str );

return unserialize($serial_str);

}

//ASC

function asc_unserialize($serial_str) {

$serial_str = str_replace("\r", "", $serial_str);
$serial_str = preg_replace('!s:(\d+):"(.*?)";!se', '"s:".strlen("$2").":\"$2\";"', $serial_str );

return unserialize($serial_str);

}

情人节晚餐

PHP 加密 & JS 解密

<?php
if(!function_exists(jm)){
function jm($str){
$len = strlen($str);
for($i=0;$i<$len;$i++){
$ascc=ord($str[$i]);
if($ascc<128){
$ascc=$ascc^7;
}
$res.=chr($ascc);
}
return $res;
}//end function
}
echo "<script>
xflag=true;
function xcount(xh){
if(!xflag) return;
var xc=\"\",xd=new Array(),xe=\"\",xf=0;
for(i=0;i<xh.length;i++){
xa=xh.charCodeAt(i);
if(xa<128)xa=xa^7;
xe+=String.fromCharCode(xa);
if(xe.length>80){
xd[xf++]=xe;xe=\"\";
}
}
xc=xd.join(\"\")+xe;
document.write(xc);
}</script>";
$check_count = addslashes(jm("<script>alert('测试咯~~~');</script>"));
$check_count="<SCRIPT LANGUAGE=\"JavaScript\">xcount(\"$check_count\");</SCRIPT>";
echo "$check_count";
echo "<!-- count ended -->";

<?php
if(!function_exists(jm)){
    function jm($str){
        $len = strlen($str);
        for($i=0;$i<$len;$i++){
            $ascc=ord($str[$i]);
            if($ascc<128){ $ascc=$ascc^7; }
            $res.=chr($ascc);
        } return $res;
     }//end function
}
echo "<script>xflag=true;function xcount(xh){ if(!xflag) return; var xc=\"\",xd=new Array(),xe=\"\",xf=0; for(i=0;i<xh.length;i++){ xa=xh.charCodeAt(i); if(xa<128)xa=xa^7; xe+=String.fromCharCode(xa); if(xe.length>80){ xd[xf++]=xe;xe=\"\"; } } xc=xd.join(\"\")+xe; document.write(xc);}</script>";

$check_count = addslashes(jm("<script>alert('测试咯~~~');</script>"));
$check_count="<SCRIPT LANGUAGE=\"JavaScript\">xcount(\"$check_count\");</SCRIPT>";
echo "$check_count";
echo "<!-- count ended -->";

有趣的三个php函数(&字符的引用调用)

&运算符置于函数name前,调用它返回函数的引用,而函数本身即$functionname不会在内存中消失
它和变量是一致的~

//第一个:
function   &strAppOne()   {
static   $v   =   0;
$v++;
echo   $v.nl2br("\n");
return   $v;
}
strAppOne();
$b   =&   strAppOne();
$b   +=   10;
strAppOne();

//第二个:
function   &strAppTwo()   {
static   $v   =   0;
$v++;
echo   $v.nl2br("\n");
return   $v;
}
strAppTwo();
$b   =   strAppTwo();
$b   +=   10;
strAppTwo();

//第三个:
function   strAppThree()   {
static   $v   =   0;
$v++;
echo   $v.nl2br("\n");
return   $v;
}
strAppThree();
$b  =  & strAppThree();
$b   +=   10;
strAppThree();

『超吉』战场正式开放啦!!!

恭喜『超吉』战场开张大吉,以后这里就可以放些技术文档、技术经验、心情故事了哈哈。

第 5 页,共 5 页12345