<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>筍子工作雜記</title>
	<atom:link href="http://twycf.com/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://twycf.com/wordpress</link>
	<description>工作、休閒之類的雜記</description>
	<lastBuildDate>Wed, 18 Nov 2009 15:20:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Proftpd 支援 UTF-8 + MYSQL 虛擬帳號 + Quota 限制</title>
		<link>http://twycf.com/wordpress/archives/166</link>
		<comments>http://twycf.com/wordpress/archives/166#comments</comments>
		<pubDate>Wed, 18 Nov 2009 15:20:05 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Services]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[虛擬帳號]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[proftpd]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/?p=166</guid>
		<description><![CDATA[原文參考:[FreeBSD &#038; Linux Ubuntu] Proftpd 支援 UTF-8 + MYSQL 虛擬帳號 + Quota 限制
原始文章中有一些錯誤，我會在內文中更正這些錯誤
安裝之前準備工作
portsnap fetch &#38;&#38; portsnap update
Mysql 要先安裝好

安裝時才不會安裝到不支援 UTF8 的舊版本，本次安裝為 proftpd-1.3.2b
實驗環境：
FreeBSD 7.2-Releaseproftpd 1.3.2b
安裝方式
cd /usr/ports/ftp/proftpd-mysqlmake install clean
選擇
NLSQuotaMysqlRatio
建立資料庫
CREATE DATABASE `ftp` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
建立使用者資料表，這個資料表是紀錄使用者的所有資料
# username 使用者帳號# uid 系統的 uid 這個可以自己隨便給個數字，不要重複到系統帳號# gid 系統的 gid 這個看你用途是什麼來去對應# password 使用者密碼# homedir 使用者家目錄# shell 使用者的 shell 最好是填 /sbin/nologin# accessed 使用者最後登入的時間# [...]]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/166/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Liaise 1.27 sc 驗證碼無法顯示</title>
		<link>http://twycf.com/wordpress/archives/164</link>
		<comments>http://twycf.com/wordpress/archives/164#comments</comments>
		<pubDate>Mon, 19 Oct 2009 07:27:44 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[xoops]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/?p=164</guid>
		<description><![CDATA[前一陣子試用了 Liaise 1.27 加上驗證碼的版本，安裝完後卻發現驗證碼的圖片上只有一些線條，完全沒有英文或數字出現。
追了程式碼，發現在
liaise/class/chaptcha_x/class.captcha_x.php 209 行if ( @putenv ( 'GDFONTPATH=' . $font_path) === false) {
某些環境不允許php 執行 putenv 的指令，而導致 225	行判斷失敗
if ( $no_putenv) {
只要將 225 行改為以下程式碼即可
if ( !$no_putenv) {
]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/164/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ Builder: Winsock 1 和 Winsock 2 Header 重複的問題</title>
		<link>http://twycf.com/wordpress/archives/161</link>
		<comments>http://twycf.com/wordpress/archives/161#comments</comments>
		<pubDate>Tue, 10 Feb 2009 09:28:22 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C++ Builder 6]]></category>
		<category><![CDATA[Indy]]></category>
		<category><![CDATA[Multiple declaration]]></category>
		<category><![CDATA[_WINSOCKAPI_]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/?p=161</guid>
		<description><![CDATA[使用 Indy 元件時，有時候會遇到元件引用的問題，在 Winsock1 和 Winsock2 的Header 裡，有不少是相同名字的宣告，而
發生時的錯誤訊息如下：
[C++ Error] winsock2.h(113): E2238 Multiple declaration for &#8216;fd_set&#8217;
[C++ Error] winsock.h(55): E2344 Earlier declaration of &#8216;fd_set&#8217;
[C++ Error] winsock2.h(116): E2146 Need an identifier to declare
[C++ Error] winsock2.h(157): E2238 Multiple declaration for &#8216;timeval&#8217;
[C++ Error] winsock.h(98): E2344 Earlier declaration of &#8216;timeval&#8217;
[C++ Error] winsock2.h(213): E2238 Multiple declaration for &#8216;hostent&#8217;
[C++ Error] winsock.h(154): E2344 Earlier [...]]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/161/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>超爛的 RAM 1.5v鹼性電池</title>
		<link>http://twycf.com/wordpress/archives/159</link>
		<comments>http://twycf.com/wordpress/archives/159#comments</comments>
		<pubDate>Thu, 03 Jul 2008 03:15:17 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[RAM 1.5v鹼性電池]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/?p=159</guid>
		<description><![CDATA[2007/07/09 買的一堆 RAM 1.5v 鹼性電池，到今天2008/07/03 己經壞掉一堆
昨天充電時發現有怪聲音，靠近一看發現電池正在噴射出電池液
我一共買了三號 20 顆, 4號4顆
這種電池用了一年之後的評價是：非常差
1.無法充電：對充電電池來說，無法充電就是宣告死亡，第一顆無法充電的電池在購入不到半年就發生，陸陸續續己經有4,5顆也是一樣的情況
2.電池漏液：電池漏液就更不用說了，直接宣告死亡，有誰還敢使用漏液的電池，而且會發生漏液的時候，就是充電時，雖然賣電池的人說，充電器會自動斷電，但是至少我看到電池噴射時，燈號還在一閃一閃，是我自己手忙腳亂把電源線拔除的。
就充電電池來說，目的是要省去購買一次性電池的錢，到今天不到一年己經壞掉一半(10顆)了，在充電電池的 c/p 值來說，算是極低的。
別被他的廣告騙了.
]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/159/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>如何讓後台的跳轉頁面也套用前台的風格</title>
		<link>http://twycf.com/wordpress/archives/157</link>
		<comments>http://twycf.com/wordpress/archives/157#comments</comments>
		<pubDate>Wed, 02 Jan 2008 05:59:16 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[xoops]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/157</guid>
		<description><![CDATA[tested with xoops 2.016
所有呼叫 redirect_header都是執行這一個函式
/include/functions.phpline 364	function redirect_header($url, $time = 3, $message = '', $addredirect = true)
而在 372 行有一個判斷目前是前台，還是後台
if (defined('XOOPS_CPFUNC_LOADED')) {&#160;&#160; &#160; &#160; &#160;$theme = 'default';&#160;&#160; &#160;} else {&#160;&#160; &#160; &#160; &#160;$theme = $xoopsConfig['theme_set'];&#160;&#160; &#160;}
只要讀到 XOOPS_CPFUNC_LOADED，就判定為後台，直接使用預設樣版
//include/cp_functions.phpline 27	//define('XOOPS_CPFUNC_LOADED', 1);
把這一行 mark起來就可以了，目前使用起來沒什麼問題
]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/157/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>樣版中的路徑問題</title>
		<link>http://twycf.com/wordpress/archives/156</link>
		<comments>http://twycf.com/wordpress/archives/156#comments</comments>
		<pubDate>Fri, 10 Aug 2007 06:08:39 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[xoops]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/156</guid>
		<description><![CDATA[這一陣子美工告訴我一個困擾他很久的問題
他做樣版時，假設樣版名稱是 default，如果遇到大改版，為了防止改壞掉的情況，都會把原始樣版保留，並把 default 目錄複製一份成為 default1，而對 default1 做修改，這時候會遇到一個問題

  

上面紅色的部份是樣版的路徑，只要樣版路徑改變，他就需要手動把 default 改為 default1，下次則需要將 default1 改為 default2，其實解決方法很簡單，只需要在樣版中加入下面這一行，此行程式的用意是把目前樣版路徑指定給 themename 成為一個 smart 變數
&#60;{assign var='themename' value=$xoTheme-&#62;path}&#62;
樣版中的路徑即可使用以下的方式



如果是 Xoops 2.2x 因為沒有 xoTheme 物件，則要使用以下的方式去拼出樣版路徑
&#60;{assign var='themename1' value=/themes/$xoops_theme/}&#62;&#60;{assign var='themename' value=$xoops_rootpath$themename1}&#62;
而使用方式一樣
]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/156/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iconv 轉碼問題</title>
		<link>http://twycf.com/wordpress/archives/155</link>
		<comments>http://twycf.com/wordpress/archives/155#comments</comments>
		<pubDate>Sat, 16 Jun 2007 16:02:13 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/155</guid>
		<description><![CDATA[剛剛在處理 MsSQL(big5) 轉 MySQL(UTF8)時，採用了 iconv 去做轉碼的處理
一開始處理幾個 Table 都沒什麼問題，直到一個欄位裡面有中文全形&#8221;／”，引起 iconv 無法轉換而整個 SQL 句子中斷
iconv 語法
iconv(FromEncoding, ToEncoding, String);
上網查到 iconv 第二個參數可以加上額外參數
//IGNORE直接把錯誤的字去掉，使用上正常，但是資料與原始的不同&#160; $txt = iconv(&#34;big5&#34;,&#34;utf-8//IGNORE&#34;,$query);&#160; //TRANSLIT遇到中文的&#34;／&#34;還是出錯&#160; $txt = iconv(&#34;big5&#34;,&#34;utf-8//TRANSLIT&#34;,$query);
這邊有一篇關於 Translit 參數的說明
Iconv and incompatible encodings
文章中指出
//TRANSLIT will raise an exception on characters it can't transliterate, however; this can be solved by using '//IGNORE//TRANSLIT' together (in that order).
最後是採用了 mb_convert_encoding 來解決
//mb_convert_encoding 可以正常的把字串轉為 UTF8，但聽說速度較慢&#160; $txt [...]]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/155/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MSN 去除廣告程式</title>
		<link>http://twycf.com/wordpress/archives/154</link>
		<comments>http://twycf.com/wordpress/archives/154#comments</comments>
		<pubDate>Sat, 12 May 2007 12:45:31 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/154</guid>
		<description><![CDATA[我個人非常喜歡使用的 MSN 去除廣告程式 Clean Messenger 己經結束營業
結束的原因是，微軟認為這隻去廣告程式擅自修改了 msn 程式，為了有法律上的爭議，所以這個程式也算是到了尾聲，作者在首頁上提供了一個可行的做法，讓你的 MSN不再出現煩人的廣告
你只要在下面這一個檔案中，加入兩行 hostname mapping 即可
C:\WINDOWS\system32\drivers\etc\hosts 
127.0.0.1&#160; &#160; &#160; &#160;rad.msn.com127.0.0.1&#160; &#160; &#160; &#160;rad.live.com
我偏好這一個 MSN去廣告程式的原因，他不只能去除廣告，而且很多MSN本身沒用的功能都可以把他隱藏起來，比如對話視窗的背景、色彩配置、動畫快遞、主視窗的搜尋，當然最主要的功能是把廣告的區塊完全拿掉，而不是像上述 hostname mapping 的做法，廣告的區塊還是會出現，只不過剩下 msn 原本的訊息
]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/154/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xoops 2.0.x 區塊複製</title>
		<link>http://twycf.com/wordpress/archives/153</link>
		<comments>http://twycf.com/wordpress/archives/153#comments</comments>
		<pubDate>Sat, 12 May 2007 12:28:20 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[xoops]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/153</guid>
		<description><![CDATA[在 xoops 2.2.x 的區塊管理下有一個非常實用的功能，就是區塊複製，在 2.0.x 上並沒有這個功能(其實是有的，只是因為某些原因程式碼被 mark 起來)，以下的步驟記錄如何打開這個封印。
一、modules/system/admin/blocksadmin/main.php
最底下有幾行程式碼被 mark 起來，把 /* 和 */ 拿掉如下
if ($op == 'clone') {&#160;&#160; &#160;clone_block($bid);}if ($op == 'clone_ok') {&#160;&#160; &#160;clone_block_ok($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options);}並在 $bid 和$bside 中間加 &#34;, $btitle&#34;
二、modules/system/admin/blocksadmin/blocksadmin.php
相對應的 function 也要多一個 &#8220;, $btitle&#8221; 順序要一樣
function clone_block_ok($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options)
三、往下數14行有一個
//$clone-&#62;setVar('title', $btitle);
把 mark 拿掉
四、modules/system/admin/blocksadmin/blocksadmin.php
在function list_blocks()裡面找到
if ($block_arr[$i]-&#62;getVar('block_type') != [...]]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/153/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>xoops system module 1.0 新增使用者時，多群組不能儲存的問題</title>
		<link>http://twycf.com/wordpress/archives/152</link>
		<comments>http://twycf.com/wordpress/archives/152#comments</comments>
		<pubDate>Wed, 18 Apr 2007 09:19:14 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[xoops]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/152</guid>
		<description><![CDATA[System 模組新增使用者時，選擇多個群組只會儲存第一個
此修正只適合 xoops 2.0.x版，2.3 沒有這個問題，修正方式如下：
\modules\system\admin\users\main.php
找到這一段
if (!$member_handler->insertUser($newuser)) {
    $adduser_errormsg = _AM_CNRNU;
} else {
    if (!$member_handler->addUserToGroup(XOOPS_GROUP_USERS, $newuser->getVar(&#8217;uid&#8217;))) {
        $adduser_errormsg = _AM_CNRNU2;
    } else {
    if( strlen($adduser_errormsg)==0){
        redirect_header(&#8221;admin.php?fct=subusers&#8221;,1,_AM_DBUPDATED);
     [...]]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/152/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
