Archive → 2005
PHP 10 周年

今天,6月8日,是 PHP 诞生十周年的日子。刚从很多国外的 blog 上知道了这个特别的日子。很值得纪念一下。
我差不多也是去年的这个时候知道 PHP 这东东的,那时是数据库课期末要做一个小程序。刚才那学期在学植物地理,所以花了一星期边学边做,弄了一个 PHP 的植物图像查询系统。从那之后就无法控制地喜欢上了 PHP 这家伙,直到现在,而且每天都能发现很多 PHP 的有趣。所以要感谢 PHP 给我带来了这么多快乐,呵呵。
同时,期待 PHP 的下个十年更好,呵呵。
《博客》杂志
上午在学校东门数完汽车后,跑到报刊亭去看了一下,发现了一本叫《博客》的杂志。

该杂志号称是国内第一本”轻“概念心灵读本。这一期是试刊号,由哈尔滨日报社报业集团主办,《知识文库》编辑部编辑。大16开本,64页全彩,零售4元。
杂志收录文章分为博客,心情,记忆,人生四大块,个人感觉和其它文摘杂志没多大的区别。
看来我一定要努力写好这个blog ,然后也许有一天我也可以出版一本文集 ,或者还可以搞签名售书。^_^
顺祝各位六一节快乐!!
Cake PHP framework 0.9 dev 发布
昨天 Cake PHP framework 发布了 0.91dev 版。
新版将函数的命名风格从像 input_tag() 这种改到 inputTag() 这种了。汗,不知应该怎么叫啊 :’(
协议换成使用 MIT License 。
框架程序改动也挺多的,详见 Cake’s release history ,不再赘述。
作者还发布了一个 Cake Framework AJAX Demo ,展示了如何使用 Cake 进行 Ajax 方面的开发。
同时并提供源码下载:Cake Framework AJAX Demo source code 。
另外从 Sourceforge 上看到了一个叫 xajax 的 PHP 类库 ,刚出炉不久 ,5.26 号发布的第一个版本: 0.1 alpha ,现在是 0.3 alpha 。它提供的一个叫 Graffiti Wall 的东东还比较好玩。
Cake PHP framework
Cake PHP framework 这东东时常在我这个 blog 上订阅的 del.icio.us/tag/php 中出现。
这是一个基于 PHP 的 framework 。它的作者称 Cake PHP framework 的设计思想源自 37signals 的 Ruby on Rails ,一个最近非常的 Ruby 框架。他说:
after playing around with Ruby on Rails you don’t want to develop software the old way. Rails does all the paperwork involved with connecting to the database, setting up the templating, linking code to URLs in a meaningful way, and so on. You write the application business logics and fire it up. Very fast, very efficient programming, saves a lot of unnecessary bother.
Cake aims to provide an easy way to write PHP applications. While designed as a Rails rip-off, it aims to be a framework of it’s own, along with certain functionalities, such as custom, specialized modules, that, if I understand correctly, Rails developer are not particularily fond of.
类似于 Ruby on Rails ,它封装了数据库连接,模板,及生成链接。最大的特点就是数据操作,不用自己再写多少代码。和 Ruby on Rails 类似,它生成一个数据表的操作最少只要一行代码。 Cake PHP framework 还有很大的一个优点就是它是一个轻量级的框架,虽然第一次看来会觉得很神奇,但是仔细看它的代码也很好懂而且也没什么特殊之处,但其开发使用方式确实很独特,实用,高效。如果是作基于数据库的 PHP 系统,这是一个很值得考虑的选择 。
看一下 Cake Tutorial 就能了解用 Cake PHP framework 建立一个 Web Application 是如何的快速方便了。它介绍了如何快速地建立一个 blog 程序的例子,几分钟就能搞定。
越来越发现 PHP 世界的有趣,哈哈。
Digital-NGP
Digital-NGP (Digital Northern Great Plains Project) 是一个在线的遥感图像存储及发布系统,是由美国的 North Dakota 大学 Upper Midwest Aerospace Consortium 开发的一套系统。用它可以查询,下载美国地区各种尺度的各种卫星遥感影像。
Digital-NGP or DNGP is an online GIS database system for archiving and delivering remote sensing images. NGP stands for Northern Great Plains, which defines the region of our interest. DNGP is developed by the Upper Midwest Aerospace Consortium at the University of North Dakota in an aim to better serve our community by providing an integrated web-based Geographic Information System.
提供的影像类型包括:MODIS,ETM,TM,QuickBird,MSS,ASTER,ETM+,SRTM 等,并能查看指定日期的各地区的各种类型的影像。并对于多光谱影像可以选择特定波段,生成RGB图像。然后还可以选择生成特定的图层的内容,如 Boundaries,Transportation,Water,Geology,Raster Layer,Agriculture等分类下的特定图层。同时也可进行 NDVI 等指数的分析。生成的影像均为 png 格式,可以自由打印和下载。
这是今天上午被老师叫去听一个 North Dakota 来的张老师的讲座了解到的。他是该项目的 Team leader 。系统数据库用的是 Oracle spatial ,底层影像的处理主要是依靠开源的 Mapserver 来完成。影像数据通过 GeoTIFF 存储,然后通过 Mapserver 根据用户的请求生成 png 图像。其 web 界面早期用的是java ,后来转而使用了 PHP 。他介绍说当时数据库之所以使用 Oracle 是因为早期只有 Oracle 有对空间数据的支持,不过现在的 MySQL 4.1 也有了对空间数据的支持,以后可以好好研究一下。PostgreSQL 现在也有 Spatial Extension:PostGIS ,相信现在开源的数据库应该也能完成这方面的应用了。
听那老师的讲述,在科研领域使用 java 很多时候都是不合适的,因为太慢的速度,内存占用对于很大数据量的遥感影像处理完全不合适。而且使用 java 容易出现各种问题,一般较适用于有快速开发要求的商业应用,然后还可以因为容易出问题而使开发者可以实现提供长期的升级,修补等服务。呵呵。
PHPMailer:Featured email transfer class for PHP
PHPMailer 是一个很有用的 PHP 发送邮件的类。它支持使用 smtp 服务器发送邮件,同时支持 Sendmail, qmail, Postfix, Imail, Exchange, Mercury, Courier 等邮件服务器。SMTP服务器的话还支持验证,多SMTP发送(不过不太清楚有什么用).邮件发送可以包括多个TO, CC, BCC and REPLY-TO,支持text和HTML两种邮件格式,可以自动换行,支持各种格式的附件及图片,自定义邮件头等基本的邮件功能。
由于 PHP 中只包含了一个 mail 函数,所以 PHPMailer 是对其很大的增强,相信是可以满足很多人的需求的,呵呵。其主要包括两个类文件:用于实现发送邮件功能的 class.phpmailer.php 和 smtp 实现的 class.smtp.php 。然后还有可以实现多种错误输出的文件,以及很详细的文档。软件发布遵循 LGPL 协议。
使用也很简单,看下面的例子就明白了:
- require(“class.phpmailer.php”);
- $mail = new PHPMailer();
- $mail->IsSMTP(); // send via SMTP
- $mail->Host = “smtp1.site.com;smtp2.site.com”; // SMTP servers
- $mail->SMTPAuth = true; // turn on SMTP authentication
- $mail->Username = “jswan”; // SMTP username
- $mail->Password = “secret”; // SMTP password
- $mail->From = “from@email.com”;
- $mail->FromName = “Mailer”;
- $mail->AddAddress(“josh@site.com”,”Josh Adams”);
- $mail->AddAddress(“ellen@site.com”); // optional name
- $mail->AddReplyTo(“info@site.com”,”Information”);
- $mail->WordWrap = 50; // set word wrap
- $mail->AddAttachment(“/var/tmp/file.tar.gz”); // attachment
- $mail->AddAttachment(“/tmp/image.jpg”, “new.jpg”);
- $mail->IsHTML(true); // send as HTML
- $mail->Subject = “Here is the subject”;
- $mail->Body = “This is the <b>HTML body</b>”;
- $mail->AltBody = “This is the text-only body”;
- if(!$mail->Send())
- {
- echo “Message was not sent <p>”;
- echo “Mailer Error: ” . $mail->ErrorInfo;
- exit;
- }
- echo “Message has been sent”;
DotClear 1.2.1 发布
DotClear 1.2.1 今天发布了。
新版本增加了四种语言支持,包括中文(我前几天提交上去的)。
新版本增加了一个新的Themes,一个防垃圾留言的插件,可通过拖拉分类及链接设置其排序,及其它小的改动。大的变化不多。
作者 Olivier 说:Ce n’est pas une révolution, juste une évolution dans le bon sens – et une préparation à la révolution
,意思是:It is not a revolution, just an evolution in the good direction – and a preparation with the revolution
。另外 Olivier 还说下一版本可能会支持 tag 等其它新的功能。
下面是其ChangeLog:
- 4 new languages :Chinese (by Tsing) German (by Hans and Frederik) Italian (by Federico) Spanish (by Gromka)
- Translation of help files (by Tehu)
- New default theme (by Maurice.)
- New $PLUGIN_HEAD variable in which a plugin can specify optional HTML headers.
- Indexes in MySQL tables.
- Improved MySQL plugin with backup and restore (by Pep.)
- Javascript event which alert when leaving an unsaved entry.
- Drag and drop sorting on categories and links.
- Javascript fixes.
- New wiki2xhtml with macro support.
- Added help files in all languages but Chinese.
- New dcCustomTitle() template function which display $dc_custom_title global variable (useful for plugins.)
- Added a template function to display an admin link if user is logged in.
- Fixed bug #15 about $_GET (yeah!)
- Added “short feeds” option.
- Fixes in Atom and RSS feeds.
- New global variable $dc_args which returns URL arguments.
- Moved sessions to a database table.
- Removed SQL cache.
The Acid2 Browser Test & browsehappy
这是在 The Web Standards Project 上看到的。
The Second Acid Test 是一个测试浏览器针对HTML,CSS,PNG等的支持的网页。其测试内容有:
- Transparent PNGs — The eyes are encoded as transparent PNGs.
- The object element — The eyes of the face are attached to an object element. Being able to use object (which can have alternative content) is one of the oldest requests from web designers.
- Absolute, relative and fixed positioning — Being able to position elements accurately is important for advanced page layouts.
- Box model — The original Acid test focused on the CSS box model. Acid2 continues in this fine tradition by testing ‘height’, ‘width’, ‘max-width’, ‘min-width’, ‘max-height’ and ‘min-height’.
- CSS tables — There is nothing wrong with table layouts. It is a powerful layout model which makes sense on bigger screens. However, the table markup is troublesome as it ties the content to these screens. Therefore, being able to specify table layouts in CSS is important.
- Margins — CSS defines accurate algorithms for how margins around elements should be calculated.
- Generated content — The ability to add decorations and annotations to Web pages without modifying the markup has long been requested by authors.
- CSS parsing — Acid2 includes a number of illegal CSS statements that should be ignored by a compliant browser.
- Paint order — We test that overlapping content is painted in the right order. This is not a feature in itself, but a requirement for other features to work correctly.
- Line heights — The Acid2 test checks a few key parts of the CSS inline box model, upon which any standards-compliant Web page depends.
- Hovering effects — One of the elements in the face changes color when you hover over it. Which one?
我用Firefox,Opera,IE试了一下,都达不到其给出的参考图像的效果。比较起来以IE最差,Firefox最好,呵呵。
另外 The Web Standards Project 建的的另一个网站 browsehappy.com 也是一个很好玩的网站。它是一个指点人们如何选择网页浏览器的网站。网站的头条是:Internet Explorer can make your computer unsafe,然后里面收集了选用除IE外的其它各种浏览器(Mozilla,Firefox,Opera,Safari)的人们的使用心得。值得一看。
Updated 2005-4-29
使Zend Studio支持中文
Zend Studio算是最好用的PHP的IDE了,不过对中文支持一直不是特别好。
Windows下Zend Studio只要选择好中文字体(DialogInput的效果似乎比较好)就可以很好的支持中文了。
但是在Linux下就没有中文字体可选。之前以为没办法,今天才发现Zend Studio的字体都放在它自带的jre下,只要把中文字体拷到jre/lib/fonts就OK了。呵呵。
不过我在使用中还发现有一个问题。就是用Zend Studio编辑过的文件采用utf-8编码的话,其它编辑器打开有时会乱码,有时不会。而其它编辑器如EditPlus保存过的utf-8编码的文件中的中文信息在Zend Studio中打开也经常会乱码。没搞明白原因。
About
Personal Stuff
tsing:现居中国北京,为某门户网站技术工程师,代码农民,从事 LAMP 相关的技术工作。
感兴趣的技术关键字:perl php python ruby ror twisted web.py mako xmpp linux cfengine puppet sphinx apache nginx mysql moose drizzle dsl lua cluster distribution cloud merb thrift disco hadoop hbase hypertable kfs gluster mogilefs memcached squid varnish gearman rabbitmq moose
Contact Me
自己找一下
This Site
目前比较懒,更新频率大致为一年几篇。。。想八卦请google: tsing