<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.11" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Real-Blog</title>
	<link>http://www.real-blog.com</link>
	<description>關於 PHP, Linux, Open Source 及個人生活記載的網誌。</description>
	<pubDate>Thu, 30 Apr 2009 07:53:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.11</generator>
	<language>en</language>
			<item>
		<title>PHPExcel 及 PHPPowerPoint</title>
		<link>http://www.real-blog.com/programming/541</link>
		<comments>http://www.real-blog.com/programming/541#comments</comments>
		<pubDate>Thu, 30 Apr 2009 07:53:03 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>程式設計分享</category>

		<guid isPermaLink="false">http://www.real-blog.com/programming/541</guid>
		<description><![CDATA[在網上找到兩個實用的 php class，分別是 PHPExcel 及 PHPPowerPoint。它們分別可以很簡單地透過 PHP 讀取及寫入 Excel 2007 及 PowerPoint 2007 的檔案。

]]></description>
			<content:encoded><![CDATA[<p>在網上找到兩個實用的 php class，分別是 <a href="http://www.phpexcel.net/" title="PHPExcel" target="_blank">PHPExcel</a> 及 <a href="http://www.phppowerpoint.net/" title="PHPPowerPoint" target="_blank">PHPPowerPoint</a>。它們分別可以很簡單地透過 PHP 讀取及寫入 Excel 2007 及 PowerPoint 2007 的檔案。
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/programming/541/feed/</wfw:commentRss>
		</item>
		<item>
		<title>影婚紗相</title>
		<link>http://www.real-blog.com/my-life/540</link>
		<comments>http://www.real-blog.com/my-life/540#comments</comments>
		<pubDate>Fri, 17 Apr 2009 01:10:27 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>生活隨筆</category>

		<guid isPermaLink="false">http://www.real-blog.com/my-life/540</guid>
		<description><![CDATA[剛過去的星期三去了影婚紗相，由早上 8:00 到婚紗攝影公司化妝、set 頭及換衫 (這段時間我主要是等)，一直到晚上 8:00 才回去落妝。
我開始時已經知道影足一日相會很累，也實際是比我預期更累，而裡面只有從一個景點到另一個景點途中可以休息一下，午飯及晚飯也在車上食飽算數。雖然過程時辛苦，但看到女朋友化好妝，穿起婚紗及晚裝真的很漂亮，這就覺得一切也值得了。下星期可以睇相，希望出來的效果會好看。

]]></description>
			<content:encoded><![CDATA[<p>剛過去的星期三去了影婚紗相，由早上 8:00 到婚紗攝影公司化妝、set 頭及換衫 (這段時間我主要是等)，一直到晚上 8:00 才回去落妝。</p>
<p>我開始時已經知道影足一日相會很累，也實際是比我預期更累，而裡面只有從一個景點到另一個景點途中可以休息一下，午飯及晚飯也在車上食飽算數。雖然過程時辛苦，但看到女朋友化好妝，穿起婚紗及晚裝真的很漂亮，這就覺得一切也值得了。下星期可以睇相，希望出來的效果會好看。
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/my-life/540/feed/</wfw:commentRss>
		</item>
		<item>
		<title>修改 IIS 上傳限制</title>
		<link>http://www.real-blog.com/programming/539</link>
		<comments>http://www.real-blog.com/programming/539#comments</comments>
		<pubDate>Thu, 26 Mar 2009 03:23:20 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>程式設計分享</category>

		<guid isPermaLink="false">http://www.real-blog.com/programming/539</guid>
		<description><![CDATA[IIS 預設上傳限制為 200kb，要修改這個限制，方法如下：
1. 開啟 Internet Information Services Manager (IIS)。 (中文版好像叫 IIS 管理員)
2. 在 server 上面 right click 及選擇 Properties
3. 選取 &#34;Enable Direct Metabase Edit&#34; 並按 OK
4. 開啟 Notepad，開啟以下檔案
%Windows dir%\System 32\Inetsrv\MetaBase.xml
5. 找出字串 AspMaxRequestEntityAllowed，預設是 204800，即 200kb，例如想改為 5mb 的話，應改為：
預設為 AspMaxRequestEntityAllowed = &#34;52428800&#34;
6. 完成後儲存 MetaBase.xml 便完成，不須要重新啟動 IIS。
7. 回到 Internet Information Services Manager (IIS)，移除 &#34;Enable Direct Metabase Edit&#34; 的選項。

]]></description>
			<content:encoded><![CDATA[<p>IIS 預設上傳限制為 200kb，要修改這個限制，方法如下：</p>
<p>1. 開啟 Internet Information Services Manager (IIS)。 (中文版好像叫 IIS 管理員)</p>
<p>2. 在 server 上面 right click 及選擇 Properties</p>
<p>3. 選取 &quot;Enable Direct Metabase Edit&quot; 並按 OK</p>
<p>4. 開啟 Notepad，開啟以下檔案</p>
<p>%Windows dir%\System 32\Inetsrv\MetaBase.xml</p>
<p>5. 找出字串 AspMaxRequestEntityAllowed，預設是 204800，即 200kb，例如想改為 5mb 的話，應改為：</p>
<p>預設為 AspMaxRequestEntityAllowed = &quot;52428800&quot;</p>
<p>6. 完成後儲存 MetaBase.xml 便完成，不須要重新啟動 IIS。</p>
<p>7. 回到 Internet Information Services Manager (IIS)，移除 &quot;Enable Direct Metabase Edit&quot; 的選項。
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/programming/539/feed/</wfw:commentRss>
		</item>
		<item>
		<title>編寫只給特定用戶執行的 shell script</title>
		<link>http://www.real-blog.com/linux-bsd-notes/538</link>
		<comments>http://www.real-blog.com/linux-bsd-notes/538#comments</comments>
		<pubDate>Tue, 17 Mar 2009 07:15:33 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>Linux / BSD 筆記</category>

		<category>程式設計分享</category>

		<guid isPermaLink="false">http://www.real-blog.com/linux-bsd-notes/538</guid>
		<description><![CDATA[在編寫了一些 shell script 並打算只給予特定用戶執行，可以先取得用戶的 user id，或者直接用 whoami 指令檢查使用者名稱，例如：

if [ $(whoami) = &#34;samtang&#34; ]
then
 &#160;&#160; # 執行程式碼
else
 &#160;&#160; echo &#34;You cannot run this script.&#34;
 &#160;&#160; exit 0
fi

如果在另一個情況下，不容許特定用戶執行，可以這樣寫：

if [ $(whoami) = &#34;root&#34; ]
then
 &#160;&#160; echo &#34;You cannot run this script.&#34;
 &#160;&#160; exit 1
fi

]]></description>
			<content:encoded><![CDATA[<p>在編寫了一些 shell script 並打算只給予特定用戶執行，可以先取得用戶的 user id，或者直接用 whoami 指令檢查使用者名稱，例如：</p>
<div class="shell">
if [ $(whoami) = &quot;samtang&quot; ]<br />
then<br />
 &nbsp;&nbsp; # 執行程式碼<br />
else<br />
 &nbsp;&nbsp; echo &quot;You cannot run this script.&quot;<br />
 &nbsp;&nbsp; exit 0<br />
fi
</div>
<p>如果在另一個情況下，不容許特定用戶執行，可以這樣寫：</p>
<div class="shell">
if [ $(whoami) = &quot;root&quot; ]<br />
then<br />
 &nbsp;&nbsp; echo &quot;You cannot run this script.&quot;<br />
 &nbsp;&nbsp; exit 1<br />
fi
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/linux-bsd-notes/538/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Sylpheed 電郵軟件</title>
		<link>http://www.real-blog.com/software/537</link>
		<comments>http://www.real-blog.com/software/537#comments</comments>
		<pubDate>Thu, 12 Mar 2009 03:00:11 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>實用軟件推薦</category>

		<guid isPermaLink="false">http://www.real-blog.com/software/537</guid>
		<description><![CDATA[Sylpheed 是一個建基於 GTK+ 的開源電郵軟件，支援 Windows 及 Unix Like 環境，特別之處是耗用系統資源十分少，及執行起來十分快速。雖然佔用資料少，但功能可是十分豐富。
以前使用 Becky! Internet Mail 已經有好幾年，也十分滿意它的效能，可是 Becky! 不支援 Windows 以外的作業系統，自從幾個月前轉用 Ubuntu 後便沒有用了。剛開始用 Ubuntu 時，用過 Evolution 及 Thunderbird，可是就是不喜歡它們的執行速度，一直也覺得不順手。
上星期找到 Sylpheed 這款電郵軟件，用了一個星期後覺得很有 Becky! 的味道，操作完全沒有不習慣的感覺，執行速度快速，尤其是搜索功能覺得比 Becky! 更快。如果是像我一樣著重電郵軟件的速度，而且郵箱內的郵件數目很多，那麼 Sylpheed 是一個很好的選擇。
至於將箱件從 Thunderbird 匯入 Sylpheed 也很簡單，以下是在 Ubuntu 的安裝及匯入方法：
1. 在終端機上面，轉到以下目錄:
cd ~/.mozilla-thunderbird/*.default/Mail/Local\ Folders
裡面會有 Thunderbird 的郵件目錄檔案，將要匯入的目錄檔案複製到家目錄，例如:
cp Inbox ~/
2. 輸入以下指令透過 apt-get 安裝 Sylpheed:
sudo apt-get install sylpheed
3. 然後到 &#34;Applications&#34; -&#62; [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sylpheed.sraoss.jp/en/" title="Sylpheed" target="_blank">Sylpheed</a> 是一個建基於 GTK+ 的開源電郵軟件，支援 Windows 及 Unix Like 環境，特別之處是耗用系統資源十分少，及執行起來十分快速。雖然佔用資料少，但功能可是十分豐富。</p>
<p>以前使用 <a href="http://www.rimarts.co.jp/becky.htm" title="Becky! Internet Mail" target="_blank">Becky! Internet Mail</a> 已經有好幾年，也十分滿意它的效能，可是 Becky! 不支援 Windows 以外的作業系統，自從幾個月前轉用 Ubuntu 後便沒有用了。剛開始用 Ubuntu 時，用過 Evolution 及 Thunderbird，可是就是不喜歡它們的執行速度，一直也覺得不順手。</p>
<p>上星期找到 <a href="http://sylpheed.sraoss.jp/en/" title="Sylpheed" target="_blank">Sylpheed</a> 這款電郵軟件，用了一個星期後覺得很有 Becky! 的味道，操作完全沒有不習慣的感覺，執行速度快速，尤其是搜索功能覺得比 Becky! 更快。如果是像我一樣著重電郵軟件的速度，而且郵箱內的郵件數目很多，那麼 <a href="http://sylpheed.sraoss.jp/en/" title="Sylpheed" target="_blank">Sylpheed</a> 是一個很好的選擇。</p>
<p>至於將箱件從 Thunderbird 匯入 <a href="http://sylpheed.sraoss.jp/en/" title="Sylpheed" target="_blank">Sylpheed</a> 也很簡單，以下是在 Ubuntu 的安裝及匯入方法：</p>
<p>1. 在終端機上面，轉到以下目錄:</p>
<p>cd ~/.mozilla-thunderbird/*.default/Mail/Local\ Folders</p>
<p>裡面會有 Thunderbird 的郵件目錄檔案，將要匯入的目錄檔案複製到家目錄，例如:</p>
<p>cp Inbox ~/</p>
<p>2. 輸入以下指令透過 apt-get 安裝 Sylpheed:</p>
<p>sudo apt-get install sylpheed</p>
<p>3. 然後到 &quot;Applications&quot; -&gt; &quot;Internet&quot; 開啟 Sylpheed，並設定好郵箱的登入資料。</p>
<p>4. 選擇 &quot;File&quot; -&gt; &quot;Import mbox file&quot;</p>
<p>5. 在 &quot;Importing files&quot; 選擇剛複製出來的郵件檔。
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/software/537/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Apache 防止 DDoS 攻擊</title>
		<link>http://www.real-blog.com/linux-bsd-notes/536</link>
		<comments>http://www.real-blog.com/linux-bsd-notes/536#comments</comments>
		<pubDate>Wed, 04 Mar 2009 09:15:35 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>Linux / BSD 筆記</category>

		<guid isPermaLink="false">http://www.real-blog.com/linux-bsd-notes/536</guid>
		<description><![CDATA[DDoS (distributed denial-of-service) 及 DoS (denial-of-service) 在網路上十分常見，而 DoS 攻擊所傳送的請求跟正常的請求一樣，分別在於每秒鐘發出大量請求到伺服器，使伺服器的負載增加，最常見的情況是伺服器暫停服務。
而 mod_evasive 則是一個預防 Apache 遭受 DDos 攻擊的模組，可以防止同一個 IP 對相同 URI 發出的大量請求，可設定的選項有：
&#8211; 限制同一個 IP 在一定秒數內請求一個頁面或檔案的次數。
&#8211; 限制同一個 IP 一秒內只可發出 50 個請求。
&#8211; 設定被禁止的 IP 封鎖時間。
以下是 mod_evasive 的安裝方法：
1. 先將原來的 httpd.conf 備份起來。
2. 到 http://www.zdziarski.com/projects/mod_evasive/ 下載 mod_evasive。
3. 在指令模式解壓及編譯 mod_evasive：

tar zxvf mod_evasive_1.10.1.tar.gz
cd mod_evasive/
apxs -cia mod_evasive20.c

以上的 apxs 會放在 Apache 的 bin 目錄內；如果 Apache 版本是 1.3 [...]]]></description>
			<content:encoded><![CDATA[<p>DDoS (distributed denial-of-service) 及 DoS (denial-of-service) 在網路上十分常見，而 DoS 攻擊所傳送的請求跟正常的請求一樣，分別在於每秒鐘發出大量請求到伺服器，使伺服器的負載增加，最常見的情況是伺服器暫停服務。</p>
<p>而 mod_evasive 則是一個預防 Apache 遭受 DDos 攻擊的模組，可以防止同一個 IP 對相同 URI 發出的大量請求，可設定的選項有：</p>
<p>&#8211; 限制同一個 IP 在一定秒數內請求一個頁面或檔案的次數。<br />
&#8211; 限制同一個 IP 一秒內只可發出 50 個請求。<br />
&#8211; 設定被禁止的 IP 封鎖時間。</p>
<p>以下是 mod_evasive 的安裝方法：</p>
<p>1. 先將原來的 httpd.conf 備份起來。</p>
<p>2. 到 <a href="http://www.zdziarski.com/projects/mod_evasive/" title="mod_evasive" target="_blank">http://www.zdziarski.com/projects/mod_evasive/</a> 下載 mod_evasive。</p>
<p>3. 在指令模式解壓及編譯 mod_evasive：</p>
<div class="shell">
tar zxvf mod_evasive_1.10.1.tar.gz<br />
cd mod_evasive/<br />
apxs -cia mod_evasive20.c
</div>
<p>以上的 apxs 會放在 Apache 的 bin 目錄內；如果 Apache 版本是 1.3 的話，指令要改為：</p>
<div class="shell">
apxs -cia mod_evasive.c
</div>
<p>安裝好 mod_evasive 後，便要修改 httpd.conf 內容。</p>
<p>4. 開啟 httpd.conf，加入以內容：</p>
<p>DOSHashTableSize 3097<br />
DOSPageCount 5<br />
DOSSiteCount 100<br />
DOSPageInterval 2<br />
DOSSiteInterval 2<br />
DOSBlockingPeriod 10<br />
DOSBlockingPeriod 600</p>
<p>DOSHashTableSize &#8212; 這是佔用記憶體的大小，如果伺服器比較繁忙，這個數值要設定大一點。<br />
DOSPageCount &#8212; 同一 IP 在一個時段內可以存取同一頁面的次數，超過會被禁止。<br />
DOSSiteCount &#8212; 同一 IP 在一個網站內可以佔用多少 Object，超過會禁止。<br />
DOSPageInterval &#8212; DOSPageCount 內的時段設定。<br />
DOSSiteInterval &#8212; DOSSiteCount 的時間設定，以秒為單位。<br />
DOSBlockingPeriod &#8212; 當發現疑似攻擊後，使用者會收到 403 Forbidden，這是設定封鎖的時間，以秒為單位。</p>
<p>5. 最後重新啟動 Apache 即可。
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/linux-bsd-notes/536/feed/</wfw:commentRss>
		</item>
		<item>
		<title>提高 Apache 的 MaxClients 選項</title>
		<link>http://www.real-blog.com/linux-bsd-notes/535</link>
		<comments>http://www.real-blog.com/linux-bsd-notes/535#comments</comments>
		<pubDate>Fri, 27 Feb 2009 09:07:00 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>Linux / BSD 筆記</category>

		<guid isPermaLink="false">http://www.real-blog.com/linux-bsd-notes/535</guid>
		<description><![CDATA[如果碰到網頁伺服器突然變慢，然後網頁服務停止，在 apache 的 error log 找到以下語句：
[error] server reached MaxClients setting, consider raising the MaxClients setting
那麼就是 Apache 超過最大連線數，如果是 Apache 2.0 的話便不用重新編譯，只要開啟 httpd.conf 修改 MaxClients 選項。

StartServers 10
MinSpareServers 10
MaxSpareServers 15
MaxClients 200
MaxRequestsPerChild 10000

完成後重新啟動 Apache 即可。

]]></description>
			<content:encoded><![CDATA[<p>如果碰到網頁伺服器突然變慢，然後網頁服務停止，在 apache 的 error log 找到以下語句：</p>
<p>[error] server reached MaxClients setting, consider raising the MaxClients setting</p>
<p>那麼就是 Apache 超過最大連線數，如果是 Apache 2.0 的話便不用重新編譯，只要開啟 httpd.conf 修改 MaxClients 選項。</p>
<p><IfModule prefork.c><br />
StartServers 10<br />
MinSpareServers 10<br />
MaxSpareServers 15<br />
MaxClients 200<br />
MaxRequestsPerChild 10000<br />
</IfModule></p>
<p>完成後重新啟動 Apache 即可。
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/linux-bsd-notes/535/feed/</wfw:commentRss>
		</item>
		<item>
		<title>用 PHP 查詢 MySQL Table 使用空間</title>
		<link>http://www.real-blog.com/programming/534</link>
		<comments>http://www.real-blog.com/programming/534#comments</comments>
		<pubDate>Fri, 27 Feb 2009 08:29:08 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>程式設計分享</category>

		<guid isPermaLink="false">http://www.real-blog.com/programming/534</guid>
		<description><![CDATA[要查詢 MySQL 資料表所用的空間，雖然資料表是用 MyISAM 的話，可以直接用 ls 指令知道，但這個方法不可以用在 InnoDB 資料表上面。
要計算資料表的容量，可以供用 MySQL 語句 &#34;SHOW TABLE STATUS&#34; 實現，然後將回傳的 Data_length 加 Index_length 即可。以下程式會擷取資料庫內所有資料表的使用空間：
PLAIN TEXT
PHP:




&#60;?php


$db_link = mysql_connect&#40;"localhost", "db_username", "db_password"&#41;;


mysql_select_db&#40;"db_name", $db_link&#41;;


&#160;


$result = mysql_query&#40;"SHOW TABLE STATUS"&#41;;


while&#40;$rows = mysql_fetch_array&#40;$result&#41;&#41;&#123;


&#160; &#160; $total_size = $rows&#91;'Data_length'&#93; + $rows&#91;'Index_length'&#93;;


&#160;


&#160; &#160; // return table size by KB or MB


&#160; &#160; if&#40;$total_size &#60;1048576&#41;&#123;


&#160; &#160; &#160; &#160; $total_size = $total_size [...]]]></description>
			<content:encoded><![CDATA[<p>要查詢 MySQL 資料表所用的空間，雖然資料表是用 MyISAM 的話，可以直接用 ls 指令知道，但這個方法不可以用在 InnoDB 資料表上面。</p>
<p>要計算資料表的容量，可以供用 MySQL 語句 &quot;SHOW TABLE STATUS&quot; 實現，然後將回傳的 Data_length 加 Index_length 即可。以下程式會擷取資料庫內所有資料表的使用空間：</p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showPlainTxt('php-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$db_link</span> = <a href="http://www.php.net/mysql_connect"><span style="color:#000066;">mysql_connect</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"localhost"</span>, <span style="color:#FF0000;">"db_username"</span>, <span style="color:#FF0000;">"db_password"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mysql_select_db"><span style="color:#000066;">mysql_select_db</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"db_name"</span>, <span style="color:#0000FF;">$db_link</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$result</span> = <a href="http://www.php.net/mysql_query"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"SHOW TABLE STATUS"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">while</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$rows</span> = <a href="http://www.php.net/mysql_fetch_array"><span style="color:#000066;">mysql_fetch_array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$result</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$total_size</span> = <span style="color:#0000FF;">$rows</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'Data_length'</span><span style="color:#006600; font-weight:bold;">&#93;</span> + <span style="color:#0000FF;">$rows</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'Index_length'</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// return table size by KB or MB</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$total_size</span> &lt;<span style="color:#CC66CC;color:#800000;">1048576</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$total_size</span> = <span style="color:#0000FF;">$total_size</span> / <span style="color:#CC66CC;color:#800000;">1024</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$total_size</span> = <span style="color:#0000FF;">$total_size</span> / <span style="color:#CC66CC;color:#800000;">1024</span> / <span style="color:#CC66CC;color:#800000;">1024</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$tables</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$rows</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'Name'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <a href="http://www.php.net/sprintf"><span style="color:#000066;">sprintf</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"%.2f"</span>, <span style="color:#0000FF;">$total_size</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print_r"><span style="color:#000066;">print_r</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$tables</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/programming/534/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ubuntu 安裝 terminus 及 Fixedsys 字型</title>
		<link>http://www.real-blog.com/linux-bsd-notes/533</link>
		<comments>http://www.real-blog.com/linux-bsd-notes/533#comments</comments>
		<pubDate>Wed, 11 Feb 2009 14:11:29 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>Linux / BSD 筆記</category>

		<guid isPermaLink="false">http://www.real-blog.com/linux-bsd-notes/533</guid>
		<description><![CDATA[平日使用電腦習慣在終端機及寫程式時使用 terminus 字型，而以 plain 閱讀電郵則喜歡 Fixedsys 字型。但 Ubuntu 安裝也這兩種字型也沒有，以下是安裝以上兩種字型的方法：
安裝 terminus
在終端機打入以下指令即可：
sudo apt-get install xfonts-terminus
安裝 Fixedsys
到 fixedsys 下載 fixedsys 的 ttf 檔，解壓後將 Fixedsys500c.ttf 複製到 /usr/share/fonts/truetype/，指令如下：
sudo cp /path/Fixedsys500c.ttf /usr/share/fonts/truetype/
sudo fc-cache -f -v 
這樣就可以使用 terminus 及 Fixedsys 字型 了。

]]></description>
			<content:encoded><![CDATA[<p>平日使用電腦習慣在終端機及寫程式時使用 terminus 字型，而以 plain 閱讀電郵則喜歡 Fixedsys 字型。但 Ubuntu 安裝也這兩種字型也沒有，以下是安裝以上兩種字型的方法：</p>
<p><strong>安裝 terminus</strong><br />
在終端機打入以下指令即可：</p>
<p>sudo apt-get install xfonts-terminus</p>
<p><strong>安裝 Fixedsys</strong><br />
到 <a href="http://fixedsys.moviecorner.de/download/fixedsys500c.zip">fixedsys</a> 下載 fixedsys 的 ttf 檔，解壓後將 Fixedsys500c.ttf 複製到 /usr/share/fonts/truetype/，指令如下：</p>
<p>sudo cp /path/Fixedsys500c.ttf /usr/share/fonts/truetype/<br />
sudo fc-cache -f -v </p>
<p>這樣就可以使用 terminus 及 Fixedsys 字型 了。
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/linux-bsd-notes/533/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Linux Memory Management</title>
		<link>http://www.real-blog.com/linux-bsd-notes/532</link>
		<comments>http://www.real-blog.com/linux-bsd-notes/532#comments</comments>
		<pubDate>Wed, 28 Jan 2009 06:44:17 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>Linux / BSD 筆記</category>

		<guid isPermaLink="false">http://www.real-blog.com/linux-bsd-notes/532</guid>
		<description><![CDATA[好文推介，介紹 Linux 的記憶體管理：
Memory management is the heart of operating systems; it is crucial for both programming and system administration. In the next few posts I’ll cover memory with an eye towards practical aspects, but without shying away from internals. While the concepts are generic, examples are mostly from Linux and Windows on 32-bit x86. This [...]]]></description>
			<content:encoded><![CDATA[<p>好文推介，介紹 Linux 的記憶體管理：</p>
<blockquote><p>Memory management is the heart of operating systems; it is crucial for both programming and system administration. In the next few posts I’ll cover memory with an eye towards practical aspects, but without shying away from internals. While the concepts are generic, examples are mostly from Linux and Windows on 32-bit x86. This first post describes how programs are laid out in memory. Each process in a multi-tasking OS runs in its own memory sandbox. This sandbox is the virtual address space, which in 32-bit mode is always a 4GB block of memory addresses.</p></blockquote>
<p><a href="http://duartes.org/gustavo/blog/post/anatomy-of-a-program-in-memory" title="Anatomy of a Program in Memory" target="_blank">Anatomy of a Program in Memory</a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/linux-bsd-notes/532/feed/</wfw:commentRss>
		</item>
		<item>
		<title>重新設定 MySQL root 密碼</title>
		<link>http://www.real-blog.com/linux-bsd-notes/531</link>
		<comments>http://www.real-blog.com/linux-bsd-notes/531#comments</comments>
		<pubDate>Mon, 26 Jan 2009 04:28:36 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>Linux / BSD 筆記</category>

		<guid isPermaLink="false">http://www.real-blog.com/linux-bsd-notes/531</guid>
		<description><![CDATA[如果忘記了 MySQL 的 root 密碼，可以透過以下方法重新設定：
1. 停止 MySQL server。
# /etc/init.d/mysql stop
2. 啟動 MySQL server，並加上 --skip-grant-tables 參數，便可以略過輸入密碼的過程:
# mysqld_safe --skip-grant-tables &#038;
3. 用 root 連接到 MySQL server，輸入:
mysql -u root
4. 進入 MySQL server 後，輸入以下幾行 SQL 語句:
mysql&#62; use mysql;
mysql&#62; update user set password=PASSWORD(&#34;newpass&#34;) where User='root';
mysql&#62; flush privileges;
mysql&#62; quit
5. 重新啟動 MySQL 即可。
]]></description>
			<content:encoded><![CDATA[<p>如果忘記了 MySQL 的 root 密碼，可以透過以下方法重新設定：</p>
<p>1. 停止 MySQL server。</p>
<p># /etc/init.d/mysql stop</p>
<p>2. 啟動 MySQL server，並加上 --skip-grant-tables 參數，便可以略過輸入密碼的過程:</p>
<p># mysqld_safe --skip-grant-tables &#038;</p>
<p>3. 用 root 連接到 MySQL server，輸入:</p>
<p>mysql -u root</p>
<p>4. 進入 MySQL server 後，輸入以下幾行 SQL 語句:<br />
mysql&gt; use mysql;<br />
mysql&gt; update user set password=PASSWORD(&quot;newpass&quot;) where User='root';<br />
mysql&gt; flush privileges;<br />
mysql&gt; quit</p>
<p>5. 重新啟動 MySQL 即可。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/linux-bsd-notes/531/feed/</wfw:commentRss>
		</item>
		<item>
		<title>&#8220;==&#8221; 及 &#8220;===&#8221; 在 PHP 的分別</title>
		<link>http://www.real-blog.com/programming/530</link>
		<comments>http://www.real-blog.com/programming/530#comments</comments>
		<pubDate>Fri, 23 Jan 2009 00:38:10 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>程式設計分享</category>

		<guid isPermaLink="false">http://www.real-blog.com/programming/530</guid>
		<description><![CDATA[在 PHP 裡面，兩個比較運算式 &#34;==&#34; 及 &#34;===&#34; 的分別是，&#34;==&#34; 用作檢查變數的值是否相同；而 &#34;==&#34; 則會檢查變數的值及資料型態。
&#34;==&#34;:
PLAIN TEXT
PHP:




&#60;?php


$str_var = "123";


if&#40;$str_var == 123&#41;&#123;


&#160; &#160; echo "Yes";


&#125;else&#123;


&#160; &#160; echo "No";


&#125;


?&#62; 






以上程式碼執行結果會輸入 &#34;Yes&#34;，因為變數 $str_var 及整數 123 是相同的值，但如果改用 &#34;===&#34; 便會有不同的結果：
&#34;===&#34;
PLAIN TEXT
PHP:




&#60;?php


$str_var = "123";


if&#40;$str_var === 123&#41;&#123;


&#160; &#160; echo "Yes";


&#125;else&#123;


&#160; &#160; echo "No";


&#125;


?&#62; 






以上程式碼會輸入 &#34;No&#34;，因為雖然 $str_var 及 123 的值是相同，但兩者的資料型態不同。 (用引號包著的 &#34;123&#34; 是字串；而沒有引號的 123 則是整數)
但如果將程式碼改成以下這樣，便會輸出 &#34;Yes&#34;
PLAIN TEXT
PHP:




&#60;?php


$str_var = 123;


if&#40;$str_var [...]]]></description>
			<content:encoded><![CDATA[<p>在 PHP 裡面，兩個比較運算式 &quot;==&quot; 及 &quot;===&quot; 的分別是，&quot;==&quot; 用作檢查變數的值是否相同；而 &quot;==&quot; 則會檢查變數的值及資料型態。</p>
<p><strong>&quot;==&quot;:</strong></p>
<div class="igBar"><span id="lphp-6"><a href="#" onclick="javascript:showPlainTxt('php-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-6">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$str_var</span> = <span style="color:#FF0000;">"123"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$str_var</span> == <span style="color:#CC66CC;color:#800000;">123</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"Yes"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"No"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>以上程式碼執行結果會輸入 &quot;Yes&quot;，因為變數 $str_var 及整數 123 是相同的值，但如果改用 &quot;===&quot; 便會有不同的結果：</p>
<p><strong>&quot;===&quot;</strong></p>
<div class="igBar"><span id="lphp-7"><a href="#" onclick="javascript:showPlainTxt('php-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-7">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$str_var</span> = <span style="color:#FF0000;">"123"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$str_var</span> === <span style="color:#CC66CC;color:#800000;">123</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"Yes"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"No"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>以上程式碼會輸入 &quot;No&quot;，因為雖然 $str_var 及 123 的值是相同，但兩者的資料型態不同。 (用引號包著的 &quot;123&quot; 是字串；而沒有引號的 123 則是整數)</p>
<p>但如果將程式碼改成以下這樣，便會輸出 &quot;Yes&quot;</p>
<div class="igBar"><span id="lphp-8"><a href="#" onclick="javascript:showPlainTxt('php-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-8">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$str_var</span> = <span style="color:#CC66CC;color:#800000;">123</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$str_var</span> === <span style="color:#CC66CC;color:#800000;">123</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"Yes"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"No"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/programming/530/feed/</wfw:commentRss>
		</item>
		<item>
		<title>透過 Linux 恢復 Windows 系統管理員密碼</title>
		<link>http://www.real-blog.com/linux-bsd-notes/529</link>
		<comments>http://www.real-blog.com/linux-bsd-notes/529#comments</comments>
		<pubDate>Thu, 22 Jan 2009 06:59:14 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>Linux / BSD 筆記</category>

		<guid isPermaLink="false">http://www.real-blog.com/linux-bsd-notes/529</guid>
		<description><![CDATA[如果忘記了 Windows 的 administrator 密碼，可以透過 Linux 的 Live CD 進行恢復，而這裡會使用 Ubuntu 作為例子：
1. 使用 Ubuntu Live CD 開機
2. 安裝一個名為 "chntpw" 的程式
$ sudo apt-get install chntpw
3. 安裝 "chntpw" 後，便要將 Windows 的 NTFS 分割區掛載。
4. 進入 Windows 分割區下的 system32/config 目錄，然後輸入：
$ sudo chntpw SAM
5. 出現了一堆訊息後，系統會提示 reset 密碼，如果想設成空密碼，可以輸入星號 *，重新開機後便可以進入 Windows。
]]></description>
			<content:encoded><![CDATA[<p>如果忘記了 Windows 的 administrator 密碼，可以透過 Linux 的 Live CD 進行恢復，而這裡會使用 Ubuntu 作為例子：</p>
<p>1. 使用 Ubuntu Live CD 開機</p>
<p>2. 安裝一個名為 "chntpw" 的程式</p>
<p>$ sudo apt-get install chntpw</p>
<p>3. 安裝 "chntpw" 後，便要將 Windows 的 NTFS 分割區掛載。</p>
<p>4. 進入 Windows 分割區下的 system32/config 目錄，然後輸入：</p>
<p>$ sudo chntpw SAM</p>
<p>5. 出現了一堆訊息後，系統會提示 reset 密碼，如果想設成空密碼，可以輸入星號 *，重新開機後便可以進入 Windows。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/linux-bsd-notes/529/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ubuntu 8.10 安裝 Java</title>
		<link>http://www.real-blog.com/linux-bsd-notes/528</link>
		<comments>http://www.real-blog.com/linux-bsd-notes/528#comments</comments>
		<pubDate>Wed, 21 Jan 2009 07:45:29 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>Linux / BSD 筆記</category>

		<guid isPermaLink="false">http://www.real-blog.com/linux-bsd-notes/528</guid>
		<description><![CDATA[安裝 Ubuntu 後系統預設沒有安裝 Java，以下是安裝方法：
$ sudo apt-get install sun-java6-jre sun-java6-plugin
安裝後再設定 Firefox 成支援 java
$ sudo ln -s /usr/lib/jvm/java-6-sun-1.6.0.10/jre/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/firefox/plugins/
]]></description>
			<content:encoded><![CDATA[<p>安裝 Ubuntu 後系統預設沒有安裝 Java，以下是安裝方法：</p>
<div class="shell">$ sudo apt-get install sun-java6-jre sun-java6-plugin</div>
<p>安裝後再設定 Firefox 成支援 java</p>
<div class="shell">$ sudo ln -s /usr/lib/jvm/java-6-sun-1.6.0.10/jre/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/firefox/plugins/</div>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/linux-bsd-notes/528/feed/</wfw:commentRss>
		</item>
		<item>
		<title>只針對檔案或目錄 chmod</title>
		<link>http://www.real-blog.com/linux-bsd-notes/527</link>
		<comments>http://www.real-blog.com/linux-bsd-notes/527#comments</comments>
		<pubDate>Wed, 21 Jan 2009 02:27:27 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
		
		<category>Linux / BSD 筆記</category>

		<guid isPermaLink="false">http://www.real-blog.com/linux-bsd-notes/527</guid>
		<description><![CDATA[在 Unix Like 環境可以用 chmod 改變檔案或目錄的權限，以下方法可以只針對檔案或目錄 chmod：
1. 在當前目錄下遁迴 chmod 檔案：
find . -type f -exec chmod 0600 {} \;
2. 在當前目錄下遁迴 chmod 目錄：
find . -type d -exec chmod 0755 {} \;

]]></description>
			<content:encoded><![CDATA[<p>在 Unix Like 環境可以用 chmod 改變檔案或目錄的權限，以下方法可以只針對檔案或目錄 chmod：</p>
<p>1. 在當前目錄下遁迴 chmod 檔案：<br />
find . -type f -exec chmod 0600 {} \;</p>
<p>2. 在當前目錄下遁迴 chmod 目錄：<br />
find . -type d -exec chmod 0755 {} \;
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.real-blog.com/linux-bsd-notes/527/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
