2010年10月16日 星期六

[PHP] 延長phpmyadmin的 timeout時間

在PHP開發階段使用到phpmyadmin, 常會發生過一段時間後, phpmyadmin timeout了, 又要重新登入一次, 實在是很麻煩, 所以調高timeout時間, 較為方便, 做法如下:

修改config.inc.php

$cfg['LoginCookieValidity'] = 7200; // In seconds

2010年10月15日 星期五

[PEAR] Windows使用PHP安裝PEAR遇到failed to open stream: phar error

C:\php>go-pear.bat

在Windows上使用PHP安裝PEAR時遇到錯誤

Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error: invalid url or non-existent phar "phar://go-pear.phar/index.php" in C:\php\PEAR\go-pear.phar on line 1236


解決方法:

修改php.ini

找到

;phar.require_hash = On

改成

phar.require_hash = Off

再安裝一次
C:\php>go-pear.bat

就可以跑了~

[Python] Calculate execution time 計算程式執行時間

'''
Created on 2010/10/15
@author: Hank Wang
'''

import time, itertools

# 記錄開始時間 Record start time
tStart = time.time()

# 跑一個permutation
for item in (itertools.permutations("0123456789", 6)):
    print(''.join(item))

# 記錄結束時間 Record stop time
tStop = time.time()

print(tStop - tStart)

[Linux] LDAP相關資料收集

LDAP Data Interchange Format (LDIF)

http://www.l-penguin.idv.tw/article/ldap-1.htm
http://phorum.study-area.org/index.php?topic=50725.0
http://dhorrigan.com/blog/article/ldap-library-for-codeigniter
http://docs.moodle.org/en/LDAP_authentication

2010年10月13日 星期三

[CentOS] 設定TimeZone 與 Date更改時間

調整 CentOS 的 Time Zone
$ cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime

修改以下檔案變更Timezone
$ vim /etc/sysconfig/clock
ZONE="Asia/Taipei"

# MMDDhhmmYYYY 月日時分年
$ date 101322202010

# 查看 BIOS 時間
$ hwclock -r

# 將系統時間寫入到 BIOS 時間
$ hwclock -w

2010年10月12日 星期二

[Moodle] 修正Moodle 1.9.9無法在某些瀏覽器正常使用HTML Editor

修正方法需些改兩個檔案~ 分別如下:

/lib/moodlelib.php

line 6519 } else {
line 6520 return 1;
line 6521 }

/lib/editor/htmlarea/htmlarea.php 
line 2408 //alert("Mozilla < 1.3 Beta is not supported!\n" +
line 2409 // "I'll try though, but it might not work.");
line 2410 return 'HTMLArea.is_gecko';
line 2414 //return false;
line 2415 return 'HTMLArea.is_gecko';

It Works!

Reference:

Making Moodle work better on #Chrome browser
http://moodle.org/mod/data/view.php?d=13&rid=3945
Related Posts Plugin for WordPress, Blogger...