四月 06

top 是一個在 linux 中監看系統狀況的指令

要在 RouterOS 3.x 中加入top,首先請先下載這個封裝檔 (原作者:ksw520)

如果還沒把 RouterOS 的 ftp 功能打開,先到 IP -> Service 把 ftp 開啟

解開壓縮後利用 ftp 把 procps3.x.npk 丟到RouterOS 上去

重新啟動 RouterOS ,就會自動安裝了

接下來使用 pietty 或 putty 來連線

IP:RouterOS 的位置

Port:12345

帳號:metro

密碼:2911911

進去後可用 top 指令來監看系統狀況

如果要改密碼,輸入 password 就可以改密碼了

參考資料:ros下的top命令補丁





四月 05

最近遇到一個問題。當你的網卡IP是透過 DHCP 取得的

那麼你 route table 內的 default route 就會使用 DHCP 的 gateway

如果再使用 pon 來連接 ADSL,default route 還是不會變成 ppp0

簡單的說,就算你連上 ADSL 了,連線還是跑 DHCP 的 gateway

要解決這個問題,必需編輯 /etc/ppp/peer/dsl-provider 這個檔案

先找到 defaultroute,然後在下面插入 replacedefaultroute

# Use this connection as the default route.
# Comment out if you already have the correct default route installed.
defaultroute
replacedefaultroute

這樣子,defaultroute 就會設為 ADSL 了





四月 03

在使用 VirtueMart 的購物車時,如果你是使用1.1.3版的AJAX 加入購物車

在第1次把商品加到購物車時是沒問題的,但是同一頁面要繼續購物時就會發生問題


.

解決方法是修改 /components/com_virtuemart/themes/default/theme.js 這個檔案

大約在第35行的地方

找到下面這個程式碼


if (document.boxB) {
document.boxB.close();
clearTimeout(timeoutID);
}

修改成以下的程式碼


if (document.boxB) {
document.boxB.close();
clearTimeout();
}

儲存後就不會有這個問題了

要測試時,記得要先清除瀏覽器的離線快取





四月 02

在 Debian 中安裝套件是一件很容易的事情

因為 apt-get 會幫你搞定一切,安裝軟體輕鬆又快樂

如果一開始只有裝基本系統,後來想加入桌面環境時也是很簡單

在 Console 中執行這行指令,桌面系統就裝好了。夠簡單吧

apt-get install xorg gnome

接下來要安裝中文的修正套件

apt-get install ttf-arphic-uming scim-tables-zh im-switch

安裝完成後再執行 startx 就能進去桌面環境了

如果嫌 gnome 太肥,你也可以改用 kde或 lxde

桌面套件 套件容量 指令
x-window + gnome 1597 MB apt-get install xorg gnome
x-window + kde 1116 MB apt-get install xorg kde
x-window + lxde 288 MB apt-get install xorg lxde

a

相關參考資料:安裝 Debian GNU/Linux 5.0 (Lenny)





四月 01

原理很簡單,就是先把圖檔轉成二進位再上傳就行了

程式碼如下

Dim db As New StudnoListDataContext

'把要更新的資料Select出來
Dim StudClass = (From s In db.Stud Where s.stud_no = studno.Text).First
'把PictureBox.Image放到Bitmap
Dim bmp As Bitmap = PictureBox1.Image
'宣告一個MemoryStream
Dim st As New MemoryStream
'把圖片放到MemoryStream裡面
bmp.Save(st, System.Drawing.Imaging.ImageFormat.Jpeg)
st.Position = 0

'把MemoryStream裡的資料轉成二進位
Dim WriteByte(st.Length - 1) As Byte
If st.CanRead Then
      st.Read(WriteByte, 0, st.Length)
      st.Close()
End If

'把WriteByte放到Linq的二進位欄位
StudClass.studimg = WriteByte
'更新上去
db.SubmitChanges()