Ruby: Incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string)

ruby出現錯誤訊息:Incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string)

用force_encoding強迫指定編碼即可。for example,

sentence=row1[0].force_encoding('utf-8').gsub(reg,cor_array[count].force_encoding('utf-8')).strip
分類: ruby | 發佈留言

mysql備份及回存

1.備份mysql資料庫
mysqldump -u (ID) -p (password) (database_name) > backup.sql

2.回存資料庫

回存mysql資料庫
mysql -u (ID) -p (password) (database_name) < backup.sql

再由phpmyadmin檢查一下資料正不正確。

分類: 系統管理 | 發佈留言

debian安裝nfs server

1.apt-get install nfs-kernel-server nfs-common

2.修改 /etc/exports

加入

/ 192.168.0.0/24(rw,async,no_root_squash,subtree_check)
^^^^^^^^^^^
這是你要許可開啟服務的 IP

3.
移除先前設定
exportfs -ua
重新載入exports設定
exportfs -a

4.執行
/etc/init.d/nfs-kernel-server restart

5.好像是出了些問題,系統說我沒有安裝statd
root@amd64:/etc# mount 192.168.0.10:/ /mnt
mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use ‘-o nolock’ to keep locks local, or start statd.
mount.nfs: an incorrect mount option was specified

所以要掛載得用
root@amd64:/etc# mount -o nolock 192.168.0.10:/ /mnt

但其他電腦連到server則無此問題。納悶中…

找到了,要執行
rpc.statd

就行了。

NFS FAQ中,有很多nfs問題的解決方法。

分類: 網路 | 發佈留言