<?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>筍子工作雜記 &#187; Programming</title>
	<atom:link href="http://twycf.com/wordpress/archives/category/programming/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>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>1</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>如何讓後台的跳轉頁面也套用前台的風格</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 做修改，這時候會遇到一個問題

  

如果是 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>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>
		<item>
		<title>Xoops 控制台選單的產生方式</title>
		<link>http://twycf.com/wordpress/archives/140</link>
		<comments>http://twycf.com/wordpress/archives/140#comments</comments>
		<pubDate>Sun, 24 Dec 2006 08:05:41 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[xoops]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/140</guid>
		<description><![CDATA[/admin.php&#160; case 'generate':&#160;&#160; &#160;xoops_module_write_admin_menu(xoops_module_get_admin_menu());/include/cp_functions.php&#160; function xoops_module_get_admin_menu()&#160; function xoops_module_write_admin_menu($content)

在 xoops_module_get_admin_menu() 這個 function 裡面，搜尋所有模組有無控制台選單，並且組合 java script 動態選單的效果。
xoops_module_write_admin_menu() 則負責把剛剛組合出來的選單寫入 Cache 裡面，路徑為
/cache/adminmenu.php
]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/140/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>userinfo.php 空白頁面懶人解決方法</title>
		<link>http://twycf.com/wordpress/archives/133</link>
		<comments>http://twycf.com/wordpress/archives/133#comments</comments>
		<pubDate>Tue, 28 Nov 2006 06:44:56 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[xoops]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/133</guid>
		<description><![CDATA[這一陣子忙的昏天暗地，部落格上也雜草叢生了，以後如果真的很忙，可能會出現只有短短幾個字的文章，反正是工作雜記嘛…
modules/profile/userinfo.php
這一隻程式有時候會出現空白頁面，之前因為有時正常，有時不正常，所以沒有直接懷疑到程式碼身上，但最近出現的頻率太過頻繁，狠下心來做全面的 Debug.
把userinfo.php加入Debug Code 後，開始執行便發覺程式卡在呼叫 XoopsModule 的 search 成員
$results =&#38; $modules[$mid]-&#62;search('', '', 5, 0, $thisUser-&#62;getVar('uid'));
而要追蹤這一隻程式，要直接去 /kernel/module.php 找 search 這一個函式，同樣的插入 Debug Code 後，執行便發覺程式又卡在
if (file_exists(XOOPS_ROOT_PATH.&#34;/modules/&#34;.$this-&#62;getVar('dirname').'/'.$search['file'])) {&#160; include_once XOOPS_ROOT_PATH.'/modules/'.$this-&#62;getVar('dirname').'/'.$search['file'];} else {&#160; return false;}
追到後面，原來是userinfo.php 他會去搜尋目前使用者，在各個模組最新發表的文章，結果因為有一個模組的的搜尋功能沒有定義好(通常是因為同樣的模組裝了兩個，但是搜尋的功能沒有設定好，比如 iContent、iContent1 兩個同樣的模組)，造成他去include 搜尋程式時，整個流程中斷，變成空白頁面，解決方法很簡單，就是把這一個功能關掉( 搜尋目前使用者，在各個模組最新發表文章的功能)
我也在xoops 網站找到相關的討論，網址如下：
[ #4157 ] Pageworks search failing (breaks userinfo.php)
所謂的懶人解決方法，就是直接把這個功能關掉，如果要讓這一個功能正常運作，需要重新定義重複安裝的模組裡的 search function.
]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/133/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>主選單生成分析</title>
		<link>http://twycf.com/wordpress/archives/130</link>
		<comments>http://twycf.com/wordpress/archives/130#comments</comments>
		<pubDate>Sat, 29 Jul 2006 12:08:05 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[xoops]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/130</guid>
		<description><![CDATA[系統主選單是如何產生的呢，下面是分析步驟
由 index.php 引入 header.php 開始
/header.php
// Get blocks&#160; $block_handler =&#38; xoops_gethandler('block');(註1)&#160; $block_handler-&#62;assignBlocks();
/kernel/block.php
function assignBlocks() //取得區塊供樣板引擎使用
&#160; $bcontent = $xoopsTpl-&#62;fetch( &#34;db:$btpl&#34;, &#34;blk_$instanceid&#34; );//取得區塊內容，經由 smarty 執行 system_blocks.php
&#160; $xoopsTpl-&#62;clear_assign('block');
&#160; $querycount = count( $xoopsLogger-&#62;queries[$xoopsLogger-&#62;context] ) - $querycountbefore;
&#160; $xoopsLogger-&#62;addBlock( $block_arr[$i]-&#62;block-&#62;getVar('name'), false, 0, $querycount );
//$block_arr[$i]-&#62;block-&#62;getVar('name')&#160; 區塊名稱
資料庫參考資料 table:xoops_block_instanceinstid bid options&#160; title&#160; &#160; side weight visible bctime&#160;&#160; &#160; 1&#160; &#160;1 a:0:{} 使用者選單&#160; &#160; 0&#160; &#160; &#160; [...]]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/130/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

