星期五, 4月 27, 2007

PHP Edit 中文亂碼解決辦法

PHP Edit 是個不錯的 php editor,不過,它對big5中文字似乎不怎麼友善。

打中文字的時候老是會出現怪怪的亂碼字。



解決辦法只有一個,就是用 UTF-8 編碼來編輯,就可以完全解決中文亂碼的情形了。





星期二, 4月 24, 2007

FreeBSD 以 ADSL撥接上網


剛好看到這篇文章,把它記下來,才不會忘記。


設定檔 /etc/ppp/ppp.conf
----------------------------------------------------------------------------------------------------


#################################################################
# PPP Sample Configuration File
# Originally written by Toshiharu OHNO
# Simplified 5/14/1999 by wself@cdrom.com
#
# See /usr/share/examples/ppp/ for some examples
#
# $FreeBSD: src/etc/ppp/ppp.conf,v 1.2.2.5 2001/07/13 10:55:23 brian Exp $
#################################################################
default:
set log Phase Chat LCP IPCP CCP tun command
ident user-ppp VERSION (built COMPILATIONDATE)
# Ensure that "device" references the correct serial port
# for your modem. (cuaa0 = COM1, cuaa1 = COM2)
#
set device PPPoE:lnc0
set speed sync
set mru 1492
set mtu 1492
set ctsrts off
set timeout 30 # 3 minute idle timer (the default)
disable lqr
deny lqr
add default HISADDR
enable dns # request DNS info (for resolv.conf)
HiNET: # 注意:這裡的hz163是你的ISP名,要比下面的set語句多出一點(一個空格).
set authname user(把這裡的user換成你的ADSL用戶名)
set authkey password (把這裡的password換成你的ADSL密碼)
set dial
set login
set ifaddr 10.0.0.1/0 10.0.0.2/0
nat enable yes
----------------------------------------------------------------------------------------------------


撥接連上ADSL網路
# ppp -ddial HiNET


星期四, 4月 19, 2007

lifetype 掛了,看不到文章內容


又過了好幾天沒有給自己的部落格一點關愛的眼神,昨天突想到,連上網看了一下,哇!怎麼只看得到類別,而沒有文章內容?!


仔細一想,好像幾天前有過一次停電,該不會是這個原因吧?!用 mysql client 連上,SELECT * FROM plog_article_text,嘿!果然有點問題,看訊息似乎是資料表有些損毀,無法讀出來。


又借了一下 GOOGLE 的神威,看到 dev.mysql.com 的說明文章指出修復的方法與注意事項。把它記錄下來,以便參考。


※ 要做修復資料庫動作之前,請先停止 MySQL伺服器: mysqladmin shutdown,停止mysqld 命令執行之後,mysqld 可能還會運作一會兒,直到所有的查詢動作和索引更動做完為止。


步驟一: 命令列: 檢查資料表
執行 myisamchk *.MYI or myisamchk -e *.MYI


步驟二:命令列: 快速又安全地修復
myisamchk -r -q tbl_name (-r -q 表示「快速修復模式(quick recovery mode)」).





  1. Make a backup of the data file before continuing.




  2. Use myisamchk -r tbl_name (-r means 「recovery mode」). This removes incorrect rows and deleted rows from the data file and reconstructs the index file.




  3. If the preceding step fails, use myisamchk --safe-recover tbl_name. Safe recovery mode uses an old recovery method that handles a few cases that regular recovery mode does not (but is slower).





步驟三: Difficult repair





  1. Move the data file to a safe place.




  2. Use the table description file to create new (empty) data and index files:



    shell> mysql db_name
    mysql> SET AUTOCOMMIT=1;
    mysql> TRUNCATE TABLE tbl_name;
    mysql> quit


  3. Copy the old data file back onto the newly created data file. (Do not just move the old file back onto the new file. You want to retain a copy in case something goes wrong.)





Go back to Stage 2. myisamchk -r -q should work. (This should not be an endless loop.)


步驟四: Very difficult repair


You should reach this stage only if the .frm description file has also crashed. That should never happen, because the description file is not changed after the table is created:





  1. Restore the description file from a backup and go back to Stage 3. You can also restore the index file and go back to Stage 2. In the latter case, you should start with myisamchk -r.




  2. If you do not have a backup but know exactly how the table was created, create a copy of the table in another database. Remove the new data file, and then move the .frm description and .MYI index files from the other database to your crashed database. This gives you new description and index files, but leaves the .MYD data file alone. Go back to Stage 2 and attempt to reconstruct the index file.





星期一, 4月 09, 2007