« Posts by Leon Zhuang

我用到过的 Yii Framework 解决方案索引

以下是我在应用到过的一些Yii中的解决方案,计划不断更新。

如何在Yii中使用PHPExcel 扩展
How to use PHPExcel external library with Yii

 

使用activeCheckBoxList()方法时如何设置已选项目(checked)

 

启用Gzip
Enabling Gzip

 

如何用ActiveRecords记录数据变更日志
How to log changes of ActiveRecords

Chateau Debuc 德布克城堡干红葡萄酒

chateau-debuc2007

在也买换悦酒会入会礼的时候随便买的,特价,今天打开喝了。

开瓶后尝了一口,感觉挺普通,并且杯中有沉淀物。醒了20分钟,再喝一口,Merlot的味道,二氧化硫也没那么浓了,但仍然只能说普通。

本以为就是一瓶普通的酒了,没想到喝着喝着,惊喜出现了,一股说不出的味道,很浓郁,说不上是什么味道,但很喜欢。大概这就是蕴含的红酒中的神秘吧。

所以,喝红酒是一件有取的事情,让好奇的人欲罢不能。

在Yii中使用活动目录验证用户身份

借助第三方类库adLDAP,将adLDAP.php复制到项目的vendors目录中。修改UserIdentity.php

PHP
<?php
 
/**
 * UserIdentity represents the data needed to identity a user.
 * It contains the authentication method that checks if the provided
 * data can identity the user.
 */
class UserIdentity extends CUserIdentity
{
	public function authenticate()
	{   
        $ldapConfig = Yii::app()->params['ldap'];
        Yii::import('application.vendors.*');
        require_once('adLDAP.php');
        try
        {
            $adldap = new adLDAP($ldapConfig);
        }
        catch (adLDAPException $e)
        {
            echo $e; exit();   
        }
        if(!$adldap->authenticate($this->username, $this->password))
            $this->errorCode=self::ERROR_PASSWORD_INVALID;
        else
        {
            $adInfo = $adldap->user_info($this->username);
            $this->setState('ad_info',$adInfo);
            $this->setState('login_time',time());
            $this->errorCode=self::ERROR_NONE;
        }
        return !$this->errorCode;
	}
}

TomcatStats_0.1_PHP – Apache/Tomcat Monitor [Cacti Script and Template]

tomcatstats

基于 Timothy Denike  的 TomcatStats v0.1 修改,去掉了perl的采集脚本,改为PHP实现(SimpleXML)。

Step 1.
配置Tomcat Manager

Step 2.
将采集脚本tomcatstats.php得到到 <cacti_root>/scripts/ 目录下。导入模板cacti_host_template_tomcat_server.xml

Step 3.
调试,在命令行下输入,测试是否可以获取数据。

php tomcatstats.php app1:8444 admin passwords

Step 4.
根据实现设定的账号密码设定Cacti Data Input Methods 中Tomcat Status Input String项

Step 5.
创建图像。

详见附件 »Read More

酒瓶

公牛血的瓶子,喝完酒发现瓶也挺好看,随手拍了两张

dsc_6987 dsc_6962

»Read More

Google+邀请(Google Plus)

mygoogleplus

一大早Twitter Timeline 上满是Google+的散布推,跟@luosheng同鞋要了一个邀请,尝尝鲜~~

有需要邀请的同鞋请留下你的Gmail.

Update:现在G+邀请功能不定期开放,所以邀请可能无法及时发送,但请大家耐心等待,一旦邀请开放,我会第一时间处理大家的留言

Update:记得圈我哦,http://gplus.to/nerrsoft