Profile老王的网络日志BlogLists Tools Help
7/17/2006

phpe的t恤邮寄到了。

本来说好上周末去北四环取的,可惜临时有事情没去成,发短信问能不能同城快递,结果今天就给送过来了,我还以为是收件人付款来着,结果原来phpe的人已经给付款了,够仗义,赶紧发短信看能不能网上支付,可惜不能了,只好周末再说了,看到邮件上面的地址写的是新浪,估计是easychen了,虽然没见过,不过感觉是个不错的家伙。。。
7/13/2006

想搬家了

正在考虑把blog放到http://hi.baidu.com/thinkinginlamp/,因为长久以来,我都把msn的空间当成记事本,没有认真地写过东西,以后想在baidu空间里好好写点东西。
 
 
------------------------------------------------------------------
 
随便唠叨一下,下午重新编译了一下mysql,很多人都说--with-extra-charsets=complex就可以加入多字节字符的支持,我这样做却找不到gbk编码,最后我都给编辑了--with-extra-charsets=all
 
------------------------------------------------------------------
 
使用rsync备份的时候,rsync -vzrtopg --progress --password-file=/etc/rsyncd.secrets 用户名@yourip::模块名 /data/dir.bak/ 出现了错误信息,rsync error: some files could not be transferred (code 23) at main.c(1298) [generator=2.6.8],估计了一下,可能是rsync服务端的某些文件没有read权限造成的,于是在服务端执行:chmod -R a+r ./htdocs/,然后再重复rsync备份,正常!
 
------------------------------------------------------------------
 
 
------------------------------------------------------------------
7/12/2006

浮点数精度问题

<?php
 $a = 64;
 $b = 64.1;
 echo $b - $a;
?>
 
Windows XP SP2结果输出:0.099999999999994
RedHat AS 4结果输出:0.1 
 
别的网友的测试结果有的和我一样,有的和我不一样。
 
类似的还有:
 
<?echo floor((0.1+0.7)*10);?>
<?echo ceil((0.1+0.7)*10);?>
 

linux下利用wget和cron来定时运行

看了neo的文章,转过来。
 
*/5 * * * * wget -qO - http://{SERVER NAME}/refresh.php
 
cron没啥说的,说说wget的这几个参数,man了一下,如下:
 
-q
--quiet
Turn off Wget's output.
 
-O file
--output-document=file
The documents will not be written to the appropriate files, but
all will be concatenated together and written to file.  If - is
used as file, documents will be printed to standard output, dis-
abling link conversion.  (Use ./- to print to a file literally
named -.)
Note that a combination with -k is only well-defined for download-
ing a single document.
 
7/11/2006

ORM和ROM的胡思乱想

RoR的风行带动了很多PHP同行开始研究数据持久化,自然而然的出现了一批ORM的php实现。
 
先看看什么叫orm,在我的理解看来,orm是为了缓解面向对象和关系数据库的不一致性而建立的,从方向性上看是o -> r才对,但是从目前的一些php的orm来看,方向似乎变成了r -> o,如常见的phpdoctrine, cake等等都是这样。
 
<?php
class User extends Doctrine_Record { 
    public function setTableDefinition() {
        // set 'user' table columns, note that
        // id column is always auto-created
        
        $this->hasColumn("name","string",30);
        $this->hasColumn("username","string",20);
        $this->hasColumn("password","string",16);
        $this->hasColumn("created","integer",11);
    }
}
?>
 
上面的代码是phpdoctrine的代码,从代码里可以看到,没有描述对象如何如何,都是有哪些列,啥类型,多长之类的数据信息。
 
这样来说,称他们为ROM或许更贴切些,他们这些实现是不是有些本末倒置呢,我自己头脑也很混乱,想想再下结论。
 
To Be or Not to Be, That Is The Question.
ORM or ROM,同样也是一个问题。