2010年3月17日 星期三

php big5跟utf-8互轉的指令

來源: http://272586.blogspot.com/2007/06/php-big5utf-8.html

php big5跟utf-8互轉的指令

big5 轉 utf-8
PHP 程式碼:
$str=iconv("big5","UTF-8",$str);

utf-8 轉 big5
PHP 程式碼:
$str=iconv("UTF-8","big5",$str);

2010年2月26日 星期五

mysql增加使用者

GRANT ALL PRIVILEGES
ON dbname.*
TO username@localhost
IDENTIFIED BY 'password';

2010年2月24日 星期三

C Library Missing

執行以下執行安裝套件

yum install gcc libgcc glibc-headers glibc-devel aclocal autoconf automake autoheader makeinfo

2010年2月23日 星期二

mysql的SUBSTRING_INDEX函數

可以用在例如 IP 位址 要取出最後主機位址時, 可以排序時使用.

SUBSTRING_INDEX(str,delim,count)
Returns the substring from string str before count occurrences of the delimiter delim. If count is positive, everything to
the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter
(counting from the right) is returned. SUBSTRING_INDEX() performs a case-sensitive match when searching for delim.
mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2);
-> 'www.mysql'
mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', -2);
-> 'mysql.com'

2010年2月18日 星期四

[HOWTO] Installing Adobe Reader 9 to Ubuntu 9.10 Karmic Koala

http://www.khattam.info/2009/08/20/howto-installing-adobe-reader-9-to-ubuntu-9-10-karmic-koala-alpha-4/


On January 14th, 2010 at 5:51 pm Jukka Says:
  1. This is how you can install Acroread to Ubuntu 9.10 64 bit:

    1. Open Synaptic Packet Manager (from System / Administration)

    2. Add Partner Repository (to do this: under Settings choose Repositories, go to inter-leaf Other Software and tick-a-box besides ‘archive.canonical.com/ubuntu karmic partner’, click Close)

    3. Update Repository info (to do this: click Reload button in Synaptic)

    4. Search for Acroread (to do this: click Search button in Synaptic)

    5. Install as usual (to do this: right click the tick-a-box besides Acroread package and choose ‘Mark for Installation’ and then click Apply)

    6. When done close Synaptic.

    That’s it. Nothing else to it.

2010年2月11日 星期四

CentOS啟用SNMP

需要安裝以下三個套件, 才算完整.
net-snmp-utils
net-snmp-libs
net-snmp

2009年11月18日 星期三

Linux裡設定密碼最長時間、以及自動登出功能

內容參考以下二個連結而來的.
http://man.chinaunix.net/linux/debian/debian_learning/ch11s02.html
http://netlab.kh.edu.tw/document/電腦安全/淺談linux的安全設置.doc

這個檔案的前半段內容如下, 可以預設系統裡的使用者, 多久要改密碼, 以及最短密碼長度為何... 很有用的.

# Password aging controls:
#
# PASS_MAX_DAYS Maximum number of days a password may be used.
# PASS_MIN_DAYS Minimum number of days allowed between password changes.
# PASS_MIN_LEN Minimum acceptable password length.
# PASS_WARN_AGE Number of days warning given before a password expires.
#
PASS_MAX_DAYS 99999
PASS_MIN_DAYS 0
PASS_MIN_LEN 5
PASS_WARN_AGE 7

=========================================
以下內容是參考 word 文件.

修改 /etc/profile 檔案, 在 HISTFILESIZE 底下加入

  TMOUT=600

代表 600秒 沒有動作的話就會自動登出系統了.