2008年12月1日星期一

用户送礼流程

用户送礼流程:
1. 定时同步用户的最新礼品数据。 <-- ok
2. 用户点击礼品,弹出送礼窗口。
3. 在窗口中显示,送给 主持人... 礼品 ... 数量 为 1 。
4. 允许用户修改数量,最大为30。
5. 有一个选项,假如积分不足,则自动送能送的最大值。
6. 用户点击确认后,自动关闭当前窗口,发送私聊消息给主持人
?sys_gift_send?
JSON_Encode(gift:xxx, giftcount:xxx,giftid:xxx, auto:0/1)
?/sys_gift_send?

auto=1表示自动计算
auto=0表示不作计算,失败则返回。

7. 主持人收到后,发送请求给服务器,确认是否能成功送出礼物:
index.php?Controller=Chat&Action=sendGift&giftid=xxx&giftcount=xxx&auto=xxx&account=xxx
服务器返回的数据为
JSON_Encode(gift:xxx, giftcount:xxx,giftid:xxx,success:0/1,message:积分不足)
success=1表示成功,success=0表示失败

<-- ok

8. success=1成功
向所有在线用户广播 ?sys_top_message/? xxx 送给 xxx xxx ( x giftcount ) . 这个显示到头条。
向房间内所有用户广播:xxx 送给 xxx xxx 显示 giftcount 次数。

向用户发送私聊信息
?sys_gift_send_ack?
JSON_Encode(gift:xxx, giftcount:xxx,giftid:xxx,success:0/1,message:积分不足)
?/sys_gift_send_ack?
收到后,弹出提示信息。并且同时从服务器更新 profile(heartbeat)

9. success=0 失败
向原用户回复,失败。以及失败原因:message

向用户发送私聊信息
?sys_gift_send_ack?
JSON_Encode(gift:xxx, giftcount:xxx,giftid:xxx,success:0/1,message:积分不足)
?/sys_gift_send_ack?

收到后,弹出提示信息。并且同时从服务器更新 profile(heartbeat)

10. 下一个送礼循环

2008年11月30日星期日

各大型网站架构分析收集

http://blog.csdn.net/phphot/archive/2008/11/26/3383057.aspx

2008年11月23日星期日

Flex 的样式问题 tab Alert 等

http://www.cnblogs.com/taobataoma/archive/2008/01/13/1037060.html
-- Tab 的样式
http://www.nshen.net/blog/article.asp?id=552l
-- Alert 的样式定义

嵌入式操作系统

1. http://www.broncho.cn/
2. http://blog.csdn.net/cuijpus/archive/2008/06/15/2549803.aspx

个人版本的 xp ???

2008年11月10日星期一

Linux boots in 2.97 seconds

http://www.linuxdevices.com/news/NS5185504436.html

2008年11月7日星期五

开发你自己的XMPP IM

http://phoenixtoday.blogbus.com/logs/20285574.html

http://phoenixtoday.blogbus.com/logs/17878527.html

http://phoenixtoday.blogbus.com/logs/17246727.html


http://initiative.yo2.cn/archives/591950

2008年11月5日星期三

wapshop网站安装

1. 安装Apache日志截断程序cronolog
wget -c wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
tar -zxvf cronolog-1.6.2.tar.gz
cd cronolog-1.6.2
./configure --prefix=/usr/wapshop/install/cronolog
make
make install
2. 安装apache服务器,测试index.html
2.1 下载
wget -c http://apache.freelamp.com/httpd/httpd-2.2.9.tar.gz

2.2 解压缩,配置,编译,安装
tar -zxvf httpd-2.2.9.tar.gz
cd httpd-2.2.9
./configure \
--prefix=/usr/wapshop/install/apache2 \
--enable-so \
--enable-rewrite=static \
--enable-cache \
--enable-file-cache \
--enable-mem-cache \
--enable-disk-cache \
--enable-static-support \
--enable-static-htpasswd \
--enable-static-htdigest \
--enable-static-rotatelogs \
--enable-static-logresolve \
--enable-static-htdbm \
--enable-static-ab \
--enable-static-checkgid \
--disable-cgid \
--disable-cgi
========================================
编译配置说明
./configure //配置源代码树
--prefix=/usr/wapshop/install/apache2 //体系无关文件的顶级安装目录PREFIX ,也就Apache的安装目录。
--enable-so //打开 so 模块,so 模块是用来提 DSO 支持的 apache 核心模块
--enable-rewrite=static //打开rewrite 功能模块
--enable-mods-shared=all //编译全部的模板,对于不需要我们可以在httpd.conf去掉。这个选项打开可能会需要有更多的依赖库,在这里可以去掉
--enable-cache //支持缓存
--enable-file-cache //支持文件缓存
--enable-mem-cache //支持记忆缓存
--enable-disk-cache //支持磁盘缓存
--enable-static-support //支持静态连接(默认为动态连接)
--enable-static-htpasswd //使用静态连接编译 htpasswd - 管理用于基本认证的用户文件
--enable-static-htdigest //使用静态连接编译 htdigest - 管理用于摘要认证的用户文件
--enable-static-rotatelogs //使用静态连接编译 rotatelogs - 滚动 Apache 日志的管道日志程序
--enable-static-logresolve //使用静态连接编译 logresolve - 解析 Apache 日志中的IP地址为主机名
--enable-static-htdbm //使用静态连接编译 htdbm - 操作 DBM 密码数据库
--enable-static-ab //使用静态连接编译 ab - Apache HTTP 服务器性能测试工具
--enable-static-checkgid //使用静态连接编译 checkgid
--disable-cgid //禁止用一个外部 CGI 守护进程执行CGI脚本
--disable-cgi //禁止编译 CGI 版本的 PHP
--enable-ssl // 编译 ssl模块。这个选项打开可能需要更多的依赖库,在这里可以去掉
=============================
make
make install
2.3 配置apache2的端口和根目录
cd /usr/wapshop/install/apache2
cp conf/httpd.conf conf/httpd.conf.20081106
vi conf/httpd.conf
==========================================
Listen 80 --> Listen 8080 不过暂时使用80,因为需要映射该端口到10080

DirectoryIndex index.html --> DirectoryIndex index.php index.html

DocumentRoot "/usr/wapshop/install/apache2/htdocs" --> DocumentRoot "/usr/wapshop/htdocs"

Directory "/usr/wapshop/install/apache2/htdocs" --> Directory "/usr/wapshop/htdocs"
==========================================

2.4 配置cronolog日志截断程序
vi conf/httpd.conf
==========================================
CustomLog "logs/access_log" common
-->
CustomLog "|/usr/wapshop/install/cronolog/sbin/cronolog /usr/wapshop/install/apache2/logs/access_log.%Y%m%d" combined
==========================================
2.5 配置启动脚本
mkdir /usr/wapshop/install/init.d
cd /usr/wapshop/install/init.d
ln -s ../apache2/bin/apachectl apache2
启动命令: /usr/wapshop/install/init.d/apache2 start
关闭命令: /usr/wapshop/install/init.d/apache2 stop
2.6 测试服务器
mkdir /usr/wapshop/htdocs
vi /usr/wapshop/htdocs/index.html
===========================================
<html>
<head>
<title> test </title>
</head>
<body>
<h1>Test</h1>
</body>
</html>
===========================================
/usr/wapshop/install/init.d/apache2 start
wget http://127.0.0.1/index.html
cat index.html | grep -e "Test"

3. 安装mysql服务器
3.0 需要安装g++ 和 ncurse-devel
wget -c ftp://mirror.switch.ch/pool/3/mirror/centos/4.6/os/x86_64/CentOS/RPMS/gcc-c++-3.4.6-9.x86_64.rpm
wget -c ftp://mirror.switch.ch/pool/3/mirror/centos/4.6/os/x86_64/CentOS/RPMS/libstdc++-devel-3.4.6-9.x86_64.rpm
wget -c ftp://mirror.switch.ch/pool/3/mirror/centos/4.6/os/x86_64/CentOS/RPMS/libstdc++-3.4.6-9.x86_64.rpm

wget -c ftp://ftp.chg.ru/pub/Linux/scientific/41/x86_64/SL/RPMS/ncurses-devel-5.4-13.x86_64.rpm

rpm -i gcc-c++-3.4.6-9.x86_64.rpm libstdc++-devel-3.4.6-9.x86_64.rpm libstdc++-3.4.6-9.x86_64.rpm ncurses-devel-5.4-13.x86_64.rpm

3.1 为了避免对系统的干扰,需要注意修改端口号和相关的目录。
wget -c http://mysql.mirror.rafal.ca/Downloads/MySQL-5.0/mysql-5.0.67.tar.gz
cd /usr/wapshop/download/mysql-5.0.67
mkdir /usr/wapshop/install/mysql5
mkdir -p /usr/wapshop/var/lib/mysql5
./configure \
--prefix=/usr/wapshop/install/mysql5 \
--localstatedir=/usr/wapshop/var/lib/mysql5 \
--with-comment=Source \
--with-server-suffix=-Community \
--with-mysqld-user=mysql \
--without-debug \
--with-big-tables \
--with-charset=utf8 \
--with-collation=utf8_unicode_ci \
--with-extra-charsets=all \
--with-pthread \
--enable-static \
--enable-thread-safe-client \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--enable-assembler \
--without-innodb \
--without-ndb-debug

make
make install

cd /usr/wapshop/install/mysql5
groupadd mysql //添加 mysql 组
useradd -g mysql mysql //添加 mysql 用户
chown -R mysql .
chgrp -R mysql .
./bin/mysql_install_db --user=mysql
chown -R root .
chown -R mysql /usr/wapshop/var/lib/mysql5


cp share/mysql/my-huge.cnf .
vi my-huge.cnf
==========================================
port: 3306 --> 3307 两个地方
socket: /tmp/mysql.sock --> /tmp/mysqlwapshop.sock 两个地方
==========================================

cp share/mysql/mysql.server /usr/wapshop/install/init.d/mysqlwapshop
vi /usr/wapshop/install/init.d/mysqlwapshop
==========================================
datadir= --> datadir=/usr/wapshop/var/lib/mysql5
conf=/etc/my.cnf --> conf=/usr/wapshop/install/mysql5/my-huge.cnf
把"$bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &"替换为(双引号中的)
"$bindir/mysqld_safe --defaults-file=/usr/wapshop/install/mysql5/my-huge.cnf --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &"(双引号中的)
==========================================
chmod 755 /usr/wapshop/install/init.d/mysqlwapshop
//chkconfig --add mysqlwapshop <-- 暂时不用

3.2 启动数据库
/usr/wapshop/install/init.d/mysqlwapshop start
3.3 确认服务正常启动
netstat -an | grep -e "LISTEN"|grep -e "3307"
3.4 修改root用户密码
./bin/mysql -u root -S /tmp/mysqlwapshop.sock
======================================================
mysql> use mysql
mysql> update user set password=password('wapshop') where user='root';
mysql> FLUSH PRIVILEGES;
======================================================
3.5 停止数据库运行
/usr/wapshop/install/init.d/mysqlwapshop stop

4. 安装php环境,测试phpinfo.php
4.0 需要lib-xml2
wget -c ftp://ftp.pbone.net/mirror/www.startcom.org/AS-4.0.0/updates/x86_64/zlib-devel-1.2.1.2-1.2.x86_64.rpm
wget -c ftp://ftp.pbone.net/mirror/www.startcom.org/AS-4.0.0/os/x86_64/StartCom/RPMS/libxml2-devel-2.6.16-6.x86_64.rpm
rpm -i libxml2-devel-2.6.16-6.x86_64.rpm zlib-devel-1.2.1.2-1.2.x86_64.rpm

4.1 下载
wget -c http://cn.php.net/get/php-5.2.6.tar.gz/from/this/mirror
4.2 解压缩,编译,安装
tar -zxvf php-5.2.6.tar.gz
cd php-5.2.6
ln -sf libjpeg.so.62.0.0 libjpeg.so
ln -sf libpng.so.3.1.2.7 libpng.so

./configure \
--prefix=/usr/wapshop/install/php5 \
--with-apxs2=/usr/wapshop/install/apache2/bin/apxs \
--with-mysql=/usr/wapshop/install/mysql5 \
--disable-debug \
--with-zlib \
--enable-mbstring \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--enable-fastcgi \
--with-config-file-scan-dir=/usr/wapshop/install/php5/etc/php \
--with-mysqli=/usr/wapshop/install/mysql5/bin/mysql_config

make
make test
make install

mkdir -p /usr/wapshop/install/php5/etc/php
cp php.ini-dist /usr/wapshop/install/php5/etc/php/php.ini

4.3 整合php和apache2
#make install 会自动修改http.conf 加上 LoadModule php5_module modules/libphp5.so

只需要在最后一行加上:
AddType application/x-httpd-php .php

4.4 测试phpinfo()
/usr/wapshop/install/init.d/apache2 stop
/usr/wapshop/install/init.d/apache2 start
cd /usr/wapshop/htdocs/
vi index.php
=========================================
phpinfo();
?>
=========================================
需要确认有 gd 和 mysqli 的支持。