三月 30

先把 RouterOS 的管理工具 Winbox 開起來

點選 IP ==> Firewall ==> NAT

接下來就看圖說故事吧

進入 NAT 後,加入一條規則(就是按那個 + )

在 General 裡,Chain 選擇 srcnat

Action 中選擇 masquerad,接下來按下 OK

最後結果如下圖

收工,簡單又快樂。

如果有需要轉Port的功能請參考在RouterOS中加入Port Mapping這篇文章





三月 24

雖然官方的語言包中文還不算太完整,不過多少也可以勉強用了

安裝完官方語言包你會發現VM(VirtueMart)會是亂碼

這是因為預設的中文語系檔是用big5存的,而Joomla是預設是用UTF-8

把中文語系檔traditional_chinese.php改為以UTF-8存檔就可以解決亂碼的問題

不過因為官方預設是用big5碼存檔的關係,所有的中文語系檔都會有"許蓋功"的問題

也就是說如果文字中有"成功"這2個字,就會變成"成?",接連後面的字串也會受到影響,導致程式錯誤

目前我修正了一些文字上的錯誤,不嫌棄的話可以拿去使用

VirtueMart 1.1.3 繁體中文語系修正

使用前記得先安裝 VirtueMart 1.1.3

繁體中文語系修正檔,下載後於 Joomla 的目錄下解開蓋過舊檔即可





三月 23

在VirtueMart 1.1.3 中,如果修改運送者為中文名稱時,會出現下面錯誤

Warning: Missing argument 2 for vmGet(), called in /var/www/vhosts/all4everyone.de/httpdocs/administrator/components/com_virtuemart/classes/ps_shipping.php on line 113 and defined in /var/www/vhosts/all4everyone.de/httpdocs/administrator/components/com_virtuemart/classes/request.class.php on line 26

解決方法如下

開啟 administrator/components/com_virtuemart/classes/ps_shipping.php

把 113 與 138 這2行中的程式碼
($fields = array( 'shipping_carrier_name' => vmGet($d["shipping_carrier_name"]),)

取代為
$fields = array( 'shipping_carrier_name' => vmGet($d, 'shipping_carrier_name'),

然後存檔,收工

參考資料:
http://forum.virtuemart.net/index.php?action=printpage;topic=50772.0





三月 20

RouterOS 看來應該是會一直玩下去了。越玩越順手

先補上在 WordPress 中可以讓 RouterOS 語法高亮的 SyntaxHighlighter-Plus 樣版

使用的方法可以參考之前的文章幫SyntaxHighlighter-Plus加上新的語言樣版

程式碼另存為shBrushRouterOS.js

SyntaxHighlighter.brushes.RouterOS = function()
{

    var keywords =  'global local do else for from to step in foreach ' +
                    'if put while environment nothing set';

    var commands =  'add comment disable enable export get move remove unset ' +
                    'delay edit blink monitor beep find led len  ' +
                    'list log pick resolve time print toid totime tonum';

        this.regexList = [
                { regex: /#.*$/gm, css: 'comments' },
                { regex: SyntaxHighlighter.regexLib.doubleQuotedString,                 css: 'string' },                // double quoted strings
                { regex: new RegExp(this.getKeywords(keywords), 'gm'),                  css: 'keyword' },               // keywords
                { regex: new RegExp(this.getKeywords(commands), 'gm'),                  css: 'functions' }              // commands
                ];
}

SyntaxHighlighter.brushes.RouterOS.prototype    = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.RouterOS.aliases      = ['ros'];

記得要在/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter.php
大約在在112行的位置加入樣版的名子

'RouterOS'=> array('ros'),





三月 18

在Windows中如果我們不想要讓某個資料夾被刪掉

那我們就在該資料夾內,建一個刪不掉的資料夾就行了

或是我們想要讓某個資料鎖定,讓別人進不去,以往通常要靠軟體來決解

不過現在我們可以利用Windows內建的cmd指令來完成(迷之音:是Bug吧)

先到開始->執行->cmd


rem 建立一個保密資料夾
md test123..\

rem 進入保密料夾
cd test12~1

rem 刪除保密資料夾
rd test12~1

rem 強制刪除保密資料夾(資料夾內有資料也一併刪除)
rd /s/q test12~1

需注意的是,要放、取檔案,只能使用cmd模式用指令的方式存取

直接用Windows進去就會出現下面這個畫面