Friday, December 28, 2007

MySQL优化实例

引用来源
在Apache, PHP, MySQL的体系架构中,MySQL对于性能的影响最大,也是关键的核心部分。对于Discuz!论坛程序也是如此,MySQL的设置是否合理优化,直接影响到论坛的速度和承载量!同时,MySQL也是优化难度最大的一个部分,不但需要理解一些MySQL专业知识,同时还需要长时间的观察统计并且根据经验进行判断,然后设置合理的参数。

下面我们了解一下MySQL优化的一些基础,MySQL的优化我分为两个部分,一是服务器物理硬件的优化;二是MySQL自身(my.cnf)的优化。

(1) 服务器硬件对MySQL性能的影响

a) 磁盘寻道能力(磁盘I/O),以目前高转速SCSI硬盘(7200转/秒)为例,这种硬盘理论上每秒寻道7200次,这是物理特性决定的,没有办法改变。 MySQL每秒钟都在进行大量、复杂的查询操作,对磁盘的读写量可想而知。所以,通常认为磁盘I/O是制约MySQL性能的最大因素之一,对于日均访问量在100万PV以上的Discuz!论坛,由于磁盘I/O的制约,MySQL的性能会非常低下!解决这一制约因素可以考虑以下几种解决方案:

使用RAID-0+1磁盘阵列,注意不要尝试使用RAID-5,MySQL在RAID-5磁盘阵列上的效率不会像你期待的那样快; 抛弃传统的硬盘,使用速度更快的闪存式存储设备。经过Discuz!公司技术工程的测试,使用闪存式存储设备可比传统硬盘速度高出6-10倍左右。

b) CPU 对于MySQL应用,推荐使用S.M.P.架构的多路对称CPU,例如:可以使用两颗Intel Xeon 3.6GHz的CPU。

c) 物理内存对于一台使用MySQL的Database Server来说,服务器内存建议不要小于2GB,推荐使用4GB以上的物理内存。

(2) MySQL自身因素当解决了上述服务器硬件制约因素后,让我们看看MySQL自身的优化是如何操作的。对MySQL自身的优化主要是对其配置文件my.cnf中的各项参数进行优化调整。下面我们介绍一些对性能影响较大的参数。

由于my.cnf文件的优化设置是与服务器硬件配置息息相关的,因而我们指定一个假想的服务器硬件环境:

CPU: 2颗Intel Xeon 2.4GHz

内存: 4GB DDR

硬盘: SCSI 73GB


下面,我们根据以上硬件配置结合一份已经优化好的my.cnf进行说明:

# vi /etc/my.cnf

以下只列出my.cnf文件中[mysqld]段落中的内容,其他段落内容对MySQL运行性能影响甚微,因而姑且忽略。

[mysqld]
port = 3306
serverid = 1
socket = /tmp/mysql.sock
skip-locking
# 避免MySQL的外部锁定,减少出错几率增强稳定性。
skip-name-resolve


禁止MySQL对外部连接进行DNS解析,使用这一选项可以消除MySQL进行DNS解析的时间。但需要注意,如果开启该选项,则所有远程主机连接授权都要使用IP地址方式,否则MySQL将无法正常处理连接请求!

back_log = 384

指定MySQL可能的连接数量。当MySQL主线程在很短的时间内接收到非常多的连接请求,该参数生效,主线程花费很短的时间检查连接并且启动一个新线程。

back_log参数的值指出在MySQL暂时停止响应新请求之前的短时间内多少个请求可以被存在堆栈中。如果系统在一个短时间内有很多连接,则需要增大该参数的值,该参数值指定到来的TCP/IP连接的侦听队列的大小。不同的操作系统在这个队列大小上有它自己的限制。

试图设定back_log高于你的操作系统的限制将是无效的。默认值为50。对于Linux系统推荐设置为小于512的整数。

key_buffer_size = 256M
# key_buffer_size指定用于索引的缓冲区大小,增加它可得到更好的索引处理性能。


对于内存在4GB左右的服务器该参数可设置为256M或384M。
注意:该参数值设置的过大反而会是服务器整体效率降低!

max_allowed_packet = 4M
thread_stack = 256K
table_cache = 128K
sort_buffer_size = 6M


查询排序时所能使用的缓冲区大小。注意:该参数对应的分配内存是每连接独占!如果有100个连接,那么实际分配的总共排序缓冲区大小为100 × 6 = 600MB。所以,对于内存在4GB左右的服务器推荐设置为6-8M。

read_buffer_size = 4M

读查询操作所能使用的缓冲区大小。和sort_buffer_size一样,该参数对应的分配内存也是每连接独享!

join_buffer_size = 8M

联合查询操作所能使用的缓冲区大小,和sort_buffer_size一样,该参数对应的分配内存也是每连接独享!

myisam_sort_buffer_size = 64M
table_cache = 512
thread_cache_size = 64
query_cache_size = 64M


指定MySQL查询缓冲区的大小。可以通过在MySQL控制台执行以下命令观察:

# > SHOW VARIABLES LIKE '%query_cache%';
# > SHOW STATUS LIKE 'Qcache%';
# 如果Qcache_lowmem_prunes的值非常大,则表明经常出现缓冲不够的情况;


如果Qcache_hits的值非常大,则表明查询缓冲使用非常频繁,如果该值较小反而会影响效率,那么可以考虑不用查询缓冲;Qcache_free_blocks,如果该值非常大,则表明缓冲区中碎片很多。

tmp_table_size = 256M
max_connections = 768

指定MySQL允许的最大连接进程数。如果在访问论坛时经常出现Too Many Connections的错误提 示,则需要增大该参数值。

max_connect_errors = 10000000
wait_timeout = 10


指定一个请求的最大连接时间,对于4GB左右内存的服务器可以设置为5-10。

thread_concurrency = 8

该参数取值为服务器逻辑CPU数量×2,在本例中,服务器有2颗物理CPU,而每颗物理CPU又支持H.T超线程,所以实际取值为4 × 2 = 8

skip-networking

开启该选项可以彻底关闭MySQL的TCP/IP连接方式,如果WEB服务器是以远程连接的方式访问MySQL数据库服务器则不要开启该选项!否则将无法正常连接!

links for 2007-12-28

Wednesday, December 26, 2007

JS字符截取




Tuesday, December 25, 2007

PHP控制浏览器缓存的方法


//下面的语句设置此页面的过期时间(用格林威治时间表示),只要是已经过去的日期即可。
header("Expires: Mon, 26 Jul 1970 05:00:00 GMT");
//下面的语句设置此页面的最后更新日期(用格林威治时间表示)为当天,可以强迫浏览器获取最新资料
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
//告诉客户端浏览器不使用缓存,HTTP 1.1 协议
header("Cache-Control: no-cache, must-revalidate");
//告诉客户端浏览器不使用缓存,兼容HTTP 1.0 协议
header("Pragma: no-cache");

Sunday, December 23, 2007

Paangood tech co. ?

最近感觉盘古网络,就是我现在用的主机空间,非常垃圾,不是一般的烂,速度其慢,我想可能是服务器资源分配不均衡导致,这是500¥一年的合租空间,不稳定,没有DreamHost的好,真的差很多。我怀疑在国外根本不可能访问到我的站点,导致最近我的Google Adsense点击几乎为0,所以我还是打算在年初想办法转换到国外的空间,原来在DH上的一年文件和网页没有及时拷贝回本地,真的是遗憾。

Tuesday, December 18, 2007

spreadsheet_excel_writer utf8 bug

here is a PEAR scodeadsheet_excel_writer bug report, if you use utf8 with scodeadsheet_excel_writer, you will get some error when you export excel files, that's all.

I get some error today, but you can use some patch on scodeadsheet_excel_writer, such as this one.

I think Gentoo is really good ;)

Monday, December 17, 2007

PHP 动态调用函数


/**
* $Id$
* Author: zhuzhu@perlchina.org (zhuzhu@isoshu.net)
*/
class Manage
{
var $todo = null;

public function route()
{
$action = &$_GET['action'];
switch($action){
case 'login':
$this->todo = '_login';
break;
case 'build_site':
$this->todo = '_build_site';
break;
case 'system';
$this->todo = '_system';
break;
default:
$this->todo = '_index';
break;
}
$myFun = $this->todo; // 动态调用函数
$this->{$myFun}();
}

private function _index()
{
print 'hi';
}
}

?>

Sunday, December 16, 2007

ubuntu laptop stop auto upgrade

yes, I stop to auto upgrade my ubuntu laptop. upgrade by hand from now on. I use ubuntu 6.06.
But I will use Linux forever. ;)

Tuesday, December 11, 2007

RHEL AS5 通过yum update自动升级

1.下载并安装yum-2.4.0-1.centos4.noarch.rpm文件,下载地址为:
ftp://ftp.pbone.net/mirror/ftp.centos.org/5.0/os/i386/CentOS/yum-cron-0.1-1.el5.centos.noarch.rpm

2.修改或建立/etc/yum.repos.d/rhel-debuginfo.repo为如下内容:
[base]
name=Red Hat Enterprise Linux $releasever -Base
baseurl=http://ftp.riken.jp/Linux/caos/centos/5.0/os/$basearch/
gpgcheck=1
[update]
name=Red Hat Enterprise Linux $releasever -Updates
baseurl=http://ftp.riken.jp/Linux/caos/centos/5.0/updates/$basearch/
gpgcheck=1
[extras]
name=Red Hat Enterprise Linux $releasever -Extras
baseurl=http://ftp.riken.jp/Linux/caos/centos/5.0/extras/$basearch/
gpgcheck=1
[addons]
name=Red Hat Enterprise Linux $releasever -Addons
baseurl=http://ftp.riken.jp/Linux/caos/centos/5.0/addons/$basearch/
gpgcheck=1


3.修改或建立/etc/yum.repos.d/dag.repo为如下内容:

[dag]
name=Dag RPM Repository for RHEL5
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el5/en/$basearch/dag/
enabled=1
gpgcheck=1
gpgkey=http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt



4.运行update:

yum update

5.升级:
yum upgrade

6.安装其它软件,例如:
yum install mplayer

Friday, December 7, 2007

cakephp session manually

Into the Controller::beforeFilter for example
$this->Session->activate();

And into the Views before you need it
$session->activate();

Saturday, December 1, 2007

web.py with fastcgi on Apache

我们为您准备了这个文档来帮助您快速的使用web.py

你可以在windows平台使用putty,UNIX则需要使用SSH.
你的用户需要有使用shell的权限,这个可以在用户控制面板中进行设置
在评论页可以看到更多的信息

目录

1.架设 web.py
1.1 CGI
1.1.1 0. 开始
1.1.2 1. 安装 web.py
1.1.3 2. 安装 Flup
1.1.4 3. 使用 Apache 服务
1.1.5 4. 检查并发现错误
1.2 FCGI
1.2.1 Benchmarking
1.2.2 重启 FASTCGI
1.2.3 改进稳定性和加快启动速度

架设 web.py

CGI
如果您按照我们的步骤来,那么架设CGI将是一件十分容易的事情.在下面的示例代码中,将example.com替换成您自己映射在dreamhost的域名.

0. 开始

进入到您的web主目录.

cd ~/example.com


1.安装web.py

使用Subversion命令行代码工具来获取最新的web.py

svn co http://webpy.org/svn/trunk/web/

按照如下方式来建立一个index.cgi,这将是您的第一个web.py网页

#!/usr/bin/env python2.4
import web
urls = ('/', 'index')
class index:
def GET(self):
print "Hi web.py, finally we meet!"
def runfcgi_apache(func):
web.wsgi.runfcgi(func, None)
if __name__ == "__main__":
web.wsgi.runwsgi = runfcgi_apache
web.run(urls, globals())


将该文件上传到web主目录后,使用如下的命令来使该文件可访问

chmod +x index.cgi


2.安装Flup

使用wget命令来获取最新的fcgi

wget http://svn.saddi.com/py-lib/trunk/fcgi.py

按照如下提示修改web/wsgi.py

--- wsgi.py (revision 130)
+++ wsgi.py (working copy)
@@ -13,8 +13,8 @@

def runfcgi(func, addr=('localhost', 8000)):
"""Runs a WSGI function as a FastCGI server."""
- import flup.server.fcgi as flups
- return flups.WSGIServer(func, multiplexed=True, bindAddress=addr).run()
+ import fcgi as flups
+ return flups.WSGIServer(func, multiplexed=False, bindAddress=addr).run()


(译者注:使用++的内容替换掉--的内容)

3.使用apache的服务

编辑apache的.htaccess文件来启用cgi

vim .htaccess

添加如下代码

Options +ExecCGI
AddHandler cgi-script .py

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.cgi/$1 [L]



4.检查并发现错误
现在,你的web主目录应该是这个样子

$ ls -F ~/example.com
fcgi.py index.cgi* web/


使用你的浏览器访问http://example.com/(您自己映射在dreamhost的域名),应该就可以看到问候语.如果浏览器显示"500内部错误",那就应该检查下错误日志.

tail -n 30 ~/logs/example.com/http/error.log


(译者注:上面的内容足够成功运行web.py了,下面的内容我也还没有进行,所以仅供参考)

FCGI
1.使用FastCGI架设您的域名或二级域名.假设您的域名是todo.dabase.com
2.cd; rmdir ~/todo.dabase.com
3.svn co http://svn.natalian.org/projects/todo/
4.ln -s ~/todo ~/todo.dabase.com
5.Tweak ~/todo with your mysql db (see config.py) and email stuff for errors
并不建议您在shell下进行fcgi的测试开发,因为如果fastcgi的进程开始运行后,停止或重启这个进程都是一件让人头痛的事情.您可以使用web.reloader在本地进行开发,这样,您的任何改变将立即被反应到您的web程序.

Benchmarking

ab is from the apache2-utils Debian package.
从apache2-utils Debian包中找到ab组件

/usr/sbin/ab -c 4 -n 300 http://todo.dabase.com/

4 concurrent connections pushing out 300 requests. If you find it too slow, considering running lighttpd on a dedicated server.
4个并发连接将产生300个请求.如果你发现它运行太慢,请考虑在一台专用服务器上运行lighttpd.

重启FastCGI进程

为了使新的代码起作用,你需要重启fcgi进程.
如下代码将会起作用

killall python2.4



改进稳定性和加快启动速度

1.使用http://svn.saddi.com/py-lib/trunk/fcgi.py来代替较新的flup
2.按照如下方法修改wsgi.py

--- wsgi.py (revision 130)
+++ wsgi.py (working copy)
@@ -13,8 +13,8 @@

def runfcgi(func, addr=('localhost', 8000)):
"""Runs a WSGI function as a FastCGI server."""
- import flup.server.fcgi as flups
- return flups.WSGIServer(func, multiplexed=True, bindAddress=addr).run()
+ import fcgi as flups
+ return flups.WSGIServer(func, multiplexed=False, bindAddress=addr).run()

Friday, November 30, 2007

PHP6的新特性和更新

1.支持Unicode
支持Unicode是有其必然,虽然Unicode占用较多的空间,但Unicode带来
的便利性,远超过占用空间的缺点,尤其在国际化的今天,硬件设备越来
越强大,网速也大幅度的提升,这么一点小小的缺点是可以忽略的。另外
一点,PHP也可以在.ini文件中设定是否开启支持Unicode,决定权在你自己,
这是一个不错的点子,关掉Unicode的支持,PHP的性能并不会有大幅度的
提升,主要的影响在于需要引用字符串的函数。

2.Register Globals 将被移除
这是一个重要的决定,说多新进的PHP开发者会觉得Register Globals满
方便的,但是却忽略了Register Globals会带来程序上安全性的隐患,大
多数的主机上此项功能是关闭的,印象中从PHP4.3.x版开始时,此项默认
设置值即是关闭状态,PHP6正式移除Register Globals也代表着如果程序
是由PHP3时代的产物,将完全无法使用,除了改写一途外,别无他法。相
信现在的PHP世界里,仍使用PHP3时代所产生的程序应该是少之又少。

3.Magic Quotes 将消失
Magic Quotes主要是自动转义需要转义的字符,此项功能移除叶符合大多
数PHP开发者的心声。

4.Safe Mode 取消
老实说,这个模式不知道哪里不好,取消就取消吧,反正也用不到

5.'var' 别名为 'public'
在类中的var声明变成public的别名,相信是为了兼容PHP5而作的决定,
PHP6现在也可以称作为OO语言了。

6.通过引用返回将出错
现在透过引用返回编译器将会报错 例如$a =& new b()、function &c(),
OO语言默认就是引用,所以不需要再使用&了。

7.zend.ze1 compatbility mode 将被移去 Zend.ze1相容模式将被移去
PHP5是为兼容旧有PHP4,所以在.ini中可选择是否
开启相容模式,原因在于PHP5使用的是第二代解析引擎,但是相容模式并不是百
分之百能解析PHP4语法,所以旧时代的产物,移除。

8.Freetype 1 and GD 1 support 将不见
这两个是很久的Libs,所以不再支持,GD1早已被现在的GD2取代了。

9.dl() 被移到 SAPI 中
dl()主要是让设计师加载extension Libs,现在被移到 SAPI 中

10.Register Long Array 去除
从PHP5起默认是关闭,再PHP6中正式移除。

11.一些Extension的变更
例如 XMLReader 和 XMLWriter 将不再是以Extension的方式出现,他们将被移入
到PHP的核心之中,并且默认是开启,ereg extension将被放入PECL,代表着它将
被移出PHP核心,这也是为了让路给新的正则表达式extension,
此外,Fileinfo extension 也将被导入PHP的核心之中。

12.APC将被导入核心
这是一个提高PHP性能的功能,现在它将被放入PHP核心中,并且可以选择是否启用APC

13.告别ASP风格的起始标签
原来是为了取悦ASP开发者转向使用PHP,现今已经不再需要这种做法了,

最后,别期望PHP6的性能可以全面超过PHP5,有可能的是PHP6的执行效率会比
PHP5还要来的慢的,但是可以预期的是,PHP开发小组将会努力的完善PHP5,超
越PHP5。
那么,对PHP6有兴趣的朋友现在可以到PHP官方网站上下载,试试这些功能是否真的已经
在PHP6中体现出来了,下载地址http://snaps.php.net/

Wednesday, November 21, 2007

Centos libstdc++.so.5

CentOS libstdc++.so.5 可以这样安装:
sudo yum install compat-libstdc++-33.i386

Tuesday, November 20, 2007

Oracle Startup Script


#!/bin/sh
#
# dbora This scripts starts and shuts down the
# oracle database
#
# chkconfig: 345 99 10
# description: This script calls the dbstart script
# to start Oracle
# and dbshut to stop it
# processname: oracle*
# config: /etc/oratab
#
# Set ORACLE_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORACLE_HOME.
export ORACLE_BASE=/opt/oracle10
export ORACLE_HOME=/opt/oracle10
export ORACLE_SID=DSSDB
ORACLE_HOME=/opt/oracle10
ORA_OWNER=oracle
if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
su $ORA_OWNER -c $ORACLE_HOME/bin/dbstart &
su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start" &
;;
'stop')
su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop " &
su $ORA_OWNER -c $ORACLE_HOME/bin/dbshut &
;;
'restart')
su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop " &
su $ORA_OWNER -c $ORACLE_HOME/bin/dbshut &
sleep 15
su $ORA_OWNER -c $ORACLE_HOME/bin/dbstart &
su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start " &
;;
esac

Friday, November 16, 2007

Centos Yum 国内配置文件


#
# /etc/yum.conf
[main]
gpgcheck=1
verbose = 0
socket_timeout = 3
enabled = 1
baseurl=http://mirror.be10.com/centos/4.5/os/$basearch/
hostfilepath = /var/cache/yum/timedhosts.txt
maxhostfileage = 1

Thursday, November 8, 2007

cakephp and me

最近一段时间一直在用cakephp做开发,每天都在看api,虽然有点问题找不到,但是连上IRC却可以很好的解决,有什么不好呢?IRC上面有很多热心的人为你解答问题,不过最重要的还是自己努力和谦虚。所以我想把自己这段时间的学习慢慢写到blog上来,最近也在看zendframework,感觉有些复杂,小型项目没有多大用处,不过想要从小的项目发展到大项目我想一开始就用zendframework也是一个不错的选择。

Monday, November 5, 2007

40 Tips for optimizing your php Code


  1. If a method can be static, declare it static. Speed improvement is by a factor of 4.


  2. echo is faster than print.

  3. Use echo's multiple parameters instead of string concatenation.


  4. Set the maxvalue for your for-loops before and not in the loop.

  5. Unset your variables to free memory, especially large arrays.

  6. Avoid magic like __get, __set, __autoload

  7. require_once() is expensive

  8. Use full paths in includes and requires, less time spent on resolving the OS paths.

  9. If you need to find out the time when the script started executing, $_SERVER[’REQUEST_TIME’] is codeferred to time()


  10. See if you can use strncasecmp, strpbrk and stripos instead of regex

  11. str_replace is faster than codeg_replace, but strtr is faster than str_replace by a factor of 4


  12. If the function, such as string replacement function, accepts both arrays and single characters as arguments, and if your argument list is not too long, consider writing a few redundant replacement statements, passing one character at a time, instead of one line of code that accepts arrays as search and replace arguments.

  13. It's better to use select statements than multi if, else if, statements.

  14. Error supcodession with @ is very slow.

  15. Turn on apache's mod_deflate

  16. Close your database connections when you're done with them

  17. $row[’id’] is 7 times faster than $row[id]

  18. Error messages are expensive

  19. Do not use functions inside of for loop, such as for ($x=0; $x < count($array); $x) The count() function gets called each time.


  20. Incrementing a local variable in a method is the fastest. Nearly the same as calling a local variable in a function.


  21. Incrementing a global variable is 2 times slow than a local var.

  22. Incrementing an object property (eg. $this->prop++) is 3 times slower than a local variable.

  23. Incrementing an undefined local variable is 9-10 times slower than a code-initialized one.

  24. Just declaring a global variable without using it in a function also slows things down (by about the same amount as incrementing a local var). PHP probably does a check to see if the global exists.

  25. Method invocation appears to be independent of the number of methods defined in the class because I added 10 more methods to the test class (before and after the test method) with no change in performance.

  26. Methods in derived classes run faster than ones defined in the base class.

  27. A function call with one parameter and an empty function body takes about the same time as doing 7-8 $localvar++ operations. A similar method call is of course about 15 $localvar++ operations.


  28. Surrounding your string by ' instead of " will make things intercodet a little faster since php looks for variables inside "..." but not inside '...'. Of course you can only do this when you don't need to have variables in the string.


  29. When echoing strings it's faster to separate them by comma instead of dot. Note: This only works with echo, which is a function that can take several strings as arguments.

  30. A PHP script will be served at least 2-10 times slower than a static HTML page by Apache. Try to use more static HTML pages and fewer scripts.

  31. Your PHP scripts are recompiled every time unless the scripts are cached. Install a PHP caching product to typically increase performance by 25-100% by removing compile times.

  32. Cache as much as possible. Use memcached - memcached is a high-performance memory object caching system intended to speed up dynamic web applications by alleviating database load. OP code caches are useful so that your script does not have to be compiled on every request

  33. When working with strings and you need to check that the string is either of a certain length you'd understandably would want to use the strlen() function. This function is codetty quick since it's operation does not perform any calculation but merely return the already known length of a string available in the zval structure (internal C struct used to store variables in PHP). However because strlen() is a function it is still somewhat slow because the function call requires several operations such as lowercase & hashtable lookup followed by the execution of said function. In some instance you can improve the speed of your code by using an isset() trick.



    Ex.
    if (strlen($foo) < 5) { echo "Foo is too short"; }
    vs.
    if (!isset($foo{5})) { echo "Foo is too short"; }


    Calling isset() happens to be faster then strlen() because unlike strlen(), isset() is a language construct and not a function meaning that it's execution does not require function lookups and lowercase. This means you have virtually no overhead on top of the actual code that determines the string's length.


  34. When incrementing or decrementing the value of the variable $i++ happens to be a tad slower then ++$i. This is something PHP specific and does not apply to other languages, so don't go modifying your C or Java code thinking it'll suddenly become faster, it won't. ++$i happens to be faster in PHP because instead of 4 opcodes used for $i++ you only need 3. Post incrementation actually causes in the creation of a temporary var that is then incremented. While code-incrementation increases the original value directly. This is one of the optimization that opcode optimized like Zend's PHP optimizer. It is a still a good idea to keep in mind since not all opcode optimizers perform this optimization and there are plenty of ISPs and servers running without an opcode optimizer.

  35. Not everything has to be OOP, often it is too much overhead, each method and object call consumes a lot of memory.

  36. Do not implement every data structure as a class, arrays are useful, too

  37. Don't split methods too much, think, which code you will really re-use

  38. You can always split the code of a method later, when needed

  39. Make use of the countless codedefined functions

  40. If you have very time consuming functions in your code, consider writing them as C extensions


  41. Profile your code. A profiler shows you, which parts of your code consumes how many time. The Xdebug debugger already contains a profiler. Profiling shows you the bottlenecks in overview

  42. mod_gzip which is available as an Apache module comcodesses your data on the fly and can reduce the data to transfer up to 80%

  43. Excellent Article about optimizing php by John Lim

bootchart.png

工作用机器的启动时间分析

bootchart.png

Thursday, November 1, 2007

Goodbye Dream Host

Dream Host搬出来了,由于种种原因,也许是暂时的,也许又是一年.但是我很高兴,我们还是继续了. 我们的爱呢?

svn使用bd4作为存储库时找不到Berkeley DB的问题

在 ./configure 时遇到错误
error: Berkeley DB not found

使用这样的配置语法可以解决问题
env LDFLAGS="-L/usr/local/db-4.2.52.NC/lib" \
LD_LIBRARY_PATH="/usr/local/db-4.2.52.NC/lib" \
./configure ...

Saturday, October 20, 2007

Hello & Goodbye

Tanya ChaTanya Chua's exceptional talent in writing, composing, and performing ballads has not only won her the admiration of her fans and critics, but also that of other music artists. The Singaporean singer's unique melodies are known to not shy away from taboo topics and to perfectly reflect people's loneliness and their longings. It was no surprise that her codevious album, Amphibian, won her the Best Mandarin Female Singer trophy at the 17th Golden Melody Awards.

071019101025.jpgGoing one step further, Tanya's latest major album, Goodbye & Hello, unveils her personal emotions and sees her acting as producer for the very first time. Presenting another moving work full of trademark songs, Tanya is back with a vengeance.

Sunday, October 7, 2007

No-QQ, from now on

腾讯的QQ的确让人感到厌恶,包括一干人等,作为一个IM到这样的封闭地步的确让你感到恶心,我情愿用MSN,情愿用YAHOO通,用GTALK,我不要用QQ这样的儿童垃圾产品,虽然目前我不可能完全脱离QQ,但是今天我删除了在我的手机上的移动QQ2007,我再使用,在我的LINUX桌面环境下,我更不会使用QQ,除非在没有办法的情况下,比如同公司同事的交流,同客户的交流,但我更愿意使用电子邮件,IM,注定不是为工作而用。如果非要使用IM在工作,我只能说这样的公司落后,就算使用IM,也不要使用QQ,最起码也应该选择GTALK,或者SKYPE,或者MSN。至于QQ,留给腾讯赚小朋友的钱吧。各位家长注意了,请不要装QQ作为IM工具。或者更好的使用LINUX操作系统,你可以在DELL,HP以及联想的机器上直接获得LINUX系统支持与服务。

麻烦告诉你的朋友:请使用GTALK,SKYPE,最好使用电子邮件联系你。

而不是使用浪费生命和时间的QQ,它毒害了你这么多年,你难道还想让它继续毒害你吗?或者毒害你的下一代?

Saturday, October 6, 2007

空间问题

最近一周DH的某个NFS服务器出现问题,波及到我的所有站点,发邮件给DH,说是正在处理中,我想处理了许久还是有问题可能应该换硬件设备了,为什么国内的空间总是让我们失望了,让我們不满意呢,不然我就选择国内的空间商了,不过,似乎原因不是这么简单。

links for 2007-10-06

Monday, October 1, 2007

10 Best Wordpress Plugins for Google Adsense

Google Adsense has become the most popular online contextual advertising program. Wordcodess allows bloggers to easily integrate Google Adsense inside wordcodess using plugins. Listed below are 10 best Adsense plugins which help you work smarter with wordcodess.



  • Adsense Deluxe - offers advanced options for managing the automatic insertion of Google AdSense or Yahoo Publisher Network (YPN) ads to your WordPress posts. Adsense Deluxe+ claims to have a an improved ad limiting algorithm.

  • Adsense Injection - inserts Adsense code randomly into a code-existing blog.

  • Adsense Inline - inserts Google adsense in blog posts

  • Adsense Beautifier - makes your Adsense look beautiful by placing images beside them to increase your clicks (CTR) and subsequent Adsense earnings.

  • AdSense Widget for WordPress Sidebar - Google AdSense widget designed for the new WordPress Sidebar Widgets plug-in.

  • MightyAdsense - allows you to host the code in wordcodess without having to modify the templates. Ads are displayed in post item and you can specify how many blocks its going to show up in a page.

  • AdRotator Wordcodess Plugin - rotates your adsense ads with other affiliate programs like Chitika Eminimalls wherever you want. Helps to reduce ad blindness and test different ad formats and affiliate programs.

  • Adsense Earnings Wordcodess Plugin - displays your adsense earning details within wordcodess admin panel.

  • WP-AdsenseProfit - shows your profit from the adsense program to the public by adding a simple call to the function in your template.

  • AdSense Sharing Revenue and Earnings System - allows you to view your adsense earnings and share your adsense imcodessions with your friends and co-authors.

  • Author Adsense Wordcodess Plugin - allows blog authors to enter their Google Adsense Publisher ID and have ads displayed on their own posts generating revenue. Admin can set the ratio of author’s ads to admin ads.

Dream Host File Server Slow

昨天终于亲自遇到 Dream Host 出问题,不过服务器那么多出问题是必然的,官方BLOG说是因为一台NFS服务器导致了用户站点访问异常所造成,下载站点访问正常了一些,但那时DH发邮件来说问题还没有完全解决,会竟快向用户报告进展情况。

最近dh有在搞一个什么10周年的活动,新注册用户有很大的优惠,500G空间5T月流量,虽然好像不能使用优惠代码,不过每月是5.95美元,算起来还是很便宜(我没有注册完全,应该是可以使用优惠代码的,要是这样,我们这些老用户干脆也做新用户好了,反正空间就要在11月到期了,不过我想dh还是会在活动结束之后考虑到为老用户升级的,我想老用户和新用户肯定是一样重要的嘛,dh应该不会不知道,打算在11月初请公司的同事用PayPal帮我在dh上续费,虽然钱比新贵了一点,但是还是各有各的好处 ;) )。


dh邮件内容

Hello,

We are sorry for the problems you experienced with connecting to your services today. We are continuing to have intermittent
issues with one of the file servers for your cluster. Our system admins resolved the problem a few hours ago and have
been keeping their eye on it. It seems to be performing much better since then. Our admins are working on these recent
issues and we will continue to do whatever we can to improve the recent performance issues you have experienced. We are
sorry for any inconvenience this caused you.

Note: This was an announcement due to a large support incident. Sorry if you did not get callback support.

Thanks!
DreamHost

Sunday, September 30, 2007

升级wp到2.3

昨天把WP升级到了2.3,感觉很好,由于WP2.3自己带有TAG的功能,所以原来的TAG插件不能使用了,不过你可以使用2.3上自带的导入功能中的TAG导入功能来导入原来TAG的数据库,并且支持多种TAG插件,完全不用修改PHP代码,不过原来你在模板中使用的TAG代码就不能用了,可以再这里找到WP2.3新的模板TAG代码。

Saturday, September 22, 2007

Intel is cool, now!

Intel 发布了一系列可以在Linux系统上的“节能”程序,主要方法是使用Intel工程师开发的Kernel模块来跟踪 Linux 系统上占用程序占用CPU的一系列参数,用户可以根据这些软件包来有目标优化自己的系统,并更加智能使系统运行更优化,使得系统可以节约能源,这个难道不是
Intel is cool, now!

吗? ;) 或者说是
Intel is green!


Linux节能项目官方站点

Efficient Editing With vim

我在这里发现了这篇关于VIM操作的文章,感觉不错,所以转载了过来。

This article has been translated into French by Geoffrey Bachelet. You can read the French version here: L'dition efficace avec vim.




"To me, vi is Zen.
To use vi is to practice zen.
Every command is a koan.
Profound to the user,
unintelligible to the uninitiated.
You discover truth every time you use it."

--reddy@lion.austin.com



This tutorial assumes a basic knowledge of vim -- insert mode, command mode, loading and saving files, etc. It is intended to help vi novices develop their skills so that they can use vi efficiently.



In this tutorial, <C-X> means Ctrl-X -- that is, hold down the Ctrl key and codess X. You can get help on most of the commands used here by typing :help command in vim, where command is what you need help on.



Moving efficiently



Stay out of insert mode



In general, you want to spend as little of your time in vim's insert mode as possible, because in that mode it acts like a dumb editor. This is why most vim novices spend so much time in insert mode -- it makes vim easy to use. But vim's real power lies in command mode! You'll find that the better you know vim, the less time you will spend in insert mode.



Use h, j, k, and l



The first step to efficient editing in vim is to wean yourself from the arrow keys. One of the the advantages of vim's modal design is that you do not need to constantly move your hands back and forth between the arrow keys and the letter keys; when you are in command mode, the letters h, j, k and l correspond to the directions left, down, up, and right, respectively. It takes some practice to get used to, but you will notice the speed difference once you're used to it.



When you are editing e-mail or other paragraph-formatted text, you might notice that the direction keys skip more lines than you expect. This is because your paragraphs appear as one long line to vim. Type g before h, j, k or l to move by screen lines instead of virtual lines.



Use motions to move the cursor in the current line



Most editors have only simple commands for moving the cursor (left, up, right, down, to beginning/end of line, etc). vim has very advanced commands for moving the cursor; these commands are referred to as motions. When the cursor moves from one point in the text to another, the text between the points (and including the points themselves) is considered to be "moved over." (This will be important later.)


rxvt-unicode 配置


Xft.dpi:96

!!========================================================
!! RXVT-unicode setting
!!========================================================
URxvt.inheritPixmap: False
URxvt.visualBell: true
URxvt.insecure: true
URxvt.saveLines: 3000
URxvt.scrollBar: True
URxvt.scrollBar_right: True
URxvt.scrollstyle: plain
URxvt.secondaryScroll: true
URxvt.underlineColor: yellow
URxvt.termName: xterm
!標籤功能
URxvt.perl-ext-common: default,tabbed
URxvt.tabbed.tab-fg: 12
URxvt.tabbed.tab-bg: 0
URxvt.tabbed.tabbar-fg: 4

!colors
URxvt.background:black
URxvt.foreground:grey
URxvt.colorBD:yellow
URxvt.colorUL:Green

URxvt.color0: #000000
URxvt.color1: #CC0000
URxvt.color2: #4E9A06
URxvt.color3: #C4A000
URxvt.color4: #3465A4
URxvt.color5: #75507B
URxvt.color6: #06989A
URxvt.color7: #D3D7CF
URxvt.color8: #555753
URxvt.color9: #EF2929
URxvt.color10: #8AE234
URxvt.color11: #FCE94F
URxvt.color12: #729FCF
URxvt.color13: #AD7FA8
URxvt.color14: #34E2E2
URxvt.color15: #EEEEEC

!字型
URxvt.font:xft:Bitstream Vera Sans Mono:pixelsize=15, \
xft:AR PL New Sung Mono:antialias=false

!URxvt.font:xft:Monospace:pixelsize=15:antialias=false

!輸入法
inputMethod:gcin
!輸入法樣式可選:Root(置底) OverTheSpot(跟隨)
URxvt.codeeditType:Root


urxvtd

urxvtd -q -f -o

啟動背景程式,然後用urxvtc來啟動客戶端。

tab功能
記得加入:

URxvt.perl-ext-common: default,tabbed

shift+down:新增tab
shif+left:左移
shift+right:右移

Saturday, September 8, 2007

links for 2007-09-08

Wednesday, September 5, 2007

vmware虚拟机在ubuntulinux上的问题

在shell里运行vmplayer,出现下面的错误然后退出,从“应用程序”菜单里也不能启动。

/usr/lib/vmware/bin/vmware: /usr/lib/vmware/lib/libpng12.so.0/libpng12.so.0: no version information available (required by /usr/lib/libcairo.so.2)

解决办法:

$ cd /usr/lib/vmware/lib/
$ sudo mv libpng12.so.0/libpng12.so.0 libpng12.so.0/libpng12.so.0.disabled
$ sudo ln -sf /usr/lib/libpng12.so.0 libpng12.so.0/libpng12.so.0


然后修改 /usr/bin/vmplayer 这个脚本,在第一行后面加上

unset GTK_IM_MODULE

links for 2007-09-05

Monday, September 3, 2007

links for 2007-09-03

创业者圣经

来自solidot.org

可能每个人都有创业的梦想吧。没有创业,是因为没有项目?缺乏资金?没有时间?我觉得最有可能的原因是没有勇气,没有做好准备。Sath Godin的《创业者圣经》就是帮你解决这个问题的。这本书在译言有专门的小组,经过众多译者的协作努力,终于全部翻译完成,现在已经制作完成PDF版本,供更多想要创业但是又不敢创业的人阅读。


如果以上链接失效,我在这里同时上传了这本书的英语中文版本,同时再次感谢这些无私奉献的朋友们

Friday, August 31, 2007

Some Linux Books

无视用户基本权利的重庆电信

本以为重庆电信的骚扰可以停止,但是根本就没有,昨天上网被无故警告竟达100多次,我想如果我是在操作网上银行得业务,那么出了问题这个责任该由谁来负责,作为一个普通的家庭用户,我的权益何在,国家法律何在,重庆电信的行为不得不让我觉得很丢脸,丢重庆人的脸,丢中国人的脸,还好我的站点是架设在国外的服务器上,所以不用担心得罪谁,我想不久之后我就该在godaddy.com上去注册一个com/net/org的域名,在这个地方,还有什么安全性可言,自由,可能成了活在这里的人最大的奢望,无耻的人做无耻的事情,这样法制健全,人民安居乐业的伟大国家,怎么能有如此下流的事情发生,我想,也并不是重庆电信无耻,其他地方的电信据说也很无耻,好像这是最先从中国网通开始的,不得不说我们的学习能力真的很强。

Tuesday, August 28, 2007

Linux with bluetooth

Linux Bluetooth Send File To Sedphone

在Debian/Ubuntu上使用bluetooth模块其实是非常容易的,只要用 apt-cache search bluetooth 来搜索相关软件包再加以安装就可以了。

Friday, August 24, 2007

ogg音频格式转换

我以前写过一篇关于从mp3转换到ogg的日志,不过那是Linux系统下的,其实在windows系统下也很容易就转换,我使用的方式是foobar2000+oggenc.exe

具体使用方法(以英文界面为例):
右键单击播放列表中的歌曲,选择"convert"-> "convert to..." ,然后在窗口中设定转换到ogg音频格式。

Wednesday, August 22, 2007

重庆电信的垃圾!

上网居然弹出这些东西,我想在国外法制健全的地方,这样的行为肯定是被搞上了,为什么中国人的素质这么低?就算我有路由器,难道重庆电信的SB们没有用过笔记本电脑?没有用过WIFI?让他们去死,竞争不过中国移动真是非常正常,中国电信的傻逼都用这种无耻下流的手段来赚钱的吗?一群见钱眼看的白痴,一群垃圾中的垃圾,中国移动是垃圾公司,中国电信更是垃圾公司,一群SB!你们都去卖大白菜以后。为什么中国的垄断这么严重,反垄断法不是出来了很久了吗?完全就是空谈!

重庆电信的垃圾!中国电信的垃圾!

我不想再在我的Blog上写关于你们这中垃圾的文字!你们应该作为国家的耻辱,民族的耻辱!

fucking_chongqing_telcom.png

Tuesday, August 21, 2007

Mac Book !

啊,Mac Book,最近又在喜欢Mac Book,喜欢13寸这样不大不小的尺寸。不过说实话这个东西的确有点贵,至少对于我来说是这样~ 而且对 apple 这种太商业化的东西有点反感,看来我还是要用我的ACER用上两三年了……

产品参数:

  • 13.3 英寸的亮丽显示屏

  • 2.0GHz 或 2.16GHz Intel Core 2 Duo

  • 高达 2GB 的内存

  • 高达 200GB 的硬盘

  • Apple Remote 遥控器和 Front Row 软件

  • 内置 iSight 摄像头

  • Intel Graphics Media Accelerator 950

  • 吸入式光驱

  • 内置 AirPort Extreme 无线功能

  • FireWire 400 和两个 USB 2.0 端口

  • 千兆以太网卡

  • 蓝牙 2.0+EDR

Sunday, August 12, 2007

Anti QQ , use google talk now!

google talk今天居然突然发现,我上次通过QQ腾讯的官方途径删除的QQ空间居然现在能访问了,让我太吃惊了,一个垃圾的服务,简直不知道在搞什么东西,明明我想删除的东西却还被腾讯保留着,玩弄用户的行为这是一种,而且又在完全没有被告知的情况下把我的空间恢复,真是太气人了,并不是因为我空间里面有什么隐私,是因为对腾讯这种劣质且不负责的行为所震惊!完全不是一个号称中国一流互联网的作为。不公开协议,不开发多平台版本,强制的广告,对病毒和黄色内容的不利监管,我还有什么理由不反对呢,虽然我还在用QQ但是我都会用QQ邀请好友使用google talk,或者这个对喜欢玩的小朋友没有吸引力,但是对于工作的朋友来说,却是很好的一个聊天工具,下载简单,不道2M的大小集成了高质量的语音对话服务、语音邮件服务、在线聊天日志保存,与GMAIL的无缝继承,并可以通过GMAIL的WEB界面作为客户端,因而免去了安装客户端的步骤。

Thursday, August 9, 2007

Tuesday, August 7, 2007

鄙视支付宝

最近看到了关于支付宝取消对非IE核心浏览器的支持的一些新闻,很让我失望,不由得鄙视起了支付宝。这么大一个有背景的B2B/B2C业务为主的公司,居然完全不顾用户的需求,在用户完全没有时间去采取措施的时候,做出这样让中国互联网蒙耻的事情,简直就是降低自身价值,我绝对不用支付宝这样的垃圾,本来打算给朋友的网店添砖加瓦买点东西的,我还是叫朋友在eBay中国上开个店吧,我情愿在那里买,一个让我失望的公司,再也不会让我有失望了,有的只是鄙视!

Sunday, August 5, 2007

links for 2007-08-05

Sunday, July 29, 2007

Web Development Toolbox: 120+ Web Development Resources

Link there

As rewarding as web development is, it can also be a pain sometimes, especially if you spend half your time looking for the right tools and resources. Well, we’ve done the work for you with this one, and have compiled a list of over 120 web development resources to make your life easier.

Saturday, July 21, 2007

A good win32 apache module binary download site

I found a very good win32 apache module binary download site, English site. You can download many binary module there. such as:

  • mod_perl

  • mod_fcgid

  • mod_macro



and this site is very cool for apache users! ;)

Friday, July 20, 2007

Using Telnet with a POP3 Mail Server

It is possible, with many ISPs, to use a Telnet program to do maintenance on your mailbox on the POP3 mail server. This allows you to look at, and possibly delete, any problem causing message (e.g. too large to download, improperly formatted message, etc.)

The instructions below are based on the Win95 TELNET.EXE program. See here for some other Telnet programs and operating systems.

From the Win95 task bar, select: Start, Run..., and enter the following:

telnet pop-server-name port#
(Note: if you start Telnet from the browser, rather than the Win95 Start Run command, the syntax is telnet://pop-server-name:port# - However, MSIE 3 has a bug and you must leave out the // on the address line and use telnet:pop-server-name:port#)

Check your mail settings for the pop-server-name and port#. Most POP3 servers use port 110.

For example:
- For CNZX Internet: telnet mail.cnzx.info 110
- For AT&T Worldnet: telnet postoffice.worldnet.att.net 110
- For Netcom: telnet popd.ix.netcom.com 110
- For SpryNet: telnet m#.sprynet.com 110
(# is 1 to 5 and varies by user)


This will connect to the mail server. If you fail to get a successful connection message, check the following:
You must include the correct port number, usually 110. The default Telnet port number won't work.
The syntax varies by how you start the Telnet program. On the Start, Run, you separate the server name and the port number with a Space. In the browser, you separate the server name and the port number with a Colon.
If starting from the browser, the browser must be configured to know about your Telnet program. The Win95 version of MSIE normally does this automatically on install. For Netscape, and the Win3.1 version of MSIE you usually need to do this manually. See your browser documentation. However, it is not necessary to start the program from the browser. You can start it directly.
MSIE 3 may not start the Telnet program from its address line if you use the "//" in the URL. Just remove the "//".
You will want to enable Local Echo so you can see what you type. In the Win95 Telnet program this is under Terminal, Preferences. Also, you may want to turn on logging to capture messages to a text file. In the Win95 Telnet program this is under Terminal, Start Logging

For the connection, and each command that you enter, the mail server will respond:

Some Chinese Driver's License Test

I put some chinese Driver's License Test on my personal WIKI.

Some new Web Desgin books on Amazon

Yeah! I found some Web Design new books on Amazon, some day, maybe it will help me ;)

the link

creative html design.2 (2nd Edition) (Paperback)

Other cool books list:

Thursday, July 19, 2007

Free Online Books List

Update - Update.. This List has Grown to 345…


Update: - I will be updating this list very shortly, many of the links were taken from http://www.programmingebooks.tk/


How to Be a Programmer
http://samizdat.mines.edu/howto/HowToBeAProgrammer.html
How to Design Programs
http://www.htdp.org/2002-09-22/Book/
Practical Theory of Programming
http://www.cs.toronto.edu/%7Ehehner/aPToP/
Software Engineering for Internet Applications
http://philip.greenspun.com/seia/
Structure and intercodetation of computer programs
http://mitcodess.mit.edu/SICP/
More programming books http://2020ok.com/3839.htm
The Programmers Stone
http://www.reciprocality.org/Reciprocality/r0/
Subversion Version Control: Using the Subversion Version Control System in Development Projects
http://www.phptr.com/promotions/promotion….84&redir=1&rl=1


Ada


Ada 95 Rational
http://www.adaic.org/standards/95rat/RATht…5-contents.html
Ada 95 Reference Manual
http://www.adahome.com/rm95/
Changes to Ada 1987 - 1995
http://www.oopweb.com/Ada/Documents/Change…lumeFrames.html
Ada 95: The Lovelace Tutorial
http://www.adahome.com/Tutorials/Lovelace/master.htm
The Big Online Book of Linux Ada Programming
http://www.pegasoft.ca/resources/boblap/book.html


Algorithms


Algorithms and Complexity
http://www.cis.upenn.edu/%7Ewilf/AlgComp.html
Programming Algorithms http://2020ok.com/3870.htm
Information Theory, Inference, and Learning Algorithms
http://www.inference.phy.cam.ac.uk/mackay/itprnn/book.html


Assembly


Assembly Language Tutorial
http://www.oopweb.com/Assembly/Documents/a…lumeFrames.html
Programming From the Ground Up
http://download.savannah.gnu.org/releases/pgubook/
Assembly Language Programming http://2020ok.com/3954.htm
Ralph Brown's Interrupt List
http://www.oopweb.com/Assembly/Documents/I…lumeFrames.html
The Art of Assembly Language Programming
http://www.oopweb.com/Assembly/Documents/A…lumeFrames.html
The Assembly Language Database
http://www.oopweb.com/Assembly/Download/NortonGuide.zip
Win32 Programming for x86 Assembly Language Programmers
http://www.oopweb.com/Assembly/Documents/W…lumeFrames.html


C


A Tutorial on Pointers and Arrays in C
http://www.oopweb.com/CPP/Documents/CPoint…lumeFrames.html
C Programming
http://www.oopweb.com/CPP/Documents/CProgr…lumeFrames.html
Object Orientated Programming in ANSI-C
http://www.planetpdf.com/developer/article…?contentid=6635
The C Book
http://publications.gbdirect.co.uk/c_book/
Writing Bug-Free C Code
http://www.duckware.com/bugfreec/index.html
C - Elements of Style
http://www.computer-books.us/c_3.php
Learning GNU C
http://www.linuxtopia.org/online_books/pro…nu_c/index.html


C++


An Overview Of The C++ Programming Langauge
http://www.oopweb.com/CPP/Download/crc.zip
C++ Annotations
http://www.oopweb.com/CPP/Documents/CPPAnn…lumeFrames.html
C++ Annotations
http://www.oopweb.com/CPP/Download/cplusplus.zip
C++ Coding Standard
http://www.oopweb.com/CPP/Documents/CodeSt…lumeFrames.html
C & C++ http://2020ok.com/3956.htm
C++ Course
http://www.oopweb.com/CPP/Download/CPPCourse.zip
C++ How To
http://www.oopweb.com/CPP/Documents/CPPHOW…lumeFrames.html
C++ In Action
http://www.relisoft.com/book/index.htm
C++: A Dialog
http://www.steveheller.com/cppad/cppad.htm
How To Think Like A Computer Scientist with C++
http://www.oopweb.com/CPP/Documents/ThinkC…lumeFrames.html
Introduction To OOP Using C++
http://www.oopweb.com/CPP/Documents/Intro2…lumeFrames.html
Introduction To OOP Using C++
http://www.oopweb.com/CPP/Download/Intro2OOP.zip
Objects First
http://www.oopweb.com/CPP/Documents/Object…lumeFrames.html
Optimizing C++
http://www.steveheller.com/opt/
STL Guide
http://www.oopweb.com/CPP/Documents/STLGui…lumeFrames.html
STL Guide
http://www.oopweb.com/CPP/Download/stl.zip
The Function Pointer Tutorials
http://www.oopweb.com/CPP/Documents/Functi…lumeFrames.html
The Standard Template Library Tutorial
http://www.oopweb.com/CPP/Documents/STL/VolumeFrames.html
Thinking in C++
http://www.planetpdf.com/developer/article…?ContentID=6634
Thinking in C++, Second Edition (Volumes 1 & 2)
http://mindview.net/Books/TICPP/ThinkingInCPP2e.html
An Introduction to C++ Programming
http://www.computer-books.us/cpp_1.php
Programming in C++ - Rules and Recommendations
http://www.computer-books.us/cpp_6.php
A Beginners C++ Book
http://www.uow.edu.au/~nabg/ABC/ABC.html


Wednesday, July 11, 2007

Catalyst 介绍








名字



Catalyst 指南 - Catalyst 介绍






描述


本文简单的介绍了为何要用 Catalyst 以及如何使用它。文中解释了 Catalyst 的工作原理并通过一个简单应用的快速建立来加以验证。




Catalyst 是什么?


Catalyst 是一个优雅的 Web 应用框架,极为灵活又特别简单。它类似于 Ruby on Rails、Java 的 Spring 和 Maypole(原来就基于 Maypole 建立)。





MVC


Catalyst 遵循模型-视图-控制(MVC)设计模式,它擅长将内容处理、表示和流程控制方面的工作区分开来交给独立的模块来做。这种区分允许你为某一方面的问题修改代码而不影响解决其它问题的代码。这样 Catalyst 提升了原有的解决 Web 应用方面的问题的模块的重用程度。


下面就是 M、V、C 分别解决的问题,每个方面都有著名的 Perl 模块的可用。



如果你不熟悉 MVC 和设计模式,你得查看一下这方面的原始资料:Gamma、Helm、Johson、Vlissides 写的 Design Patterns,也叫 Gang of Four 或 GoF。你也可以 google 一下。有很多很多的 Web 应用框架都是基于 MVC 的,如前面提到的那些。




灵活性


Catalyst 比起其他的框架来说灵活很多。我们会慢慢的解释,很快就会看到那些你喜爱的 Perl 模块在 Catalyst 里面的应用。




  • 多模型、视图和控制


  • 为了要建立一个 Catalyst 应用,你得用名为 组件(Components) 的模块来处理各种问题。一般这样的代码会非常简单,只是调用 MVC 下面列出的 Perl 模块。Catalyst 用很灵活的方式来使用这些组件。在一个应用里面可以使用任意数量的模板、视图和控制模块。想要操作多个数据库并读写 LDAP 数据么?没问题。想要用 Template ToolkitPDF::Template 来展现同样的模型么?很简单。


Sunday, July 8, 2007

全球国家/地区级域名地理分布情况图

国外有人做了一个全球国家/地区级域名地理分布情况图,通过这个图,你可以看到最近时间的全球国家/地区级域名地理分布情况图,不过如果你需要更完整和详细的图片资料,就需要通过PayPal或者Google Check Out支付一定的费用了。

map_www_large.gif

Tuesday, July 3, 2007

王心淩--那年夏天寧靜的海MV

重庆比成都热多了~

回到重庆的第一感觉就是很热,当火车到了遂宁的时候,就不再是阴天了,直射的阳光让人感觉有点刺眼。想不到重庆和成都差这么多,可能也是因为这样吧,重庆的房价也比成都低很多。发两张我家楼上水池的照片 ;)

img_0215.jpg img_0217.jpg

Sunday, July 1, 2007

links for 2007-07-01

新专辑: 西界 / 林俊杰

西界 / 林俊杰专辑名称:西界
演唱歌手:林俊杰
唱片公司:海蝶唱片
发行时间:2007年06月29日
专辑语种:国语专辑

专辑试听下载

专辑简介

  JJ林俊杰《西界》第5张全新创作专辑
  非常 J Fusion 年度必杀专辑!
  东方古典+南欧浪漫+美西灵魂+北非热情

  每个人心中都有西界,通往那个未知的自己
  在爱与恨之间 在黑与白之间 在善与恶之间
  名曲曹操作词大师-林秋离 神来之笔创西界之说

  罗比威廉斯&MR.Children&Glay都崇拜的
  日本艺术大师信藤先生“双J与鸟“概念之作
  让这张专辑视觉充满想像力

  一年一度跨界盛事 JJ新专辑收集世界大师精髓 绕着地球跑!
  日本艺术大师信藤三雄献出华人处女作
  日本歌姬米希亚闻乐慕名求合作!
  美国舞蹈电影宗师 Dave Scott 首度为亚洲歌手编舞
  日本 Top5 Dancers 现身尬舞!
  国际古筝大师王勇揭开序幕
  金钟影帝王传一跨刀以声相许!
  香港电影道具高手特制奇幻视觉道具空运来台
  新马中港台四海音乐才子共聚一堂三千万大制作!
  JJ写歌谱曲编曲制作全创作专辑!

  这个节奏让你摇摆,
  这个旋律打动你,
  这种音乐给你灵感,
  这才是我要的 J–Fusion… 林俊杰

Saturday, June 30, 2007

取消某个目录的PHP运行权限

RemoveHandler .cgi
RemoveHandler .php
RemoveHandler .pl
RemoveHandler .py


.htaccess 中或者是 httpd.conf 配置中设定就可以了。

又一个6月,末

时间,就像是暗示着一切的神话,不知不觉,一切被它带来,又被它带走。又一个6月,从两年前大学毕业开始,仿佛6月末都是那么不平常。最近没有什么些日志,可能比较忙吧,也可能是生活比较单一,不知道写什么。所以我准备回重庆休息一下。 ;)

昨天传了一个Perl的教程Python的教程

Sunday, June 24, 2007

谁最喜欢快乐男生?

SP、湖南电视台和中国移动。

谁最吃醋?

很多很多…… 在PPLIVE上看了6月22日的录象,最让人反感的就是俞灏明的那些歌迷,年龄层真的好小啊,真的很疯狂,受不了,小朋友就是小朋友,不知道以后他们怎么想。不过这个也正常,各爽各的,关其他人屁事。越是小朋友越难过,越疯狂,不过这个很好啊,至少比玩网络游戏好多了,湖南电视台越开心,主持越开心,因为这些都是¥¥嘛,不过这个只是湖南电视台的娱乐而已?何时我们才能进入一个全民娱乐的时代呢,不过这个不是湖南电视台希望的,说实话CCTV原来对湖南台的XXX,其实真的帮湖南台做了一个几个亿的广告。无聊。

娱乐,本来是属于每个人的,至少现在还不属于每个人,大家现在也只有搞搞SB,SG这样的活动。但是,中国的GDP又被大家贡献了。GOOD LUCK!

Saturday, June 23, 2007

正确曝光的秘诀(下)

没有测光表时的曝光:“晴天 f/16”法则

内置在相机里通过镜头进行测光(TTL:through-the-lens)的测光表使我们进行的摄影工作简化了很多。实际上,我们非常依赖于这种测光表,如果没有它,当各种事物出现在我们的镜头前时,我们会感觉到有些迷失方向或混乱。我知道,有一些摄影师可以凭经验比较准确的估算出正确的曝光参数,他们也为他们的这个能力而自豪,但我不是这种人。

535502_1.jpg
晴天

然而,在一种情况下,正确的曝光参数是一个不变的常数,那就是当你在明媚的阳光下进行摄影的时候。在这种情况下为了得到正确的曝光值,你应该遵循我们称之为“晴天f/16”法则的一些规则:在明亮的太阳光底下(高空无云,没有薄雾,没有空气污染),大概从日出以后的几个小时开始直到接近日落前的几个小时,对正面光照的被摄物体的正确曝光值近似接近于,用感光度的ISO数值的倒数作为快门速度,同时把光圈设置为f/16时的曝光量,或者是其他任何等同的曝光参数。呵呵,这样说有点太空洞了,让我们来更深入的研究一些这些规则。

首先,“晴天f/16”仅适用于明亮的、直射的太阳光线,而不适合凌晨或黎明的太阳光,也不适合薄雾或阴天的光线。而且这个法则也不适合在北方深冬时使用,因为这时的太阳离地平线很近,光线很低。“晴天f/16”也不适合拍微距,因为许多镜头在近距离对焦时有效光圈的大小都会发生改变。理论上,光圈f值只在无限远处是准确的,相同光圈下,当焦点移近时,焦点处进入镜头的光线也会减少。不过通常不用担心这个问题,因为你的TTL测光表已经把这个变化计算进去了。但是,“晴天f/16”法则是不用测光表时的曝光值,所以当这些条件变化时,这个法则就不灵了。而且这个法则只适合应用于正面光照的被摄物体(太阳光从高于你的肩的高度直接照射到被摄物体上)。所以,在夏天的正午,此时太阳是从头顶直射下来的,只有当你想从上往下拍摄你的双脚时,才可以应用“晴天f/16”法则。如果你想在此时象往常一样拍摄,那你就需要修改“晴天f/16”法则的参数以适应侧面光照的曝光需要,后面我将简短的介绍如何进行修正。

还有,这个法则只对均匀(average)色调的被摄对象有效,太亮或太暗物体都会出问题。其实大多数被摄物的色调都是很均匀的,用摄影师的话说,都是“中间的”(middletoned)。我个人不大喜欢“中间的”这个说法,因为当我们讨论色调时,有太多的摄影师使用“中间灰”(middletone gray)这个词,但我们并不是在讨论黑白摄影。因此我用“中等的”(medium)这个词来代替。这样就可以说“中等绿”、“中等红”、“中等蓝”等等。

别忘记的是,当使用“晴天f/16”法则时,不是一定要使用ISO值做为快门速度和f/16,还可以是用其他等效的曝光参数进行曝光。而且这个法则中没有提到使用的地点。我就曾被人问过在山顶是否可以使用“晴天f/16”法则。答案是肯定的,因为太阳离我们有93,000,000英里远,我不认为当我们走近太阳10,000和12,000英尺时,会对“晴天f/16”法则有多么大的影响。
【编注:对于现在自动化程度都比较高的相机,所谓“晴天 f/16”法则并没有太多实用价值,但,了解这个规则,对于深入理解曝光控制会有帮助。】

正确曝光的秘诀(上)

导引:应该拍些什么?

  其实这是一个不该问的问题,这个问题会使拍摄出的照片缺少一些让人激动的内容。如果没有激情,我们拍摄出的照片无非只是记录一些场景。我们经常问自己的问题应该是“我们到那应该去发现什么?”只有当我们的大脑和眼睛满怀热情的去发现那些大量存在于我们身边的自然界里的惊奇事物时,我们才会有拍摄的兴趣。

535498_1.jpg


  摄影的过程应该是一个发现新事物的过程,同时也是一个记录这些发现的过程。

  在这个摄影的过程中,我们通过许多决策而使我们周围混沌的事物变得有序。我们必须做出决定,要突出强调我们发现的事物的哪个方面,而忽略其他的。我们会希望用一种恰当的方式表现某个主题,以表达我们自己是如何被它感动的。为了做到这些,我们必须做出冷静的决定:取景器里应该包括那些东西,以及如何组织这些内容。从这开始,摄影的过程也开始了。

  现在我们又必须做出一些技术性的考虑,当然是和摄影相关的:使用什么相机、什么镜头、如何用光、以及如何曝光。
  摄影的过程应该是经过认真考虑的和有计划的。摄影创作的任务就是对可见环境的设计和组织,但是这个设计不会无端的出现。对于相机、镜头、和自动曝光的选择过程也是一样的。我们必须能够熟练地应付摄影中遇到的美学以及摄影器材出现的问题,否则我们会得到失败的结果。

  摄影这种双重的本质一直吸引着我。对于好的摄影作品,各个方面是平行发挥作用的,不会互相压倒对方。形式和内容在一起构成一个和谐的整体,使它成为一个同时吸引着观众思维和感情的有趣的作品。

  为了达到这种和谐,作为摄影师的你必须同时完成两个方面的工作。一方面,你必须是一个诗人和艺术家,发挥你的想象力来面对直观的和神秘的世界;另一方面,你必须是一个技师,理性的来处理快门速度、光圈值和焦距。没有技术的想象力和没有想象力的技术同样是失败的(太精辟了——编注)。

  我们肯定都看过那些凭着个人的热情和感情拍摄的照片,但缺乏技术性的竞争力。我们会因为这些照片缺乏组织性而丢弃它们,而且会认为拍摄者没有使用好摄影这个工具。同样,我们也一定看到过那些技术很精湛的照片,但是它们缺乏照片的灵魂,是缺乏艺术气息的、空洞的、没有灵感的作品。

535498_2.jpg

  很多人都比较缺乏摄影技术方面的技能。我们通过眼睛可以看到很多图像,但怎样把它们记录下来呢?我们的旅行是非常精彩的,但往往最终拍到的照片却和我们的经历几乎没什么关系。为什么?我认为最主要的原因是,我们中的大多数人只是充当了一次临时摄影师。他们一直处在学习摄影的起步阶段,一直没有掌握基本的摄影技术。结果是,许多人倾向于买一架喜爱的相机,然后把它设置为自动对焦、自动曝光、甚至全自动的模式,这样他们根本不用去想相机是如何去工作的了。但是,这意味着他们放弃了摄影师的责任,而变成了一个相机携带者,而不是一个摄影师。他们让一个机器来为他们做出决定,而不是学习如何去控制这个机器。

  我经常会很惊讶的听到有些人说,他们学不会如何操作相机,因为它太复杂了。我曾经遇到过,一些人在其他方面有非常强的能力,但当面对光圈f值或三脚架时,他们显得是那样无助。同样是这些人,他们可能是医生、律师、教师、或者是计算机程序员,他们每天都会做许多比操作相机更复杂的事情。其实相机只是一个机器,并不比其他机器更神秘。如果你能开汽车、骑自行车、或者操作电脑,同样你也一定能操作一架相机。
  当掌握了摄影技术方面的技巧,你就能把更多的注意力放到美学层面上,这也是我为什么着重强调摄影技术的原因。如果你一直在笨拙的应付镜头和三脚架,那你大脑里的那些灵感很快就会蒸发掉。你一定也希望掌握摄影技术方面的技能,这样就可以更多的关注照片本身而不是具体的过程。如果想拍出精彩的照片,对摄影技术和美学两方面的掌握是必不可少的。

检查客户端浏览器和操作系统PHP脚本

使用方法:

echo ( browser_detection( 'number' ) .'
'.
browser_detection( 'browser' ) .'
'.
browser_detection( 'os' ) .'
'.
browser_detection( 'os_number' ) );
?>


Outputs (browser version, browser, os, os number):

1.5
moz
nt
5.1



if ( ( browser_detection( 'browser' ) == 'ie' )
&&
( browser_detection( 'number' ) >= 5 ) )
{
echo 'it is Internet Explorer ' .
browser_detection( 'number' );
// or anything else you want to happen of course
}
?>


下载:
browser_detection_php_ar.txt

原文地址:
http://techpatterns.com/downloads/php_browser_detection.php

Friday, June 22, 2007

links for 2007-06-22




  • Smashing Magazine在这里给出了80+个专业ajax解决方案,它们几乎涵盖了所有的ajax使用场景
    而且个个都带图,选你喜欢的,然后下载示例代码就是了!"

    (tags: ajax)


Wednesday, June 20, 2007

作文就是申论

等咱中国强大了,全叫老外考中文四六级!文言文太简单,全用毛笔答题,这是便宜他们。惹急了一人一把刀一个龟壳,刻甲骨文!论文题目就叫:论三个代表!到了考听力的时候全用周杰伦的歌,《双截棍》听两遍,《菊花台》只能听一遍。告诉他们这是中国人说话最正常的语速!阅读理解全是政府工作报告。作文就是申论。

学习一下单词

tulip 郁金香
newbie 菜鸟
lesbian 女同性恋
vatican 梵蒂冈
ladyman 人妖
wind mill 风车
pot 大麻
population census 人口普查
autonomic region 自治区
municipality 直辖市
bald eagle 白头鹰
national anthem 国歌
wall streat 华尔街
mineral deposit 矿产资源
mineral water 矿泉水
be rich in 富有
be short of 短缺
be noted for=be famous for

Monday, June 11, 2007

彼埃·蒙德里安

mondrian_small.jpg很多学艺术、建筑的人很可能都知道彼埃·蒙德里安,这位荷兰的绘画大师以简单的直线、直角和方形影响了现在艺术和现代建筑学。


彼埃,蒙德里安(1872--1944年)生于荷兰中部的阿麦斯福特,逝于纽约。他出身于一个严格信奉加尔文教的家庭,父亲是位小学教员,要求儿子也从事教育。但最终,他的儿子还是拒绝了这一职业,并在两个公共学校获得了图画教学证书之后,进了阿姆斯特丹美术学院,成为一名勤奋刻苦,颇受教师赏识的学生。然后,他经历了一个困难时期,画的很多,卖掉的很少,靠在博物馆临画卖和绘制科技挂图过活。

他主要画阿姆斯特丹周围的风景,并经常重复一个题材。例如,他以同一角度多次重画杜旺德里兹农庄。他的颜色尽管以灰和暗绿为主,却往往柔和秀美。他的画风爽直,笔法也非常肯定。1903年,他在荷兰布拉拜特信奉天主教的农民地区住了很长时间,这似乎给他的绘画展开了新的前景。宗教问题使他着迷,他读着“神智学协会”出版的书籍,并在几年之后,成为它的会员。他爱画孤立的村舍,淡紫色和灰色的神秘森林内景。1908年夏,他到瓦尔申岛东布尔的首次旅行彻底改变了他的画风,颜色有了光泽,淡紫色渐渐消失,从而使浅兰色、白色、玫瑰色、金黄色得以自由驰骋(一系列的《沙丘》,《西卡拜尔之塔》,1908—1911年)。

一些朋友劝他前往巴黎,荷兰画家吉克尔把自己在蒙巴纳斯的画室借给了他。于是,蒙德里安于1911年底来到巴黎。他马上受到立体派的影响,画出作为本世纪绘画中对确定主题进行不断抽象化的唯一组画—著名的《树》。在第一次世界大战爆发前十五天,他回到荷兰,看望生病的父亲。在阿姆斯特丹,他得知了开战的坏消息。停战之后,他才急迫地回到巴黎。在这四年半中,他住过东布尔,斯赫维宁根,阿姆斯特丹,拉兰的小村镇。他继续探索抽象画(以海和大教堂正门为题),并在1915年画出一种横、直线的节奏(这些作品后来被称作《多与少》的组画),予示着即将出现的新造型主义和纯造型派。

这时,他认识了瑟奥·凡·杜斯堡,两人一起创立了斯蒂尔杂志,并于1917年10月出了创刊号。蒙德里安在该时期中写作要多于绘画。他在《斯蒂尔》上发表了一些长篇理论文章,其中有几篇采用了对话的形式。其中一篇《自然现实与抽象现实》堪称抽象艺术的基石。1919年初,蒙德里安回到巴黎,继续就横、直的新造型艺术主题进行长期思考。在直至去世的二十五年中,这一工作从未停止。他画的背景先为灰色,后为兰色,从1922年起,固定为白色。构图经常是稍有变动的重复(1929到1932年间为正方形画幅)。在颜色中,他偏爱红色。他这一中心时期的某些作品含有红色的长方形,有时占着色面积的三分之二。

他很少展出作品,只卖给极少的收藏家,谦逊地生活在一间以新造型主义原则布置和油漆的画室里。他极少去宣传自己,然而却驰名世界。从此,其作品的意义超越了荷兰国界。他的思想曾在一段时间里影响了莱歇和包梅斯特,后来,又影响了本·尼克松和马克斯·比尔。他也有忠实的学生:摩斯小姐、让·高林。1925年,包豪斯出版了他的书《新造型》,在德文译本中,还加上了1920年他在巴黎《现代努力画廊》出版的一本小册子《新造型主义》。

蒙德里安艺术的意义在于他把方法缩减到简单地表现一种往往是两条直线在直角上相交的关系,以此来寻求造型艺术的单纯。不光是曲线和空间想象,就连用笔的一切可能,一切使人想起印象派技巧的笔法,都统统被他抛弃了,因此造成一种反对一切外表世界的持续、神秘的绝对化。他的画是平的,画上的颜色也是极平的,这样,它就变成了一种既不联系于时间,也不联系于空间的思想工具,然而它又驾驭着时间和空间。这就造成了一种关系,蒙德里安一直想要使它充满活力,表达出不对称的平衡。

1938年9月,他感到战争临近了,于是,离开巴黎去伦敦。然后,又于1940年9月到达纽约,在众多崇拜者的关心之下画了起来。他在纽约完成了一些在伦敦和巴黎动手的画,办法是以方块或色线的相加来减轻已变得众多的黑线的压迫感。生命的最后两年带给他的满足要胜过不断劳作的五十年。他有了某种物质上的舒适,并在作品中表现为更大的精神安逸。黑色被赶走了,《纽约市区》一画只有黄色,红色和兰色的线。在《康庄大道之歌》中,线有断成一个个小长方形的倾向,有如音乐中一段快乐的拨弦乐。他的未竟之作《胜利之歌》更是一首表达欢乐之情的交响乐,审慎和自由,保留和激发组成了仍以横、直新造型主义的已知条件作为法则的完全统一。

在本世纪绘画中,蒙德里安占有极为重要的地位,这不仅因为他从自然主义缓慢地、逐步地走向最完全的抽象化,也是因为他在这一过程中的成就。每一步都是一个人的全部体现,这一绘画对进程中的任何时刻都不是漠不关心的:它负起了完全的责任,并且不作任何妥协。在冷漠的抽象化顶峰上,画的后面有某种东西在振响着,它使画面温暖、人道,并使它成为无法摹仿的。

大家都玩BT下载

在一个LINUX服务器上下一个BT种子,周5晚上开始下载,速度只有20K,周6周日依然,但是周一下载的时候,居然可以打倒2M,吃惊,难道大家都是用工作的电脑下载BT的吗?

看来在大陆用公家的东西成了一种时尚,一种玩味,代表一种特殊的全力,当然这和很多人上班没有事情做密不可分,不过下载BT也可以做事情,还有上班用的电脑下BT比较好就是网速可能比家里快,或者是硬件比自己家的好。

大家很流行一张报纸一杯茶然后就下班的公务员生活,怪不得大家都想当公务员,而且是公家公务员。国家为大,理所当然,可是我们总是不知道国人是人民当家作主这句话的真正意义,可能这也是国人的通病。教育制度的后遗症。

大家很流行灰色收入,因为大部分人的收入的确很少,不过那些有特权人的收入却越来越多,但是他们才是真正灰色收入的大赢家。最近在大陆流行股票和基金,仿佛普通的国人又看到了希望,是这样的,越是有投入越是能够快速发展,理论上没有错。但是更多的人却没有想到,银行业好起来了吗,照样越搞越烂;公务员素质提高了吗,照样官官相卫;经济政策完善了吗,如果是的你还能看到房价涨的那么高。

不能不说,现在上班玩BT下载的越来越多…… ,不幸我也成了其中一员。

Sunday, June 10, 2007

CANON A710 IS 作业一张

刚拿到A710,很不熟悉,感觉手动的确要比自动强很多,A710的手动很强大,不过现在拍出来真的很糟糕,拍人物和风景也只有先用自动了,就算是自动我也拍得很不好~~看来我需要好好练习一下。

发一张微距的,我的Acer 3600 WinXP桌面。 ;)

img_0016.jpg

笔记本光驱驱动损坏问题

今天想安装CD上的一个东西,但发现我的ACER 3600/3609 的光驱驱动损坏,不会是DVD坏了吧,启动到LINUX,一切正常,在网上搜索了一下,这是软件引起的问题,在注册表中删除以下内容就可以正常工作了,不过我的光驱很少使用的一般。

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\
{4D36E965-E325-11CE-BFC1-08002BE10318}


删除以下键
LowerFilters 和 UpperFilters

重新启动机器,就看得到光驱盘符了。

Saturday, June 9, 2007

聆听从前,往前飞

很可能,在听这首歌的时候,我都会想一想,第一次听见这歌是什么时候,两年前,三年前?

后来却发现我的记忆现在可以用年来计算了,从前似乎离我很近,当我用数字来计算的时候,我自己也不敢相信时间过得那么快,我一直很喜欢两个女歌手,一个是戴佩妮,另一个是蔡健雅, penny一直都是我喜欢的那种类型,你从他的歌中能够感受坚强,也能够感受到温柔,我想这一直都是我想寻找的东西.

时光倒转的可能是亿分之一,与人相识的机会也是60亿分之一,不过更多的人是永远都不能认识的,于是寻找更多就成了梦想,似乎我真的不用再去感叹什么,时间的快慢,生活的苦乐,只需要往前飞.

Friday, June 8, 2007

linux下的bt下载工具

http://www.bittornado.com/download.html

今天找到这个工具,可以在命令行下载。对于闲置的LINUX服务器到是很好的东西。 ;)

python写的,安装方便,我在RHEL4上使用完全没有问题。


刚刚看到有位朋友的留言,rTorrent,这个BT客户端也是不错的,不过我在RHEL4上没有顺利安装,因为我懒得去升级和安装其他的包,不过如果你使用的是桌面的系统或者比较新的SERVER,用rTorrent应该是很好的选择(命令行模式下)。

links for 2007-06-08

Sunday, June 3, 2007

专辑:王子 - 张栋梁

  每个女生都希望自己是公主,每个男生都可以成为王子,
  勇敢捍卫爱情,才能成为公主生命中的王子……
  从歌手到偶像剧男主角;从微笑男孩到捍卫爱情的王子!

  全新张栋梁


http://www.1ting.com/album/65/album_11591.html

Friday, May 25, 2007

Song: If I Aint GotYou

If I Ain’t Got You
"If I Ain't Got You" is a Grammy Award-winning single released from R&B/soul musician Alicia Keys[wikipedia]'s sophomore album, The Diary of Alicia Keys. Released in 2004, the ballad peaked at number four on Billboard Hot 100. The music video featured Grammy award-winning rapper/actor Method Man playing the role of Alicia's boyfriend.

this song on wikipedia

Some people live for the fortune
Some people live just for the fame
Some people live for the power yeah
Some people live just to play the game
Some people think that the physical things
Define what's within
I've been there before
But that life's a bore
So full of the superficial

Some people want it all
But I don't want nothing at all
If it ain't you baby
If I ain't got you baby
Some people want diamond rings
Some just want everything
But everything means nothing
If I ain't got you

Some people search for a fountain
Promises forever young
Some people need three dozen roses
And that's the only way to prove you love them

Hand me the world on a silver platter
And what good would it be
with no one to share,
with no one who truly cares for me

Some people want it all
But I don't want nothing at all
If it ain't you baby
If I ain't got you baby
Some people want diamond rings
Some just want everything
But everything means nothing
If I ain't got you

Some people want it all
But I don't want nothing at all
If it ain't you baby
If I ain't got you baby
Some people want diamond rings
Some just want everything
But everything means nothing
If I ain't got you

If I ain't got you with me baby
Nothing in this whole wide world don't mean a thing
If I ain't got you with me baby

Monday, May 21, 2007

最近

最近,升级到了WP2.2,最近天气很热,最近没有什么大事发生,就算很大,我也应该平静对待,最近做的决定不少,最近还是习惯了路人甲的身份.

5月,6月,7月,8月,9月,仿佛夏天对我来说是很特别,今年也不例外。

最近,又要放暑假了 ;) ,最近,我想我一直活在最近。

links for 2007-05-21




  • The regular excodession, as a pattern, can match all kinds of text strings helping your application validate, compare, compute, decide etc. It can do simple or very complex string manipulations. The list of possibilities is enormous when it comes to what y

    (tags: code tutorial php)


Monday, May 14, 2007

PHP script highcoloring with trac on dreamhost

因为在dreamhost 默认PATH的PHP4是cli编译的,就是CGI方式,所以PHP的语法高亮不能显示,在安装了silvercity之后也不能,需要将 trac.ini 中这样设置
php_path = /usr/bin/php -q
就可以了,关于这个主题的讨论可以看看这里

Sunday, May 13, 2007

links for 2007-05-13




  • Haskell, like most other languages, comes in two flavors: batch oriented (compiler) and interactive (intercodeter). An interactive system gives you a command line where you can experiment and evaluate excodessions directly, and is probably a good choice to





  • Perl 6 will soon be here. How will programming in Perl 6 be different from programming in Perl 5 for your average Perl programmer? The answer is: very different yet very much the same. A Perl 6 program viewed at arm's length will look much like a Perl 5 p

    (tags: perl)




  • 大部分文字整理自 PerlChina 北京的 3月5日台湾大陆Perl小型聚会 ,唐宗汉的口述,其他部分文字整理翻译自perl的相关站点。 写作目的:讲述一个奇异华人在世界开放源代码界的努力,叙述开放源

    (tags: perl)


Saturday, May 12, 2007

Perl6与唐宗汉

摘要

大部分文字整理自 PerlChina 北京的 3月5日台湾大陆Perl小型聚会 ,唐宗汉的口述,其他部分文字整理翻译自perl的相关站点。
写作目的:讲述一个奇异华人在世界开放源代码界的努力,叙述开放源代码作者们的宏伟蓝图。


唐个人简历:

  • 唐宗汉 男 1981年生人 籍贯台湾。
  • 唐的外表:长发,面白,十指修长。
  • 唐的行为:说话有力,吐字清晰,语速很快(说明思维敏捷),随时携带自己的笔记本电脑,包括上厕所,目的是纪录下自己的随时会有的想法。
  • 唐的称号:据称台湾十大电脑高手。
  • 唐个人网址:http://www.autrijus.org/
  • 唐的工作态度:每天一直努力干活直到累倒为止(累倒,是说感觉到十分的疲劳,沾床就睡的感觉)。
  • 唐的教育经历: 14岁辍学,一直凭兴趣自学计算机知识(自称拥有自8086以来每个类型的计算机,现在在用一台华硕讯驰1。8G,计划很快去买台Mini-mac),是个绝对自学成材的自由软件者。曾去大学蹭课听,主听中文系与哲学系的课程。自我感受听中文系的老教授所讲的知识很有受益。
  • 英语的学习:曾一段时间迷恋万智牌,为了打好牌而常上irc与老外交流,切磋牌技,经过一段时间,在irc里熟练了英语。而且还曾打到台湾万智牌的积分排名第一。
  • 唐现在的生活:
      喜欢旅游,过去去过世界各地的很多地方(基本都是自费)。
      到处推广perl,参加开放源代码会议。刚在大陆给perlchina成员上课,推广perl。

  开办一家小计算机公司2-3年,没有什么正式的员工,大家都是网上认识的朋友。接到工作后,按照过去对大家能力的评价分配给大家干,然后大家分钱。自己干活的话是按照小时收费。每写一小时的软件收费100美金或欧元。写完的产品给客户说明需要开源,开源可以让客户免费享受很多的开源社区升级更新所带来的好处。当然如果客户不同意,他就说明要收两倍的价钱,如果客户要求软件的版权完全归自己所有,他会要求收6倍的价钱(竟然还是有一个客户愿意收6倍的价钱)。


  从2005-02-01开始领导一个开发团队夜以继日的编写Pugs。这个团队大约有十五六人,其中有三分之一来自于台北perl推广组。


  平时当遇到某些困难问题的时候就需要大量的咖啡因(咖啡,后来换成可乐,可乐其实比较伤胃,所以注意不能多喝,好像现在想要换成茶?)。



唐对于perl的经历:

  学习perl只是由于正值互联网的兴起,有公司要他过去开发cgi,这才开始了perl的生涯。后来编写了大量的perl模块,有100多个,可以在cpan(请看附录)上找到。
  网址:http://search.cpan.org/~autrijus/


  原来最初觉得写perl很孤独,但是经过长时间的与各种朋友的交流才发现,原来很多的软件都是用perl写,原来有很多的大公司都在使用perl,例如:微软的员工在用perl,微软赞助了windows下面的perl版本activeperl的开发;摩根士坦利整个公司都在使用perl,他们在2003年赞助了perl基金会大约一半的费用;众多华尔街的金融机构都在使用perl   来做金融数据的处理;物工程科学也都在很大程度上使用perl,据称现在的基因工程还十分得益于perl的快速开发。


  由于在cpan上的贡献,曾在2003年2次获得perl基金会的奖励,每次2000美金。
  网址:http://www.perlfoundation.org/gc/grants/2003.html


  与台北的perl爱好者成立了台北perl推广组,每个月组织一次聚会,大约有30多人,大家见见面,并找个新的perl课题让某个人上台给大家讲演一下。最近半年这个活动已经成为了例行活动。(在台湾写perl的人大家互相都很熟悉,从唐口中了解到了董仲恺,openwebmail的开发者,一个上了8年的博士生,将自己的精力都放在了openwebmail的开发上,一个perl写的web mail,很不错)。


  在2001年唐第2次参加开放源代码大会的时候,需要在会上做一个5分钟的演讲,那时唐刚接管cpan的相关管理工作,所以他把自己在cpan上最喜欢用的模块拿出来用中文创作了一段数来宝(cpan数来宝,有点中文rap的味道),最后还有一段一用英文唱的总结歌曲,这引起了与会者的满堂喝彩。所以以后唐到西雅图,德国,英国,都会应要求表演一段。
  网址:http://wagner.elixus.org/~autrijus/favcpan/start.html
  錄像:http://www.perl.org/tpc/2003/movies/perl-lt/


links for 2007-05-12

Friday, May 11, 2007

links for 2007-05-11




  • monotone is a free distributed version control system. it provides a simple, single-file transactional version store, with fully disconnected operation and an efficient peer-to-peer synchronization protocol. it understands history-sensitive merging, light



Thursday, May 10, 2007

用python来缩放图片

Python Imaging Library (PIL) 是一个普遍使用的图片库,你需要下载安装。这里有一段示例代码,最新的代码看这里

#!/usr/bin/env python
# $Id: thumbnails_create.py 5 2007-05-10 05:44:05Z zhuzhu $
# first you must install Python Imaging Library (PIL) at
# http://www.pythonware.com/products/pil/
import os, sys
import Image
import glob

size = [580,1024]
files = glob.glob('*.jpg')
# files = ["Leah_Dizon_613516.jpg"]

for infile in files:
im = Image.open(infile)
if im.size[0] > size[0]:
how = (size[0]*100)/im.size[0]
outfile = os.path.splitext(infile)[0] + ".webcan.jpg"
if infile != outfile:
try:
im = im.resize((size[0], (im.size[1]*how)/100), Image.BILINEAR)
im.save(outfile, "JPEG")
print outfile+" is created"
except IOError:
print "cannot create thumbnail for", infile
else:
print "not need create thumbnail for", infile


我还收集了一个python的小小手册,相当于是FAQ吧。

Wednesday, May 9, 2007

Last.fm on Ubuntulinux (dapper and high version)

今天下班回来编译了QT4,太长了,用了2个多小时 ;( 编译完全后大小,居然有364M。搞这个完全是为了学习用。

接下来安装了 Last.fm ,一个很好的听歌的(我也比较庸俗)工具,ubuntu/debian的版本在这里下载得到。使用Last.fm的朋友加我为好友吧,我的ID是 id_sonic。 ;)

Last.fm on ubuntulinux