Archive for the 'development' Category

把UTC/GMT(伦敦)时间字符串转成中国时间

四月 29th, 2008 by xLight

今天第一次知道UTC时间竟然还有夏令时,这不是添乱嘛。
原来写的代码转换时区时都是用timestamp +3600*8 。。

function conventDateTime_UTCtoChina($strDatetime){
date_default_timezone_set(’Europe/London’);
$t = strtotime($strDateTime);
date_default_timezone_set(’Asia/Shanghai’);
return date(’Y-m-d H:i:s’,$t );
}

 和“ ”(空格)是不同的

十一月 9th, 2007 by xLight

下面这段代码在fireFox和IE中的结果是不同的


function trim (str)
{
return str.replace(/ */g, '');
}

function getTextContent (el)
{
if (el.textContent) return el.textContent;
if (el.innerText) return el.innerText;
if (el.innerHTML) return
el.innerHTML.replace(/( )|( )|( )/g, ' ');
}

   here    is the text 0.123 

tag:javascript 正则

Google Reader iPhone专用版?有的玩了

九月 26th, 2007 by xLight

大体上就是列表页多了上面的文章摘要,还是挺实用的东西
以后可以在自己手机上用iPhone版的GReader了,呵呵

Google真小气,直接所有手机上都一样改进不就好了。小气

Firefox是不支持div的name属性的

九月 19th, 2007 by xLight

想获得 div的name属性值请使用 div.getAttribute(’name’)

完毕

SHELL下执行PHP程序时怎么触发Xdebug记录CacheGrid?

八月 20th, 2007 by xLight

需求有时就是这么的变态

情况:通过CronTab定时并发执行的一系列php程序 ,我想检测 其中的某个程序的效率。

分析:

开始的时候想通过xdebug.profiler_enable = 1并且传入GET/POST 。
但发现SHELL下PHP并不提供产生GET/POST的机制。

通过PHP -h发现可以在调用的时候使用“ -d foo[=bar] Define INI entry foo with value ‘bar’”方式改变INI设置,

于是 一切变得简单了:php -d xdebug.profiler_enable=1  ./i.php

搞定。

WinCacheGrind中的CUM是什么意思

八月 3rd, 2007 by xLight

Function、Self、File、Called From 都很容易明白

唯独这个Cum不知道什么意思 。。

今天终于去搜索了一下XDebug的网站,发现了这个 。

原来Self是代表此Funcion自己花费的 时间,不包含此Function调用的其他Function。

而Cum则是 此Funcion整体花费的 时间,包含此Function调用的其他Function。