2007/03 30
很多的工作要做,很多的事情要忙。
有时想休息一下,但脑袋里总是有很多的事情在闹,烦心。
下周,或者要下周的下周,要找个周末睡一天懒觉,出门晒一天太阳了。

Posted by rollenc

Not modified
2007/03 26
替换掉Prototype为1.5之后,发现了一个Bug,找了半天。发现是一个函数在1.5和1.4中有差别。
//1.4
Element.toggle(elem1 [, elem2 [, elem3 [...]]]) //	instance	elemN: element object or id  	Toggles the visibility of each passed element.
//1.5版本不再支持多参数
Element.toggle(element)	 // instance	element: element object or id  	Toggles the visibility of the element.
Defined tags for this entry:

Posted by rollenc

Not modified
2007/03 25
直接使用刚才的方法,升级成功,没有出现任何问题。
不过还是采用了6.06升级到6.10的经验,升级之后不要马上重启,点击关闭,仍然打开软件报管理器,重新刷新软件源,再点击安装所有更新。
上次升级到6.10时我这样重复了3次,才把所有的文件升级完,不然就很可能出现经不了图形界面的问题。
这次升级7也是这样,升级时下载了900多兆(还好网速快,但也在奇怪,为什么明明是国外的服务器,我也能跑到150k以上)。再次更新升级时又下载了100多兆。也为了安全起见,把ubuntu-desktop给装上了,这样虽然会额外安装一些我不需要的,比如蓝牙等,但毕竟,为了保证ubuntu的完整性,还是先装上,运行正常之后再卸掉就成了。
Ubuntu 7 默认安装了3D左面,可怜我的256内存的机子,跑不动啊。不过效果还是可以看到的,但是进行一次操作要等半分钟左右:)
Defined tags for this entry: ,

Posted by rollenc

Last modified on 2007-03-25 12:42
2007/03 25
使用方法:
gksu "update-manager -c -d"

检查完毕之后,系统就提示有7.04,点击升级,照着步骤一步一步来。
可能安装 的洞子太多了。这次升级需要下载900多兆。吓人。
不管了,先下了再说。
Dapper升级到Edgy也折腾过了,怎么着现在也要Feisty一下嘛?
Defined tags for this entry: ,

Posted by rollenc

Last modified on 2007-03-28 09:30
2007/03 24
等了很久了。办公室的机子前一段时间装上了opensuse,令我太失望了。一直想卸掉,但重新装回Ubuntu6又不太愿意,毕竟7就快出来了。
也下载了一个Ubuntu7.04 Alpha5过来,按照常规的银盘安装没装成功,可能是文件放在最后一个硬盘分区中,安装时识别不了。没去管了。目前用了很久的windows开发了,好在开发环境都是一样的,不会有什么影响。
Ubuntu 7.04 beta终于出来了,先去下载了再说。希望到时beta升级到正式版是无缝的。
Defined tags for this entry: ,

Posted by rollenc

Last modified on 2007-03-24 10:28
2007/03 21
当magic_quotes_gpc设置为1时,GPCF的数据将被addslashes。
这里是使用程序还原原始数据的代码,相当于把magic_quotes_gpc设置为0。

if (get_magic_quotes_gpc()) { // check magic_quotes_gpc state
  function strip_quotes(&$var) {
  if (is_array($var)
    array_walk($var, 'strip_quotes');
  else
    $var = stripslashes($var);
}
// Handle GPC
foreach (array('GET','POST','COOKIE') as $v)
  if (!empty(${"_".$v}))
    array_walk(${"_".$v}, 'strip_quotes');
// Original file names may contain escaped data as well
if (!empty($_FILES))
  foreach ($_FILES as $k => $v) {
    $_FILES[$k]['name'] = stripslashes($v['name']);
}

或者更快的解决方法:
if (get_magic_quotes_gpc()) {
  $in = array(&$_GET, &$_POST, &$_COOKIE);
    while (list($k,$v) = each($in)) {
      foreach ($v as $key => $val) {
        if (!is_array($val)) {
          $in[$k][$key] = stripslashes($val);
          continue;
        }
      $in[] =& $in[$k][$key];
    }
  }
  unset($in);
}
Defined tags for this entry:

Posted by rollenc

Last modified on 2007-03-21 20:04
2007/03 21
在PHP核心中定义了:
Directory 在 dir 中用来实例化的类。
stdClass 标准类,什么方法什么属性都没有。
__PHP_Incomplete_Class 不完整的类。不知道是什么意思,根据使用上理解,相当与在定义类的之前的一个“占位符”类型。比如unserialize一个字符串,在回调函数存在且回调函数没有运行完毕前,是不能返回返回一个对象的。在这一过程中,这个对象就属于__PHP_Incomplete_Class类

自 PHP 5 起预定义的类
这些额外的预定义类是 PHP 5.0.0 引进的。

exception 异常
php_user_filter 用于stream流过滤的抽象类,通过stream_filter_register来注册其具体类
来看了一下php_user_filter 的属性和方法

其他的模块中会带有很多的类。部分列表如下

== Reflection API ==
ReflectionException
Reflection
ReflectionFunction
ReflectionParameter
ReflectionMethod
ReflectionClass
ReflectionObject
ReflectionProperty
ReflectionExtension
== SQLLite ==
SQLiteDatabase
SQLiteResult
SQLiteUnbuffered
SQLiteException
== Standard PHP Lib. ==
RecursiveIteratorIterator
FilterIterator
ParentIterator
LimitIterator
CachingIterator
CachingRecursiveIterator
ArrayObject
ArrayIterator
DirectoryIterator
RecursiveDirectoryIterator
== SimpleXML ==
SimpleXMLElement
SimpleXMLIterator
== DOM/XSL/XPath extensions ==
DOMException
DOMStringList
DOMNameList
DOMImplementationList
DOMImplementationSource
DOMImplementation
DOMNode
DOMNameSpaceNode
DOMDocumentFragment
DOMDocument
DOMNodeList
DOMNamedNodeMap
DOMCharacterData
DOMAttr
DOMElement
DOMText
DOMComment
DOMTypeinfo
DOMUserDataHandler
DOMDomError
DOMErrorHandler
DOMLocator
DOMConfiguration
DOMCdataSection
DOMDocumentType
DOMNotation
DOMEntity
DOMEntityReference
DOMProcessingInstruction
DOMStringExtend
DOMXPath
XSLTProcessor


同样,你可以使用函数get_declared_classes ()来获取你安装的PHP及其模块中有那一些预定义了的类。

知识来源: http://cn.php.net/manual/zh/reserved.classes.php
Defined tags for this entry:

Posted by rollenc

Last modified on 2007-03-21 16:27
2007/03 21
PHP 手册
Smarty - the compiling PHP template engine
MySQL 5.1参考手册
JavaScript Reference
prototype.js
Apache HTTP Server Version 2.2 Documentation
Bash Reference Manual
Subversion
Defined tags for this entry: , , , ,

Posted by rollenc

Last modified on 2007-03-21 12:31
2007/03 16
cakePHP的HABTM的确让人头痛,不是使用上的,而是效率。比方:
关系: Article HABTM Tag ,
现在我在首页列出十条最新的Article,需要包括他的tag。
SQL语句将是像这样的:
select Article.* from articles as Article ;
select * from tags as Tag left join articles_tags on articles_tags.article_id = 1 AND articles_tags.tag_id = Tag.id;
select * from tags as Tag left join articles_tags on articles_tags.article_id = 2 AND articles_tags.tag_id = Tag.id;
#.....

很不好意思,上面的代码我手写的,不是直接copycake生成的代码(生成的query太长了。)关系误写成了left join,实际上是join。这个错误给老王造成了不少麻烦,在这里向他道歉了。

SQL的查询次数将是:
1 + HABTM数目 * 第一次查询的放回结果数
以上列子则为 11条。

另外如果我需要按Tag来分页显示所有的Article,在cakePHP中还没有可以直接使用的语句。
$articleMode->findAll("Tag.name='$tag'"); #没有Tag表联立,SQL语句错误
$tagModel->findAll('Tag.name'); # 将没有limit可以设置,不能翻页到第二页

所以,放弃cakePHP的HABTM 关系,使用hasMany && belongsTo来替代。在控制上要麻烦一些,但效率可控性上要强的多。
现在的关系为:
Article hasMany ArticlesTag
ArticleTag belongsTo Tag
Defined tags for this entry: ,

Posted by rollenc

Last modified on 2007-03-28 11:03
2007/03 15
Defined tags for this entry:

Posted by rollenc

Last modified on 2007-03-16 10:15
2007/03 12
03
海外华人设计师访谈-雅虎欧洲设计师王小丹

10


12

Handling UTF-8 with PHP

OpenID介绍与使用指南(附支持服务商)

2006 Open Source Content Management System Award Winner Announced

14

CVSDude: Professional CVS Hosting and Subversion Hosting

19

基金入门系列-持续更新中!

20

bash编程教学实例
Defined tags for this entry:

Posted by rollenc

Last modified on 2007-03-20 22:29
2007/03 11

Error-Handing Techniques

  • 返回中立值 如:数值返回0
  • 换用下一个正确的数据
  • 返回与前次相同的数据
  • 换用最接近的合法值 如经度设置为(-180,180)之间
  • 把警告信息记录到日志文件中 兼用以上的处理,同时记录它。
  • 返回一个错误码
    • 设置一个状态变量的值(个人不推荐)
    • 用状态值作为函数的返回值
    • 用语言内建的异常机制跑出一个异常
  • 调用错误处理子程序活对象 优点:能把错误处理的职责都集中到一起。代价:错误处理代码与整个程序紧密耦合。
  • 当错误发生时显示出错信息 出错信息散布于整个应用程序中。
  • 用最妥当的方式在局部处理错误 留给执行设计和实现的程序员来解决,灵活性强,但整体正确性和可靠性无法满足,风险显著
  • 关闭程序 用于人身攸关的应用程序
知识来源:《代码大全2》
Defined tags for this entry: ,

Posted by rollenc

Last modified on 2007-03-11 20:40
2007/03 11
You can use Google Earth (Navigatation plus for Chinese) or Google Maps (EEmap.org for Chinese) to see the Earth, but How can I learn the acknowledge in the space.
Kstars is wonderful.
KStars is a Desktop Planetarium for KDE. It provides an accurate graphical simulation of the night sky, from any location on Earth, at any date and time. The display includes 130,000 stars, 13,000 deep-sky objects, all 8 planets, the Sun and Moon, and thousands of comets and asteroids.


Two picture followed:

Figure 1: The sky for current time (13:01:40) in Shanghai, And I can see the Sun above my header.

Figure 2: The sky for this night time(04:09:56), And the Moon is the focus.

Figure 3: My constellation: PISCES.

Defined tags for this entry: ,

Posted by rollenc

Last modified on 2007-03-17 09:00
2007/03 10

cn域名现在搞成1块钱,估计也没什么抢头了。但有总比没有好。既然edong送了5个域名机会,先用掉再说:
  1. phpfunction.cn 三马说的,要一个php函数网。这个再适合不过了,这个域名留给三马了。
  2. phplibrary.cn 函数是不够的,library才是我真正想要的。
  3. php.hi.cn 这个域名比较好玩,也满简短的。hi, php! 很可能近期就会用起来。
  4. rss.hi.cn 这个域名一注册下来就后悔了,因为是在不晓得可以拿来干嘛。就一个名词RSS而已,也不是我深入的方向。
  5. pmal.cn 呵呵,从镜子中看,就是LAMP。而且我觉得按pmal排列我需要的知识深度更合适。
Defined tags for this entry:

Posted by rollenc

Last modified on 2007-03-11 17:54
2007/03 9
卓越网购买了两本书,前天下的订单,晚上付款,今天上午拿到手上了。
一本Head First Design Patterns, 一本是代码大全(第二版),两本书前段时间都看了会电子版,不过眼睛太累了,还是纸质的要舒服,“养眼”:)
Defined tags for this entry:

Posted by rollenc

Not modified

(Page 1 of 2, totaling 26 entries)