<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2enclosuresfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Joe Horn 的啟示錄</title>
	
	<link>http://www.joehorn.idv.tw</link>
	<description>Joe Horn's Blog</description>
	<lastBuildDate>Mon, 08 Mar 2010 16:15:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>zh-TW</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<feedburner:info uri="joehorn-rss2" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://www.joehorn.idv.tw/feed/" /><feedburner:browserFriendly>This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site.</feedburner:browserFriendly><item>
		<title>[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/BBG5wjjqN_U/</link>
		<comments>http://www.joehorn.idv.tw/archives/2010/03/08/768/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 15:23:43 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[INDEX]]></category>
		<category><![CDATA[LIMIT]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PDO]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Primary Key]]></category>
		<category><![CDATA[Query Cache]]></category>
		<category><![CDATA[Super Smack]]></category>
		<category><![CDATA[UNIQUE]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=768</guid>
		<description><![CDATA[我利用前兩天的空閒時間寫了個 PHP 的小程式，運用 PHP 的 PDO 元件，對 MySQL 進行小測試。
Server 作業系統與硬體：

作業系統：FreeBSD 8.0-RELEASE
CPU：Intel(R) Pentium(R) 4 CPU 3.00GHz (3042.62-MHz 686-class CPU)，Hyper-Threading 開啟
RAM：2G DDR2 800
放資料庫的 HDD：WDC WD800JB-00JJA0，UDMA 100

MySQL 5.1.44 的設定（/etc/my.cnf）：
# defult setting (maybe changed)
key_buffer_size = 128M
max_allowed_packet = 4M
table_open_cache = 4096
sort_buffer_size = 1M
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

# added for tunning by Joe Horn
skip-name-resolve
connect_timeout = 60
join_buffer_size = [...]]]></description>
			<content:encoded><![CDATA[<p>我利用前兩天的空閒時間寫了個 <a href="http://www.php.net" target="_blank">PHP</a> 的小程式，運用 <a href="http://www.php.net/pdo" target="_blank">PHP 的 PDO 元件</a>，對 <a href="http://dev.mysql.com/" target="_blank">MySQL</a> 進行小測試。</p>
<p>Server 作業系統與硬體：</p>
<ul>
<li>作業系統：<a href="http://www.freebsd.org" target="_blank">FreeBSD</a> 8.0-RELEASE</li>
<li>CPU：Intel(R) Pentium(R) 4 CPU 3.00GHz (3042.62-MHz 686-class CPU)，Hyper-Threading 開啟</li>
<li>RAM：2G DDR2 800</li>
<li>放資料庫的 HDD：WDC WD800JB-00JJA0，UDMA 100</li>
</ul>
<p><a href="http://dev.mysql.com/" target="_blank">MySQL</a> 5.1.44 的設定（/etc/my.cnf）：</p>
<pre class="brush: plain;"># defult setting (maybe changed)
key_buffer_size = 128M
max_allowed_packet = 4M
table_open_cache = 4096
sort_buffer_size = 1M
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

# added for tunning by Joe Horn
skip-name-resolve
connect_timeout = 60
join_buffer_size = 1M
max_connect_errors = 10000
max_connections = 100
max_heap_table_size = 1G
query_cache_size = 16M
slave_net_timeout = 30
sync_binlog=1
thread_cache_size = 512
thread_concurrency = 8
tmp_table_size = 1G
table_definition_cache = 512
# choose one ( depend on query amount )
#concurrent_insert=2
low_priority_updates=1</pre>
<p>這台機器跑 <a href="http://vegan.net/tony/supersmack/" target="_blank">Super Smack</a> 的結果：</p>
<pre class="brush: plain;"># super-smack -d mysql update-select.smack 80 1000
Query Barrel Report for client smacker
connect: max=14ms  min=1ms avg= 4ms from 80 clients
Query_type      num_queries  max_time  min_time  q_per_s
select_index    80000        101       6         717.91
update_index    80000        108       1         717.91</pre>
<p>我用<a href="http://www.joehorn.idv.tw/download/test.phps" target="_blank">測試程式</a>產生了一百萬筆資料的 <a href="http://en.wikipedia.org/wiki/MyISAM" target="_blank">MyISAM</a> table，各種測試各循環 1000 次，產生如下的測試結果（後面的數字單位是秒）：</p>
<pre class="brush: plain; gutter: true;">SELECT BY PK_COL WITH_QUERY_CACHE:              0.058
SELECT BY PK_COL WITHOUT_QUERY_CACHE:           0.062
SELECT BY PK_COL LIMIT WITH_QUERY_CACHE:        0.058
SELECT BY PK_COL LIMIT WITHOUT_QUERY_CACHE:     0.062
SELECT BY UNIQUE_COL WITH_QUERY_CACHE:          0.058
SELECT BY UNIQUE_COL WITHOUT_QUERY_CACHE:       0.062
SELECT BY UNIQUE_COL LIMIT WITH_QUERY_CACHE:    0.058
SELECT BY UNIQUE_COL LIMIT WITHOUT_QUERY_CACHE: 0.062
SELECT BY INDEX_COL WITH_QUERY_CACHE:           0.058
SELECT BY INDEX_COL WITHOUT_QUERY_CACHE:        0.061
SELECT BY INDEX_COL LIMIT WITH_QUERY_CACHE:     0.058
SELECT BY INDEX_COL LIMIT WITHOUT_QUERY_CACHE:  0.063
SELECT BY COL WITH_QUERY_CACHE:                 0.786
SELECT BY COL WITHOUT_QUERY_CACHE:              0.063
SELECT BY COL LIMIT WITH_QUERY_CACHE:           0.059
SELECT BY COL LIMIT WITHOUT_QUERY_CACHE:        0.062
UPDATE BY PK_COL WITH_QUERY_CACHE:              1.139
UPDATE BY PK_COL WITHOUT_QUERY_CACHE:           1.199
UPDATE BY PK_COL LIMIT WITH_QUERY_CACHE:        0.125
UPDATE BY PK_COL LIMIT WITHOUT_QUERY_CACHE:     0.142
UPDATE BY UNIQUE_COL WITH_QUERY_CACHE:          2.734
UPDATE BY UNIQUE_COL WITHOUT_QUERY_CACHE:       1.203
UPDATE BY UNIQUE_COL LIMIT WITH_QUERY_CACHE:    0.147
UPDATE BY UNIQUE_COL LIMIT WITHOUT_QUERY_CACHE: 0.163
UPDATE BY INDEX_COL WITH_QUERY_CACHE:           1.183
UPDATE BY INDEX_COL WITHOUT_QUERY_CACHE:        1.063
UPDATE BY INDEX_COL LIMIT WITH_QUERY_CACHE:     0.138
UPDATE BY INDEX_COL LIMIT WITHOUT_QUERY_CACHE:  0.154
UPDATE BY COL WITH_QUERY_CACHE:                 4704.859
UPDATE BY COL WITHOUT_QUERY_CACHE:              4641.191
UPDATE BY COL LIMIT WITH_QUERY_CACHE:           0.156
UPDATE BY COL LIMIT WITHOUT_QUERY_CACHE:        0.167</pre>
<p>根據測試結果，大概可以看到出以下幾個要點：</p>
<ol>
<li>根據第 21 行與 22 行的差異看來，<a href="http://dev.mysql.com/doc/refman/5.1/en/query-cache.html" target="_blank">MySQL Query cache</a> 還是有點用處，不過效用不大。</li>
<li>根據第 13 行與第 29 行的結果看來，有沒有設定 Primary Key、UNIQUE、INDEX 的影響不小。</li>
<li>根據 UPDATE 語法的測試結果看來，有沒有 LIMIT 頗重要。</li>
</ol>
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2009/11/20/705/" title="一些增進 MySQL 效能的 tips">一些增進 MySQL 效能的 tips</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2008/09/03/304/" title="FreeBSD i386 與 amd64 platform 的差異">FreeBSD i386 與 amd64 platform 的差異</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2006/05/23/225/" title="抖抖..">抖抖..</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/11/28/208/" title="FreeBSD 上面的 PHP 4.4.1">FreeBSD 上面的 PHP 4.4.1</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2010/03/02/759/" title="[筆記] 最近製作/修改 FreeBSD ports 的一些心得">[筆記] 最近製作/修改 FreeBSD ports 的一些心得</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/FreeBSD' rel='tag' target='_self'>FreeBSD</a>, <a class='technorati-link' href='http://technorati.com/tag/INDEX' rel='tag' target='_self'>INDEX</a>, <a class='technorati-link' href='http://technorati.com/tag/LIMIT' rel='tag' target='_self'>LIMIT</a>, <a class='technorati-link' href='http://technorati.com/tag/MySQL' rel='tag' target='_self'>MySQL</a>, <a class='technorati-link' href='http://technorati.com/tag/PDO' rel='tag' target='_self'>PDO</a>, <a class='technorati-link' href='http://technorati.com/tag/PHP' rel='tag' target='_self'>PHP</a>, <a class='technorati-link' href='http://technorati.com/tag/Primary+Key' rel='tag' target='_self'>Primary Key</a>, <a class='technorati-link' href='http://technorati.com/tag/Query+Cache' rel='tag' target='_self'>Query Cache</a>, <a class='technorati-link' href='http://technorati.com/tag/Super+Smack' rel='tag' target='_self'>Super Smack</a>, <a class='technorati-link' href='http://technorati.com/tag/UNIQUE' rel='tag' target='_self'>UNIQUE</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/igd6ettYV8sbrR7gyHjhhZGmYX0/0/da"><img src="http://feedads.g.doubleclick.net/~a/igd6ettYV8sbrR7gyHjhhZGmYX0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/igd6ettYV8sbrR7gyHjhhZGmYX0/1/da"><img src="http://feedads.g.doubleclick.net/~a/igd6ettYV8sbrR7gyHjhhZGmYX0/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2010/03/08/768/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2010/03/08/768/</feedburner:origLink></item>
		<item>
		<title>Xuite 的問題（with RSS/Atom feed from Feedburner）</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/bymXJ7yG-wM/</link>
		<comments>http://www.joehorn.idv.tw/archives/2010/03/07/763/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 10:41:18 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[WWW]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[FeedBurner]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Xuite]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=763</guid>
		<description><![CDATA[這是前陣子在寫 Plurk Bot 時發現的問題。
因為 FeedBurner 已經被 Google 買下了。
所以，FeedBurner 會以「http://feedproxy.google.com/.....」這種 URL 進行 HTTP 重新導向，使瀏覽器連結到「http://原始URL/?utm_source=feedburner&#038;utm_medium=feed&#038;utm_campaign=Feed%3A......」這種頁面。
若是部落客用 FeedBurner 把放在 Xuite 上面的部落格 RSS/Atom feed 燒起來，而訂閱者透過 feedproxy.google.com 連結到文章頁面時，得到 HTTP 400 Error 的頁面（只有第一次被重新導向時，是正常的）。
會得到 HTTP 400 Error 頁面的原因是...
經過第一次的瀏覽後，瀏覽器的 cookie 被塞入兩個值，而 Xuite 無法正確解析瀏覽器的 cookie。

目前使用者自行排除問題的方式是拒絕 Xuite 存取瀏覽器的 cookie。
Related posts:

Google 更換圖示以紀念點字系統發明者 Louis Braille
Google 的免費圖片管理軟體 &#8211; Picasa !
Google adsense for RSS/ATOM ! O_O
Google 跟 PCHome 合作了!!
Firefox 擴充套件 [...]]]></description>
			<content:encoded><![CDATA[<p>這是前陣子在寫 <a href="http://www.plurk.com">Plurk</a> Bot 時發現的問題。</p>
<p>因為 <a href="http://www.feedburner.com">FeedBurner</a> 已經被 <a href="http://www.google.com">Google</a> 買下了。<br />
所以，<a href="http://www.feedburner.com">FeedBurner</a> 會以「<em>http://feedproxy.google.com/.....</em>」這種 URL 進行 HTTP 重新導向，使瀏覽器連結到「<em>http://原始URL/?utm_source=feedburner&#038;utm_medium=feed&#038;utm_campaign=Feed%3A......</em>」這種頁面。</p>
<p>若是部落客用 <a href="http://www.feedburner.com">FeedBurner</a> 把放在 <a href="http://xuite.net/" target="_blank">Xuite</a> 上面的部落格 RSS/Atom feed 燒起來，而訂閱者透過 feedproxy.google.com 連結到文章頁面時，得到 HTTP 400 Error 的頁面（只有第一次被重新導向時，是正常的）。</p>
<p>會得到 HTTP 400 Error 頁面的原因是...<br />
經過第一次的瀏覽後，瀏覽器的 cookie 被塞入兩個值，而 <a href="http://xuite.net/" target="_blank">Xuite</a> 無法正確解析瀏覽器的 cookie。<br />
<a href="http://www.joehorn.idv.tw/upload/2010/03/Xuite-Feedburner.jpg" rel="lightbox"><img src="http://www.joehorn.idv.tw/upload/2010/03/Xuite-Feedburner.jpg" width="400" /></a></p>
<p>目前使用者自行排除問題的方式是拒絕 <a href="http://xuite.net/" target="_blank">Xuite</a> 存取瀏覽器的 cookie。<br />
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2006/01/05/218/" title="Google 更換圖示以紀念點字系統發明者 Louis Braille">Google 更換圖示以紀念點字系統發明者 Louis Braille</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/09/21/199/" title="Google 的免費圖片管理軟體 &#8211; Picasa !">Google 的免費圖片管理軟體 &#8211; Picasa !</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/04/27/138/" title="Google adsense for RSS/ATOM ! O_O">Google adsense for RSS/ATOM ! O_O</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/04/26/135/" title="Google 跟 PCHome 合作了!!">Google 跟 PCHome 合作了!!</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/04/19/123/" title="Firefox 擴充套件 &#8211;  Adsense Notifier">Firefox 擴充套件 &#8211;  Adsense Notifier</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/cookie' rel='tag' target='_self'>cookie</a>, <a class='technorati-link' href='http://technorati.com/tag/FeedBurner' rel='tag' target='_self'>FeedBurner</a>, <a class='technorati-link' href='http://technorati.com/tag/Google' rel='tag' target='_self'>Google</a>, <a class='technorati-link' href='http://technorati.com/tag/Xuite' rel='tag' target='_self'>Xuite</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/Fa7tWEYDT6j738EYPoyccenl_2Q/0/da"><img src="http://feedads.g.doubleclick.net/~a/Fa7tWEYDT6j738EYPoyccenl_2Q/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Fa7tWEYDT6j738EYPoyccenl_2Q/1/da"><img src="http://feedads.g.doubleclick.net/~a/Fa7tWEYDT6j738EYPoyccenl_2Q/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2010/03/07/763/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2010/03/07/763/</feedburner:origLink></item>
		<item>
		<title>[筆記] 最近製作/修改 FreeBSD ports 的一些心得</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/9V0MO9FOHQQ/</link>
		<comments>http://www.joehorn.idv.tw/archives/2010/03/02/759/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 14:56:20 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[ports]]></category>
		<category><![CDATA[porttools]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=759</guid>
		<description><![CDATA[在 1 月底，我開始使用 FreeBSD Port Tools 來製作/修改 FreeBSD ports。
因為太好用了，使得我在一個月左右時間內，整整送了 10 個 FreeBSD PR（我知道這種量不值一提，但對我來說，這是目前為止的尖峰值）。
對 FreeBSD ports 有興趣的人，請先詳讀一下這個討論串。
針對 FreeBSD Port Tools 的使用，大概要注意的是：

要送出前，請先用 port test 測試過，並記得用 -- 參數來測試所有的 make 參數與選項。
修改 ports，但只是 patch，不是版本更新時，請用 port submit -m change，並記得修改 Synopsis。
對 ports 進行版本更新時，請用 port submit -m update。
製作新的 ports 時，請用 port submit -m new。

至於 FreeBSD ports 的部份，大概要注意這些：

如果是 PHP Web systems/projects，要先下載後解開，花點時間檢查該系統需要哪些 PHP extensions。可以參考 PHP [...]]]></description>
			<content:encoded><![CDATA[<p>在 1 月底，我開始使用 <a href="http://porttools.sourceforge.net/" target="_blank">FreeBSD Port Tools</a> 來製作/修改 FreeBSD ports。<br />
因為太好用了，使得我在一個月左右時間內，整整送了 10 個 <a href="http://www.freebsd.org/support/bugreports.html" target="blank">FreeBSD PR</a>（我知道這種量不值一提，但對我來說，這是目前為止的尖峰值）。</p>
<p>對 FreeBSD ports 有興趣的人，請先詳讀一下<a href="http://www.ptt.cc/man/FreeBSD/DEBD/D160/M.1135705310.A.E5B.html" title="[文件] send-pr 的基本介紹" target="_blank">這個討論串</a>。<br />
針對 <a href="http://porttools.sourceforge.net/" target="_blank">FreeBSD Port Tools</a> 的使用，大概要注意的是：</p>
<ul>
<li>要送出前，請先用 <strong>port test</strong> 測試過，並記得用 -- 參數來測試所有的 make 參數與選項。</li>
<li>修改 ports，但只是 patch，不是版本更新時，請用 <strong>port submit -m change</strong>，並記得修改 Synopsis。</li>
<li>對 ports 進行版本更新時，請用 <strong>port submit -m update</strong>。</li>
<li>製作新的 ports 時，請用 <strong>port submit -m new</strong>。</li>
</ul>
<p>至於 FreeBSD ports 的部份，大概要注意這些：</p>
<ul>
<li>如果是 <a href="http://www.php.net/" target="_blank">PHP</a> Web systems/projects，要先下載後解開，花點時間檢查該系統需要哪些 PHP extensions。可以參考 <a href="http://www.php.net/manual/en/funcref.php" target="_blank">PHP 的 Function Reference</a>，例如：mbstring 可以用 <strong>grep -r "mb_*" [PHP_PROJECT_ROOT_DIR]</strong>。</li>
<li>如果要在安裝後顯示的 pkg-message，或是 pkg-plist 帶入變數，建議在 [PORT_DIRECTORY]/files 放 pkg-message.in 或 pkg-plist.in 這種檔案。</li>
<li>儘量在 Makefile 使用變數，主要（常用）的變數可以參考 /usr/ports/Mk/bsd.port.mk，其他的請參考 /usr/ports/Mk/ 底下的其他檔案。</li>
</ul>
<p>由於我還算是新手小嫩咖，目前只能提供以上的心得（順便留個筆記）... orz</p>
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2010/03/08/768/" title="[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要">[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2010/01/08/738/" title="FreeBSD-SA-10:02.ntpd">FreeBSD-SA-10:02.ntpd</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2008/09/03/304/" title="FreeBSD i386 與 amd64 platform 的差異">FreeBSD i386 與 amd64 platform 的差異</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2006/05/23/225/" title="抖抖..">抖抖..</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/12/28/209/" title="FreeBSD ports 裡的 Apache 2.2 啟動 shell script 的問題">FreeBSD ports 裡的 Apache 2.2 啟動 shell script 的問題</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/FreeBSD' rel='tag' target='_self'>FreeBSD</a>, <a class='technorati-link' href='http://technorati.com/tag/ports' rel='tag' target='_self'>ports</a>, <a class='technorati-link' href='http://technorati.com/tag/porttools' rel='tag' target='_self'>porttools</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/O1vPEREfA-LKRPyaxMaGj6MEa_Y/0/da"><img src="http://feedads.g.doubleclick.net/~a/O1vPEREfA-LKRPyaxMaGj6MEa_Y/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/O1vPEREfA-LKRPyaxMaGj6MEa_Y/1/da"><img src="http://feedads.g.doubleclick.net/~a/O1vPEREfA-LKRPyaxMaGj6MEa_Y/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2010/03/02/759/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2010/03/02/759/</feedburner:origLink></item>
		<item>
		<title>刪除 IE 與 Firefox 的 CNNIC 根憑證</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/wWRijU6znFY/</link>
		<comments>http://www.joehorn.idv.tw/archives/2010/02/02/748/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 14:23:29 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[Computer Software]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[WWW]]></category>
		<category><![CDATA[CNNIC]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[root certificate]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=748</guid>
		<description><![CDATA[這幾天，我的噗浪河道上，除了 Apple iPad 之外，也出現了一些關於 CNNIC 根憑證的噗。
基於中國大陸政府的黑暗與邪惡，以及中國網路界的「和諧」作風，我決定把 CNNIC 的根憑證移除掉，順便把移除方法貼出來。

IE（Internet Explorer）：

Firefox（聽說 3.6 有。因為我在用的附加元件尚未完全相容，所以我還在用 3.5.7）：


2010/02/02 23:37 UPDATE
另有 MacOS 與 Linux 的移除教學文，有需要的請參考以下連結：

刪除 Mac OS X Key chain 的 CNNIC 根憑證 Root Certifications
在 Linux 上移除 CNNIC 憑證

Related posts:

資料同步與備份
IE 與 FireFox &#8211; 再度發現
IE 與 FireFox
RoundCube 的郵件中文夾檔問題
Google Reader 怪怪的？




Technorati Tags: CNNIC, Firefox, IE, Internet Explorer, root certificate


]]></description>
			<content:encoded><![CDATA[<p>這幾天，<a href="http://www.plurk.com/JoeHorn">我的噗浪</a>河道上，除了 Apple iPad 之外，也出現了一些關於 <a href="http://www.cnnic.net.cn" rel="nofollow">CNNIC</a> 根憑證的噗。<br />
基於中國大陸政府的黑暗與邪惡，以及中國網路界的「和諧」作風，我決定把 <a href="http://www.cnnic.net.cn" rel="nofollow">CNNIC</a> 的根憑證移除掉，順便把移除方法貼出來。</p>
<ul>
<li>IE（Internet Explorer）：<br />
<a href="http://www.joehorn.idv.tw/upload/2010/02/2010-02-02-21-53-31.jpg" title="Remove CNNIC root certificate from IE" rel="lightbox"><img src="http://www.joehorn.idv.tw/upload/2010/02/2010-02-02-21-53-31.jpg" alt="Remove CNNIC root certificate from IE" title="Remove CNNIC root certification from IE" width="400" /></a></li>
<li>Firefox（聽說 3.6 有。因為我在用的附加元件尚未完全相容，所以我還在用 3.5.7）：<br />
<a href="http://www.joehorn.idv.tw/upload/2010/02/2010-02-02-22-01-58.jpg" title="Remove CNNIC root certificate from Firefox" rel="lightbox"><img src="http://www.joehorn.idv.tw/upload/2010/02/2010-02-02-22-01-58.jpg" alt="Remove CNNIC root certificate from Firefox" title="Remove CNNIC root certificate from Firefox" width="400" /></a></li>
</ul>
<p><strong>2010/02/02 23:37 UPDATE</strong><br />
另有 MacOS 與 Linux 的移除教學文，有需要的請參考以下連結：</p>
<ul>
<li><a href="http://jclin.blogspot.com/2010/02/mac-os-x-key-chain-cnnic-root.html">刪除 Mac OS X Key chain 的 CNNIC 根憑證 Root Certifications</a></li>
<li><a href="http://people.debian.org.tw/~chihchun/2010/02/02/remove-cnnic-cert-on-linux/">在 Linux 上移除 CNNIC 憑證</a></li>
</ul>
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2008/07/05/287/" title="資料同步與備份">資料同步與備份</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/02/25/40/" title="IE 與 FireFox &#8211; 再度發現">IE 與 FireFox &#8211; 再度發現</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/02/23/34/" title="IE 與 FireFox">IE 與 FireFox</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2008/07/18/292/" title="RoundCube 的郵件中文夾檔問題">RoundCube 的郵件中文夾檔問題</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2008/07/12/291/" title="Google Reader 怪怪的？">Google Reader 怪怪的？</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/CNNIC' rel='tag' target='_self'>CNNIC</a>, <a class='technorati-link' href='http://technorati.com/tag/Firefox' rel='tag' target='_self'>Firefox</a>, <a class='technorati-link' href='http://technorati.com/tag/IE' rel='tag' target='_self'>IE</a>, <a class='technorati-link' href='http://technorati.com/tag/Internet+Explorer' rel='tag' target='_self'>Internet Explorer</a>, <a class='technorati-link' href='http://technorati.com/tag/root+certificate' rel='tag' target='_self'>root certificate</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/j2pBxDUh04b2dyMRQ3uzxQGYkio/0/da"><img src="http://feedads.g.doubleclick.net/~a/j2pBxDUh04b2dyMRQ3uzxQGYkio/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/j2pBxDUh04b2dyMRQ3uzxQGYkio/1/da"><img src="http://feedads.g.doubleclick.net/~a/j2pBxDUh04b2dyMRQ3uzxQGYkio/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2010/02/02/748/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2010/02/02/748/</feedburner:origLink></item>
		<item>
		<title>Gallery 的 RSS module 問題：Undefined index:  sfPhotosRecursiveLimit in ....</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/aT7SUQ1mcdk/</link>
		<comments>http://www.joehorn.idv.tw/archives/2010/01/09/744/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 21:58:10 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[Gallery]]></category>
		<category><![CDATA[RSS]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=744</guid>
		<description><![CDATA[有安裝 Apache 的 error log 裡面看到一大串如下的 log：
PHP Notice:  Undefined index:  sfPhotosRecursiveLimit in [Gallery目錄]/modules/rss/SimpleRender.inc on line 78
追了一下程式，發現是變數沒處理好。
於是，我修改了 modules/rss/SimpleRender.inc，加了以下這段程式碼處理變數：
        if ( !isset($params['sfPhotosRecursiveLimit']) ) {
                $params['sfPhotosRecursiveLimit'] = $params['sfPhotosRecurseLimit'];
       [...]]]></description>
			<content:encoded><![CDATA[<p>有安裝 <a href="http://gallery.menalto.com/" target=_blank">Gallery</a> 2 作為相簿系統的人可能跟我一樣，會在 <a href="http://httpd.apache.org/" target=_blank">Apache</a> 的 error log 裡面看到一大串如下的 log：</p>
<blockquote><p>PHP Notice:  Undefined index:  sfPhotosRecursiveLimit in [Gallery目錄]/modules/rss/SimpleRender.inc on line 78</p></blockquote>
<p>追了一下程式，發現是變數沒處理好。<br />
於是，我修改了 modules/rss/SimpleRender.inc，加了以下這段程式碼處理變數：</p>
<pre class="brush: php;">        if ( !isset($params['sfPhotosRecursiveLimit']) ) {
                $params['sfPhotosRecursiveLimit'] = $params['sfPhotosRecurseLimit'];
        }</pre>
<p>修改過後的某個片段長這樣：</p>
<pre class="brush: php;">        $params['feedDate'] = $params['sfDate'];

        if ( !isset($params['sfPhotosRecursiveLimit']) ) {
                $params['sfPhotosRecursiveLimit'] = $params['sfPhotosRecurseLimit'];
        }

        /* apply defaults */</pre>
<p>跟我一樣，覺得那些 log 很礙眼的，就參考一下吧。<br />
我把 patch 一併貼到官方論壇了（<a href="http://gallery.menalto.com/node/93705" target=_blank">Problem fix for RSS module</a>），不知道會不會被採用就是了。<br />
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2005/04/27/138/" title="Google adsense for RSS/ATOM ! O_O">Google adsense for RSS/ATOM ! O_O</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/03/29/90/" title="電視節目表的 RSS">電視節目表的 RSS</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/02/19/25/" title="Bloglines 與 SharpReader">Bloglines 與 SharpReader</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/error' rel='tag' target='_self'>error</a>, <a class='technorati-link' href='http://technorati.com/tag/Gallery' rel='tag' target='_self'>Gallery</a>, <a class='technorati-link' href='http://technorati.com/tag/RSS' rel='tag' target='_self'>RSS</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/x0kRzAfwEOXKFfgwMoo2jW3xqBw/0/da"><img src="http://feedads.g.doubleclick.net/~a/x0kRzAfwEOXKFfgwMoo2jW3xqBw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/x0kRzAfwEOXKFfgwMoo2jW3xqBw/1/da"><img src="http://feedads.g.doubleclick.net/~a/x0kRzAfwEOXKFfgwMoo2jW3xqBw/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2010/01/09/744/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2010/01/09/744/</feedburner:origLink></item>
		<item>
		<title>FreeBSD-SA-10:02.ntpd</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/_ZX3MRR_tpI/</link>
		<comments>http://www.joehorn.idv.tw/archives/2010/01/08/738/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 17:06:54 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[Security Advisories]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=738</guid>
		<description><![CDATA[昨天，FreeBSD 官方發布了三個 Security Advisories：

FreeBSD-SA-10:01.bind
FreeBSD-SA-10:02.ntpd
FreeBSD-SA-10:03.zfs

根據 Advisories 內容，我原本打算透過以下的步驟作 patch：

cd /usr/src &#038;&#038; make update
cd /usr/src/lib/bind &#038;&#038; make obj &#038;&#038; make depend &#038;&#038; make &#038;&#038; make install
cd /usr/src/usr.sbin/named &#038;&#038; make obj &#038;&#038; make depend &#038;&#038; make &#038;&#038; make install
cd /usr/src/usr.sbin/ntp/ntpd &#038;&#038; make obj &#038;&#038; make depend &#038;&#038; make &#038;&#038; make install
cd /usr/src &#038;&#038; make kernel
[REBOOT]

但是，進行到第 4 個步驟（FreeBSD-SA-10:02.ntpd 的編譯階段），就出現了如下的 message：
make: [...]]]></description>
			<content:encoded><![CDATA[<p>昨天，<a href="http://www.freebsd.org" target="_blank">FreeBSD</a> 官方發布了三個 Security Advisories：</p>
<ul>
<li><a href="http://security.freebsd.org/advisories/FreeBSD-SA-10:01.bind.asc" target="_blank">FreeBSD-SA-10:01.bind</a></li>
<li><a href="http://security.freebsd.org/advisories/FreeBSD-SA-10:02.ntpd.asc" target="_blank">FreeBSD-SA-10:02.ntpd</a></li>
<li><a href="http://security.freebsd.org/advisories/FreeBSD-SA-10:03.zfs.asc" target="_blank">FreeBSD-SA-10:03.zfs</a></li>
</ul>
<p>根據 Advisories 內容，我原本打算透過以下的步驟作 patch：</p>
<ol>
<li>cd /usr/src &#038;& make update</li>
<li>cd /usr/src/lib/bind &#038;& make obj &#038;& make depend &#038;& make &#038;& make install</li>
<li>cd /usr/src/usr.sbin/named &#038;& make obj &#038;& make depend &#038;& make &#038;& make install</li>
<li>cd /usr/src/usr.sbin/ntp/ntpd &#038;& make obj &#038;& make depend &#038;& make &#038;& make install</li>
<li>cd /usr/src &#038;& make kernel</li>
<li>[REBOOT]</li>
</ol>
<p>但是，進行到第 4 個步驟（<a href="http://security.freebsd.org/advisories/FreeBSD-SA-10:02.ntpd.asc" target="_blank">FreeBSD-SA-10:02.ntpd</a> 的編譯階段），就出現了如下的 message：</p>
<blockquote><p>make: don't know how to make /usr/obj/usr/src/usr.sbin/ntp/ntpd/../libparse/libparse.a. Stop</p></blockquote>
<p>找了一些討論後，我在<a href="http://forums.freebsd.org/showthread.php?t=1475" target="_blank" title="Error while building FreeBSD-SA-09:03.ntpd">這個討論串</a>裡看到好幾種作法。<br />
幾經嘗試，我最終在 FreeBSD 8.0-RELEASE-p1 amd64 用以下這個作法順利編譯成功：</p>
<ol>
<li>cd /usr/src/usr.sbin/ntp</li>
<li>rm -rf /usr/obj/*</li>
<li>make obj &#038;& make depend &#038;& make &#038;& make install</li>
</ol>
<p>有相同問題（狀況）的人可以參考看看。<br />
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2010/03/08/768/" title="[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要">[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2010/03/02/759/" title="[筆記] 最近製作/修改 FreeBSD ports 的一些心得">[筆記] 最近製作/修改 FreeBSD ports 的一些心得</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2008/09/03/304/" title="FreeBSD i386 與 amd64 platform 的差異">FreeBSD i386 與 amd64 platform 的差異</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2006/05/23/225/" title="抖抖..">抖抖..</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/12/28/209/" title="FreeBSD ports 裡的 Apache 2.2 啟動 shell script 的問題">FreeBSD ports 裡的 Apache 2.2 啟動 shell script 的問題</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/FreeBSD' rel='tag' target='_self'>FreeBSD</a>, <a class='technorati-link' href='http://technorati.com/tag/patch' rel='tag' target='_self'>patch</a>, <a class='technorati-link' href='http://technorati.com/tag/Security+Advisories' rel='tag' target='_self'>Security Advisories</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/W8vRW_hs1OsnL4Z1SI2X0ISWO5c/0/da"><img src="http://feedads.g.doubleclick.net/~a/W8vRW_hs1OsnL4Z1SI2X0ISWO5c/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/W8vRW_hs1OsnL4Z1SI2X0ISWO5c/1/da"><img src="http://feedads.g.doubleclick.net/~a/W8vRW_hs1OsnL4Z1SI2X0ISWO5c/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2010/01/08/738/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2010/01/08/738/</feedburner:origLink></item>
		<item>
		<title>[Javascript] 從 array 裡隨機挑出不重複的值</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/3_YKOmznsjc/</link>
		<comments>http://www.joehorn.idv.tw/archives/2010/01/07/735/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 09:17:25 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[Programing]]></category>
		<category><![CDATA[WWW]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[For loop]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=735</guid>
		<description><![CDATA[Javascript 提供了 For ... In ... ，我用的還蠻高興的（雖然我很少撰寫 Javascript）。
今天遇到某種特殊需求，我才發現這個迴圈語法並非萬能。
從 array 裡隨機挑出不重複的值有兩種情況，一種很單純，For ... In ... 迴圈可以處理的很好：
var fruits = [&#34;Banana&#34;, &#34;Orange&#34;, &#34;Apple&#34;, &#34;Mango&#34;];
var x;

while(fruits.length &#62; 0) {
	var r = Math.floor( Math.random() * fruits.length );
	var n = fruits[r];
	document.write(&#34;Choosen[&#34; + r + &#34;]: &#34; + n + &#34;&#60;br /&#62;&#34;);
	document.write(&#34;Array: &#34; + fruits + &#34;&#60;br /&#62;&#34;);

	for(x in fruits) {
		if (fruits[x] == [...]]]></description>
			<content:encoded><![CDATA[<p>Javascript 提供了 <a href="http://www.w3schools.com/js/js_loop_for_in.asp" title="Javascript For ... In Statement" target="_blank">For ... In ...</a> ，我用的還蠻高興的（雖然我很少撰寫 Javascript）。<br />
今天遇到某種特殊需求，我才發現這個迴圈語法並非萬能。</p>
<p>從 array 裡隨機挑出不重複的值有兩種情況，一種很單純，<a href="http://www.w3schools.com/js/js_loop_for_in.asp" title="Javascript For ... In Statement" target="_blank">For ... In ...</a> 迴圈可以處理的很好：</p>
<pre class="brush: jscript;">var fruits = [&quot;Banana&quot;, &quot;Orange&quot;, &quot;Apple&quot;, &quot;Mango&quot;];
var x;

while(fruits.length &gt; 0) {
	var r = Math.floor( Math.random() * fruits.length );
	var n = fruits[r];
	document.write(&quot;Choosen[&quot; + r + &quot;]: &quot; + n + &quot;&lt;br /&gt;&quot;);
	document.write(&quot;Array: &quot; + fruits + &quot;&lt;br /&gt;&quot;);

	for(x in fruits) {
		if (fruits[x] == n) {
			fruits.splice(x, 1);
		}
	}
}</pre>
<p>若是 array 裡面已經存在重複的值，而且 array 的資料的來源不方便控制（例如是 HTML 裡面的 li 物件），<a href="http://www.w3schools.com/js/js_loop_for_in.asp" title="Javascript For ... In Statement" target="_blank">For ... In ...</a> 這種方便的迴圈語法就必須放棄，改用傳統的 for 迴圈：</p>
<pre class="brush: jscript;">var fruits = [&quot;Banana&quot;, &quot;Banana&quot;, &quot;Orange&quot;, &quot;Orange&quot;, &quot;Banana&quot;, &quot;Apple&quot;, &quot;Apple&quot;, &quot;Orange&quot;, &quot;Mango&quot;];
var i=0;

while(fruits.length &gt; 0) {
	var r = Math.floor( Math.random() * fruits.length );
	var n = fruits[r];
	document.write(&quot;Choosen[&quot; + r + &quot;]: &quot; + n + &quot;&lt;br /&gt;&quot;);
	document.write(&quot;Array: &quot; + fruits + &quot;&lt;br /&gt;&quot;);

	for(i=0; i&lt;fruits.length; i++) {
		if (fruits[i] == n) {
			fruits.splice(i, 1);
			i--;
		}
	}
}</pre>
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2005/03/08/55/" title="讓瀏覽者能快速將頁面加入 furl 跟 Del.icio.us 的作法">讓瀏覽者能快速將頁面加入 furl 跟 Del.icio.us 的作法</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/array' rel='tag' target='_self'>array</a>, <a class='technorati-link' href='http://technorati.com/tag/For+loop' rel='tag' target='_self'>For loop</a>, <a class='technorati-link' href='http://technorati.com/tag/Javascript' rel='tag' target='_self'>Javascript</a>, <a class='technorati-link' href='http://technorati.com/tag/random' rel='tag' target='_self'>random</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/buDLCyUvRGZ2V82ahH1r5FFOJ3U/0/da"><img src="http://feedads.g.doubleclick.net/~a/buDLCyUvRGZ2V82ahH1r5FFOJ3U/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/buDLCyUvRGZ2V82ahH1r5FFOJ3U/1/da"><img src="http://feedads.g.doubleclick.net/~a/buDLCyUvRGZ2V82ahH1r5FFOJ3U/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2010/01/07/735/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2010/01/07/735/</feedburner:origLink></item>
		<item>
		<title>[C#] 取得 wav 檔案格式</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/fMnoJMXhlSM/</link>
		<comments>http://www.joehorn.idv.tw/archives/2010/01/04/729/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 05:01:25 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[NAudio]]></category>
		<category><![CDATA[PCM]]></category>
		<category><![CDATA[wav]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=729</guid>
		<description><![CDATA[前陣子，在工作上剛好需要對 wav 檔案格式進行判定，可是 NAudio 製作出來的格式用來作判斷又有錯誤，所以土法煉鋼寫了一個小 class：

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;

    public class Wave
    {
        public struct Format
     [...]]]></description>
			<content:encoded><![CDATA[<p>前陣子，在工作上剛好需要對 wav 檔案格式進行判定，可是 <a href="http://www.codeplex.com/naudio">NAudio</a> 製作出來的格式用來作判斷又有錯誤，所以土法煉鋼寫了一個小 class：</p>
<pre class="brush: csharp;">
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;

    public class Wave
    {
        public struct Format
        {
            public String FileName = String.Empty;
            public Boolean PCM = false;
            public uint Channel = 0;
            public uint SampleRate = 0;
            public uint BitsPerSample = 0;
            public uint ByteRate = 0;
            public uint BlockAlign = 0;
        };

        private Format _fmt;

        private void fillUp()
        {
            _fmt.ByteRate = _fmt.Channel * _fmt.SampleRate * _fmt.BitsPerSample / 8;
            _fmt.BlockAlign = _fmt.Channel * _fmt.BitsPerSample / 8;
        }

        public Format getType(String fileName)
        {
            _fmt.FileName = fileName;

            try
            {
                FileStream fs = File.OpenRead(@fileName);
                Byte[] readTmp = new Byte[36];

                fs.Read(readTmp, 0, 36);
                fs.close();

                if (BitConverter.ToUInt16(readTmp, 20) == 1)
                {
                    _fmt.PCM = true;
                }

                _fmt.Channel = BitConverter.ToUInt16(readTmp, 22);
                _fmt.SampleRate = BitConverter.ToUInt32(readTmp, 24);
                _fmt.BitsPerSample = BitConverter.ToUInt16(readTmp, 34);

                fillUp();
            }
            catch (Exception e)
            {
                Console.WriteLine(&quot;Wave.getType(fileName) Error : &quot; + e.ToString());
            }
            return _fmt;
        }
    }
</pre>
<ul>
<li>檢查 FileName 是否為空字串，就知道是否成功呼叫 getType() 。</li>
<li>檢查 PCM 是否為 true，就知道該檔案是不是 PCM 格式的 wav 檔。</li>
<li>wav 檔播放的時間會等於 ByteRate。</li>
</ul>
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2009/10/11/701/" title="[小軟體] 備份 putty 的設定 &#8211; puttyBackup">[小軟體] 備份 putty 的設定 &#8211; puttyBackup</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2006/06/22/232/" title="[VB.Net] 將 DataSet 匯出成 CSV 檔">[VB.Net] 將 DataSet 匯出成 CSV 檔</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/.NET' rel='tag' target='_self'>.NET</a>, <a class='technorati-link' href='http://technorati.com/tag/Audio' rel='tag' target='_self'>Audio</a>, <a class='technorati-link' href='http://technorati.com/tag/C%23' rel='tag' target='_self'>C#</a>, <a class='technorati-link' href='http://technorati.com/tag/file' rel='tag' target='_self'>file</a>, <a class='technorati-link' href='http://technorati.com/tag/NAudio' rel='tag' target='_self'>NAudio</a>, <a class='technorati-link' href='http://technorati.com/tag/PCM' rel='tag' target='_self'>PCM</a>, <a class='technorati-link' href='http://technorati.com/tag/wav' rel='tag' target='_self'>wav</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/hrMqRlTfd34T84pDeAQfr3ILfIc/0/da"><img src="http://feedads.g.doubleclick.net/~a/hrMqRlTfd34T84pDeAQfr3ILfIc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/hrMqRlTfd34T84pDeAQfr3ILfIc/1/da"><img src="http://feedads.g.doubleclick.net/~a/hrMqRlTfd34T84pDeAQfr3ILfIc/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2010/01/04/729/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2010/01/04/729/</feedburner:origLink></item>
		<item>
		<title>輕鬆設定 PHP 的專案變數</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/NdLkeMmYZAI/</link>
		<comments>http://www.joehorn.idv.tw/archives/2009/12/10/718/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 17:31:05 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[auto_prepend_file]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[include]]></category>
		<category><![CDATA[include_once]]></category>
		<category><![CDATA[php_value]]></category>
		<category><![CDATA[require]]></category>
		<category><![CDATA[require_once]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=718</guid>
		<description><![CDATA[我們在開發 PHP 專案時，時常會把一些常用變數放在某個 PHP 檔案，接著用 require()、require_once()、incluce()、include_once() 等函式將之引入。
若系統目錄很複雜，就會在很多檔案裡面看到類似這樣的語法：
require_once('../../Config.php');
然而，當這種系統必須變動目錄結構與檔案所在目錄時，開發人員就得額外多花些時間來更改上述之程式碼。
其實，PHP 的設定檔中，有個很少被注意到的變數，就是 auto_prepend_file 。
假設目前有個 PHP 專案，專案根目錄之系統絕對路徑為 /var/www/html/Project，
共用設定檔為 /var/www/html/Project/Config.php 。
我們可以在 /var/www/html/Project 下建立 .htaccess 檔案，內容如下：
php_value auto_prepend_file "/var/www/html/Project/Config.php"
而 /var/www/html/Project 目錄下所有的檔案，以及所有子目錄中的檔案都會自行引入 /var/www/html/Project/Config.php 。
PS. 由於 auto_prepend_file 的設定是透過 require() 來實作，使用這種方法要特別注意以下兩點：

一旦設定了 auto_prepend_file ，該檔案就必須要存在，否則就會有 error ，導致該目錄下的所有 PHP 檔案無法正常執行。
include_path 會影響 auto_prepend_file。

Related posts:

[分享] 謹慎使用 Smarty 樣板的 {include} &#8230;
[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要
中文界面圖形驗證碼的新選擇 &#8211; reCAPTCHA
等待 reCAPTCHA 的多國語言支援
phpBB 2.0.20 and [...]]]></description>
			<content:encoded><![CDATA[<p>我們在開發 <a href="http://www.php.net">PHP</a> 專案時，時常會把一些常用變數放在某個 PHP 檔案，接著用 <a href="http://www.php.net/require">require()</a>、<a href="http://www.php.net/require_once">require_once()</a>、<a href="http://www.php.net/manual/en/function.include.php">incluce()</a>、<a href="http://tw2.php.net/manual/en/function.include-once.php">include_once()</a> 等函式將之引入。<br />
若系統目錄很複雜，就會在很多檔案裡面看到類似這樣的語法：</p>
<pre class="brush: plain;">require_once('../../Config.php');</pre>
<p>然而，當這種系統必須變動目錄結構與檔案所在目錄時，開發人員就得額外多花些時間來更改上述之程式碼。</p>
<p>其實，<a href="http://www.php.net">PHP</a> 的設定檔中，有個很少被注意到的變數，就是 <em>auto_prepend_file</em> 。</p>
<p>假設目前有個 <a href="http://www.php.net">PHP</a> 專案，專案根目錄之系統絕對路徑為 /var/www/html/Project，<br />
共用設定檔為 /var/www/html/Project/Config.php 。<br />
我們可以在 /var/www/html/Project 下建立 .htaccess 檔案，內容如下：</p>
<blockquote><p>php_value auto_prepend_file "/var/www/html/Project/Config.php"</p></blockquote>
<p>而 /var/www/html/Project 目錄下所有的檔案，以及所有子目錄中的檔案都會自行引入 /var/www/html/Project/Config.php 。</p>
<p>PS. 由於 auto_prepend_file 的設定是透過 <a href="http://www.php.net/require">require()</a> 來實作，使用這種方法要特別注意以下兩點：</p>
<ol>
<li>一旦設定了 auto_prepend_file ，該檔案就必須要存在，否則就會有 error ，導致該目錄下的所有 PHP 檔案無法正常執行。</li>
<li>include_path 會影響 auto_prepend_file。</li>
</ol>
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2009/09/27/641/" title="[分享] 謹慎使用 Smarty 樣板的 {include} &#8230;">[分享] 謹慎使用 Smarty 樣板的 {include} &#8230;</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2010/03/08/768/" title="[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要">[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2009/09/09/634/" title="中文界面圖形驗證碼的新選擇 &#8211; reCAPTCHA">中文界面圖形驗證碼的新選擇 &#8211; reCAPTCHA</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2007/11/10/249/" title="等待 reCAPTCHA 的多國語言支援">等待 reCAPTCHA 的多國語言支援</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2006/06/11/227/" title="phpBB 2.0.20 and CPG 1.4.6 work fine on PHP 4.4.2 !">phpBB 2.0.20 and CPG 1.4.6 work fine on PHP 4.4.2 !</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/auto_prepend_file' rel='tag' target='_self'>auto_prepend_file</a>, <a class='technorati-link' href='http://technorati.com/tag/htaccess' rel='tag' target='_self'>htaccess</a>, <a class='technorati-link' href='http://technorati.com/tag/include' rel='tag' target='_self'>include</a>, <a class='technorati-link' href='http://technorati.com/tag/include_once' rel='tag' target='_self'>include_once</a>, <a class='technorati-link' href='http://technorati.com/tag/PHP' rel='tag' target='_self'>PHP</a>, <a class='technorati-link' href='http://technorati.com/tag/php_value' rel='tag' target='_self'>php_value</a>, <a class='technorati-link' href='http://technorati.com/tag/require' rel='tag' target='_self'>require</a>, <a class='technorati-link' href='http://technorati.com/tag/require_once' rel='tag' target='_self'>require_once</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/lZ_wuviLpqhFJyBv3PWvIMJR6O0/0/da"><img src="http://feedads.g.doubleclick.net/~a/lZ_wuviLpqhFJyBv3PWvIMJR6O0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/lZ_wuviLpqhFJyBv3PWvIMJR6O0/1/da"><img src="http://feedads.g.doubleclick.net/~a/lZ_wuviLpqhFJyBv3PWvIMJR6O0/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2009/12/10/718/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2009/12/10/718/</feedburner:origLink></item>
		<item>
		<title>一些增進 MySQL 效能的 tips</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/9_D_vnj0CTA/</link>
		<comments>http://www.joehorn.idv.tw/archives/2009/11/20/705/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 17:29:26 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[BLOB]]></category>
		<category><![CDATA[CHAR]]></category>
		<category><![CDATA[ENUM]]></category>
		<category><![CDATA[EXPLAIN]]></category>
		<category><![CDATA[INDEX]]></category>
		<category><![CDATA[MyISAM]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[NOT NULL]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[TEXT]]></category>
		<category><![CDATA[VARCHAR]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=705</guid>
		<description><![CDATA[幾天前，跟 Solaris 叔叔 談到 MySQL 的 ENUM，回家後上網找了些資料，剛好找出了一些使用 MySQL 時，與效能有關的 tips。
稍微整理過後，放在這裡：

善用 EXPLAIN SELECT 分析 SQL statement，以下列舉狀態解讀：


EQ_REF
一對一比對


REF
一對多比對


RANGE
特定範圍的資料會被傳回


INDEX
使用 INDEX 裡的資料


ALL
對整個 TABLE 作掃瞄（最差）



善用 INDEX，以這個 SQL statement 為例：
SELECT `col_a`
FROM `table_a` LEFT JOIN `table_b`
ON `table_a`.`col_b` = `table_b`.`col_c`
WHERE `col_d` = ....;

-- SELECT 的欄位不需 INDEX，ex： `col_a`。
-- JOIN 的欄位需要 INDEX，ex： `table_a`.`col_b` 與 `table_b`.`col_c`。
-- WHERE 的欄位需要 INDEX，ex： `col_d`。


儘量使用固定大小的欄位，MyISAM 搜尋固定大小欄位比較快；也就是說，能用 CHAR 就別用 VARCHAR。
儘量將欄位指定為 NOT NULL。
ENUM 格式的欄位，資料處理速度很快（實測結果在這）。
不要取不需要的資料，下面這種語法就是不好的例子：
SELECT [...]]]></description>
			<content:encoded><![CDATA[<p>幾天前，跟 <a href="http://www.evil-elf.net/" target="_blank">Solaris 叔叔</a> 談到 <a href="http://dev.mysql.com/doc/refman/5.1/en/enum.html">MySQL 的 ENUM</a>，回家後上網找了些資料，剛好找出了一些使用 <a href="http://dev.mysql.com">MySQL</a> 時，與效能有關的 tips。</p>
<p>稍微整理過後，放在這裡：</p>
<ul>
<li>善用 EXPLAIN SELECT 分析 SQL statement，以下列舉狀態解讀：<br />
<table border="1">
<tr>
<td>EQ_REF</td>
<td>一對一比對</td>
</tr>
<tr>
<td>REF</td>
<td>一對多比對</td>
</tr>
<tr>
<td>RANGE</td>
<td>特定範圍的資料會被傳回</td>
</tr>
<tr>
<td>INDEX</td>
<td>使用 INDEX 裡的資料</td>
</tr>
<tr>
<td>ALL</td>
<td>對整個 TABLE 作掃瞄（最差）</td>
</tr>
</table>
</li>
<li>善用 INDEX，以這個 SQL statement 為例：
<pre class="brush: sql;">SELECT `col_a`
FROM `table_a` LEFT JOIN `table_b`
ON `table_a`.`col_b` = `table_b`.`col_c`
WHERE `col_d` = ....;

-- SELECT 的欄位不需 INDEX，ex： `col_a`。
-- JOIN 的欄位需要 INDEX，ex： `table_a`.`col_b` 與 `table_b`.`col_c`。
-- WHERE 的欄位需要 INDEX，ex： `col_d`。
</pre>
</li>
<li>儘量使用固定大小的欄位，MyISAM 搜尋固定大小欄位比較快；也就是說，能用 CHAR 就別用 VARCHAR。</li>
<li>儘量將欄位指定為 NOT NULL。</li>
<li>ENUM 格式的欄位，資料處理速度很快（<a href="http://www.mysqlperformanceblog.com/2008/01/24/enum-fields-vs-varchar-vs-int-joined-table-what-is-faster/" title="Enum Fields VS Varchar VS Int + Joined table: What is Faster?" target="_blank">實測結果在這</a>）。</li>
<li>不要取不需要的資料，下面這種語法就是不好的例子：
<pre class="brush: sql;">SELECT * ...</pre>
</li>
<li>把 BLOB 與 TEXT 拆開，減少 <a href="http://dev.mysql.com">MySQL</a> 開啟單一大檔（table 資料檔案過大）的機會。</li>
<li>JOIN 用的欄位資料格式最好是相同的，以免 <a href="http://dev.mysql.com">MySQL</a> 作 FULL TABLE SCAN。</li>
<li>使用 LIKE 時，避免把 % 放在字串開頭，以免 INDEX 利用率不佳。
<pre class="brush: sql;">-- 下列這種語法無法利用 INDEX
SELECT ... WHERE `col` LIKE '%string%';

-- 下列這種語法會利用 INDEX
SELECT ... WHERE `col` LIKE 'string%';</pre>
</li>
<li>注意 WHERE 子句內的運算式。
<pre class="brush: sql;">-- 下列這種語法會使用 INDEX，速度快。
SELECT ... WHERE `col` &lt; 100 / 10;

-- 下列這種語法會導致 FULL TABLE SCAN，速度慢。
SELECT ... WHERE `col` * 10 &lt; 100;</pre>
</li>
</ul>
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2010/03/08/768/" title="[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要">[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2009/05/29/609/" title="網頁系統的使用者驗證與 MySQL 的 &#8220;SELECT &#8230; LIMIT m,n&#8221;">網頁系統的使用者驗證與 MySQL 的 &#8220;SELECT &#8230; LIMIT m,n&#8221;</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2008/09/03/304/" title="FreeBSD i386 與 amd64 platform 的差異">FreeBSD i386 與 amd64 platform 的差異</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2008/08/30/301/" title="謹慎使用 MySQL 的 InnoDB storage engine&#8230;">謹慎使用 MySQL 的 InnoDB storage engine&#8230;</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2008/03/19/282/" title="用 MySQL 處理時間資料所應該注意的事">用 MySQL 處理時間資料所應該注意的事</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/BLOB' rel='tag' target='_self'>BLOB</a>, <a class='technorati-link' href='http://technorati.com/tag/CHAR' rel='tag' target='_self'>CHAR</a>, <a class='technorati-link' href='http://technorati.com/tag/ENUM' rel='tag' target='_self'>ENUM</a>, <a class='technorati-link' href='http://technorati.com/tag/EXPLAIN' rel='tag' target='_self'>EXPLAIN</a>, <a class='technorati-link' href='http://technorati.com/tag/INDEX' rel='tag' target='_self'>INDEX</a>, <a class='technorati-link' href='http://technorati.com/tag/MyISAM' rel='tag' target='_self'>MyISAM</a>, <a class='technorati-link' href='http://technorati.com/tag/MySQL' rel='tag' target='_self'>MySQL</a>, <a class='technorati-link' href='http://technorati.com/tag/NOT+NULL' rel='tag' target='_self'>NOT NULL</a>, <a class='technorati-link' href='http://technorati.com/tag/performance' rel='tag' target='_self'>performance</a>, <a class='technorati-link' href='http://technorati.com/tag/TEXT' rel='tag' target='_self'>TEXT</a>, <a class='technorati-link' href='http://technorati.com/tag/VARCHAR' rel='tag' target='_self'>VARCHAR</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/AWE_W5H8uryqFRnDue4smstICZo/0/da"><img src="http://feedads.g.doubleclick.net/~a/AWE_W5H8uryqFRnDue4smstICZo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/AWE_W5H8uryqFRnDue4smstICZo/1/da"><img src="http://feedads.g.doubleclick.net/~a/AWE_W5H8uryqFRnDue4smstICZo/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2009/11/20/705/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2009/11/20/705/</feedburner:origLink></item>
		<item>
		<title>[小軟體] 備份 putty 的設定 - puttyBackup</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/QycCPhLkWck/</link>
		<comments>http://www.joehorn.idv.tw/archives/2009/10/11/701/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 10:02:27 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Computer Software]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[putty]]></category>
		<category><![CDATA[registry]]></category>
		<category><![CDATA[Windows Form]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=701</guid>
		<description><![CDATA[這是我的第一個 C# Windows Form 程式。
執行畫面：

使用方法：

點選 Browse 按鈕，選擇並輸入 reg 檔存放位置與檔名。
點選 Backup 按鈕就能將 putty 的登錄檔輸出。

下載：

							
							
								puttyBackup
							Downloads: 170 File Size: 0.0 KB 
						
Related posts:

[C#] 取得 wav 檔案格式
在 Visual Studio 2008 設定 Windows Form 的圖示
資料同步與備份
換 ssh client&#8230;




Technorati Tags: backup, C#, putty, registry, Windows Form


]]></description>
			<content:encoded><![CDATA[<p>這是我的第一個 C# Windows Form 程式。</p>
<p>執行畫面：<br />
<a href="http://www.joehorn.idv.tw/upload/2009/10/2009-10-11-17-53-24.png" rel="lightbox" title="puttyBackup"><img src="http://www.joehorn.idv.tw/upload/2009/10/2009-10-11-17-53-24.png" alt="puttyBackup" width="400" /></a></p>
<p>使用方法：</p>
<ol>
<li>點選 <strong>Browse</strong> 按鈕，選擇並輸入 reg 檔存放位置與檔名。</li>
<li>點選 <strong>Backup</strong> 按鈕就能將 putty 的登錄檔輸出。</li>
</ol>
<p>下載：<br />
<div class='download-link'>
							<a href='http://www.joehorn.idv.tw/download.php?file=http://www.joehorn.idv.tw/upload/puttyBackup.exe'><img alt='Download' class='leftalign' src='http://www.joehorn.idv.tw/wp-content/plugins/dBeautifier/icons/downloads.png' /></a>
							<h4>
								<a href='http://www.joehorn.idv.tw/download.php?file=http://www.joehorn.idv.tw/upload/puttyBackup.exe'>puttyBackup</a>
							</h4><p>Downloads: 170 File Size: 0.0 KB </p>
						</div><br />
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2010/01/04/729/" title="[C#] 取得 wav 檔案格式">[C#] 取得 wav 檔案格式</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2009/10/08/698/" title="在 Visual Studio 2008 設定 Windows Form 的圖示">在 Visual Studio 2008 設定 Windows Form 的圖示</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2008/07/05/287/" title="資料同步與備份">資料同步與備份</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/05/02/140/" title="換 ssh client&#8230;">換 ssh client&#8230;</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/backup' rel='tag' target='_self'>backup</a>, <a class='technorati-link' href='http://technorati.com/tag/C%23' rel='tag' target='_self'>C#</a>, <a class='technorati-link' href='http://technorati.com/tag/putty' rel='tag' target='_self'>putty</a>, <a class='technorati-link' href='http://technorati.com/tag/registry' rel='tag' target='_self'>registry</a>, <a class='technorati-link' href='http://technorati.com/tag/Windows+Form' rel='tag' target='_self'>Windows Form</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/bidScavZVNW_7Yy0iCbY5mOsBG8/0/da"><img src="http://feedads.g.doubleclick.net/~a/bidScavZVNW_7Yy0iCbY5mOsBG8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/bidScavZVNW_7Yy0iCbY5mOsBG8/1/da"><img src="http://feedads.g.doubleclick.net/~a/bidScavZVNW_7Yy0iCbY5mOsBG8/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2009/10/11/701/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2009/10/11/701/</feedburner:origLink></item>
		<item>
		<title>在 Visual Studio 2008 設定 Windows Form 的圖示</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/vdz-cmUwVOI/</link>
		<comments>http://www.joehorn.idv.tw/archives/2009/10/08/698/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 21:31:04 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[icon]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Windows Form]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=698</guid>
		<description><![CDATA[最近在玩 C#，寫個小軟體。
不過，我發現我產生出來的 exe 檔就是很醜，看起來的感覺就好像是病毒檔...  
用 MSDN 跟上網搜尋，solution 也不算好找，所以寫這篇順便幫自己紀錄一下。
Windows Form 有兩種圖示可以設定：

Form 的圖示：只要在 Form 的屬性中，更改 Icon 屬性的 Value 就好，設定的圖示會顯示在執行的視窗的左上角。
Application 的圖示：在 Visual Studio 2008 中，最上方工具列的 專案 -> [專案名稱]屬性，開啟的分頁中的 應用程式 有個 圖示與資訊清單 項目。在此便可設定軟體圖示。

By the way，我覺得目前寫這個小軟體應該還算實用，寫完後再丟上來～  
Related posts:

[小軟體] 備份 putty 的設定 &#8211; puttyBackup




Technorati Tags: icon, Visual Studio, Windows Form


]]></description>
			<content:encoded><![CDATA[<p>最近在玩 C#，寫個小軟體。<br />
不過，我發現我產生出來的 exe 檔就是很醜，看起來的感覺就好像是病毒檔...  <img src='http://www.joehorn.idv.tw/wp-includes/images/smilies/joehorn/my_embarrassed.png' alt=':oops:' class='wp-smiley' /><br />
用 MSDN 跟上網搜尋，solution 也不算好找，所以寫這篇順便幫自己紀錄一下。</p>
<p>Windows Form 有兩種圖示可以設定：</p>
<ul>
<li>Form 的圖示：只要在 Form 的屬性中，更改 Icon 屬性的 Value 就好，設定的圖示會顯示在執行的視窗的左上角。</li>
<li>Application 的圖示：在 Visual Studio 2008 中，最上方工具列的 <strong>專案</strong> -> <strong>[專案名稱]屬性</strong>，開啟的分頁中的 <strong>應用程式</strong> 有個 <strong>圖示與資訊清單</strong> 項目。在此便可設定軟體圖示。</li>
</ul>
<p>By the way，我覺得目前寫這個小軟體應該還算實用，寫完後再丟上來～  <img src='http://www.joehorn.idv.tw/wp-includes/images/smilies/joehorn/my_cool.png' alt='8)' class='wp-smiley' /><br />
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2009/10/11/701/" title="[小軟體] 備份 putty 的設定 &#8211; puttyBackup">[小軟體] 備份 putty 的設定 &#8211; puttyBackup</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/icon' rel='tag' target='_self'>icon</a>, <a class='technorati-link' href='http://technorati.com/tag/Visual+Studio' rel='tag' target='_self'>Visual Studio</a>, <a class='technorati-link' href='http://technorati.com/tag/Windows+Form' rel='tag' target='_self'>Windows Form</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/oJK6tagZvQMJcBEwdAa0ck6-xFM/0/da"><img src="http://feedads.g.doubleclick.net/~a/oJK6tagZvQMJcBEwdAa0ck6-xFM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/oJK6tagZvQMJcBEwdAa0ck6-xFM/1/da"><img src="http://feedads.g.doubleclick.net/~a/oJK6tagZvQMJcBEwdAa0ck6-xFM/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2009/10/08/698/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2009/10/08/698/</feedburner:origLink></item>
		<item>
		<title>[分享] 謹慎使用 Smarty 樣板的 {include} ...</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/YTNCS3SwSmA/</link>
		<comments>http://www.joehorn.idv.tw/archives/2009/09/27/641/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 18:37:08 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[include]]></category>
		<category><![CDATA[Smarty]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=641</guid>
		<description><![CDATA[以下是在 PTT 的 PHP 板看到某篇文章後的心得，以及小小的經驗分享。
對 Smarty 稍有經驗的人，應該都知道樣板內可使用 {include} 這個 tag 來嵌入其他 template file。
然而，因為 Smarty 內的變數都是全域變數，所以我對這個 tag 的看法是「能不用，就不用」。
用常見的網站論壇系統舉個簡單的例子：

A 設計師負責開發顯示 HTML header 的 template，使用了 $title 變數作為 page title，ex：
&#60;html&#62;&#60;head&#62;&#60;title&#62;$title&#60;/title&#62;&#60;/head&#62;

B 設計師負責開發顯示論壇文章內容的 template，恰巧也使用了 $title 作為文章標題。

若 B 設計師在其 template file 中使用了 {include} 來嵌入 A 設計師的 template file，就可能會產生預期之外的顯示結果。
當然，若是開發團隊已事先溝通好各項變數的命名，就不會有這種情況。
但為了減少此類風險，降低 debug 的難度，我們會選擇使用這種方式：

在系統全域共用的函式檔案中增加負責顯示 HTML header 的 function，例如 function page_header($title) { ...} ，並在 function 中 assign [...]]]></description>
			<content:encoded><![CDATA[<p>以下是在 <a href="telnet://ptt.cc">PTT</a> 的 PHP 板看到某篇文章後的心得，以及小小的經驗分享。</p>
<p>對 <a href="http://www.smarty.net/" title="Smarty : Template Engine" target="_blank">Smarty</a> 稍有經驗的人，應該都知道樣板內可使用 <a href="http://www.smarty.net/manual/en/language.function.include.php" target="_blank">{include}</a> 這個 tag 來嵌入其他 template file。<br />
然而，因為 <strong>Smarty 內的變數都是全域變數</strong>，所以我對這個 tag 的看法是「能不用，就不用」。</p>
<p>用常見的網站論壇系統舉個簡單的例子：</p>
<ul>
<li>A 設計師負責開發顯示 HTML header 的 template，使用了 $title 變數作為 page title，ex：
<pre class="brush: php;">&lt;html&gt;&lt;head&gt;&lt;title&gt;$title&lt;/title&gt;&lt;/head&gt;</pre>
</li>
<li>B 設計師負責開發顯示論壇文章內容的 template，恰巧也使用了 $title 作為文章標題。</li>
</ul>
<p>若 B 設計師在其 template file 中使用了 <a href="http://www.smarty.net/manual/en/language.function.include.php" target="_blank">{include}</a> 來嵌入 A 設計師的 template file，就可能會產生預期之外的顯示結果。</p>
<p>當然，若是開發團隊已事先溝通好各項變數的命名，就不會有這種情況。<br />
但為了減少此類風險，降低 debug 的難度，我們會選擇使用這種方式：</p>
<ul>
<li>在系統全域共用的函式檔案中增加負責顯示 HTML header 的 function，例如 function page_header($title) { ...} ，並在 function 中 assign 變數，引入 A 設計師開發的 template file。</li>
<li>在論壇文章內容顯示的程式檔中，呼叫 page_header($title)，再 assign 文章標題的變數，引入 B 設計師開發的 template file。</li>
</ul>
<p>當然，若嵌入的 template file 內沒有任何變數，就不須考量以上的狀況，開發/設計人員可以大膽地隨意使用。 <img src='http://www.joehorn.idv.tw/wp-includes/images/smilies/joehorn/my_cool.png' alt='8)' class='wp-smiley' /><br />
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2009/12/10/718/" title="輕鬆設定 PHP 的專案變數">輕鬆設定 PHP 的專案變數</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2010/03/08/768/" title="[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要">[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2009/09/09/634/" title="中文界面圖形驗證碼的新選擇 &#8211; reCAPTCHA">中文界面圖形驗證碼的新選擇 &#8211; reCAPTCHA</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2007/11/10/249/" title="等待 reCAPTCHA 的多國語言支援">等待 reCAPTCHA 的多國語言支援</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2006/06/11/227/" title="phpBB 2.0.20 and CPG 1.4.6 work fine on PHP 4.4.2 !">phpBB 2.0.20 and CPG 1.4.6 work fine on PHP 4.4.2 !</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/include' rel='tag' target='_self'>include</a>, <a class='technorati-link' href='http://technorati.com/tag/PHP' rel='tag' target='_self'>PHP</a>, <a class='technorati-link' href='http://technorati.com/tag/Smarty' rel='tag' target='_self'>Smarty</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/4A_TQlL98iQc59fYhQBhpu5sHdc/0/da"><img src="http://feedads.g.doubleclick.net/~a/4A_TQlL98iQc59fYhQBhpu5sHdc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/4A_TQlL98iQc59fYhQBhpu5sHdc/1/da"><img src="http://feedads.g.doubleclick.net/~a/4A_TQlL98iQc59fYhQBhpu5sHdc/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2009/09/27/641/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2009/09/27/641/</feedburner:origLink></item>
		<item>
		<title>中文界面圖形驗證碼的新選擇 - reCAPTCHA</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/VMrJAvBhctw/</link>
		<comments>http://www.joehorn.idv.tw/archives/2009/09/09/634/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 04:51:05 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[CAPTCHA]]></category>
		<category><![CDATA[il8n]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[reCAPTCHA]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=634</guid>
		<description><![CDATA[昨晚，有個學長透過 MSN 問我有無簡單好用的 PHP 圖形驗證碼，又讓我想到 reCAPTCHA。
上一次使用時，reCAPTCHA 僅提供顏色變更；如今，reCAPTCHA 已經開始支援多國語言了。
剛才稍微玩了一下，寫了這個簡單的網頁。
reCAPTCHA 的多國語言化相關資訊可以參考 這裡，而我使用的中文化程式碼片段為：
&#60;script type=&#34;text/javascript&#34;&#62;
	var RecaptchaOptions = {
		custom_translations : {
			visual_challenge : &#34;取得圖形驗證碼&#34;,
			audio_challenge : &#34;取得音效驗證碼&#34;,
			refresh_btn : &#34;重新整理圖形&#34;,
			instructions_visual : &#34;輸入兩個英文單字:&#34;,
			instructions_audio : &#34;輸入您聽到的聲音:&#34;,
			help_btn : &#34;獲得協助&#34;,
			play_again : &#34;重新播放音效&#34;,
			cant_hear_this : &#34;將音效下載為 MP3&#34;,
			incorrect_try_again : &#34;錯誤！ 請再試一次&#34;
		}
	};
&#60;/script&#62;
Related posts:

等待 reCAPTCHA 的多國語言支援
[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要
輕鬆設定 PHP 的專案變數
[分享] 謹慎使用 Smarty 樣板的 {include} &#8230;
phpBB 2.0.20 and CPG 1.4.6 [...]]]></description>
			<content:encoded><![CDATA[<p>昨晚，有個學長透過 MSN 問我有無簡單好用的 PHP 圖形驗證碼，又讓我想到 <a href="http://recaptcha.net/" title="reCAPTCHA: Stop Spam, Read Books" target="_blank">reCAPTCHA</a>。<br />
<a href="http://www.joehorn.idv.tw/archives/2007/11/10/249/" title="等待 reCAPTCHA 的多國語言支援" target="blank">上一次使用</a>時，<a href="http://recaptcha.net/" title="reCAPTCHA: Stop Spam, Read Books" target="_blank">reCAPTCHA</a> 僅提供<a href="http://wiki.recaptcha.net/index.php/How_to_change_reCAPTCHA_colors" title="How to change reCAPTCHA colors" target="_blank">顏色變更</a>；如今，<a href="http://recaptcha.net/" title="reCAPTCHA: Stop Spam, Read Books" target="_blank">reCAPTCHA</a> 已經開始支援多國語言了。</p>
<p>剛才稍微玩了一下，寫了<a href="http://captcha.joehorn.idv.tw/" title="中文  reCAPTCHA 測試">這個簡單的網頁</a>。<br />
<a href="http://recaptcha.net/" title="reCAPTCHA: Stop Spam, Read Books" target="_blank">reCAPTCHA</a> 的多國語言化相關資訊可以參考 <a href="http://wiki.recaptcha.net/index.php/I18n">這裡</a>，而我使用的中文化程式碼片段為：</p>
<pre class="brush: jscript;">&lt;script type=&quot;text/javascript&quot;&gt;
	var RecaptchaOptions = {
		custom_translations : {
			visual_challenge : &quot;取得圖形驗證碼&quot;,
			audio_challenge : &quot;取得音效驗證碼&quot;,
			refresh_btn : &quot;重新整理圖形&quot;,
			instructions_visual : &quot;輸入兩個英文單字:&quot;,
			instructions_audio : &quot;輸入您聽到的聲音:&quot;,
			help_btn : &quot;獲得協助&quot;,
			play_again : &quot;重新播放音效&quot;,
			cant_hear_this : &quot;將音效下載為 MP3&quot;,
			incorrect_try_again : &quot;錯誤！ 請再試一次&quot;
		}
	};
&lt;/script&gt;</pre>
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2007/11/10/249/" title="等待 reCAPTCHA 的多國語言支援">等待 reCAPTCHA 的多國語言支援</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2010/03/08/768/" title="[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要">[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2009/12/10/718/" title="輕鬆設定 PHP 的專案變數">輕鬆設定 PHP 的專案變數</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2009/09/27/641/" title="[分享] 謹慎使用 Smarty 樣板的 {include} &#8230;">[分享] 謹慎使用 Smarty 樣板的 {include} &#8230;</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2006/06/11/227/" title="phpBB 2.0.20 and CPG 1.4.6 work fine on PHP 4.4.2 !">phpBB 2.0.20 and CPG 1.4.6 work fine on PHP 4.4.2 !</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/CAPTCHA' rel='tag' target='_self'>CAPTCHA</a>, <a class='technorati-link' href='http://technorati.com/tag/il8n' rel='tag' target='_self'>il8n</a>, <a class='technorati-link' href='http://technorati.com/tag/localization' rel='tag' target='_self'>localization</a>, <a class='technorati-link' href='http://technorati.com/tag/PHP' rel='tag' target='_self'>PHP</a>, <a class='technorati-link' href='http://technorati.com/tag/reCAPTCHA' rel='tag' target='_self'>reCAPTCHA</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/H2Nx24qCXXdNp4FDIw3WwROtdB4/0/da"><img src="http://feedads.g.doubleclick.net/~a/H2Nx24qCXXdNp4FDIw3WwROtdB4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/H2Nx24qCXXdNp4FDIw3WwROtdB4/1/da"><img src="http://feedads.g.doubleclick.net/~a/H2Nx24qCXXdNp4FDIw3WwROtdB4/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2009/09/09/634/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2009/09/09/634/</feedburner:origLink></item>
		<item>
		<title>開啟 Aptana 的 upload current file on save</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/4VWeVSUCREE/</link>
		<comments>http://www.joehorn.idv.tw/archives/2009/09/04/631/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 09:01:48 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[Computer Software]]></category>
		<category><![CDATA[Programing]]></category>
		<category><![CDATA[Aptana]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=631</guid>
		<description><![CDATA[以往我撰寫 PHP 的兩個工具是 vim 跟 jEdit（vim 比較常用）。
當時會選 jEdit 是因為 jEdit 提供了 FTP 遠端存取的功能，更改或新增的程式檔可以自動上傳到遠端主機。
昨天在 PTT 的 PHP 板看到有人提到 Aptana Studio，今天想到就抓來玩看看。
令我驚豔的是，Aptana Studio 也提供了遠端存取的功能，包括 FTP、FTPS、SFTP，以及各種版本控制系統。
不過，試了一下之後，發現它沒有辦法自動讓更改或新增的程式檔上傳到遠端主機，只能儲存後，再手動作 upload。
在網路上搜尋解決方法後，我卻發現工具列上的 Scripts -> Synchronize -> Upload Current File On Save 是壞掉的。  
在即將放棄使用 Aptana Studio 時，我發現了 這個討論串，而且也順利解決自動上傳的問題。
討論串的內容有點亂，所以把解法整理在這邊，順便幫自己留個備份（以免以後又要找解法）：

在 Aptana Studio 安裝的資料夾找出 upload_current_file_on_save.js 這個檔案，並編輯它。
在 header 的部份補上這兩行：
Listener: commandService().addExecutionListener(this);
Key: M1+S
補完之後的 header 大概像這樣：
/* Listener: commandService().addExecutionListener(this);
 * Currently an [...]]]></description>
			<content:encoded><![CDATA[<p>以往我撰寫 PHP 的兩個工具是 <a href="http://www.vim.org/" target="_blank">vim</a> 跟 <a href="http://www.jedit.org/" target="_blank">jEdit</a>（<a href="http://www.vim.org/" target="_blank">vim</a> 比較常用）。<br />
當時會選 <a href="http://www.jedit.org/" target="_blank">jEdit</a> 是因為 <a href="http://www.jedit.org/" target="_blank">jEdit</a> 提供了 FTP 遠端存取的功能，更改或新增的程式檔可以自動上傳到遠端主機。<br />
昨天在 <a href="telnet://ptt.cc">PTT</a> 的 PHP 板看到有人提到 <a href="http://aptana.com/" target="_blank">Aptana Studio</a>，今天想到就抓來玩看看。</p>
<p>令我驚豔的是，<a href="http://aptana.com/" target="_blank">Aptana Studio</a> 也提供了遠端存取的功能，包括 FTP、FTPS、SFTP，以及各種版本控制系統。<br />
不過，試了一下之後，發現它沒有辦法自動讓更改或新增的程式檔上傳到遠端主機，只能儲存後，再手動作 upload。<br />
在網路上搜尋解決方法後，我卻發現工具列上的 Scripts -> Synchronize -> Upload Current File On Save 是壞掉的。 <img src='http://www.joehorn.idv.tw/wp-includes/images/smilies/joehorn/my_ball.jpg' alt='=_=|||' class='wp-smiley' /> </p>
<p>在即將放棄使用 <a href="http://aptana.com/" target="_blank">Aptana Studio</a> 時，我發現了 <a href="http://forums.aptana.com/viewtopic.php?p=9298">這個討論串</a>，而且也順利解決自動上傳的問題。<br />
討論串的內容有點亂，所以把解法整理在這邊，順便幫自己留個備份（以免以後又要找解法）：</p>
<ol>
<li>在 <a href="http://aptana.com/" target="_blank">Aptana Studio</a> 安裝的資料夾找出 upload_current_file_on_save.js 這個檔案，並編輯它。</li>
<li>在 header 的部份補上這兩行：
<pre class="brush: jscript;">Listener: commandService().addExecutionListener(this);</pre>
<pre class="brush: jscript;">Key: M1+S</pre>
<p>補完之後的 header 大概像這樣：</p>
<pre class="brush: jscript;">/* Listener: commandService().addExecutionListener(this);
 * Currently an example script (disabled)&gt; Copy as your own script, and modify
 * the Listener command as shown below
 *
 * Menu: Synchronize &gt; Upload Current File On Save
 * Key: M1+S
 * Kudos: Ingo Muschenetz
 * License: EPL 1.0
 * DOM: http://localhost/com.aptana.ide.syncing.doms
 * DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.eclipsemonkey.lang.javascript
 */</pre>
</li>
<li>在檔案最後面補上這段：
<pre class="brush: jscript;">function main() {
   sync.uploadCurrentEditor();
}</pre>
</li>
<li>存檔並重新執行 <a href="http://aptana.com/" target="_blank">Aptana Studio</a>。</li>
</ol>
<p>之後只要按下 Ctrl + s 儲存檔案，該檔案就會自動上傳到遠端主機囉。 <img src='http://www.joehorn.idv.tw/wp-includes/images/smilies/joehorn/my_jejeje.jpg' alt=':evil:' class='wp-smiley' /><br />
<h3>Random posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2005/09/21/199/" title="Google 的免費圖片管理軟體 &#8211; Picasa !">Google 的免費圖片管理軟體 &#8211; Picasa !</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/05/17/155/" title="P4 的 HT 出包了!? O_O">P4 的 HT 出包了!? O_O</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/06/19/171/" title="Microsoft 研發出新的 P2P 架構!">Microsoft 研發出新的 P2P 架構!</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/04/02/99/" title="IE 跟 Outlook 的新漏洞..O_O">IE 跟 Outlook 的新漏洞..O_O</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/12/31/216/" title="全家便利商店的發票兌換商品服務..">全家便利商店的發票兌換商品服務..</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Aptana' rel='tag' target='_self'>Aptana</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/QmE-mUVu87GsQg6dN65ZIYl8JA4/0/da"><img src="http://feedads.g.doubleclick.net/~a/QmE-mUVu87GsQg6dN65ZIYl8JA4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/QmE-mUVu87GsQg6dN65ZIYl8JA4/1/da"><img src="http://feedads.g.doubleclick.net/~a/QmE-mUVu87GsQg6dN65ZIYl8JA4/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2009/09/04/631/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2009/09/04/631/</feedburner:origLink></item>
		<item>
		<title>網頁系統的使用者驗證與 MySQL 的 "SELECT ... LIMIT m,n"</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/htA_5NpfbjA/</link>
		<comments>http://www.joehorn.idv.tw/archives/2009/05/29/609/#comments</comments>
		<pubDate>Thu, 28 May 2009 17:44:34 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=609</guid>
		<description><![CDATA[幾個小時前，PTT 的 Database 板 又有人問到 MySQL 的 "SELECT ... LIMIT m,n" 相關問題。
其實，在大多數的網頁系統中，"SELECT ... LIMIT m,n" 應該是一定要用的語法，尤其是在使用者驗證時。
簡單舉例，MySQL 的 "SELECT ..." 語法運作可說是拿著籃子去裝東西，若以 LIMIT 語法限制籃子裝東西的數量，MySQL 會在籃子裝滿後就停止動作，並傳回結果。
在網頁系統中，因為使用者帳號都是獨立的，所以，進行使用者登入驗證時，只需要抓出一筆資料來進行比對。
因此，在網頁系統中，我時常用這種語法來進行使用者登入的驗證：
SELECT `使用者身份` FROM `users` WHERE `username`='使用者名稱' AND `password`='雜湊後的密碼' LIMIT 1;
如果找不到資料，代表使用者的帳號/密碼錯誤。
而直接把密碼加入 WHERE 子句，不挑出來用程式比對則是為了杜絕 SQL Injection 導致的密碼外洩。 
另外，這樣作也不錯：
SELECT `使用者身份` FROM `users` WHERE `username`='使用者名稱' AND `password`=PASSWORD( '雜湊前或雜湊後的密碼' ) LIMIT 1;
 
Related posts:

一些增進 MySQL 效能的 tips
[MySQL] Primary [...]]]></description>
			<content:encoded><![CDATA[<p>幾個小時前，<a href="http://www.ptt.cc/" title="批踢踢實業坊" target="_blank">PTT</a> 的 <a href="http://www.ptt.cc/bbs/Database/index.html" target="_blank">Database 板</a> 又有人問到 <a href="http://dev.mysql.com" title="MySQL" target="_blank">MySQL</a> 的 "SELECT ... LIMIT m,n" 相關問題。<br />
其實，在大多數的網頁系統中，"SELECT ... LIMIT m,n" 應該是<strong>一定要用</strong>的語法，尤其是在使用者驗證時。</p>
<p>簡單舉例，<a href="http://dev.mysql.com" title="MySQL" target="_blank">MySQL</a> 的 "SELECT ..." 語法運作可說是拿著籃子去裝東西，若以 LIMIT 語法限制籃子裝東西的數量，<a href="http://dev.mysql.com" title="MySQL" target="_blank">MySQL</a> 會在籃子裝滿後就停止動作，並傳回結果。<br />
在網頁系統中，因為使用者帳號都是獨立的，所以，進行使用者登入驗證時，只需要抓出一筆資料來進行比對。</p>
<p>因此，在網頁系統中，我時常用這種語法來進行使用者登入的驗證：</p>
<pre class="brush: sql;">SELECT `使用者身份` FROM `users` WHERE `username`='使用者名稱' AND `password`='雜湊後的密碼' LIMIT 1;</pre>
<p>如果找不到資料，代表使用者的帳號/密碼錯誤。<br />
而直接把密碼加入 WHERE 子句，不挑出來用程式比對則是為了杜絕 SQL Injection 導致的密碼外洩。 </p>
<p>另外，這樣作也不錯：</p>
<pre class="brush: sql;">SELECT `使用者身份` FROM `users` WHERE `username`='使用者名稱' AND `password`=PASSWORD( '雜湊前或雜湊後的密碼' ) LIMIT 1;</pre>
<p> <img src='http://www.joehorn.idv.tw/wp-includes/images/smilies/joehorn/my_cool.png' alt=':cool:' class='wp-smiley' /><br />
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2009/11/20/705/" title="一些增進 MySQL 效能的 tips">一些增進 MySQL 效能的 tips</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2010/03/08/768/" title="[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要">[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2008/09/03/304/" title="FreeBSD i386 與 amd64 platform 的差異">FreeBSD i386 與 amd64 platform 的差異</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2008/08/30/301/" title="謹慎使用 MySQL 的 InnoDB storage engine&#8230;">謹慎使用 MySQL 的 InnoDB storage engine&#8230;</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2008/03/19/282/" title="用 MySQL 處理時間資料所應該注意的事">用 MySQL 處理時間資料所應該注意的事</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/MySQL' rel='tag' target='_self'>MySQL</a>, <a class='technorati-link' href='http://technorati.com/tag/performance' rel='tag' target='_self'>performance</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/fNn6dYVKaq8CyNZpB8r5NqjrxfY/0/da"><img src="http://feedads.g.doubleclick.net/~a/fNn6dYVKaq8CyNZpB8r5NqjrxfY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/fNn6dYVKaq8CyNZpB8r5NqjrxfY/1/da"><img src="http://feedads.g.doubleclick.net/~a/fNn6dYVKaq8CyNZpB8r5NqjrxfY/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2009/05/29/609/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2009/05/29/609/</feedburner:origLink></item>
		<item>
		<title>WD3200BEVE 還蠻凶悍的嘛～</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/m4bL9Ry57DU/</link>
		<comments>http://www.joehorn.idv.tw/archives/2009/05/27/605/#comments</comments>
		<pubDate>Wed, 27 May 2009 14:36:55 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[Computer Hardware]]></category>
		<category><![CDATA[HDD]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=605</guid>
		<description><![CDATA[前陣子覺得手上這台 laptop 效能不好，用了一些軟體檢查了一下，發現硬碟效能頗低。
於是，買了一顆 WD3200BEVE 來換。
剛才心血來潮，用轉換線把舊的那顆 ST98832A 跟新的 WD3200BEVE 裝到 desktop 做測試。

ST98832A：

WD3200BEVE：


平平都是 PATA、5400 rpm 的 2.5" HDD，WD3200BEVE 還蠻凶悍的嘛～ 
Related posts:

2007 年 8 月至 11 月中旬購買 Maxtor 硬碟的人當心囉～
SATA 2.5 !!
IBM Deskstar 75GXP 用戶真悲苦..
硬碟檢測軟體 &#8211; HD Tune




Technorati Tags: HDD


]]></description>
			<content:encoded><![CDATA[<p>前陣子覺得手上這台 laptop 效能不好，用了一些軟體檢查了一下，發現硬碟效能頗低。<br />
於是，買了一顆 WD3200BEVE 來換。</p>
<p>剛才心血來潮，用轉換線把舊的那顆 ST98832A 跟新的 WD3200BEVE 裝到 desktop 做測試。</p>
<ul>
<li>ST98832A：<br />
<a href="http://www.joehorn.idv.tw/upload/2009/05/st98823a.jpg" rel="lightbox" title="ST98832A"><img src="http://www.joehorn.idv.tw/upload/2009/05/st98823a.jpg" alt="ST98832A" title="ST98832A" width="400" class="alignnone size-full wp-image-606" /></a></li>
<li>WD3200BEVE：<br />
<a href="http://www.joehorn.idv.tw/upload/2009/05/wd3200beve.jpg" rel="lightbox" title="WD3200BEVE"><img src="http://www.joehorn.idv.tw/upload/2009/05/wd3200beve.jpg" alt="WD3200BEVE"  width="400" class="alignnone size-full wp-image-607" /></a></li>
</ul>
<p>平平都是 PATA、5400 rpm 的 2.5" HDD，WD3200BEVE 還蠻凶悍的嘛～ <img src='http://www.joehorn.idv.tw/wp-includes/images/smilies/joehorn/my_neutral.png' alt=':neutral:' class='wp-smiley' /><br />
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2007/11/12/250/" title="2007 年 8 月至 11 月中旬購買 Maxtor 硬碟的人當心囉～">2007 年 8 月至 11 月中旬購買 Maxtor 硬碟的人當心囉～</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/10/13/203/" title="SATA 2.5 !!">SATA 2.5 !!</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/06/30/177/" title="IBM Deskstar 75GXP 用戶真悲苦..">IBM Deskstar 75GXP 用戶真悲苦..</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/04/25/133/" title="硬碟檢測軟體 &#8211; HD Tune">硬碟檢測軟體 &#8211; HD Tune</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/HDD' rel='tag' target='_self'>HDD</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/mU_dnRTjW9nC0t8gs5L10C_yBbU/0/da"><img src="http://feedads.g.doubleclick.net/~a/mU_dnRTjW9nC0t8gs5L10C_yBbU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/mU_dnRTjW9nC0t8gs5L10C_yBbU/1/da"><img src="http://feedads.g.doubleclick.net/~a/mU_dnRTjW9nC0t8gs5L10C_yBbU/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2009/05/27/605/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2009/05/27/605/</feedburner:origLink></item>
		<item>
		<title>好用的小軟體 - Process Explorer 與 Magic Process</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/vc25ZDifNgg/</link>
		<comments>http://www.joehorn.idv.tw/archives/2009/03/08/590/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 04:13:00 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[Computer Software]]></category>
		<category><![CDATA[Magic Process]]></category>
		<category><![CDATA[Process Explorer]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=590</guid>
		<description><![CDATA[Magic Process 是我用了好一段時間，也覺得蠻好用的軟體。
跟 Windows 內建的工作管理員比較起來，Magic Process 可以讓我們知道目前執行的程式，其程式檔案位於何處，類似這樣：

簡而言之，透過 Magic Process 可以檢查執行中程式是否為木馬或病毒（因為程式所在路徑不同）。
然而，最近發現我的 Firefox 瘋狂地佔用 CPU 資源，Magic Process 似乎不夠用，所以在網路上找了一些資料來查原因。
Microsoft TechNet 的 Process Explorer 也可以顯示出目前執行中的程式所在路徑。

而且，Process Explorer 的 process properties 可以顯示出執行中的程式的各個 thread 詳細資料。
類似 Firefox 瘋狂地佔用 CPU 資源這種問題，使用Process Explorer 更容易找出原因。

Random posts:

phpBB 2.0.20 and CPG 1.4.6 work fine on PHP 4.4.2 !
Microsoft 對 Longhorn 的效能背書
Office 12 將支援輸出 PDF 格式文件
Gmail invitation
新竹好店 &#8211; 大海拉麵




Technorati [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://holanet.pixnet.net/blog/post/350073">Magic Process</a> 是我用了好一段時間，也覺得蠻好用的軟體。<br />
跟 Windows 內建的工作管理員比較起來，<a href="http://holanet.pixnet.net/blog/post/350073">Magic Process</a> 可以讓我們知道目前執行的程式，其程式檔案位於何處，類似這樣：<br />
<a href="http://www.joehorn.idv.tw/upload/2009/03/magic-process.gif" title="Magic Process" rel="lightbox"><img src="http://www.joehorn.idv.tw/upload/2009/03/magic-process.gif" alt="Magic Process" title="Magic Process" width="400" class="alignnone size-full wp-image-591" /></a><br />
簡而言之，透過 <a href="http://holanet.pixnet.net/blog/post/350073">Magic Process</a> 可以檢查執行中程式是否為木馬或病毒（因為程式所在路徑不同）。</p>
<p>然而，最近發現我的 <a href="http://www.moztw.org/firefox/" target="_blank" title="Mozilla Firefox 中文版">Firefox</a> 瘋狂地佔用 CPU 資源，<a href="http://holanet.pixnet.net/blog/post/350073">Magic Process</a> 似乎不夠用，所以在網路上找了一些資料來查原因。</p>
<p><a href="http://technet.microsoft.com/en-us/default.aspx">Microsoft TechNet</a> 的 <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx">Process Explorer</a> 也可以顯示出目前執行中的程式所在路徑。<br />
<a href="http://www.joehorn.idv.tw/upload/2009/03/process-explorer-1.gif" alt="Process Explorer" title="Process Explorer" rel="lightbox"><img src="http://www.joehorn.idv.tw/upload/2009/03/process-explorer-1.gif" alt="Process Explorer" title="Process Explorer" width="400" class="alignnone size-full wp-image-594" /></a><br />
而且，<a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx">Process Explorer</a> 的 process properties 可以顯示出執行中的程式的各個 thread 詳細資料。<br />
類似 <a href="http://www.moztw.org/firefox/" target="_blank" title="Mozilla Firefox 中文版">Firefox</a> 瘋狂地佔用 CPU 資源這種問題，使用<a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx">Process Explorer</a> 更容易找出原因。<br />
<a href="http://www.joehorn.idv.tw/upload/2009/03/process-explorer-process-properties.gif" title="Process Explorer-process properties" rel="lightbox"><img src="http://www.joehorn.idv.tw/upload/2009/03/process-explorer-process-properties.gif" alt="Process Explorer-process properties" title="Process Explorer-process properties" width="400" class="alignnone size-full wp-image-595" /></a><br />
<h3>Random posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2005/04/12/111/" title="Itanium 版的 Longhorn !? O_O">Itanium 版的 Longhorn !? O_O</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/10/05/201/" title="Office 12 將支援輸出 PDF 格式文件">Office 12 將支援輸出 PDF 格式文件</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/05/24/162/" title="Blog 軟體效能測試">Blog 軟體效能測試</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2007/12/08/259/" title="Yahoo 客服回信&#8230;">Yahoo 客服回信&#8230;</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2005/04/13/113/" title="Blogger.com 爛掉!? XD">Blogger.com 爛掉!? <img src='http://www.joehorn.idv.tw/wp-includes/images/smilies/joehorn/my_XD.gif' alt='XD' class='wp-smiley' /> </a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Magic+Process' rel='tag' target='_self'>Magic Process</a>, <a class='technorati-link' href='http://technorati.com/tag/Process+Explorer' rel='tag' target='_self'>Process Explorer</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/dNcKvfH-ozQLTN3hxXJdymPqXAs/0/da"><img src="http://feedads.g.doubleclick.net/~a/dNcKvfH-ozQLTN3hxXJdymPqXAs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/dNcKvfH-ozQLTN3hxXJdymPqXAs/1/da"><img src="http://feedads.g.doubleclick.net/~a/dNcKvfH-ozQLTN3hxXJdymPqXAs/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2009/03/08/590/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2009/03/08/590/</feedburner:origLink></item>
		<item>
		<title>FreeBSD i386 與 amd64 platform 的差異</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/HQEuioh8uN4/</link>
		<comments>http://www.joehorn.idv.tw/archives/2008/09/03/304/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 12:52:00 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[amd64]]></category>
		<category><![CDATA[i386]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=304</guid>
		<description><![CDATA[除了已知的效能差異（以前用 Ubench 測過的，gaod 長輩也貢獻了一些資訊，都 紀錄在這）、預設支援的記憶體容量之外，這兩天又找出另外一項。
某台機器跑 FreeBSD i386 platform，搭配 PAE 與 SMP。
根據以往的經驗，這種記憶體容量超過 4G 的機器，我會選 amd64 platform。
（至少經手過的幾台機器到現在都很健康...）
近來這台機器的 MySQL daemon process 時常會掛掉...
追蹤 error log 之後，發現這種錯誤訊息：
Out of memory (Needed 16391 bytes)
我把錯誤訊息丟上 Google 後，才發現 FreeBSD i386 platform 版本，其預設之單 process 記憶體容量限制為 512 MB，而 MySQL daemon process 使用超過 512 MB 後就會噴出上述的錯誤訊息，接著就是嗝屁...  
我沒碰過這種瓶頸，似乎是 amd64 platform 沒有這種限制。
i386 platform 遭遇到這種瓶頸的解法是在 /boot/loader.conf 裡面丟進類似這三行：
kern.maxdsiz="2G"
kern.dfldsiz="2G"
kern.maxssiz="256M"
（拉高單 process 的記憶體容量限制，變為 [...]]]></description>
			<content:encoded><![CDATA[<p>除了已知的效能差異（以前用 <a href="http://www.phystech.com/download/ubench.html" target="_blank">Ubench</a> 測過的，gaod 長輩也貢獻了一些資訊，都 <a href="http://wiki.leobbs.net/index.php/Ubench" title="Ubench 紀錄" target="_blank">紀錄在這</a>）、預設支援的記憶體容量之外，這兩天又找出另外一項。</p>
<p>某台機器跑 <a href="http://www.freebsd.org" target="_blank">FreeBSD</a> i386 platform，搭配 <a href="http://en.wikipedia.org/wiki/Physical_Address_Extension" title="Physical Address Extension" target="_blank">PAE</a> 與 <a href="http://en.wikipedia.org/wiki/Symmetric_multiprocessing" title="Symmetric multiprocessing" target="_blank">SMP</a>。<br />
根據以往的經驗，這種記憶體容量超過 4G 的機器，我會選 amd64 platform。<br />
（至少經手過的幾台機器到現在都很健康...）</p>
<p>近來這台機器的 <a href="http://dev.mysql.com" target="_blank">MySQL</a> daemon process 時常會掛掉...<br />
追蹤 error log 之後，發現這種錯誤訊息：</p>
<blockquote><p>Out of memory (Needed 16391 bytes)</p></blockquote>
<p>我把錯誤訊息丟上 <a href="http://www.google.com.tw" title="" target="_blank">Google</a> 後，才發現 <a href="http://www.freebsd.org" target="_blank">FreeBSD</a> i386 platform 版本，其預設之單 process 記憶體容量限制為 512 MB，而 <a href="http://dev.mysql.com" target="_blank">MySQL</a> daemon process 使用超過 512 MB 後就會噴出上述的錯誤訊息，接著就是嗝屁... <img src='http://www.joehorn.idv.tw/wp-includes/images/smilies/joehorn/my_suprise.gif' alt='(!!)' class='wp-smiley' /> </p>
<p>我沒碰過這種瓶頸，似乎是 amd64 platform 沒有這種限制。<br />
i386 platform 遭遇到這種瓶頸的解法是在 /boot/loader.conf 裡面丟進類似這三行：</p>
<blockquote><p>kern.maxdsiz="2G"<br />
kern.dfldsiz="2G"<br />
kern.maxssiz="256M"</p></blockquote>
<p>（拉高單 process 的記憶體容量限制，變為 2G）<br />
然後 reboot，準備驗收成果...<br />
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2010/03/08/768/" title="[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要">[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2010/03/02/759/" title="[筆記] 最近製作/修改 FreeBSD ports 的一些心得">[筆記] 最近製作/修改 FreeBSD ports 的一些心得</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2010/01/08/738/" title="FreeBSD-SA-10:02.ntpd">FreeBSD-SA-10:02.ntpd</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2009/11/20/705/" title="一些增進 MySQL 效能的 tips">一些增進 MySQL 效能的 tips</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2009/05/29/609/" title="網頁系統的使用者驗證與 MySQL 的 &#8220;SELECT &#8230; LIMIT m,n&#8221;">網頁系統的使用者驗證與 MySQL 的 &#8220;SELECT &#8230; LIMIT m,n&#8221;</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/amd64' rel='tag' target='_self'>amd64</a>, <a class='technorati-link' href='http://technorati.com/tag/FreeBSD' rel='tag' target='_self'>FreeBSD</a>, <a class='technorati-link' href='http://technorati.com/tag/i386' rel='tag' target='_self'>i386</a>, <a class='technorati-link' href='http://technorati.com/tag/MySQL' rel='tag' target='_self'>MySQL</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/tq4LUDFdBMhhLK79f5Viqf4O-v0/0/da"><img src="http://feedads.g.doubleclick.net/~a/tq4LUDFdBMhhLK79f5Viqf4O-v0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/tq4LUDFdBMhhLK79f5Viqf4O-v0/1/da"><img src="http://feedads.g.doubleclick.net/~a/tq4LUDFdBMhhLK79f5Viqf4O-v0/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2008/09/03/304/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2008/09/03/304/</feedburner:origLink></item>
		<item>
		<title>謹慎使用 MySQL 的 InnoDB storage engine...</title>
		<link>http://feedproxy.google.com/~r/JoeHorn-rss2/~3/jhU5-lQGflw/</link>
		<comments>http://www.joehorn.idv.tw/archives/2008/08/30/301/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 19:05:20 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[InnoDB]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/?p=301</guid>
		<description><![CDATA[幾個月前，我幫人家建置了一套網頁系統，用以觀察網站瀏覽趨勢。
想當然爾，這種系統勢必會對資料庫產生大量 INSERT 或 UPDATE 的 query，而且會保留大量歷史性資料。
為了使系統能快速存取後端資料庫，我將存放 raw data 資料表的 storage engine 設定為 InnoDB。
（因為 InnoDB 支援了 row lock。   ）
並搭配定時執行的 script 整理資料，進行統計，並存放在 MyISAM 格式的資料表中。
最近，這套系統的後端資料庫伺服器，mysqld 三不五時會自行 restart，系統狀態也看似正常（根據他們的說法）。
追蹤後，發現 InnoDB 的運作狀態被忽略了...
光是其中一塊放置 raw data 的資料表就存放了三百多萬筆資料，佔用了 3xx MB 的空間，可是 innodb_buffer_pool_size 只有 256 MB，連 mysqldump 都無法完全撈出這塊資料表的內容...
追查程式後，發現原本用以刪除過期 raw data 的那些程式碼片段都被註解掉..   
這段故事給我們幾個啟示：

InnoDB 拿來放 raw data 真的不錯，但是要定時整理，否則維護難度會提高...
沒事別雞婆，胡亂更改人家的設計...  

Related posts:

[MySQL] Primary Key、UNIQUE、INDEX [...]]]></description>
			<content:encoded><![CDATA[<p>幾個月前，我幫人家建置了一套網頁系統，用以觀察網站瀏覽趨勢。<br />
想當然爾，這種系統勢必會對資料庫產生大量 INSERT 或 UPDATE 的 query，而且會保留大量歷史性資料。</p>
<p>為了使系統能快速存取後端資料庫，我將存放 raw data 資料表的 storage engine 設定為 InnoDB。<br />
（因為 <a href="http://www.innodb.com/" target="_blank">InnoDB</a> 支援了 row lock。 <img src='http://www.joehorn.idv.tw/wp-includes/images/smilies/joehorn/my_embarrassed.png' alt=':oops:' class='wp-smiley' />  ）<br />
並搭配定時執行的 script 整理資料，進行統計，並存放在 MyISAM 格式的資料表中。</p>
<p>最近，這套系統的後端資料庫伺服器，mysqld 三不五時會自行 restart，系統狀態也看似正常（根據他們的說法）。<br />
追蹤後，發現 <a href="http://www.innodb.com/" target="_blank">InnoDB</a> 的運作狀態被忽略了...</p>
<p>光是其中一塊放置 raw data 的資料表就存放了三百多萬筆資料，佔用了 3xx MB 的空間，可是 innodb_buffer_pool_size 只有 256 MB，連 mysqldump 都無法完全撈出這塊資料表的內容...<br />
追查程式後，發現原本用以刪除過期 raw data 的那些程式碼片段都被註解掉..  <img src='http://www.joehorn.idv.tw/wp-includes/images/smilies/joehorn/my_ball.jpg' alt='=_=|||' class='wp-smiley' /> </p>
<p>這段故事給我們幾個啟示：</p>
<ul>
<li><a href="http://www.innodb.com/" target="_blank">InnoDB</a> 拿來放 raw data 真的不錯，但是要定時整理，否則維護難度會提高...</li>
<li>沒事別雞婆，胡亂更改人家的設計... <img src='http://www.joehorn.idv.tw/wp-includes/images/smilies/joehorn/my_XD.gif' alt='XD' class='wp-smiley' /> </li>
</ul>
<h3>Related posts:</h3>
<ul class="related_post">
<li><a href="http://www.joehorn.idv.tw/archives/2010/03/08/768/" title="[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要">[MySQL] Primary Key、UNIQUE、INDEX 與 LIMIT 有多重要</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2009/11/20/705/" title="一些增進 MySQL 效能的 tips">一些增進 MySQL 效能的 tips</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2009/05/29/609/" title="網頁系統的使用者驗證與 MySQL 的 &#8220;SELECT &#8230; LIMIT m,n&#8221;">網頁系統的使用者驗證與 MySQL 的 &#8220;SELECT &#8230; LIMIT m,n&#8221;</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2008/09/03/304/" title="FreeBSD i386 與 amd64 platform 的差異">FreeBSD i386 與 amd64 platform 的差異</a></li>
<li><a href="http://www.joehorn.idv.tw/archives/2008/03/19/282/" title="用 MySQL 處理時間資料所應該注意的事">用 MySQL 處理時間資料所應該注意的事</a></li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/InnoDB' rel='tag' target='_self'>InnoDB</a>, <a class='technorati-link' href='http://technorati.com/tag/MySQL' rel='tag' target='_self'>MySQL</a></p>

<!-- end wp-tags-to-technorati -->

<p><a href="http://feedads.g.doubleclick.net/~a/euFyViczYbeqGB__aIgTD5JI6Eo/0/da"><img src="http://feedads.g.doubleclick.net/~a/euFyViczYbeqGB__aIgTD5JI6Eo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/euFyViczYbeqGB__aIgTD5JI6Eo/1/da"><img src="http://feedads.g.doubleclick.net/~a/euFyViczYbeqGB__aIgTD5JI6Eo/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2008/08/30/301/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.joehorn.idv.tw/archives/2008/08/30/301/</feedburner:origLink></item>
	</channel>
</rss>
