总是忘记好友的生日

Posted on 27th August 2004 by Nio in 日常生活

今天是好友 E+ 的生日,我已经忘记了,是他自己提醒我的,可惜他现在在上海,没机会请我们吃饭了。这一年来,我忘掉了很多好友的生日,甚至我表妹的生日,而且我这个人没有记录别人生日的习惯,有时连自己的都忘掉。最为夸张的一次是大学的某年,本来是 shxll 的生日,结果忘掉了,一大早起来之后就和宿舍老大一起跑去师兄郑振华那里玩,直到吃了晚饭之后,老大突然想到那天是 shxll 的生日,这才匆忙赶回学校,据说她在宿舍等了我一整天,哈哈,忘了当时是怎么蒙混过关的~。今天 E+ 的 MSN 名字也很有创意:Today is E-Day!哈哈哈,兄弟,生日快乐,记得补请我们,嘻嘻。

PHP :: 面向对象编程的相关教程列表

Posted on 26th August 2004 by Nio in 程序人生

From: php.faqtsKnow of any basic tutorials on PHP Classes and OOP?
Aug 11th, 2004 12:18
Philip Olson

The first place to look is, of course, the manual:

PHP 4 OOP
http://www.php.net/oop

PHP 5 OOP
http://www.php.net/oop5

Here are a few basic tutorials on the subject of OOP and Class. They
all approach the subject of OOP and Classes in PHP a little differently
so it depends on your tastes. It'll eventually click.

An Introduction to Classes :
————————————————————-
http://www.zend.com/zend/tut/class-intro.php

Another Introduction to Classes, including PHP 5 OOP info :
————————————————————-
http://zend.com/php5/abs/php101-7.php

Taking PHP the OO way :
————————————————————-
http://www.php-mag.net/itr/online_artikel/show.php3?id=284&nodeid=114

Introduction to OOP :
————————————————————-
http://www.devarticles.com/c/a/PHP/Introduction-to-PHP-Classes-OOP/

PHP Object Oriented Programming :
————————————————————-
http://www.liquidpulse.net/articles/125

Using objects to create an application :
————————————————————-
http://www.zend.com/zend/tut/tutorial-johnson.php
http://www.zend.com/zend/tut/tutorial-johnson2.php

Back to Class :
————————————————————-
http://www.devshed.com/Server_Side/PHP/BackToClass/

Accessing Databases with Class :
————————————————————-
http://www.devshed.com/Server_Side/PHP/Class/

Object Oriented Programming in PHP :
————————————————————-
http://php.vamsi.net/article/3/1

Introduction to PHP Classes (OOP) :
————————————————————-
http://www.phpfreaks.com/tutorials/48/0.php

Classes and PHP :
————————————————————-
http://www.phpbuilder.com/columns/rod19990601.php3

Introduction to PHP Objects :
————————————————————-
http://www.onlamp.com/pub/a/php/2002/08/01/php_foundations.html

OOP Talk : A slide presentation :
————————————————————-
http://www.sdphp.net/talks/talks/sdphp_class

OOP Design Patterns in PHP : A slide presentation in german :
————————————————————-
http://www.php-conference.de/2001/slides/bergmann_oopdesignpatterns/

Some information about overusing OOP can be seen here:

Overusing OO :
————————————————————-
http://www.zend.com/zend/art/mistake1.php#Heading13

And PHP 5 offers many new OOP features. For more information of PHP 5,
including words on the Zend Engine 2, read this faqt:

Where can I get more information about PHP5?
————————————————————:
http://www.faqts.com/knowledge_base/view.phtml/aid/22154/fid/1150

Since PEAR is full of classes, you may find some of them useful
as you learn:

PEAR :
————————————————————-
http://www.faqts.com/knowledge_base/index.phtml/fid/707
http://pear.php.net/

And a good general tutorial regarding OOP is the following Java tutorial:

Lesson: Object-Oriented Programming Concepts :
————————————————————-
http://java.sun.com/docs/books/tutorial/java/concepts/

No IE

Posted on 26th August 2004 by Nio in 程序人生

记得刚开始上网的时候,国内的网页大都只兼容 IE 浏览器,而且还会在网页上注上“请用 IE 4 或以上版本浏览”的字样。可能那个时候国内用 Windows 的人很多,当然有很多是盗版,而且当时 Windows 可用的浏览器只有 IE 和 Netscape,而使用 Netscape 的时候就会发现很多网页无法正常浏览,页面出现严重变形,这样促使大家都使用 IE 浏览器,再加上 M$ 的手段,导致了 Netscape 的沦陷。就是这样的恶性循环,导致越来越多的网页只支持 IE,而不支持别的浏览器。

几年之后,浏览器也有了很大的发展,最受关注的为 Mozilla 及其 Firefox,他们对 W3C 的标准支持得很好,而且有很多实用的功能,具有快速、系统资源占用少等特性,于是越来越得到广大网民(在国内,主要是技术人员)的青睐。而 IE 浏览器则由于它对 W3C 标准支持得不是很好,导致很多人开始对 IE 反感,特别是开发人员,因为他们必须降低网站的设计标准来兼容 IE 浏览器,另外,IE 对于革命性的 PNG 也支持的不好,所以现在我们在很多 BLOG 网页上,都可以看到 NoIE 的图标(例如:Bryan Bell):imageSite design downgraded to work with Windows Internet Explorer. Images surrounded by grey result from IE's failure to support the revolutionary PNG standard. Alternative web browsers (Mozilla, Safari, etc.) provide a better web experience.

这也表明了他们对 IE 及 M$ 行为的愤慨。

(more…)

Cryptanalysis of MD5 and SHA: Time for a new standard

Posted on 25th August 2004 by Nio in 程序人生

最近看到“SHA-0 Broken, MD5 Rumored Broken”:Posted by CowboyNeal on Monday August 16, @09:56PM
from the lucky-numbers dept.
An anonymous reader writes "Exciting advances in breaking hash functions this week at the CRYPTO conference. SHA-0 has definitely been broken (collision found in the full function). Rumors are that at the informal rump session, a researcher will announce a collision in full MD5 and RIPEMD-128. And Ed Felten is speculating about collisions in SHA-1! Many systems, especially those that use cryptography for digital signatures are most at risk here."

由于目前已经发现了 SHA-0 的冲突(参考:Joux found a collision for SHA-0 !),继而提出了“Cryptanalysis of MD5 and SHA: Time for a new standard”。

关于 SHA-0 的冲突描述是这样的:

Thursday 12th, August 2004

We are glad to announce that we found a collision for SHA-0.

First message (2048 bits represented in hex):
a766a602 b65cffe7 73bcf258 26b322b3 d01b1a97 2684ef53 3e3b4b7f 53fe3762
24c08e47 e959b2bc 3b519880 b9286568 247d110f 70f5c5e2 b4590ca3 f55f52fe
effd4c8f e68de835 329e603c c51e7f02 545410d1 671d108d f5a4000d cf20a439
4949d72c d14fbb03 45cf3a29 5dcda89f 998f8755 2c9a58b1 bdc38483 5e477185
f96e68be bb0025d2 d2b69edf 21724198 f688b41d eb9b4913 fbe696b5 457ab399
21e1d759 1f89de84 57e8613c 6c9e3b24 2879d4d8 783b2d9c a9935ea5 26a729c0
6edfc501 37e69330 be976012 cc5dfe1c 14c4c68b d1db3ecb 24438a59 a09b5db4
35563e0d 8bdf572f 77b53065 cef31f32 dc9dbaa0 4146261e 9994bd5c d0758e3d

Second message:
a766a602 b65cffe7 73bcf258 26b322b1 d01b1ad7 2684ef51 be3b4b7f d3fe3762
a4c08e45 e959b2fc 3b519880 39286528 a47d110d 70f5c5e0 34590ce3 755f52fc
6ffd4c8d 668de875 329e603e 451e7f02 d45410d1 e71d108d f5a4000d cf20a439
4949d72c d14fbb01 45cf3a69 5dcda89d 198f8755 ac9a58b1 3dc38481 5e4771c5
796e68fe bb0025d0 52b69edd a17241d8 7688b41f 6b9b4911 7be696f5 c57ab399
a1e1d719 9f89de86 57e8613c ec9e3b26 a879d498 783b2d9e 29935ea7 a6a72980
6edfc503 37e69330 3e976010 4c5dfe5c 14c4c689 51db3ecb a4438a59 209b5db4
35563e0d 8bdf572f 77b53065 cef31f30 dc9dbae0 4146261c 1994bd5c 50758e3d

Common hash value (can be found using for example "openssl sha file.bin"
after creating a binary file containing any of the messages)
c9f160777d4086fe8095fba58b7e20c228a4006b

This was done by using a generalization of the attack presented at Crypto'98
by Chabaud and Joux. This generalization takes advantage of the iterative
structure of SHA-0. We also used the "neutral bit" technique of Biham and
Chen (To be presented at Crypto'2004).

The computation was performed on TERA NOVA (a 256 Intel-Itanium2 system
developped by BULL SA, installed in the CEA DAM open laboratory
TERA TECH). It required approximatively 80 000 CPU hours.
The complexity of the attack was about 2^51.

We would like to thank CEA DAM, CAPS Entreprise and BULL SA for
their strong support to break this challenge.

Antoine Joux(*) (DCSSI Crypto Lab)
Patrick Carribault (Bull SA)
Christophe Lemuet, William Jalby
(Universit'e de Versailles/Saint-Quentin en Yvelines)

(*) The theoretical cryptanalysis was developped by this author.
The three others authors ported and optimized the attack on the TERA NOVA
supercomputer, using CAPS Entreprise tools.

$hexdump fic1.bin
0000000 66a7 02a6 5cb6 e7ff bc73 58f2 b326 b322
0000010 1bd0 971a 8426 53ef 3b3e 7f4b fe53 6237
0000020 c024 478e 59e9 bcb2 513b 8098 28b9 6865
0000030 7d24 0f11 f570 e2c5 59b4 a30c 5ff5 fe52
0000040 fdef 8f4c 8de6 35e8 9e32 3c60 1ec5 027f
0000050 5454 d110 1d67 8d10 a4f5 0d00 20cf 39a4
0000060 4949 2cd7 4fd1 03bb cf45 293a cd5d 9fa8
0000070 8f99 5587 9a2c b158 c3bd 8384 475e 8571
0000080 6ef9 be68 00bb d225 b6d2 df9e 7221 9841
0000090 88f6 1db4 9beb 1349 e6fb b596 7a45 99b3
00000a0 e121 59d7 891f 84de e857 3c61 9e6c 243b
00000b0 7928 d8d4 3b78 9c2d 93a9 a55e a726 c029
00000c0 df6e 01c5 e637 3093 97be 1260 5dcc 1cfe
00000d0 c414 8bc6 dbd1 cb3e 4324 598a 9ba0 b45d
00000e0 5635 0d3e df8b 2f57 b577 6530 f3ce 321f
00000f0 9ddc a0ba 4641 1e26 9499 5cbd 75d0 3d8e

$ hexdump fic2.bin
0000000 66a7 02a6 5cb6 e7ff bc73 58f2 b326 b122
0000010 1bd0 d71a 8426 51ef 3bbe 7f4b fed3 6237
0000020 c0a4 458e 59e9 fcb2 513b 8098 2839 2865
0000030 7da4 0d11 f570 e0c5 5934 e30c 5f75 fc52
0000040 fd6f 8d4c 8d66 75e8 9e32 3e60 1e45 027f
0000050 54d4 d110 1de7 8d10 a4f5 0d00 20cf 39a4
0000060 4949 2cd7 4fd1 01bb cf45 693a cd5d 9da8
0000070 8f19 5587 9aac b158 c33d 8184 475e c571
0000080 6e79 fe68 00bb d025 b652 dd9e 72a1 d841
0000090 8876 1fb4 9b6b 1149 e67b f596 7ac5 99b3
00000a0 e1a1 19d7 899f 86de e857 3c61 9eec 263b
00000b0 79a8 98d4 3b78 9e2d 9329 a75e a7a6 8029
00000c0 df6e 03c5 e637 3093 973e 1060 5d4c 5cfe
00000d0 c414 89c6 db51 cb3e 43a4 598a 9b20 b45d
00000e0 5635 0d3e df8b 2f57 b577 6530 f3ce 301f
00000f0 9ddc e0ba 4641 1c26 9419 5cbd 7550 3d8e

$ diff fic1.bin fic2.bin
Binary files fic1.bin and fic2.bin differ

$ openssl sha fic1.bin
SHA(fic1.bin)= c9f160777d4086fe8095fba58b7e20c228a4006b

$ openssl sha fic2.bin
SHA(fic2.bin)= c9f160777d4086fe8095fba58b7e20c228a4006b

可以在自己机器上试试 :D

Lucene 全文检索实践(5)

Posted on 24th August 2004 by Nio in Lucene, 程序人生

对于 Lucene 的初步研究已经过去一段时间,自己感觉还不是很深入,但由于时间的关系,一直也没再拿起。应网友的要求,将自己实践中写的一些代码贴出来,希望能对大家有用。程序没有做进一步的优化,只是很简单的实现功能而已,仅供参考。

在实践中,我以将 PHP 中文手册中的 HTML 文件生成索引,然后通过一个 JSP 对其进行全文检索。

(more…)