WordPress Tip: Category RSS Feed

乖乖承認,我有在觀察 Feedburner 訂閱或是網站的流量。感覺的出來新文章貼出來如果是「週記」會比較沒有人點…(默)。無可厚非啦,不是每個人都對一個無聊傢伙的日常生活有興趣。

不想看就不要點,像這裡的回應這樣跟作者嗆聲就真的不太禮貌了。

既然這裡也差不多雜亂(只是沒談到政治而已),讓我來說個小小的建議:真的覺得無關的文章很煩的話,請訂閱您有興趣的分類 RSS Feed。只要在分類的網址後面加上 rss/ 或是 feed/ 就可以了。像是(對不特定觀眾比較有用的)軟體分類的RSS就是 http://blog.timc.idv.tw/categories/programming/software/feed/

這個做法適用於所有開 Rewrite 的 WordPress Blog 。不過它好像沒有提供過濾掉某個分類的 Feed。

不知道什麼是 RSS 訂閱的 IE/KKMAN/PCMan 使用者請自行洽詢 Ask 或是 Ladies_Digi 版XD。很好用喔,Firefox、Opera 都有,IE 的話要等到 IE7。

To who feel annoy seeing unrelated posts on general blogs such as this one, WordPress provided a great function for you to subscribe a category feed: just attach feed/ or rss/ after the category URL.

For example, if you only interested in my posts related to Software, you can subscribe this feed instead of the whole site: http://blog.timc.idv.tw/categories/programming/software/feed/.

PHP’s libmysql (Again)

總歸來說,只有兩種解法可以解決一PHP的libmysql每次都用utf8和MySQL伺服器連線的問題。這個問題只會發生在MySQL4.1以上,只要發生就會讓PHP從資料庫拿到的中文字通通變成問號。

這篇文章修正之前那篇提到的解法。

第一個解法是在my.cnf[mysqld]加上下面的設定。不管是Win32或是Linux上的MySQL都可以用。

default-character-set = utf8
default-collation = utf8_unicode_ci
skip-character-set-client-handshake

前兩行將MySQL伺服器的預設邊碼放在UTF-8,第三行叫MySQL忽略libmysql傳過來的字碼連線要求;libmysql總是試圖用utf8連線是造成這個問題的主因。

建議所有管理自己機器的人用這個方法解決亂碼問題。這也是MySQL5 CJK FAQ建議的方法。當然重新編譯libmysql也是可以的,但是那個太複雜了我也不知道怎麼做orz。

如果您沒有權限修改自己的MySQL-PHP環境,還有第二個方法;有點煩,要在所有的PHP程式碼裡面mysql_connect()出現的地方之下加上以下兩行:

mysql_query("SET NAMES 'UTF8'");
mysql_query("SET CHARACTER SET UTF8");

即便是下載的程式也要自己修改。對於WordPress,要修改的位置在wp-db.php

To sum up, there are two solutions for php to connect MySQL server using the correct charset. When the connected in wrong charsets, all non-utf8 characters becomes question marks.

This is the correction to the previous post.

The first solution is to put the following lines in my.cnf under [mysqld] session. Works on both MySQL on Win32 and Linux.

default-character-set = utf8
default-collation = utf8_unicode_ci
skip-character-set-client-handshake

The first two lines changes MySQL default to what the charest needed, and the third one ask MySQL to ignore what libmysql said about the charset – which always attempts to connect with utf8 charset.

This is the solution in MySQL5 CJK FAQ and it’s recommends for everyone with their own machines.

It’s can also be done by re-compile libmysql which is technical advanced and the I-don’t-know-how-to-do-it-so-don’-ask method.

For people did not have control over their MySQL-PHP environment but facing wrong charset connection all the time, you must add following line after every mysql_connect() in PHP scripts.

mysql_query("SET NAMES 'UTF8'");
mysql_query("SET CHARACTER SET UTF8");

This is kind of annoying and is required even in the programs you downloaded. WordPress is included and should be added in wp-db.php.

blog.timc.idv.tw

換網址啦!新網址看起來短多了;還在用原本的網址沒有關係,我設了Redirect所以不會走丟。大家有空還是Update一下書籤和blogroll吧,感謝。

Permalink也順便改了。同樣的舊的網址會被轉址到新的網址。所以任何還是不會走丟(^^)。

倒是第一個聽說這件事情的朋友跟我說「啊,網址已經不重要了啦,現在大家都用搜尋引擎直接打網站名字找站。」Well,既然舊網址可以順利轉到新網站,在Google或是Yahoo找到的這裡文章還是連了到喔~

唯一可惜的就是 http://timdream.twbbs.org/blog/ 的 PageRank 有4,這個網址是新的所以是0。就看Redirect會不會一並把 PageRank 更新過來了。

如果您用的是現代瀏覽器,有國際域名(IDN)支援的話,這裡也可以用網誌.timc.idv.tw連。沒錯,IE已經過時了。

BTW,要訂閱本站可以直接用WordPress的Feed或是Feedburner —— 後者可以做的事情很多(甚至可以把文章當電子報寄),不過我不太想同時依賴太多服務,所以沒有把Feedburner當成主feed。

Anyway, enjoy your stay!

Welcome to the whole new, short, easy to remember URI – blog.timc.idv.tw! I’ve redirect all the traffic from the old site but please update your Blogroll. Thanks.

I’ve also re-configured Permalink. Old URI still good since I’ve set RewriteRules for them.

If you are using Online RSS Reader, the Feedburner feed with all the little subscribe stickers would be helpful. You may also subscribe the original WordPress feed. a .zh-tw {display: none} CSS rule would be helpful if you couldn’t read Chinese.

Giving up a PageRank 4 URI was a tough choice, but I believe that it would show up on the new URI.