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

<channel>
	<title>roga&#039;s blog &#187; Linux</title>
	<atom:link href="http://blog.roga.tw/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.roga.tw</link>
	<description>walk away in slow motion.</description>
	<lastBuildDate>Sat, 19 May 2012 14:26:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-beta4-20825</generator>
		<item>
		<title>Debian Linux 64bit 安裝 utserver 發生錯誤</title>
		<link>http://blog.roga.tw/2012/05/debian-linux-64bit-%e5%ae%89%e8%a3%9d-utserver-%e7%99%bc%e7%94%9f%e9%8c%af%e8%aa%a4/</link>
		<comments>http://blog.roga.tw/2012/05/debian-linux-64bit-%e5%ae%89%e8%a3%9d-utserver-%e7%99%bc%e7%94%9f%e9%8c%af%e8%aa%a4/#comments</comments>
		<pubDate>Fri, 11 May 2012 18:51:29 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2689</guid>
		<description><![CDATA[Debian Linux 64 bit 出現 utserver: error while loading shared libraries: libssl.so.0.9.8: cannot open shared object file: No such file or directory. 只要安裝 32 bit 的 lib 就可以解決了。 sudo apt-get install ia32-libs]]></description>
			<content:encoded><![CDATA[<p>Debian Linux 64 bit 出現 </p>
<blockquote><p>
utserver: error while loading shared libraries: libssl.so.0.9.8: cannot open shared object file: No such file or directory.
</p></blockquote>
<p>只要安裝 32 bit 的 lib 就可以解決了。</p>
<p><code>sudo apt-get install ia32-libs</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2012/05/debian-linux-64bit-%e5%ae%89%e8%a3%9d-utserver-%e7%99%bc%e7%94%9f%e9%8c%af%e8%aa%a4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>安裝 reiserfs 和 xfs 檔案系統支援到 Debian Linux</title>
		<link>http://blog.roga.tw/2012/05/%e5%ae%89%e8%a3%9d-reiserfs-%e5%92%8c-xfs-%e6%aa%94%e6%a1%88%e7%b3%bb%e7%b5%b1%e6%94%af%e6%8f%b4%e5%88%b0-debian-linux/</link>
		<comments>http://blog.roga.tw/2012/05/%e5%ae%89%e8%a3%9d-reiserfs-%e5%92%8c-xfs-%e6%aa%94%e6%a1%88%e7%b3%bb%e7%b5%b1%e6%94%af%e6%8f%b4%e5%88%b0-debian-linux/#comments</comments>
		<pubDate>Fri, 11 May 2012 18:21:03 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2688</guid>
		<description><![CDATA[只要分別安裝這兩個套件： xfsprogs 和 reiserfsprogs 之後重新啟動即可。]]></description>
			<content:encoded><![CDATA[<p>只要分別安裝這兩個套件： xfsprogs 和 reiserfsprogs</p>
<p>之後重新啟動即可。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2012/05/%e5%ae%89%e8%a3%9d-reiserfs-%e5%92%8c-xfs-%e6%aa%94%e6%a1%88%e7%b3%bb%e7%b5%b1%e6%94%af%e6%8f%b4%e5%88%b0-debian-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>慘案發生..</title>
		<link>http://blog.roga.tw/2012/04/%e6%85%98%e6%a1%88%e7%99%bc%e7%94%9f/</link>
		<comments>http://blog.roga.tw/2012/04/%e6%85%98%e6%a1%88%e7%99%bc%e7%94%9f/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 03:09:04 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2643</guid>
		<description><![CDATA[跑 Raid 1 的 DB Server 昨天爆了.. 先是傍晚的時候收到 pingdom 的警告信，說我的服務超過 5 分鐘沒回應，雖然擔心，但因為手邊還有很多事情在忙，等好等回家再檢查。 回家後發現不得了，原來在 17:32 的時候硬碟開始發生問題，然後到 17:53 的時候，Raid 1 其中一顆硬碟就完全離線了。 Apr 19 07:59:21 roga rsyslogd: [origin software="rsyslogd" swVersion="4.6.4" x-pid="1529" x-info="http://www.rsyslog.com"] rsyslogd was HUPed, type 'lightweight'. Apr 19 17:32:50 roga kernel: [3363378.997370] ata7.00: configured for UDMA/133 Apr 19 17:32:50 roga kernel: [3363378.997381] ata7: EH complete Apr 19 [...]]]></description>
			<content:encoded><![CDATA[<p>跑 Raid 1 的 DB Server 昨天爆了..<br />
<span id="more-2643"></span><br />
先是傍晚的時候收到 pingdom 的警告信，說我的服務超過 5 分鐘沒回應，雖然擔心，但因為手邊還有很多事情在忙，等好等回家再檢查。</p>
<p>回家後發現不得了，原來在 17:32 的時候硬碟開始發生問題，然後到 17:53 的時候，Raid 1 其中一顆硬碟就完全離線了。 </p>
<pre>
Apr 19 07:59:21 roga rsyslogd: [origin software="rsyslogd" swVersion="4.6.4" x-pid="1529" x-info="http://www.rsyslog.com"] rsyslogd was HUPed, type 'lightweight'.
Apr 19 17:32:50 roga kernel: [3363378.997370] ata7.00: configured for UDMA/133                                                                                                                                                                
Apr 19 17:32:50 roga kernel: [3363378.997381] ata7: EH complete
Apr 19 17:52:33 roga kernel: [3364562.781954] ata7: hard resetting link
Apr 19 17:52:43 roga kernel: [3364572.804525] ata7: hard resetting link
Apr 19 17:52:53 roga kernel: [3364582.836519] ata7: hard resetting link
Apr 19 17:53:04 roga kernel: [3364593.404015] ata7: link is slow to respond, please be patient (ready=0)
Apr 19 17:53:28 roga kernel: [3364617.868033] ata7: limiting SATA link speed to 1.5 Gbps
Apr 19 17:53:28 roga kernel: [3364617.868036] ata7: hard resetting link
</pre>
<p>現在看系統狀況是這樣，這組 Raid 1 只剩下另一顆硬碟在撐，不過我有不少重要的服務都跑在這上面，昨天緊急把備份的資料都先複製出來，等明天有空(週六)再來看問題到底出在哪裡&#8230;</p>
<pre>
root@roga:/home/roga # mdadm --detail /dev/md1
/dev/md1:
        Version : 1.2
  Creation Time : Fri Oct 14 11:58:20 2011
     Raid Level : raid1
     Array Size : 312567481 (298.09 GiB 320.07 GB)
  Used Dev Size : 312567481 (298.09 GiB 320.07 GB)
   Raid Devices : 2
  Total Devices : 1
    Persistence : Superblock is persistent

    Update Time : Fri Apr 20 11:00:10 2012
          State : active, degraded
 Active Devices : 1
Working Devices : 1
 Failed Devices : 0
  Spare Devices : 0

           Name : roga.tw:1  (local to host roga.tw)
           UUID : 193b7bf0:8f9e58d3:01d8f770:ab4c45f1
         Events : 141969

    Number   Major   Minor   RaidDevice State
       0       8       33        0      active sync   /dev/sdc1
       1       0        0        1      removed
</pre>
<p>唉 /dev/sdd 就這樣不見了，意味著又要花錢了。</p>
<p>這組 Raid 是在 2011/10 設好的，用了半年就掛一顆硬碟了 (運作狀況是 7x24x365) 。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2012/04/%e6%85%98%e6%a1%88%e7%99%bc%e7%94%9f/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>shell script 備份 www 目錄</title>
		<link>http://blog.roga.tw/2011/10/shell-script-%e5%82%99%e4%bb%bd-www-%e7%9b%ae%e9%8c%84/</link>
		<comments>http://blog.roga.tw/2011/10/shell-script-%e5%82%99%e4%bb%bd-www-%e7%9b%ae%e9%8c%84/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 15:42:57 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2570</guid>
		<description><![CDATA[因為上次把自己 VM 不小心刪掉又救回來的那件事情，所以開始著手計畫備份所有資料。 這隻是我寫的 Shell Script，每次執行都會把 $WWW_DIR 下面的所有目錄個別壓縮成 tgz 檔案，並且把 *.tgz 搬移到 $BACKUP_DIR 下面，然後刪掉 $BACKUP_DIR 目錄下大於一個月的備份。 目前我是放到 cron table 裡面跑，每三天會跑一次。 [crayon-4fbc4dd774c09/] 如果不想要輸出訊息，就在 crontab 裡面把輸出導向到 /dev/null 即可。]]></description>
			<content:encoded><![CDATA[<p>因為上次把自己 VM 不小心刪掉又救回來的那件事情，所以開始著手計畫備份所有資料。</p>
<p>這隻是我寫的 Shell Script，每次執行都會把 $WWW_DIR 下面的所有目錄個別壓縮成 tgz 檔案，並且把 *.tgz 搬移到 $BACKUP_DIR 下面，然後刪掉 $BACKUP_DIR 目錄下大於一個月的備份。</p>
<p>目前我是放到 cron table 裡面跑，每三天會跑一次。</p>
<p></p><pre class="crayon-plain-tag">
#!/bin/bash

date=`date +%Y-%m-%d`

BACKUP_DIR=&quot;/data/www_backup/&quot;
WWW_DIR=&quot;/var/www/&quot;
WWW_DIR_CMD=`ls $WWW_DIR`

cd $WWW_DIR

for f in $WWW_DIR_CMD;
do 
    backup_file_name=$f
    backup_file_new_name=$f-$date.tgz
    backup_cmd=&quot;tar -zcf $date-$backup_file_name.tgz $backup_file_name&quot;
    echo $backup_cmd
    `$backup_cmd`
done

mv_cmd=&quot;mv $WWW_DIR*.tgz $BACKUP_DIR&quot;
echo $mv_cmd
`$mv_cmd`

del_cmd=&quot;find $BACKUP_DIR -type f -mtime +30 -delete&quot;
echo $del_cmd
`$del_cmd`</pre><p></p>
<p>如果不想要輸出訊息，就在 crontab 裡面把輸出導向到 /dev/null 即可。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2011/10/shell-script-%e5%82%99%e4%bb%bd-www-%e7%9b%ae%e9%8c%84/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Password Authentication to Squid 3 Proxy Server</title>
		<link>http://blog.roga.tw/2011/10/add-password-authentication-to-squid-3-proxy-server/</link>
		<comments>http://blog.roga.tw/2011/10/add-password-authentication-to-squid-3-proxy-server/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 10:36:33 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2569</guid>
		<description><![CDATA[在自己的 proxy 上面加上帳號密碼認證 編輯 /etc/squid3/squid.conf 在 auth_param 區塊加入以下設定： auth_param basic program /usr/lib/squid3/ncsa_auth /etc/squid3/squid.pwd auth_param basic children 5 auth_param basic realm Squid 3 Proxy Server auth_param basic credentialsttl 2 hours acl user_def_passwords proxy_auth REQUIRED http_access allow user_def_passwords 如果 /usr/lib/squid3/ncsa_auth 找不到就 locate 一下，一般來說是這個位置。 接著用 htpasswd 設定帳號密碼：htpasswd -c /etc/squid3/squid.pwd user_name 最後重起 suqid3 /etc/init.d/squid3 restart]]></description>
			<content:encoded><![CDATA[<p>在自己的 proxy 上面加上帳號密碼認證</p>
<p>編輯 /etc/squid3/squid.conf </p>
<p>在 auth_param 區塊加入以下設定：</p>
<p><code><br />
auth_param basic program /usr/lib/squid3/ncsa_auth /etc/squid3/squid.pwd<br />
auth_param basic children 5<br />
auth_param basic realm Squid 3 Proxy Server<br />
auth_param basic credentialsttl 2 hours<br />
acl user_def_passwords proxy_auth REQUIRED<br />
http_access allow user_def_passwords<br />
</code></p>
<p>如果 /usr/lib/squid3/ncsa_auth 找不到就 locate 一下，一般來說是這個位置。</p>
<p>接著用 htpasswd 設定帳號密碼：<code>htpasswd -c /etc/squid3/squid.pwd user_name</code></p>
<p>最後重起 suqid3 <code>/etc/init.d/squid3 restart</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2011/10/add-password-authentication-to-squid-3-proxy-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>壓縮 vmdk 檔案</title>
		<link>http://blog.roga.tw/2011/10/%e5%a3%93%e7%b8%ae-vmdk-%e6%aa%94%e6%a1%88/</link>
		<comments>http://blog.roga.tw/2011/10/%e5%a3%93%e7%b8%ae-vmdk-%e6%aa%94%e6%a1%88/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 19:31:54 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2566</guid>
		<description><![CDATA[我的 BBS 是用 VMWare Player 在跑的。當初規劃的硬碟上限是 240GB ，而實際虛擬機器映像檔的大小大約在 60GB ，但在機器裡面看，卻只有使用 5.7 GB 而已。 roga@proxy:~$ df -h Filesystem Size Used Avail Use% Mounted on /dev/hda1 240G 5.7G 235G 3% / tmpfs 502M 0 502M 0% /lib/init/rw udev 10M 692K 9.4M 7% /dev tmpfs 502M 0 502M 0% /dev/shm roga@proxy:~$ 69GB 這麼大的映像檔，要備份和搬移都不是很容易，所以勢必要壓縮 (compact) 以節省 HOST 的磁碟空間，方法如下： 1. [...]]]></description>
			<content:encoded><![CDATA[<p>我的 BBS 是用 VMWare Player 在跑的。當初規劃的硬碟上限是 240GB ，而實際虛擬機器映像檔的大小大約在 60GB ，但在機器裡面看，卻只有使用 5.7 GB 而已。</p>
<blockquote>
<pre>
roga@proxy:~$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1             240G  5.7G  235G   3% /
tmpfs                 502M     0  502M   0% /lib/init/rw
udev                   10M  692K  9.4M   7% /dev
tmpfs                 502M     0  502M   0% /dev/shm
roga@proxy:~$ 
</pre>
</blockquote>
<p>69GB 這麼大的映像檔，要備份和搬移都不是很容易，所以勢必要壓縮 (compact) 以節省 HOST 的磁碟空間，方法如下：</p>
<p>1. 先刪掉 Guest OS 裡面不要的檔案，包括垃圾桶也要清掉，然後 apt-get clean 也可以執行。<br />
2. 接著在 Guest OS 裡面執行 <code>cat /dev/zero > zero.fill; sync; sleep 1; sync; rm -f zero.fill</code> 由於會跑很久，可以掛著 screen 放著。<br />
3. 用 VMWare Player 本身提供的 GUI 工具對映像檔進行壓縮。</p>
<p>p.s 在虛擬機器的設定中，選好要壓縮的硬碟，然後選 Utilities > Compact 即可。</p>
<p>壓縮完畢之後，原本大約 60GB 的 vmdk 映像檔，只剩下 9.7 GB 。</p>
<p>來源：<a href="http://www.howtoforge.com/how-to-shrink-vmware-virtual-disk-files-vmdk">How To Shrink VMware Virtual Disk Files (.vmdk)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2011/10/%e5%a3%93%e7%b8%ae-vmdk-%e6%aa%94%e6%a1%88/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>VirtualBox 存取 usb 子系統時失敗</title>
		<link>http://blog.roga.tw/2011/10/virtualbox-%e5%ad%98%e5%8f%96-usb-%e5%ad%90%e7%b3%bb%e7%b5%b1%e6%99%82%e5%a4%b1%e6%95%97/</link>
		<comments>http://blog.roga.tw/2011/10/virtualbox-%e5%ad%98%e5%8f%96-usb-%e5%ad%90%e7%b3%bb%e7%b5%b1%e6%99%82%e5%a4%b1%e6%95%97/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 19:15:44 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2565</guid>
		<description><![CDATA[在 Debian Squeeze 上面裝了 VirtualBox ，然後把舊的虛擬機器移過去，發現出現 VirtaulBox 存取子系統時失敗的錯誤。 錯誤訊息： Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND). The service might be not installed on the host computer. VirtualBox 存取 usb 子系統時失敗 然後原因是執行 VirtualBox 的使用者沒有加入到 vboxusers 這個群組裡面，只要多加進去就可以了。 來源：All about USB related Questions.]]></description>
			<content:encoded><![CDATA[<p>在 Debian Squeeze 上面裝了 VirtualBox ，然後把舊的虛擬機器移過去，發現出現 VirtaulBox 存取子系統時失敗的錯誤。</p>
<p>錯誤訊息：</p>
<p>Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND). The service might be not installed on the host computer.<br />
VirtualBox 存取 usb 子系統時失敗</p>
<p>然後原因是執行 VirtualBox 的使用者沒有加入到 vboxusers 這個群組裡面，只要多加進去就可以了。</p>
<p>來源：<a href="https://forums.virtualbox.org/viewtopic.php?t=8669">All about USB related Questions.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2011/10/virtualbox-%e5%ad%98%e5%8f%96-usb-%e5%ad%90%e7%b3%bb%e7%b5%b1%e6%99%82%e5%a4%b1%e6%95%97/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>您的登入鑰匙圈並未在登入時自動解鎖</title>
		<link>http://blog.roga.tw/2011/10/%e6%82%a8%e7%9a%84%e7%99%bb%e5%85%a5%e9%91%b0%e5%8c%99%e5%9c%88%e4%b8%a6%e6%9c%aa%e5%9c%a8%e7%99%bb%e5%85%a5%e6%99%82%e8%87%aa%e5%8b%95%e8%a7%a3%e9%8e%96/</link>
		<comments>http://blog.roga.tw/2011/10/%e6%82%a8%e7%9a%84%e7%99%bb%e5%85%a5%e9%91%b0%e5%8c%99%e5%9c%88%e4%b8%a6%e6%9c%aa%e5%9c%a8%e7%99%bb%e5%85%a5%e6%99%82%e8%87%aa%e5%8b%95%e8%a7%a3%e9%8e%96/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 19:06:52 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2563</guid>
		<description><![CDATA[剛剛裝好 Debian Squeeze ，發現啟動 Gnome 預設的遠端桌面 (VINO) 之後，在使用者連線進來時，會出現：「您的登入鑰匙圈並未在登入時自動解鎖」並且再詢問一次密碼，當輸入密碼給 keyring 記住後，重新開機卻又失效了，上網找了一下，發現有不少人遇到類似問題&#8230; 解決方法如下： 1. 先打開鑰匙圈： 系統 -> 偏好設定 -> 密碼及加密金鑰 System-> Preferences ->Passwords and Encryption Keys 2. 刪掉已存密碼： 找到 Passwords: Login 展開後裡面的 vino:5900 (類似的東西) ，然後刪掉該筆密碼之後關閉程式 3. 再輸入指令 gconf-editor 開啟 gnome 的組態編輯器， 在組態裡面找到 /desktop/gnome/remote_access 這筆記錄 然後把以後要登入 VNC 的密碼用 base64 編碼過後，存到 vnc_password 欄位裡面 當然也要確定 enabled 有啟用以及其他欄位有設定好 (組態編輯器對每個欄位都有說明作用) 再來關掉組態編輯器，然後重新啟動系統就可以了。 來源：Re: [...]]]></description>
			<content:encoded><![CDATA[<p>剛剛裝好 Debian Squeeze ，發現啟動 Gnome 預設的遠端桌面 (VINO) 之後，在使用者連線進來時，會出現：「您的登入鑰匙圈並未在登入時自動解鎖」並且再詢問一次密碼，當輸入密碼給 keyring 記住後，重新開機卻又失效了，上網找了一下，發現有不少人遇到類似問題&#8230;</p>
<p>解決方法如下：</p>
<p>1. 先打開鑰匙圈：</p>
<p>系統 -> 偏好設定 -> 密碼及加密金鑰<br />
System-> Preferences ->Passwords and Encryption Keys</p>
<p>2. 刪掉已存密碼：</p>
<p>找到 Passwords: Login 展開後裡面的 vino:5900 (類似的東西) ，然後刪掉該筆密碼之後關閉程式</p>
<p>3. 再輸入指令 gconf-editor 開啟 gnome 的組態編輯器，</p>
<p>在組態裡面找到 /desktop/gnome/remote_access 這筆記錄<br />
然後把以後要登入 VNC 的密碼用 base64 編碼過後，存到 vnc_password 欄位裡面<br />
當然也要確定 enabled 有啟用以及其他欄位有設定好 (組態編輯器對每個欄位都有說明作用) </p>
<p>再來關掉組態編輯器，然後重新啟動系統就可以了。</p>
<p>來源：<a href="http://ubuntuforums.org/showpost.php?p=10229123&#038;postcount=6">Re: Login Kerying issues with Remote Desktop</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2011/10/%e6%82%a8%e7%9a%84%e7%99%bb%e5%85%a5%e9%91%b0%e5%8c%99%e5%9c%88%e4%b8%a6%e6%9c%aa%e5%9c%a8%e7%99%bb%e5%85%a5%e6%99%82%e8%87%aa%e5%8b%95%e8%a7%a3%e9%8e%96/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DNS 轉換完成</title>
		<link>http://blog.roga.tw/2011/06/dns-%e8%bd%89%e6%8f%9b%e5%ae%8c%e6%88%90/</link>
		<comments>http://blog.roga.tw/2011/06/dns-%e8%bd%89%e6%8f%9b%e5%ae%8c%e6%88%90/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 03:07:14 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2527</guid>
		<description><![CDATA[這週抽空裝了兩台 DNS Server 起來 (裝在 VM 裡面)，順便把我的 Domain Name 都搬回來，目前看來狀況良好，但放在 VM 裡面，網卡用 Bridge 模式有點不穩，曾經發生過 VM 已經打開了，但是網路卻連不到的情形。我猜或許可能是一張網卡上面 Bridge 太多網卡的關係。 目前新的 DNS 是 ns1.roga.tw 和 ns2.roga.tw ，應付我網站的涓涓細流足矣。]]></description>
			<content:encoded><![CDATA[<p><img src="http://gallery.roga.tw/var/albums/storage/ns.png" alt="" /></p>
<p>這週抽空裝了兩台 DNS Server 起來 (裝在 VM 裡面)，順便把我的 Domain Name 都搬回來，目前看來狀況良好，但放在 VM 裡面，網卡用 Bridge 模式有點不穩，曾經發生過 VM 已經打開了，但是網路卻連不到的情形。我猜或許可能是一張網卡上面 Bridge 太多網卡的關係。</p>
<p>目前新的 DNS 是 ns1.roga.tw 和 ns2.roga.tw ，應付我網站的涓涓細流足矣。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2011/06/dns-%e8%bd%89%e6%8f%9b%e5%ae%8c%e6%88%90/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>EveryDNS 服務終止</title>
		<link>http://blog.roga.tw/2011/06/everydns-%e6%9c%8d%e5%8b%99%e7%b5%82%e6%ad%a2/</link>
		<comments>http://blog.roga.tw/2011/06/everydns-%e6%9c%8d%e5%8b%99%e7%b5%82%e6%ad%a2/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 04:42:16 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2523</guid>
		<description><![CDATA[去年一月的時候 EveryDNS 宣布被 Dyn Inc. 買下，當時我曾經說過：如果哪天要收費了，我大概就要把 DNS 拿回來自己管了。 過了一年多，果然 EveryDNS 還是走向付費這條路，我剛剛看了一下 Dyn Inc. 寄過來的資費方案，看來要收不少錢&#8230; 1. 轉換手續費 $4.95 2. 如果選 DynDNS 方案， 在轉換後的 90 日是免費期。接下來的九個月，每個 zone 會收費 $19.95 元。然後一年後，每個 zone 收費 $29.95 (年費) 。 如果只有一個 zone ，那其實這樣收費不太貴，但我有七個 zone ，意思就是將來每年得付出 $210 美金左右來給 DNS 代管服務。 由於這樣我覺得太貴了，所以我還是打算拿回來自己管 (默..) 反正我目前對所有服務的期望就是一年 95% uptime 就夠了。 接下來要做的事情，就是在 http://roga.tw 再開兩個 VM 來當 DNS Server [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://gallery.roga.tw/var/albums/storage/s.png" alt="" /><br />
<span id="more-2523"></span><br />
去年一月的時候 EveryDNS 宣布被 Dyn Inc. 買下，當時<a href="http://blog.roga.tw/2010/01/everydns-%E7%9A%84%E6%9C%AA%E4%BE%86/">我曾經說過</a>：如果哪天要收費了，我大概就要把 DNS 拿回來自己管了。</p>
<p>過了一年多，果然 EveryDNS 還是走向付費這條路，我剛剛看了一下 Dyn Inc. 寄過來的資費方案，看來要收不少錢&#8230;</p>
<p>1. 轉換手續費 $4.95</p>
<p>2. 如果選 DynDNS 方案， 在轉換後的 90 日是免費期。接下來的九個月，每個 zone 會收費 $19.95 元。然後一年後，每個 zone 收費 $29.95 (年費) 。</p>
<p>如果只有一個 zone ，那其實這樣收費不太貴，但我有七個 zone ，意思就是將來每年得付出 $210 美金左右來給 DNS 代管服務。</p>
<p>由於這樣我覺得太貴了，所以我還是打算拿回來自己管 (默..)</p>
<p>反正我目前對所有服務的期望就是一年 95% uptime 就夠了。</p>
<p>接下來要做的事情，就是在 http://roga.tw 再開兩個 VM 來當 DNS Server 了，唉，真怕機器不夠力。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2011/06/everydns-%e6%9c%8d%e5%8b%99%e7%b5%82%e6%ad%a2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Shell Script 分割字串的功能</title>
		<link>http://blog.roga.tw/2011/05/shell-script-%e5%88%86%e5%89%b2%e5%ad%97%e4%b8%b2%e7%9a%84%e5%8a%9f%e8%83%bd/</link>
		<comments>http://blog.roga.tw/2011/05/shell-script-%e5%88%86%e5%89%b2%e5%ad%97%e4%b8%b2%e7%9a%84%e5%8a%9f%e8%83%bd/#comments</comments>
		<pubDate>Wed, 18 May 2011 09:32:26 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2516</guid>
		<description><![CDATA[有時候常常需要寫一些工具來執行一些簡單的動作，這種情況我通常會用 shell script 來做。 最近遇到一個問題，有一個字串內容是以逗號(或其他字元)分隔，我想要把這個字串分割之後讀入一個陣列， 找了一下，發現 shell script 可以簡單利用 IFS (inter-field separator) 的功能來達成，只要把 delimeter assign 給 IFS 這個變數，並且 export 即可。 [crayon-4fbc4dd77c4b7/] 利用這個功能，可以很容易的把一個字串分割，並且把分割內容依序填入陣列。 印出來的結果就是 [crayon-4fbc4dd77c507/]]]></description>
			<content:encoded><![CDATA[<p>有時候常常需要寫一些工具來執行一些簡單的動作，這種情況我通常會用 shell script 來做。</p>
<p>最近遇到一個問題，有一個字串內容是以逗號(或其他字元)分隔，我想要把這個字串分割之後讀入一個陣列，</p>
<p>找了一下，發現 shell script 可以簡單利用 IFS (inter-field separator) 的功能來達成，只要把 delimeter assign 給 IFS 這個變數，並且 export 即可。</p>
<p></p><pre class="crayon-plain-tag">
#!/bin/bash                                                                                                                                                                                                     
IFS=&quot;,&quot;
export IFS;

words=&quot;Orz,OGC,Otz,O-(&quot;

for word in $words; do
    echo &quot;$word&quot;</pre><p></p>
<p>利用這個功能，可以很容易的把一個字串分割，並且把分割內容依序填入陣列。</p>
<p>印出來的結果就是</p>
<p></p><pre class="crayon-plain-tag">
roga@wifi-post-auth-client-115-247:~/test$ ./split.sh 
Orz
OGC
Otz
O-(</pre><p></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2011/05/shell-script-%e5%88%86%e5%89%b2%e5%ad%97%e4%b8%b2%e7%9a%84%e5%8a%9f%e8%83%bd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>記得補充水分 for ubuntu</title>
		<link>http://blog.roga.tw/2011/03/%e8%a8%98%e5%be%97%e8%a3%9c%e5%85%85%e6%b0%b4%e5%88%86-for-ubuntu/</link>
		<comments>http://blog.roga.tw/2011/03/%e8%a8%98%e5%be%97%e8%a3%9c%e5%85%85%e6%b0%b4%e5%88%86-for-ubuntu/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 10:16:46 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2501</guid>
		<description><![CDATA[在 gugod&#8217;s blog 看到一篇記得補充水分，覺得實在是個很棒的點子，所以寫了個 Ubuntu 版的 script 。 需要先安裝 libnotify-bin 才能執行 sudo apt-get install libnotify-bin 然後把下面這三行存成一個 shell script 檔案，然後把工作加到 cronjob 中即可。 [crayon-4fbc4dd77cde5/] 記得指定 DISPLAY=:0.0 要不然不會出現在螢幕上。 Ubuntu 版的喝水休息提醒 備註：notify 前面的圖片可以自訂，例如說： /usr/bin/notify-send -t 5000 -i /home/roga/bin/clock.png message is here.]]></description>
			<content:encoded><![CDATA[<p>在 <a href="http://gugod.org/">gugod&#8217;s blog</a> 看到一篇<a href="http://gugod.org/2010/12/post-84.html">記得補充水分</a>，覺得實在是個很棒的點子，所以寫了個 Ubuntu 版的 script 。</p>
<p>需要先安裝 libnotify-bin 才能執行<br />
<code><br />
sudo apt-get install libnotify-bin<br />
</code></p>
<p>然後把下面這三行存成一個 shell script 檔案，然後把工作加到 cronjob 中即可。</p>
<p></p><pre class="crayon-plain-tag">
#!/bin/bash
CURRENT_DATE=$(date +%H:%M)
`DISPLAY=:0.0 /usr/bin/notify-send -t 5000  &quot;現在時間 $CURRENT_DATE 該喝水，休息一下了&quot;`</pre><p></p>
<p>記得指定 <b>DISPLAY=:0.0</b> 要不然不會出現在螢幕上。</p>
<p>Ubuntu 版的喝水休息提醒<br />
<img src="http://gallery.roga.tw/var/albums/storage/Screenshot-3-2135234866.png" alt="" /></p>
<p>備註：notify 前面的圖片可以自訂，例如說：</p>
<p><code><br />
/usr/bin/notify-send -t 5000 <strong>-i /home/roga/bin/clock.png</strong> message is here.<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2011/03/%e8%a8%98%e5%be%97%e8%a3%9c%e5%85%85%e6%b0%b4%e5%88%86-for-ubuntu/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Debian 下面的 Mail Agent</title>
		<link>http://blog.roga.tw/2010/12/debian-%e4%b8%8b%e9%9d%a2%e7%9a%84-mail-agent/</link>
		<comments>http://blog.roga.tw/2010/12/debian-%e4%b8%8b%e9%9d%a2%e7%9a%84-mail-agent/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 10:57:30 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2467</guid>
		<description><![CDATA[我的 Apache2 有安裝 mod_evasive 來阻擋 DDoS 攻擊，當疑似攻擊發生時，這個 module 會 block 該訪客 IP 並且發信給使用者。 最近在清理 Error Log 的時候，發現一行訊息&#8230; sh: /bin/mail: No such file or directory 才發現我沒安裝 Mail User Agent 。 在 Debian 安裝很簡單&#8230; sudo apt-get install bsd-mailx cd /bin ln -s /usr/bin/mail mail 只要安裝好套件，建個 symbol link 即可。]]></description>
			<content:encoded><![CDATA[<p>我的 Apache2 有安裝 mod_evasive 來阻擋 DDoS 攻擊，當疑似攻擊發生時，這個 module 會 block 該訪客 IP 並且發信給使用者。</p>
<p>最近在清理 Error Log 的時候，發現一行訊息&#8230;</p>
<p><strong>sh: /bin/mail: No such file or directory</strong></p>
<p>才發現我沒安裝 Mail User Agent 。</p>
<p>在 Debian 安裝很簡單&#8230;</p>
<p><code><br />
sudo apt-get install bsd-mailx<br />
cd /bin<br />
ln -s  /usr/bin/mail mail<br />
</code></p>
<p>只要安裝好套件，建個 symbol link 即可。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/12/debian-%e4%b8%8b%e9%9d%a2%e7%9a%84-mail-agent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 下解決 Pidgin 無法登入 MSN 方法&#8230;</title>
		<link>http://blog.roga.tw/2010/11/ubuntu-%e4%b8%8b%e8%a7%a3%e6%b1%ba-pidgin-%e7%84%a1%e6%b3%95%e7%99%bb%e5%85%a5-msn-%e6%96%b9%e6%b3%95/</link>
		<comments>http://blog.roga.tw/2010/11/ubuntu-%e4%b8%8b%e8%a7%a3%e6%b1%ba-pidgin-%e7%84%a1%e6%b3%95%e7%99%bb%e5%85%a5-msn-%e6%96%b9%e6%b3%95/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 08:41:59 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2464</guid>
		<description><![CDATA[最近 Ubuntu 下面的 pidgin 連接 MSN 的功能爛掉了，原因是 omega.contacts.msn.com 的憑證有誤，大部分的人都是手動下載新的憑證，然後換掉舊的來解決問題，但這不是治標的方法，過不久這個問題還是會持續發生。 目前官方發布到 pidgin-2.7.7 ，必須升級到這個版本才能徹底解決問題。但 Ubuntu 的軟體庫裡面還沒更新 (目前是 pidgin-2.7.5，所以我只好自力救濟) 。 首先把編譯 pidgin 會用到的原始碼都裝一裝，會裝不少東西下去，但這也是沒辦法。 sudo apt-get build-dep pidgin 接著下載 pidgin-2.7.7 的原始碼到家目錄下面 Download Pidgin 2.7.7 Source 。 解壓縮 tar -xvjf pidgin-2.7.7.tar.bz2 先把 libpurple 移除，因為系統裡面是 2.7.5 。 sudo apt-get remove libpurple0 再切換到原始碼的目錄，然後把 pidgin 編譯裝好 cd ~/pidgin-2.7.7 ./configure sudo make install 接著從選單重新啟動 [...]]]></description>
			<content:encoded><![CDATA[<p>最近 Ubuntu 下面的 pidgin 連接 MSN 的功能爛掉了，原因是 omega.contacts.msn.com 的憑證有誤，大部分的人都是手動下載新的憑證，然後換掉舊的來解決問題，但這不是治標的方法，過不久這個問題還是會持續發生。</p>
<p>目前官方發布到 pidgin-2.7.7 ，必須升級到這個版本才能徹底解決問題。但 Ubuntu 的軟體庫裡面還沒更新 (目前是 pidgin-2.7.5，所以我只好自力救濟) 。</p>
<p>首先把編譯 pidgin 會用到的原始碼都裝一裝，會裝不少東西下去，但這也是沒辦法。</p>
<p><code>sudo apt-get build-dep pidgin</code></p>
<p>接著下載 pidgin-2.7.7 的原始碼到家目錄下面 <a href="http://www.pidgin.im/download/source/">Download Pidgin 2.7.7 Source </a>。</p>
<p>解壓縮</p>
<p><code>tar -xvjf pidgin-2.7.7.tar.bz2</code></p>
<p>先把 libpurple 移除，因為系統裡面是 2.7.5 。</p>
<p><code>sudo apt-get remove libpurple0</code></p>
<p>再切換到原始碼的目錄，然後把 pidgin 編譯裝好</p>
<p><code>cd  ~/pidgin-2.7.7</code></p>
<p><code>./configure</code></p>
<p><code>sudo make install</code></p>
<p>接著從選單重新啟動 pidgin 即可，要確認版本可以按下 pidgin 的 (說明->關於)。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/11/ubuntu-%e4%b8%8b%e8%a7%a3%e6%b1%ba-pidgin-%e7%84%a1%e6%b3%95%e7%99%bb%e5%85%a5-msn-%e6%96%b9%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>避免 Notecase 按下 ESC 鍵將視窗最小化</title>
		<link>http://blog.roga.tw/2010/11/%e9%81%bf%e5%85%8d-notecase-%e6%8c%89%e4%b8%8b-esc-%e9%8d%b5%e5%b0%87%e8%a6%96%e7%aa%97%e6%9c%80%e5%b0%8f%e5%8c%96/</link>
		<comments>http://blog.roga.tw/2010/11/%e9%81%bf%e5%85%8d-notecase-%e6%8c%89%e4%b8%8b-esc-%e9%8d%b5%e5%b0%87%e8%a6%96%e7%aa%97%e6%9c%80%e5%b0%8f%e5%8c%96/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 05:42:06 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2462</guid>
		<description><![CDATA[我最近常常用 notecase 來記事，因為它跨平台，所以搭配 Dropbox 可以讓我的文件在 Linux / Windows 共享。 不過有個問題一直困擾我，那就是在 Notecase 裡面不小心按下 ESC 鍵時，會將視窗最小化，這對我來說非常不方便，因為我打字時，常常習慣用 ESC 來消掉自己打錯的字，所以我常常不小心把視窗最小化，然後又得重新開啟，而且很慘的是，這個功能是寫死在程式裡面的，並不能透過 Notecase 本身的 Configure ShortCut 這個功能來修改鍵盤快捷鍵。 因為這幾天頻頻發生不小心把視窗最小化的狀況，實在受不了了。只好去 notecase 的官網找這隻程式的原始碼來下載來自己改，以下是修改方法： 下載最新版本的 notecase-1.9.8_src.zip 。 先在 ./src/lib/IniFile.cpp 的前面加上 #include 以免 snprintf() 這函式找不到導致編譯不過。 修改 ./src/MainWnd.cpp 裡面第 2126 行 [crayon-4fbc4dd77debe/] 改完之後，在視窗內按下 ESC 就不會將視窗本身最小化了，而是改用 CTRL + ESC 來把視窗最小化。 如果在 Ubuntu 編譯的話，必須先確定裝有下列套件： apt-get install make g++ libgtk2.0-dev [...]]]></description>
			<content:encoded><![CDATA[<p>我最近常常用 <a href="http://notecase.sourceforge.net/">notecase</a> 來記事，因為它跨平台，所以搭配 Dropbox 可以讓我的文件在 Linux / Windows 共享。</p>
<p>不過有個問題一直困擾我，那就是在 Notecase 裡面不小心按下 ESC 鍵時，會將視窗最小化，這對我來說非常不方便，因為我打字時，常常習慣用 ESC 來消掉自己打錯的字，所以我常常不小心把視窗最小化，然後又得重新開啟，而且很慘的是，這個功能是寫死在程式裡面的，並不能透過 Notecase 本身的 Configure ShortCut 這個功能來修改鍵盤快捷鍵。</p>
<p>因為這幾天頻頻發生不小心把視窗最小化的狀況，實在受不了了。只好去 notecase 的官網找這隻程式的原始碼來下載來自己改，以下是修改方法： </p>
<p>下載最新版本的 <a href="http://prdownloads.sourceforge.net/notecase/notecase-1.9.8_src.zip?download">notecase-1.9.8_src.zip</a> 。</p>
<p>先在 ./src/lib/IniFile.cpp 的前面加上  #include <stdio.h> 以免 snprintf() 這函式找不到導致編譯不過。</p>
<p>修改 ./src/MainWnd.cpp 裡面第 2126 行</p>
<p></p><pre class="crayon-plain-tag">
gint dlg_keyboard_handler(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
-	//Esc press in the main window minimizes the application  // 刪掉這一行
-	if( event-&gt;keyval == GDK_Escape ) // 刪掉這一行
+	// Ctrl + Esc press in the main window minimizes the application  // 加上這一行
+	if( event-&gt;keyval == GDK_Escape &amp;&amp; (event-&gt;state &amp; GDK_CONTROL_MASK)) // 加上這一行
	{	
		GtkWidget *widget1 = gtk_window_get_focus(GTK_WINDOW(window1));
		if( widget1 != g_text.m_pWidget &amp;&amp;
			widget1 != g_tree.m_pWidget)
			return FALSE;	// skip this, we are in the label editing mode

		gtk_window_iconify(GTK_WINDOW(widget));
		return TRUE;    //eat event (handled here)
	}

	return FALSE;
}</pre><p></p>
<p>改完之後，在視窗內按下 ESC 就不會將視窗本身最小化了，而是改用 CTRL + ESC 來把視窗最小化。</p>
<p>如果在 Ubuntu 編譯的話，必須先確定裝有下列套件：</p>
<p><code>apt-get install make g++ libgtk2.0-dev libgnomevfs2-dev</code></p>
<p>弄好之後在 notecase 目錄下直接 make 即可 (在 notecase/bin/ 下面會編出來可用的執行檔)，如果直接下 make install 則會裝到 /usr/bin 裡面去。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/11/%e9%81%bf%e5%85%8d-notecase-%e6%8c%89%e4%b8%8b-esc-%e9%8d%b5%e5%b0%87%e8%a6%96%e7%aa%97%e6%9c%80%e5%b0%8f%e5%8c%96/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>安裝 VMWare Player 出現錯誤訊息&#8230;</title>
		<link>http://blog.roga.tw/2010/11/%e5%ae%89%e8%a3%9d-vmware-player-%e5%87%ba%e7%8f%be%e9%8c%af%e8%aa%a4%e8%a8%8a%e6%81%af/</link>
		<comments>http://blog.roga.tw/2010/11/%e5%ae%89%e8%a3%9d-vmware-player-%e5%87%ba%e7%8f%be%e9%8c%af%e8%aa%a4%e8%a8%8a%e6%81%af/#comments</comments>
		<pubDate>Tue, 16 Nov 2010 03:51:54 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2460</guid>
		<description><![CDATA[因為一些需求，所以我在 Ubuntu 下面安裝了 VMWare Player ，環境是 Ubuntu 10.10 (64 bit) 加上 VMWare Player 3.1.2 build-301548。 安裝進行到編譯 kernel module 的時候，出現了無法編譯的情況，出現「Unable to build kernel module &#8211; See log file /temp/vmware-root/setup-xxxx.log」。找了一下，發現這是 VMWare 本身的問題。 解法如下： cd /tmp wget http://www.sputnick-area.net/scripts/vmware7.1.1-patch-kernel-2.6.35.bash chmod +x vmware7.1.1-patch-kernel-2.6.35.bash ./vmware7.1.1-patch-kernel-2.6.35.bash sudo vmware-modconfig --console --install-all 看到命令列出現 Starting VMware services: VMware USB Arbitrator done Virtual machine monitor done [...]]]></description>
			<content:encoded><![CDATA[<p>因為一些需求，所以我在 Ubuntu 下面安裝了 VMWare Player ，環境是 Ubuntu 10.10 (64 bit) 加上 VMWare Player 3.1.2 build-301548。</p>
<p>安裝進行到編譯 kernel module 的時候，出現了無法編譯的情況，出現「Unable to build kernel module &#8211; See log file /temp/vmware-root/setup-xxxx.log」。找了一下，發現這是 VMWare 本身的問題。</p>
<p>解法如下：</p>
<p><code>cd /tmp</code></p>
<p><code>wget http://www.sputnick-area.net/scripts/vmware7.1.1-patch-kernel-2.6.35.bash</code></p>
<p><code>chmod +x vmware7.1.1-patch-kernel-2.6.35.bash</code></p>
<p><code>./vmware7.1.1-patch-kernel-2.6.35.bash</code></p>
<p><code>sudo vmware-modconfig --console --install-all</code></p>
<p>看到命令列出現</p>
<pre>
Starting VMware services:
   VMware USB Arbitrator                    done
   Virtual machine monitor                  done
   Virtual machine communication interface  done
   VM communication interface socket family done
   Blocking file system                     done
   Virtual ethernet                         done
   Shared Memory Available                  done
</pre>
<p>就表示完成了。</p>
<p>ref: <a href="http://pario.no/2010/10/02/installing-vmware-workstation-7-1-1-64-bit-on-ubuntu-10-10/">Installing VMware Workstation 7.1.1 64 bit on Ubuntu 10.10<br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/11/%e5%ae%89%e8%a3%9d-vmware-player-%e5%87%ba%e7%8f%be%e9%8c%af%e8%aa%a4%e8%a8%8a%e6%81%af/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>差勁的 UI 設計</title>
		<link>http://blog.roga.tw/2010/10/%e5%b7%ae%e5%8b%81%e7%9a%84-ui-%e8%a8%ad%e8%a8%88/</link>
		<comments>http://blog.roga.tw/2010/10/%e5%b7%ae%e5%8b%81%e7%9a%84-ui-%e8%a8%ad%e8%a8%88/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 05:52:26 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2453</guid>
		<description><![CDATA[這是 Gompiz 的一個特效設定畫面，在功能上沒什麼問題，但在介面設計上，著實堪稱是不良 UI 設計的典範。 1. 最右邊有個看起來像是「掃把」的圖示，按下去實際動作是「恢復預設值」，但使用者第一眼看到，會以為是清除設定。 2. 把「刪除」放在「新增」和「編輯」中間，非常容易誤按。 3. 沒有特別將刪除功能用別的顏色或是粗體標示，另外，按下刪除後也沒有提示是否真的要刪除。 這種 UI 設計真的很容易讓使用者翻桌。]]></description>
			<content:encoded><![CDATA[<p>這是 Gompiz 的一個特效設定畫面，在功能上沒什麼問題，但在介面設計上，著實堪稱是不良 UI 設計的典範。<br />
<span id="more-2453"></span><br />
<img src="http://gallery.roga.tw/var/albums/storage/Screenshot-810171804.png" alt="" /></p>
<p>1. 最右邊有個看起來像是「掃把」的圖示，按下去實際動作是「恢復預設值」，但使用者第一眼看到，會以為是清除設定。<br />
2. 把「刪除」放在「新增」和「編輯」中間，非常容易誤按。<br />
3. 沒有特別將刪除功能用別的顏色或是粗體標示，另外，按下刪除後也沒有提示是否真的要刪除。</p>
<p>這種 UI 設計真的很容易讓使用者翻桌。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/10/%e5%b7%ae%e5%8b%81%e7%9a%84-ui-%e8%a8%ad%e8%a8%88/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux 批次修改檔名</title>
		<link>http://blog.roga.tw/2010/09/%e6%89%b9%e6%ac%a1%e4%bf%ae%e6%94%b9%e6%aa%94%e5%90%8d/</link>
		<comments>http://blog.roga.tw/2010/09/%e6%89%b9%e6%ac%a1%e4%bf%ae%e6%94%b9%e6%aa%94%e5%90%8d/#comments</comments>
		<pubDate>Thu, 23 Sep 2010 08:32:27 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2437</guid>
		<description><![CDATA[前兩天抓圖的時候沒注意，把副檔名抓成 IMG0000.jpg.jpg ，但我預期的副檔名應該是 IMG0000.jpg ，稍微找一下，發現有個指令叫做 rename 可以用，以我的 case 來說，可以這樣下： [crayon-4fbc4dd77e679/] 這樣就解決大量修改副檔名的問題了，真快。]]></description>
			<content:encoded><![CDATA[<p>前兩天抓圖的時候沒注意，把副檔名抓成 IMG0000.jpg.jpg ，但我預期的副檔名應該是 IMG0000.jpg ，稍微找一下，發現有個指令叫做 rename 可以用，以我的 case 來說，可以這樣下：</p>
<p></p><pre class="crayon-plain-tag">rename -v 's/\.jpg.jpg$/\.jpg/' *.jpg</pre><p></p>
<p>這樣就解決大量修改副檔名的問題了，真快。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/09/%e6%89%b9%e6%ac%a1%e4%bf%ae%e6%94%b9%e6%aa%94%e5%90%8d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aapache2 multi-threaded mode 發生 coredump</title>
		<link>http://blog.roga.tw/2010/09/aapache2-multi-threaded-mode-%e7%99%bc%e7%94%9f-coredump/</link>
		<comments>http://blog.roga.tw/2010/09/aapache2-multi-threaded-mode-%e7%99%bc%e7%94%9f-coredump/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 16:05:22 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2435</guid>
		<description><![CDATA[今天傍晚看了一下 Apache2 的 error.log 發現有不少 coredump ，算了一下，發現一週裡面 coredump 了 330 次。 [crayon-4fbc4dd77ed59/] 找了一下，發現 DK 大神去年有遇過這個問題，然後有寫了 patch 在 修正 mod_fastcgi 在 threading 環境下會 coredump 的 bug 。 FastCGI 官方目前最新的 mod_fastcgi-SNAP-0910052141.tar.gz 原始碼還沒有把 patch 收進去，所以下載新的原始碼回來之後還要把 patch 補上才行。另外由於 FastCGI 官方沒有提供 configure ，所以必須自己改 Makefile ，另外也必須先準備 Apache2 的原始碼才能進行編譯。 Debian 可以透過 apt-get 取得。 [crayon-4fbc4dd77eda9/] 以下是我改過適合 Debian Linux 5.0.4 的 Makefile ，主要是修改了 top_dir [...]]]></description>
			<content:encoded><![CDATA[<p>今天傍晚看了一下 Apache2 的 error.log 發現有不少 coredump ，算了一下，發現一週裡面 coredump 了 330 次。<br />
<span id="more-2435"></span></p><pre class="crayon-plain-tag">
[roga@lab3:/usr/include] $ sudo cat /var/log/apache2/error.log | grep 'Segmentation fault (11)' | wc -l
330</pre><p></p>
<p>找了一下，發現 DK 大神去年有遇過這個問題，然後有寫了 patch 在 <a href="http://blog.gslin.com/2009/07/modfastcgi-threading-coredump-bug.html">修正 mod_fastcgi 在 threading 環境下會 coredump 的 bug</a> 。</p>
<p>FastCGI 官方目前最新的 <a href="http://www.fastcgi.com/dist/mod_fastcgi-SNAP-0910052141.tar.gz">mod_fastcgi-SNAP-0910052141.tar.gz</a> 原始碼還沒有把 patch 收進去，所以下載新的原始碼回來之後還要把 patch 補上才行。另外由於 FastCGI 官方沒有提供 configure ，所以必須自己改 Makefile ，另外也必須先準備 Apache2 的原始碼才能進行編譯。 Debian 可以透過 apt-get 取得。</p>
<p></p><pre class="crayon-plain-tag"> apt-get install apache2-threaded-dev </pre><p> </p>
<p>以下是我改過適合 Debian Linux 5.0.4 的 Makefile ，主要是修改了 top_dir 和 INCLUDES ：</p>
<p></p><pre class="crayon-plain-tag">
#
#  Makefile for Apache2
#

builddir     = .
top_dir      = /usr/share/apache2

top_srcdir   = ${top_dir}
top_builddir = ${top_dir}

include ${top_builddir}/build/special.mk

APXS      = apxs
APACHECTL = apachectl

#DEFS=-Dmy_define=my_value
INCLUDES=-I/usr/include/apache2 -I /usr/include/apr-1.0/
#LIBS=-Lmy/lib/dir -lmylib

all: local-shared-build

install: install-modules

clean:
    -rm -f *.o *.lo *.slo *.la</pre><p></p>
<p>所以，原來 Fast-CGI 的  apache2 module 本身也沒有完全 thread-safe 。</p>
<p>備註：根據 POSIX.1-2001 以及 POSIX.1-2008 有要求 function 必須要 thread-safe ，但有例外，在 Linux Programmer&#8217;s Manual 的 <a href="http://www.kernel.org/doc/man-pages/online/pages/man7/pthreads.7.html">Thread-safe functions</a> 有列表。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/09/aapache2-multi-threaded-mode-%e7%99%bc%e7%94%9f-coredump/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>對 memcached 做 add, set, replace 的差別</title>
		<link>http://blog.roga.tw/2010/09/%e5%b0%8d-memcached-server-%e5%81%9a-add-set-replace-%e5%b7%ae%e5%88%a5/</link>
		<comments>http://blog.roga.tw/2010/09/%e5%b0%8d-memcached-server-%e5%81%9a-add-set-replace-%e5%b7%ae%e5%88%a5/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 16:34:54 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2430</guid>
		<description><![CDATA[動作 意義 add 當這個 key 不存在的時候才保存 value replace 當 key 相同的時候才替換 value set 直接寫入新的 value ，如果 key 存在就是替換 value 用法，以 memcached++ 為例： [crayon-4fbc4dd77f890/]]]></description>
			<content:encoded><![CDATA[<table>
<tr>
<td> <strong>動作</strong> </td>
<td> <strong>意義</strong> </td>
</tr>
<tr>
<td> add </td>
<td> 當這個 key 不存在的時候才保存 value </td>
</tr>
<tr>
<td> replace </td>
<td> 當 key 相同的時候才替換 value </td>
</tr>
<tr>
<td> set </td>
<td> 直接寫入新的 value ，如果 key 存在就是替換 value </td>
</tr>
</table>
<p>用法，以 <a href="http://sourceforge.net/projects/memcachedpp/">memcached++</a> 為例：</p>
<p></p><pre class="crayon-plain-tag">

struct memcache *mc = mc_new();

mc_add(mc, key, key_len, val, bytes, expire, flags);
mc_replace(mc, key, key_len, val, bytes, expire, flags);
mc_set(mc, key, key_len, val, bytes, expire, flags);</pre><p></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/09/%e5%b0%8d-memcached-server-%e5%81%9a-add-set-replace-%e5%b7%ae%e5%88%a5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>拿掉 SSH private key 的 passphrase</title>
		<link>http://blog.roga.tw/2010/09/%e6%8b%bf%e6%8e%89-ssh-private-key-%e7%9a%84-passphrase/</link>
		<comments>http://blog.roga.tw/2010/09/%e6%8b%bf%e6%8e%89-ssh-private-key-%e7%9a%84-passphrase/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 08:09:36 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2429</guid>
		<description><![CDATA[因為方便跑 cronjob 的關係，我得把 private key 的 passphrase 拿掉，以免無法順利執行我的程式，回頭翻了一下文件，發現方法很簡單，不需要重新 gen public/private key ，但是又可以把 passphrase 拿掉。 [crayon-4fbc4dd77ff72/] 系統會問舊的 passphrase 和新的 passphrase ，留空白表示不用 passphrase 保護。 備註：這個動作有危險性，完成後，private key 將沒有被密碼保護，可能導致您的帳號身份被竊取。]]></description>
			<content:encoded><![CDATA[<p>因為方便跑 cronjob 的關係，我得把 private key 的 passphrase 拿掉，以免無法順利執行我的程式，回頭翻了一下文件，發現方法很簡單，不需要重新 gen public/private key ，但是又可以把 passphrase 拿掉。</p>
<p></p><pre class="crayon-plain-tag">sudo ssh-keygen -p -f private_key_file</pre><p></p>
<p>系統會問舊的 passphrase 和新的 passphrase ，留空白表示不用 passphrase 保護。</p>
<p>備註：這個動作有危險性，完成後，private key 將沒有被密碼保護，可能導致您的帳號身份被竊取。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/09/%e6%8b%bf%e6%8e%89-ssh-private-key-%e7%9a%84-passphrase/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>用 mod_bandwidth 對 Apache2 限制流量</title>
		<link>http://blog.roga.tw/2010/09/%e7%94%a8-mod_bandwidth-%e5%b0%8d-apache2-%e9%99%90%e5%88%b6%e6%b5%81%e9%87%8f/</link>
		<comments>http://blog.roga.tw/2010/09/%e7%94%a8-mod_bandwidth-%e5%b0%8d-apache2-%e9%99%90%e5%88%b6%e6%b5%81%e9%87%8f/#comments</comments>
		<pubDate>Thu, 09 Sep 2010 06:22:38 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2427</guid>
		<description><![CDATA[在 Debian Linux 中安裝 mod_bandwidth 的方法： 先安裝模組，之後建立暫存目錄 ，設定目錄擁有者 [crayon-4fbc4dd780fe4/] 接著建立config 檔案： [crayon-4fbc4dd781034/] 在 config 裡面寫 [crayon-4fbc4dd781081/] 之後把 module enable 起來： [crayon-4fbc4dd7810cd/] 然後到各個目錄下面，分別設定 [crayon-4fbc4dd78111a/] 其中 BandWidth 的單位是 byte ，接著重新啟動 Apache2 即可。 [crayon-4fbc4dd781166/] 至於 mod_bandwidth 更詳細的用法可以參考 Apache Mod_bandwidth 的 document。]]></description>
			<content:encoded><![CDATA[<p>在 Debian Linux 中安裝 mod_bandwidth 的方法：<br />
<span id="more-2427"></span><br />
先安裝模組，之後建立暫存目錄 ，設定目錄擁有者</p>
<p></p><pre class="crayon-plain-tag">
apt-get install libapache2-mod-bw
mkdir /var/cache/apache2/mod_bandwidth
mkdir /var/cache/apache2/mod_bandwidth/link
mkdir /var/cache/apache2/mod_bandwidth/master
chown -R www-data.www-data /var/cache/apache2/mod_bandwidth</pre><p></p>
<p>接著建立config 檔案：</p>
<p></p><pre class="crayon-plain-tag">
touch /etc/apache2/mods-available/bw.conf</pre><p></p>
<p>在 config 裡面寫</p><pre class="crayon-plain-tag">
&lt;IfModule mod_bandwidth.c&gt;
	BandWidthDataDir &quot;/var/cache/apache2/mod_bandwidth/&quot;
	BandWidthModule On
&lt;/IfModule&gt;</pre><p></p>
<p>之後把 module enable 起來：</p>
<p></p><pre class="crayon-plain-tag">
a2enmod bw</pre><p></p>
<p>然後到各個目錄下面，分別設定</p>
<p></p><pre class="crayon-plain-tag">
&lt;Directory &quot;/var/www/&quot;&gt;
	BandWidthModule On
	BandWidth all 10240
&lt;/Directory&gt;</pre><p></p>
<p>其中 BandWidth 的單位是 byte  ，接著重新啟動 Apache2 即可。 </p>
<p></p><pre class="crayon-plain-tag">
/etc/init.d/apache2 restart</pre><p></p>
<p>至於 mod_bandwidth 更詳細的用法可以參考 <a href="http://www.cohprog.com/mod_bandwidth.html">Apache Mod_bandwidth</a> 的 <a href="http://www.cohprog.com/v3/bandwidth/doc-en.html">document</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/09/%e7%94%a8-mod_bandwidth-%e5%b0%8d-apache2-%e9%99%90%e5%88%b6%e6%b5%81%e9%87%8f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP5 + FastCGI  + Apache2 發生 header 錯誤的問題..</title>
		<link>http://blog.roga.tw/2010/09/php5-fastcgi-apache2-%e7%99%bc%e7%94%9f-header-%e9%8c%af%e8%aa%a4%e7%9a%84%e5%95%8f%e9%a1%8c/</link>
		<comments>http://blog.roga.tw/2010/09/php5-fastcgi-apache2-%e7%99%bc%e7%94%9f-header-%e9%8c%af%e8%aa%a4%e7%9a%84%e5%95%8f%e9%a1%8c/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 05:56:55 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2426</guid>
		<description><![CDATA[Apache2 用 FastCGI 跑 PHP5 之後，在 ERROR LOG 發生這個問題 FastCGI: comm with server &#8220;/my_path/my_cgi.fcgi&#8221; aborted: error parsing headers: duplicate header &#8216;Status&#8217; 解法是，把原本程式裡面 PHP5 會送出 header 的地方改掉，把 HTTP/1.1 換成 Status: ，例如： [crayon-4fbc4dd7820e7/] 原本的 apache2-mpm-prefork + mod_php5 跑得很好，但換成 apache2-worker + FastCGI + php-cgi 後卻會導致 Internel Error ，不過只要改成下面這種作法就正常了： [crayon-4fbc4dd782136/] 這是因為 php-cgi 是回應給 FastCGI 然後 FastCGI 再給 Apache2 ，但 [...]]]></description>
			<content:encoded><![CDATA[<p>Apache2 用 FastCGI 跑 PHP5 之後，在 ERROR LOG 發生這個問題</p>
<blockquote><p>FastCGI: comm with server &#8220;/my_path/my_cgi.fcgi&#8221; aborted: error parsing headers: duplicate header &#8216;Status&#8217;</p></blockquote>
<p><span id="more-2426"></span><br />
解法是，把原本程式裡面 PHP5 會送出 header 的地方改掉，把 HTTP/1.1 換成 Status: ，例如：</p>
<p></p><pre class="crayon-plain-tag">
&lt;?php header(&quot;HTTP/1.1 404 Not Found&quot;); ?&gt;</pre><p></p>
<p>原本的 apache2-mpm-prefork + mod_php5 跑得很好，但換成 apache2-worker + FastCGI  + php-cgi 後卻會導致 Internel Error ，不過只要改成下面這種作法就正常了：</p>
<p></p><pre class="crayon-plain-tag">
&lt;?php header(&quot;Status: 404 Not Found&quot;); ?&gt;</pre><p></p>
<p>這是因為 php-cgi 是回應給 FastCGI 然後 FastCGI 再給 Apache2 ，但 FastCGI 看不懂  HTTP/1.1 (只看得懂 Status Code)，所以會有錯誤 。另外在 FastCGI 模式下 Header 有個特性，除非 header(&#8220;Location: url&#8221;) 其中 url 的內容是 HTTP 開頭的完整路徑，要不然 FastCGI 會把它當成內部路徑(就是磁碟上的路徑)，詳細說明可以看 <a href="http://www.fastcgi.com/om_archive/servers/apache/apache-fastcgi/mod_fastcgi.html">Module mod_fastcgi</a> 裡面的 &#8220;Notes on CGI response headers&#8221; 。</p>
<p>不過在 Lighttpd 裡面，看似沒有這個問題，因為在它們的部落格有篇 <a href="http://blog.lighttpd.net/articles/2006/11/29/faster-fastcgi">Faster FastCGI</a> 提到：「We are just forwarding them in most cases without touching them.」.. XD</p>
<p>另外， FastCGI 也會導致沒辦法進行 401 Authorization ，所以要在 Apache2 的 FastCGI 設定多加上 </p>
<p></p><pre class="crayon-plain-tag">FastCgiConfig -pass-header HTTP_AUTHORIZATION</pre><p></p>
<p>唉，有時候，換種方式來跑，背後也是要修修改改不少地方&#8230;</p>
<p>UPDATE.20100907: <a href="http://www.fastcgi.com/docs/faq.html#httpstatus">FastCGI FAQ</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/09/php5-fastcgi-apache2-%e7%99%bc%e7%94%9f-header-%e9%8c%af%e8%aa%a4%e7%9a%84%e5%95%8f%e9%a1%8c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VMware Server 2.0.2 無法開啟 web ui 的問題。</title>
		<link>http://blog.roga.tw/2010/09/vmware-server-2-0-2-%e7%84%a1%e6%b3%95%e9%96%8b%e5%95%9f-web-ui-%e7%9a%84%e5%95%8f%e9%a1%8c%e3%80%82/</link>
		<comments>http://blog.roga.tw/2010/09/vmware-server-2-0-2-%e7%84%a1%e6%b3%95%e9%96%8b%e5%95%9f-web-ui-%e7%9a%84%e5%95%8f%e9%a1%8c%e3%80%82/#comments</comments>
		<pubDate>Mon, 06 Sep 2010 13:11:31 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2425</guid>
		<description><![CDATA[我之前升級我的 Kernel ，所以重新安裝了一次 VMware Server 2.0.2 (因為要重新編譯相關的 kernel module)。但是更新完成之後，我卻沒辦法透過 HTTPS 登入，狀況是 chrome 直接爛掉，firefox 出現無法顯示網頁，而 IE 則是出現 JS 的錯誤，後來找了半天，發現是 VMware Server 內建的 tomcat web server 搞的鬼。 我的環境是 Linux Debian 5.0.4 + VMware Server 2.0.2 修改路徑：/usr/lib/vmware/webAccess/tomcat/apache-tomcat-6.0.16/conf/server.xml 找到 [crayon-4fbc4dd782bcc/] 把裡面的 compression=&#8221;on&#8221; 改為 compression=&#8221;off&#8221; 就可以了。 然後重新啟動 VMWare 的 web ui 管理介面即可 /etc/init.d/vmware-mgmt restart]]></description>
			<content:encoded><![CDATA[<p>我之前升級我的 Kernel ，所以重新安裝了一次 VMware Server 2.0.2 (因為要重新編譯相關的 kernel module)。但是更新完成之後，我卻沒辦法透過 HTTPS 登入，狀況是 chrome 直接爛掉，firefox 出現無法顯示網頁，而 IE 則是出現 JS 的錯誤，後來找了半天，發現是 VMware Server 內建的 tomcat web server 搞的鬼。<br />
<span id="more-2425"></span><br />
我的環境是 Linux Debian 5.0.4 + VMware Server 2.0.2</p>
<p>修改路徑：<code>/usr/lib/vmware/webAccess/tomcat/apache-tomcat-6.0.16/conf/server.xml</code></p>
<p>找到</p><pre class="crayon-plain-tag">
 &lt;Connector port=&quot;8308&quot; maxHttpHeaderSize=&quot;8192&quot;
	maxThreads=&quot;150&quot; minSpareThreads=&quot;25&quot; maxSpareThreads=&quot;75&quot;
	enableLookups=&quot;false&quot; acceptCount=&quot;100&quot;
	connectionTimeout=&quot;20000&quot; disableUploadTimeout=&quot;true&quot;
	compression=&quot;on&quot; compressionMinSize=&quot;256&quot;
	compressableMimeType=&quot;text/html,text/xml,text/javascript,application/x-javascript,application/javascript&quot; /&gt;</pre><p></p>
<p>把裡面的 compression=&#8221;on&#8221; 改為 compression=&#8221;off&#8221; 就可以了。</p>
<p>然後重新啟動 VMWare 的 web ui 管理介面即可 <code> /etc/init.d/vmware-mgmt restart </code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/09/vmware-server-2-0-2-%e7%84%a1%e6%b3%95%e9%96%8b%e5%95%9f-web-ui-%e7%9a%84%e5%95%8f%e9%a1%8c%e3%80%82/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Acrobat Reader 9.X 在 Ubuntu Linux 10.04 無法閱讀中文</title>
		<link>http://blog.roga.tw/2010/07/acrobat-reader-9-x-%e5%9c%a8-ubuntu-linux-10-04-%e7%84%a1%e6%b3%95%e9%96%b1%e8%ae%80%e4%b8%ad%e6%96%87/</link>
		<comments>http://blog.roga.tw/2010/07/acrobat-reader-9-x-%e5%9c%a8-ubuntu-linux-10-04-%e7%84%a1%e6%b3%95%e9%96%b1%e8%ae%80%e4%b8%ad%e6%96%87/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 03:34:31 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2408</guid>
		<description><![CDATA[使用 Ubuntu 的都知道系統的更新管理員會定期更新，不過缺點是有時候更新了反而會出現一些問題。 目前在 Adobe 官網可以下載的 Acrobat Reader for Linux 繁體中文版只有提供到 8.1.7 ，不過 Canonical 提供的更新檔已經到了 9.3.3 了，如果用更新管理員裝了最新版本的 Acrobat Reader 那就會發生讀不到中文這種爛掉的情況&#8230; 目前的解決方法是到 Adobe 的 FTP 去抓 Tar ball 回來自己安裝 Language Pack 。 1. 如果不能閱讀中文，打開 Acrobat Reader 確定版本。 2. 上官網的下載區看目前包好的繁體中文版版號和自己版號的差異，如果自己版本比官網的新，那就要手動 patch 一下。 3. 到 Adobe 的 FTP，找到自己的版本的目錄，進去後選擇 misc ，然後挑 cht 版本下載。 4. 如果找不到符合的版號，可以試著拿別的版本代替看看能不能成功 (目前應該是找不到，所以我用 9.3.3 的主程式，卻用 9.1 [...]]]></description>
			<content:encoded><![CDATA[<p>使用 Ubuntu 的都知道系統的更新管理員會定期更新，不過缺點是有時候更新了反而會出現一些問題。</p>
<p>目前在 Adobe 官網可以下載的 Acrobat Reader for Linux 繁體中文版只有提供到 8.1.7 ，不過 Canonical 提供的更新檔已經到了 9.3.3 了，如果用更新管理員裝了最新版本的 Acrobat Reader 那就會發生讀不到中文這種爛掉的情況&#8230;<br />
<span id="more-2408"></span><br />
目前的解決方法是到 Adobe 的 FTP 去抓 Tar ball 回來自己安裝 Language Pack 。</p>
<p>1. 如果不能閱讀中文，打開 Acrobat Reader 確定版本。</p>
<p>2. 上<a href="http://get.adobe.com/tw/reader/">官網的下載區</a>看目前包好的繁體中文版版號和自己版號的差異，如果自己版本比官網的新，那就要手動 patch 一下。</p>
<p>3. 到 <a href="ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/">Adobe 的 FTP</a>，找到自己的版本的目錄，進去後選擇 misc ，然後挑 cht 版本下載。</p>
<p>4. 如果找不到符合的版號，可以試著拿別的版本代替看看能不能成功 (目前應該是找不到，所以我用 <b> 9.3.3 </b> 的主程式，卻用 <b>9.1</b> 的 <a href="ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.1/misc/FontPack910_cht_i486-linux.tar.bz2">FontPack910_cht_i486-linux.tar.bz2</a> 語言套件。</p>
<p>5. 下載完畢之後解壓縮 <code>tar -xjf FontPack910_cht_i486-linux.tar.bz2</code></p>
<p>6. 會出現一個 CHTKT 目錄，進去之後 <code>sudo ./INSTALL</code> 。</p>
<p>7. 當詢問 If you do not have Adobe Reader version 9.1 already installed on your system please do so before installing this Asian Language Kit.<br />
Continue installation?  [y] 的時候輸入 &#8220;y&#8221;</p>
<p>8. 當詢問 Please type  &#8220;accept&#8221;  to accept the terms and conditions of license agreement; Type  &#8220;decline&#8221;  to exit. 的時候打 &#8220;accept&#8221;</p>
<p>9. 當詢問 Enter the location where you installed the Adobe Reader [/opt] 的時候直接按 enter</p>
<p>完成之後重新啟動 Acrobat Reader 應該就可以看到中文了，如果不小心被弄爛了，用 apt-get 或是 Synaptic 套件管理程式重新安裝 Acrobat Reader (acroread)即可。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/07/acrobat-reader-9-x-%e5%9c%a8-ubuntu-linux-10-04-%e7%84%a1%e6%b3%95%e9%96%b1%e8%ae%80%e4%b8%ad%e6%96%87/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Apache2(mpm-worker) + mod_fastcgi + PHP5 on Debian Linux.</title>
		<link>http://blog.roga.tw/2010/06/%e5%9c%a8-debian-linux-%e9%81%8b%e8%a1%8c-apache2-fastcgi-php5/</link>
		<comments>http://blog.roga.tw/2010/06/%e5%9c%a8-debian-linux-%e9%81%8b%e8%a1%8c-apache2-fastcgi-php5/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 07:54:34 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2396</guid>
		<description><![CDATA[由於終於受不了速度太慢，耗用太多記憶體，所以改用 FastCGI 來跑我的服務。這種做法的好處就不用多說了，網路上很多人都有講，不過我找到的這類教學文章環境大多都是 FreeBSD 上的，所以照著弄了一下，終於搞出來。以下是給 Debian Linux 的作法，做個筆記： 首先到 /etc/apt/sources.list ，在 main 後面加上 non-free 因為 libapache2-mod-fastcgi 屬於 non-free 。 [crayon-4fbc4dd783308/] 接著安裝 Apache2 Mpm Worker 、 FastCGI Module 以及 PHP5-CGI： [crayon-4fbc4dd783358/] 安裝 Apache2 Mpm Worker 會移除 Apache2 Mpm prefork 和 PHP5 Module 。所以請注意！如果沒有把握，請先把 HTTP 檔案都隔離開來，以避免 PHP5 的 Module 被移除掉之後，你的原始碼都被下載光了。 接著啟用 Apache2 的 Module Actions 和 FastCGI [...]]]></description>
			<content:encoded><![CDATA[<p>由於終於受不了速度太慢，耗用太多記憶體，所以改用 FastCGI 來跑我的服務。這種做法的好處就不用多說了，網路上很多人都有講，不過我找到的這類教學文章環境大多都是 FreeBSD 上的，所以照著弄了一下，終於搞出來。以下是給 Debian Linux 的作法，做個筆記：<br />
<span id="more-2396"></span><br />
首先到 /etc/apt/sources.list ，在 main 後面加上 non-free 因為 libapache2-mod-fastcgi 屬於 non-free 。</p>
<p></p><pre class="crayon-plain-tag">
deb http://debian.linux.org.tw/debian/ lenny main non-free
deb-src http://debian.linux.org.tw/debian/ lenny main non-free</pre><p></p>
<p>接著安裝 Apache2 Mpm Worker 、 FastCGI Module 以及 PHP5-CGI：</p>
<p></p><pre class="crayon-plain-tag">
apt-get install apache2-mpm-worker libapache2-mod-fastcgi php5-cgi</pre><p></p>
<p>安裝 Apache2 Mpm Worker 會移除 Apache2 Mpm prefork 和 PHP5 Module 。所以請注意！如果沒有把握，請先把 HTTP 檔案都隔離開來，以避免 PHP5 的 Module 被移除掉之後，你的原始碼都被下載光了。</p>
<p>接著啟用 Apache2 的 Module Actions  和 FastCGI</p>
<p></p><pre class="crayon-plain-tag">
a2enmod actions fastcgi</pre><p></p>
<p>寫個 script 來執行 FastCGI</p>
<p></p><pre class="crayon-plain-tag">
#!/bin/bash
PHPRC=&quot;/etc&quot;
export PHPRC
PHP_FCGI_CHILDREN=128
export PHP_FCGI_CHILDREN
exec /usr/bin/php5-cgi</pre><p></p>
<p>把這個檔案存成 &#8220;php.fgci&#8221; 然後新建個目錄，某個目錄下 (以這個範例來說是 /var/www 下) 。接著然後改寫 Apache2 的 Config</p>
<p></p><pre class="crayon-plain-tag">
ScriptAlias /fastcgi/ &quot;/var/www/fastcgi/&quot;

&lt;Directory /var/www/fastcgi&gt;
    Options ExecCGI FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
&lt;/Directory&gt;</pre><p></p>
<p>寫完這邊之後，請確認是否有 /etc/apache2/mods-enabled/fastcgi.conf 這個檔案，並且內容為：</p>
<p></p><pre class="crayon-plain-tag">
&lt;IfModule mod_fastcgi.c&gt;
    AddHandler fastcgi-script .fcgi
    AddHandler php-fastcgi .php .php5 .inc
    Action php-fastcgi /fastcgi/php.fcgi
    FastCgiIpcDir /var/lib/apache2/fastcgi
    FastCgiConfig   -pass-header HTTP_AUTHORIZATION -autoUpdate -killInterval 120 -idle-timeout 60 -maxClassProcesses 1
&lt;/IfModule&gt;</pre><p></p>
<p>都完成之後，重跑 Apache2 <code>/etc/init.d/apache2 restart</code>即可。</p>
<p>至於更進接的設定可以參考<a href="http://blog.gslin.org">大神</a>兩年前寫的<a href="http://blog.gslin.org/archives/2008/08/17/1624/">apache22 (worker) + mod_fastcgi + php5-fcgi</a>這篇文章研究一下。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/06/%e5%9c%a8-debian-linux-%e9%81%8b%e8%a1%8c-apache2-fastcgi-php5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>安裝 Adobe FLash Player 10 於 Ubuntu 9.10 x86_64</title>
		<link>http://blog.roga.tw/2010/03/%e5%ae%89%e8%a3%9d-adobe-flash-player-10-%e6%96%bc-ubuntu-9-10-64bit/</link>
		<comments>http://blog.roga.tw/2010/03/%e5%ae%89%e8%a3%9d-adobe-flash-player-10-%e6%96%bc-ubuntu-9-10-64bit/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 19:58:01 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2371</guid>
		<description><![CDATA[之前就知道 Flash Player 安裝在 64bit Linux 上面不是很好解決，包括我在內，我想應該很多人都會被這個問題搞得半死。明明看起來好像裝好了，但是在 Firefox 就是怎樣都不能看見 Flash 影片。網路上有不少 deb 檔下載下來，不是衝突就是不能安裝。因此這邊紀錄一下解決方法。 然後把所有 Flash 相關的 Plugin 都移除掉 sudo apt-get remove -y --purge flashplugin-nonfree gnash gnash-common mozilla-plugin-gnash swfdec-mozilla libflashsupport nspluginwrapper 為了保險起見，請再度確認以下四個目錄下面的 Flash Plugin 都被清空了 (如果還有 Flash 相關檔案，請手動刪除)。 /usr/lib/mozilla/plugins/ ~/.mozilla/plugins/ /usr/lib/firefox/plugins/ /usr/lib/nspluginwrapper 安裝ia32-libs 和 nspluginwrapper sudo apt-get install ia32-libs nspluginwrapper 到 Adobe Labs Downloads 下載最新的 tar.gz [...]]]></description>
			<content:encoded><![CDATA[<p>之前就知道 Flash Player 安裝在 64bit Linux 上面不是很好解決，包括我在內，我想應該很多人都會被這個問題搞得半死。明明看起來好像裝好了，但是在 Firefox 就是怎樣都不能看見 Flash 影片。網路上有不少 deb 檔下載下來，不是衝突就是不能安裝。因此這邊紀錄一下解決方法。<br />
<span id="more-2371"></span><br />
然後把所有 Flash 相關的 Plugin 都移除掉<br />
<code><br />
sudo apt-get remove -y --purge flashplugin-nonfree gnash gnash-common mozilla-plugin-gnash swfdec-mozilla libflashsupport nspluginwrapper<br />
</code></p>
<p>為了保險起見，請再度確認以下四個目錄下面的 Flash Plugin 都被清空了 (如果還有 Flash 相關檔案，請手動刪除)。<br />
<code><br />
/usr/lib/mozilla/plugins/<br />
~/.mozilla/plugins/<br />
/usr/lib/firefox/plugins/<br />
/usr/lib/nspluginwrapper<br />
</code></p>
<p>安裝<strong>ia32-libs</strong> 和 nspluginwrapper<br />
<code><br />
sudo apt-get install ia32-libs nspluginwrapper</code></p>
<p>到 <a href="http://labs.adobe.com/downloads/flashplayer10.html">Adobe Labs Downloads </a> 下載最新的 tar.gz 檔案，解壓縮之後，把 <strong>libflashplayer.so</strong> 複製到 <strong>/usr/lib/mozilla/plugins/</strong></p>
<p>接著用 nspluginwrapper 安裝 Flash Player 並且建立 symbol link<br />
<code><br />
sudo nspluginwrapper -i /usr/lib/mozilla/plugins/libflashplayer.so<br />
sudo ln -sf /usr/lib/nspluginwrapper/plugins/npwrapper.libflashplayer.so /usr/lib/mozilla/plugins/<br />
sudo ln -sf /usr/lib/nspluginwrapper/plugins/npwrapper.libflashplayer.so /usr/lib/firefox-addons/plugins/</code></p>
<p>接著重新啟動 Firefox 就可以生效了。</p>
<p>相關連結：<a href="http://meandubuntu.wordpress.com/2008/08/20/flash-10-rc-on-ubuntu-amd64/">Flash 10 RC on Ubuntu amd64</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/03/%e5%ae%89%e8%a3%9d-adobe-flash-player-10-%e6%96%bc-ubuntu-9-10-64bit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 4GB Ram 的問題&#8230;</title>
		<link>http://blog.roga.tw/2010/03/ubuntu-4gb-ram-%e7%9a%84%e5%95%8f%e9%a1%8c/</link>
		<comments>http://blog.roga.tw/2010/03/ubuntu-4gb-ram-%e7%9a%84%e5%95%8f%e9%a1%8c/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 09:36:35 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2362</guid>
		<description><![CDATA[剛剛覺得筆電有點慢慢的，所以用 free -m 來看記憶體使用，結果 RAM 的大小只有 3GB 和我印象中的 4GB 不同，害我嚇一跳，趕緊檢查一下&#8230; root@carlisten-lx:/home/roga# lshw -C memory *-firmware description: BIOS vendor: Hewlett-Packard physical id: a version: 68PCU Ver. F.12 (07/31/2009) size: 64KiB capacity: 1472KiB *-memory description: System Memory physical id: 4 slot: System board or motherboard size: 4GiB 確定是 4GB 後，想說抓不到的原因應該是 Kernel 的關係。原來 Ubuntu 預設安裝的 Kernel 不支援 4GB [...]]]></description>
			<content:encoded><![CDATA[<p>剛剛覺得筆電有點慢慢的，所以用 free -m 來看記憶體使用，結果 RAM 的大小只有 3GB 和我印象中的 4GB 不同，害我嚇一跳，趕緊檢查一下&#8230;</p>
<pre>
root@carlisten-lx:/home/roga# lshw -C memory
  *-firmware
       description: BIOS
       vendor: Hewlett-Packard
       physical id: a
       version: 68PCU Ver. F.12 (07/31/2009)
       size: 64KiB
       capacity: 1472KiB
  *-memory
       description: System Memory
       physical id: 4
       slot: System board or motherboard
       size: 4GiB
</pre>
<p>確定是 4GB 後，想說抓不到的原因應該是 Kernel 的關係。原來 Ubuntu 預設安裝的 Kernel 不支援 4GB RAM, 除非是安裝 Server 版本的 Kernel 或是安裝支援 PAE 版本的 Kernel，當然在 desktop (laptop) 上面最好是安裝 PAE 版本。指令很簡單，先找出最新版本的 Kernel 或是用預設的 PAE 核心都可以：</p>
<p><code>apt-get install linux-headers-generic-pae linux-image-generic-pae</code></p>
<p>共安裝兩個套件，前者是安裝原始碼，後者安裝核心本身。完成之後重新開機，可以看到結果</p>
<pre>
roga@carlisten-lx:~$ free -m
             total       used       free     shared    buffers     cached
Mem:          3859        639       3220          0         45        182
-/+ buffers/cache:        411       3447
Swap:        11444          0      11444
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/03/ubuntu-4gb-ram-%e7%9a%84%e5%95%8f%e9%a1%8c/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>我目前使用的 .vimrc 設定檔</title>
		<link>http://blog.roga.tw/2010/01/%e6%88%91%e7%9b%ae%e5%89%8d%e4%bd%bf%e7%94%a8%e7%9a%84-vimrc-%e8%a8%ad%e5%ae%9a%e6%aa%94/</link>
		<comments>http://blog.roga.tw/2010/01/%e6%88%91%e7%9b%ae%e5%89%8d%e4%bd%bf%e7%94%a8%e7%9a%84-vimrc-%e8%a8%ad%e5%ae%9a%e6%aa%94/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 09:48:32 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2350</guid>
		<description><![CDATA[以往我使用 vim 的時機大概都是編輯設定檔，或是做些小修改，但最近因為某些原因，開始強迫自己用 vim 做正經事(儘管我不是很想)，也因此在網路上找到不少人的 .vimrc。 vim 可供設定的參數非常多，也可以加裝非常多 powerful 的 plug-in ，甚至連 auto-complete 都可以辦到！不過我目前只有使用基本的功能而已，所以設定參數只有下面寥寥幾行。 備註： .vimrc 是 vim (VIM &#8211; Vi IMproved) 編輯器的設定檔，一般放置於使用者的家目錄中。 [crayon-4fbc4dd7844b2/] 我的 colorscheme 是用 torte ，一般的 linux 裝好 vim 應該都會有這個配色，實際看起來會像： 一些相關的連結： c9s &#8211; vim &#8211; 很多進階的用法，作者對 vim 非常熟稔，也寫了很多很棒的文章。 給程式設計師的Vim入門圖解說明 &#8211; 這陣子推薦非常多人看。 vi / vim 圖解鍵盤指令 &#8211; 我最早找到的圖解說明]]></description>
			<content:encoded><![CDATA[<p>以往我使用 vim 的時機大概都是編輯設定檔，或是做些小修改，但最近因為某些原因，開始強迫自己用 vim 做正經事(儘管我不是很想)，也因此在網路上找到不少人的 .vimrc。 vim 可供設定的參數非常多，也可以加裝非常多 powerful 的 plug-in ，甚至連 auto-complete 都可以辦到！不過我目前只有使用基本的功能而已，所以設定參數只有下面寥寥幾行。</p>
<p>備註： .vimrc 是 vim (VIM &#8211; Vi IMproved) 編輯器的設定檔，一般放置於使用者的家目錄中。<br />
<span id="more-2350"></span></p><pre class="crayon-plain-tag">
&quot; 檔案編碼
set encoding=utf-8
set fileencodings=utf-8,cp950

&quot; 編輯喜好設定                                                                                                                                                                                                     
syntax on        &quot; 語法上色顯示
set nocompatible &quot; VIM 不使用和 VI 相容的模式
&quot; set ai           &quot; 自動縮排
set shiftwidth=2 &quot; 設定縮排寬度 = 4 
set tabstop=4    &quot; tab 的字元數
set softtabstop=4
&quot; set expandtab   &quot; 用 space 代替 tab

set ruler        &quot; 顯示右下角設定值
set backspace=2  &quot; 在 insert 也可用 backspace
set ic           &quot; 設定搜尋忽略大小寫
set ru           &quot; 第幾行第幾個字
set hlsearch     &quot; 設定高亮度顯示搜尋結果
set incsearch    &quot; 在關鍵字還沒完全輸入完畢前就顯示結果
set smartindent  &quot; 設定 smartindent
set confirm      &quot; 操作過程有衝突時，以明確的文字來詢問
set history=100  &quot; 保留 100 個使用過的指令
set cursorline   &quot; 顯示目前的游標位置

set laststatus=2
set statusline=%4*%&lt;\%m%&lt;[%f\%r%h%w]\ [%{&amp;ff},%{&amp;fileencoding},%Y]%=\[Position=%l,%v,%p%%]

colorscheme torte</pre><p></p>
<p>我的 colorscheme 是用 torte ，一般的 linux 裝好 vim 應該都會有這個配色，實際看起來會像：</p>
<p><img src="http://gallery.roga.tw/d/38523-1/Screenshot-5.png" alt="" /></p>
<p>一些相關的連結：<br />
<a href="http://c9s.blogspot.com/search/label/Vim">c9s &#8211; vim</a> &#8211; 很多進階的用法，作者對 vim 非常熟稔，也寫了很多很棒的文章。<br />
<a href="http://blog.vgod.tw/2009/12/08/vim-cheat-sheet-for-programmers/">給程式設計師的Vim入門圖解說明</a> &#8211; 這陣子推薦非常多人看。<br />
<a href="http://blog.linux.org.tw/~jserv/archives/001675.html">vi / vim 圖解鍵盤指令</a> &#8211; 我最早找到的圖解說明</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2010/01/%e6%88%91%e7%9b%ae%e5%89%8d%e4%bd%bf%e7%94%a8%e7%9a%84-vimrc-%e8%a8%ad%e5%ae%9a%e6%aa%94/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>從 VMware Player 轉換到 VMware Server</title>
		<link>http://blog.roga.tw/2009/12/%e5%be%9e-vmware-player-%e8%bd%89%e6%8f%9b%e5%88%b0-vmware-server/</link>
		<comments>http://blog.roga.tw/2009/12/%e5%be%9e-vmware-player-%e8%bd%89%e6%8f%9b%e5%88%b0-vmware-server/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 04:55:18 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2337</guid>
		<description><![CDATA[前幾天才從 VirtualBox 換到 VMware Player (將虛擬機器從 VirtualBox 轉換至 VMWare)，但因為 VMware Player 不是專門為了 Server 遠端管理設計的虛擬機器，所以我還是換成了 VMWare Server ，幾個步驟紀錄一下(我的 HOST 是 64 bit Debian Linux 5.0.3)： 先下載 VMWare Server，因為我的 HOST 關係，使用 tgz 版本。 安裝必須套件，主要是要給 VMware Server 編譯用的： sudo apt-get install gcc build-essential make psmisc linux-headers-版號 1. gcc, 版本要 4.1, 這和編譯 Kernel 的 gcc 有關係，目前 Debian 的 Kernel [...]]]></description>
			<content:encoded><![CDATA[<p>前幾天才從 VirtualBox 換到 VMware Player (<a href="http://blog.roga.tw/2009/12/03/2333">將虛擬機器從 VirtualBox 轉換至 VMWare</a>)，但因為 VMware Player 不是專門為了 Server 遠端管理設計的虛擬機器，所以我還是換成了 VMWare Server ，幾個步驟紀錄一下(我的 HOST 是 64 bit Debian Linux 5.0.3)：</p>
<p><span id="more-2337"></span></p>
<p>先下載 <a href="http://www.vmware.com/products/server/">VMWare Server</a>，因為我的 HOST 關係，使用 tgz 版本。</p>
<p>安裝必須套件，主要是要給 VMware Server 編譯用的：</p>
<p><code>sudo apt-get install gcc build-essential make psmisc linux-headers-版號</code></p>
<p>1. gcc, 版本要 4.1, 這和編譯 Kernel 的 gcc 有關係，目前 Debian 的 Kernel 是用 gcc 4.1 編的，除非你自己編譯 Kernel。<br />
2. linux-headers 這是編譯程式需要的 .h 檔案，用 uname -a 查出 kernel 的版號，像我的系統是 linux-headers-2.6.26-2-amd64<br />
3. build-essential, make, psmisc 都是必備的套件</p>
<p><code>tar zxvf VMware-server-版本. tgz<br />
cd vmware-server-distrib<br />
<strong>CC=/usr/bin/gcc-4.1 ./vmware-install.pl</strong> - 安裝過程中使用 gcc-4.1 編譯<br />
</code></p>
<p>安裝完之後會問要不要執行 Config ，請選擇 yes 繼續。接下來就很好安裝了，其他設定因為每個人機器不同，這邊就不贅述。</p>
<p>使用心得是 Web 管理介面也不錯用，也支援 remote console。另外，我第一次安裝完成之後，有些靈異現象，服務跑不起來，後來重新執行一次 vmware-config.pl 編譯 kernel module 就好了。</p>
<p><code>CC=/usr/bin/gcc-4.1 vmware-config.pl</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2009/12/%e5%be%9e-vmware-player-%e8%bd%89%e6%8f%9b%e5%88%b0-vmware-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>該升級到 Ubuntu 9.10 了</title>
		<link>http://blog.roga.tw/2009/10/%e8%a9%b2%e5%8d%87%e7%b4%9a%e5%88%b0-ubuntu-9-10-%e4%ba%86/</link>
		<comments>http://blog.roga.tw/2009/10/%e8%a9%b2%e5%8d%87%e7%b4%9a%e5%88%b0-ubuntu-9-10-%e4%ba%86/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 02:59:03 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2321</guid>
		<description><![CDATA[(呃，那隻 Debian 的蝸牛是怎麼回事？) 這個版本 Ubuntu 9.10 的代號叫做 Karmic Koala (因果無尾熊？)，大概在今年的五月中左右就有 Alpha 1 的測試了，不過我一向對於踩地雷這件事情很沒信心，所以我在筆電上還是乖乖的用 Ubuntu 9.04 (Jaunty Jackalope) ，等到 Final Release 再來升級手邊的機器。而昨天 (10/29 ) 正是 Final Release 的日子，所以今天就來把手邊的筆電升級成 9.10 的正式版本吧！ 這次的 9.10 提供了 Amazon API 方便佈署虛擬機器，另外也增進了開機速度，當然畫面也更華麗了點，還有一大堆 bla bla bla 的改變，值得一提的是有一點滿有趣的： Sparc not supported by Ubuntu 9.10 The upstart init system in Ubuntu 9.10 fails to work [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://gallery.roga.tw/d/38267-1/koala-timeline.png" rel="lightbox"><img src="http://gallery.roga.tw/d/38268-2/koala-timeline.png" alt="" /></a><br />
(呃，那隻 Debian 的蝸牛是怎麼回事？)<br />
<span id="more-2321"></span><br />
這個版本 Ubuntu 9.10 的代號叫做 Karmic Koala (因果無尾熊？)，大概在今年的五月中左右就有 Alpha 1 的測試了，不過我一向對於踩地雷這件事情很沒信心，所以我在筆電上還是乖乖的用 Ubuntu 9.04 (Jaunty Jackalope) ，等到 Final Release 再來升級手邊的機器。而昨天 (10/29 ) 正是 Final Release 的日子，所以今天就來把手邊的筆電升級成 9.10 的正式版本吧！</p>
<p>這次的 9.10 提供了 Amazon API 方便佈署虛擬機器，另外也增進了開機速度，當然畫面也更華麗了點，還有一大堆 bla bla bla 的改變，值得一提的是有一點滿有趣的：</p>
<blockquote><p>
<strong>Sparc not supported by Ubuntu 9.10</strong><br />
The upstart init system in Ubuntu 9.10 fails to work on the sparc architecture due to an undiagnosed SIGBUS error. Users of Ubuntu on sparc are advised to remain on Ubuntu 9.04 instead of upgrading to 9.10. Assistance in resolving this architecture-specific bug for Ubuntu 10.04 is welcome.
</p></blockquote>
<p>大意就是使用 Sparc 處理器的沒辦法玩 9.10 ，因為有個無法診斷的 <a href="http://en.wikipedia.org/wiki/SIGBUS">SIGBUS </a> error ， <a href="http://www.netsplit.com/">Scott James Remnant</a> 有提到：「SPARC is not a supported architecture. Patches welcome, but I&#8217;m not going to spend any particular amount of time investigating this.」在這個 <a href="https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/436758">ticket </a> 裡面有說明，然後這個問題的優先權也很妙，先是 <a href="http://ncommander.blogspot.com/">Michael Casadevall</a> 設定為 High 然後 <a href="http://www.netsplit.com/">Scott James Remnant</a> 改為 low (應該是認為沒必要去理它，而且把這個問題 Assign 給 <a href="http://ncommander.blogspot.com/">Michael Casadevall</a>&#8230;. XD)，經過一串討論，最後的結果是 Declined for Karmic by Scott James Remnant 。至於我的感覺是：「是為什麼想不開要在 Sparc 裝 Ubuntu 阿！(XD)」</p>
<p>其餘詳細的更動可以看 9.10 的 <a href="http://www.ubuntu.com/getubuntu/releasenotes/910">Release Notes</a> 。</p>
<p>至於升級的方法很簡單，雖然和 Dedian 稍有不同。</p>
<p>1. 直接下指令：<br />
<code><br />
sudo su<br />
do-release-upgrade<br />
</code></p>
<p>2. 叫出更新管理員，進行升級<br />
<code><br />
sudo su<br />
update-manager -d<br />
</code></p>
<p>不過今天 tw.archive.ubuntu.com 這台伺服器有點怪怪的，可能是大家都在更新的關係，速度不是很快，而且有時後會連不到，我搞了好幾次才升級完成，真是快吐血了。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2009/10/%e8%a9%b2%e5%8d%87%e7%b4%9a%e5%88%b0-ubuntu-9-10-%e4%ba%86/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>MyDNS 安裝筆記 for Debian Linux</title>
		<link>http://blog.roga.tw/2009/08/mydns-%e5%ae%89%e8%a3%9d%e7%ad%86%e8%a8%98-in-ubuntu-debian-server/</link>
		<comments>http://blog.roga.tw/2009/08/mydns-%e5%ae%89%e8%a3%9d%e7%ad%86%e8%a8%98-in-ubuntu-debian-server/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 04:15:09 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2292</guid>
		<description><![CDATA[前置作業： 必須先有一個資料庫(MySQL, PostgreSQL)，並且正確設定帳號密碼。並且安裝 MySQL CLient Library (套件名稱類似：libmysqlclient16，搜尋方式 apt-cache search libmysqlclient ) 安裝步驟： cd /tmp wget http://mydns.bboy.net/download/mydns-1.1.0.tar.gz tar xvfz mydns-1.1.0.tar.gz 下載原始檔，存到 /tmp 之後解壓縮。 cd mydns-1.1.0/ ./configure make make install 切換到目錄，並且編譯，預設使用 MySQL ，如果 ./configure &#8211;without-mysql 代表使用 PostgreSQL 。編譯完成後，會有提示如下： ### mydns version 1.1.0 installed! ### ### See the file QUICKSTART if you are in a hurry. ### Otherwise, [...]]]></description>
			<content:encoded><![CDATA[<p>前置作業：</p>
<p>必須先有一個資料庫(MySQL, PostgreSQL)，並且正確設定帳號密碼。並且安裝 MySQL CLient Library (套件名稱類似：libmysqlclient16，搜尋方式 apt-cache search libmysqlclient )<br />
<span id="more-2292"></span><br />
安裝步驟：<br />
<code><br />
cd /tmp<br />
wget http://mydns.bboy.net/download/mydns-1.1.0.tar.gz<br />
tar xvfz mydns-1.1.0.tar.gz<br />
</code><br />
下載原始檔，存到 /tmp 之後解壓縮。<br />
<code><br />
cd mydns-1.1.0/<br />
./configure<br />
make<br />
make install<br />
</code><br />
切換到目錄，並且編譯，預設使用 MySQL ，如果 ./configure &#8211;without-mysql 代表使用 PostgreSQL 。編譯完成後，會有提示如下：</p>
<pre>
  ###  mydns version 1.1.0 installed!
  ###
  ###  See the file QUICKSTART if you are in a hurry.
  ###  Otherwise, consult the manual (in doc/).
  ###
  ###  The MyDNS server program was installed as
  ###  /usr/local/sbin/mydns
  ###
  ###  Your configuration file should be installed as
  ###  /etc/mydns.conf
  ###  (You can auto-create it with "make conf")
  ###
</pre>
<p>編輯 /etc/mydns.conf ，裡面可以修改資料庫的連線設定，以及執行 MyDNS 的使用者和群組(可設定為 nobody/nogroup)。然後利用 mydns 自己的指令新增資料表：<br />
<code><br />
mydns --create-tables | mysql -u root -p dbname<br />
</code><br />
dbname 是您的資料庫的名稱，這個指令會建立 soa 和 rr 兩個資料表。<br />
接著在資料庫中修改欄位屬性：<br />
<code><br />
ALTER TABLE soa ADD COLUMN active ENUM('Y','N') NOT NULL;<br />
ALTER TABLE soa ADD INDEX (active);<br />
ALTER TABLE soa ADD COLUMN xfer CHAR(255) NOT NULL;<br />
</code><br />
然後在 /etc/init.d 裡面建立一個 shell script</p><pre class="crayon-plain-tag">
#! /bin/sh
# mydns         Start the MyDNS server
# Author:       Falko Timme &lt;ft@falkotimme.com&gt;.
set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=mydns
DAEMON=/usr/local/sbin/$NAME
DESC=&quot;MyDNS Server&quot;

SCRIPTNAME=/etc/init.d/$NAME

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

case &quot;$1&quot; in
  start)
        echo -n &quot;Starting $DESC: $NAME&quot;
        $DAEMON --background
        echo &quot;.&quot;
        ;;
  stop)
        echo &quot;Stopping $DESC: $NAME.&quot;
        kill -9 `pidof $NAME` &amp;&gt; /dev/null
        ;;
  restart)
        echo &quot;Restarting $DESC: $NAME.&quot;
        $0 stop &amp;&amp; sleep 1
        $0 start
        ;;
  *)
        echo &quot;Usage: $SCRIPTNAME {start|stop|restart}&quot; &gt;&amp;2
        exit 1
        ;;
esac
exit 0</pre><p>執行 /etc/init.d/mydns start 看看能不能跑起來，沒有問題的話，讓服務開機自動啟動：<br />
<code><br />
update-rc.d mydns defaults 21 22<br />
</code><br />
接著複製系統裡面內建的管理介面到 www 目錄下：<br />
<code><br />
cp /tmp/mydns-1.0.0/contrib/admin.php /var/www<br />
</code><br />
接著修改 admin.php ，修改資料庫連線設定。如果把 $auto_update_serial 和 $auto_update_ptr 設定為 1 ，系統會在修改資料的時候，自動增加數值。</p>
<p>參考資料：<a href="http://www.howtoforge.com/mydns_name_server ">Running A MySQL-Based DNS Server: MyDNS</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2009/08/mydns-%e5%ae%89%e8%a3%9d%e7%ad%86%e8%a8%98-in-ubuntu-debian-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 9.04 下 SCIM 沒有回應的解法</title>
		<link>http://blog.roga.tw/2009/07/ubuntu-9-04-%e4%b8%8b-scim-%e6%b2%92%e6%9c%89%e5%9b%9e%e6%87%89%e7%9a%84%e8%a7%a3%e6%b3%95/</link>
		<comments>http://blog.roga.tw/2009/07/ubuntu-9-04-%e4%b8%8b-scim-%e6%b2%92%e6%9c%89%e5%9b%9e%e6%87%89%e7%9a%84%e8%a7%a3%e6%b3%95/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 01:15:46 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2278</guid>
		<description><![CDATA[在 Ubuntu 下面使用 SCIM 不論是 Eclipse 或是 Firefox 或是其他軟體，常常會有用到一半 SCIM 就沒有回應的情況(通常是視窗失去焦點之後再回來就會沒有回應)，除非把視窗關掉，或是調整視窗大小，或是重新啟動 SCIM 。但這樣不是個好解法，在 Re: SCIM doesn&#8217;t work on Ubuntu Gutsy 7.10 有提到解法： 安裝：apt-get install scim-bridge 如果沒辦法安裝，則改：apt-get install scim-bridge-client-gtk 接著編輯設定檔：vim /etc/X11/xinit/xinput.d/scim 找到：GTK_IM_MODULE=xim 換成：GTK_IM_MODULE="scim-bridge" 然後重新啟動 SCIM 就可以解決這個問題了。]]></description>
			<content:encoded><![CDATA[<p>在 Ubuntu 下面使用 SCIM 不論是 Eclipse 或是 Firefox 或是其他軟體，常常會有用到一半 SCIM 就沒有回應的情況(通常是視窗失去焦點之後再回來就會沒有回應)，除非把視窗關掉，或是調整視窗大小，或是重新啟動 SCIM 。但這樣不是個好解法，在 <a href="http://http://ubuntuforums.org/showpost.php?p=3676161&#038;postcount=6">Re: SCIM doesn&#8217;t work on Ubuntu Gutsy 7.10</a> 有提到解法：</p>
<p>安裝：<code>apt-get install scim-bridge</code></p>
<p>如果沒辦法安裝，則改：<code>apt-get install scim-bridge-client-gtk</code></p>
<p>接著編輯設定檔：<code>vim /etc/X11/xinit/xinput.d/scim</code></p>
<p>找到：<code>GTK_IM_MODULE=xim</code></p>
<p>換成：<code>GTK_IM_MODULE="scim-bridge"</code></p>
<p>然後重新啟動 SCIM 就可以解決這個問題了。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2009/07/ubuntu-9-04-%e4%b8%8b-scim-%e6%b2%92%e6%9c%89%e5%9b%9e%e6%87%89%e7%9a%84%e8%a7%a3%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VirtualBox 和 KVM 在 Linux 下衝突的問題</title>
		<link>http://blog.roga.tw/2009/07/virtualbox-%e5%92%8c-kvm-%e5%9c%a8-ubuntu-%e4%b8%8b%e8%a1%9d%e7%aa%81%e7%9a%84%e5%95%8f%e9%a1%8c/</link>
		<comments>http://blog.roga.tw/2009/07/virtualbox-%e5%92%8c-kvm-%e5%9c%a8-ubuntu-%e4%b8%8b%e8%a1%9d%e7%aa%81%e7%9a%84%e5%95%8f%e9%a1%8c/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 05:46:15 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2263</guid>
		<description><![CDATA[當安裝了 kvm module 之後，如果要啟動 VirtualBox 會出現必須先移除 kvm_intel 模組的訊息，原因是兩者都會增加 Kernel Module ，執行時會互相衝突，所以必須擇一移除，有以下幾種方法可以解決： 把 kvm_intel 加入 /etc/modprobe.d/blacklist.conf 裡面 rmmod kvm_intel modprobe -r kvm_intel p.s. 這是移除 kvm 模組的方法，VirtualBox 的模組名稱可以在 /proc/modules 裡面找到，移除之後要重新 make kernel 。]]></description>
			<content:encoded><![CDATA[<p>當安裝了 kvm module 之後，如果要啟動 VirtualBox 會出現必須先移除 kvm_intel 模組的訊息，原因是兩者都會增加 Kernel Module ，執行時會互相衝突，所以必須擇一移除，有以下幾種方法可以解決：<br />
<span id="more-2263"></span></p>
<ol>
<li><code>把 kvm_intel 加入 /etc/modprobe.d/blacklist.conf 裡面</code></li>
<li><code>rmmod kvm_intel</code></li>
<li><code>modprobe -r kvm_intel</code></li>
</ol>
<p>p.s. 這是移除 kvm 模組的方法，VirtualBox 的模組名稱可以在 /proc/modules 裡面找到，移除之後要重新 make kernel 。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2009/07/virtualbox-%e5%92%8c-kvm-%e5%9c%a8-ubuntu-%e4%b8%8b%e8%a1%9d%e7%aa%81%e7%9a%84%e5%95%8f%e9%a1%8c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>閒談壓力測試</title>
		<link>http://blog.roga.tw/2009/06/%e7%95%b6%e7%b6%b2%e8%b7%af%e6%87%89%e7%94%a8%e7%a8%8b%e5%bc%8f%e5%ae%8c%e6%88%90%e5%be%8c%ef%bc%8c%e6%87%89%e8%a9%b2%e8%a6%81%e9%80%b2%e8%a1%8c%e5%a3%93%e5%8a%9b%e6%b8%ac%e8%a9%a6%e3%80%82/</link>
		<comments>http://blog.roga.tw/2009/06/%e7%95%b6%e7%b6%b2%e8%b7%af%e6%87%89%e7%94%a8%e7%a8%8b%e5%bc%8f%e5%ae%8c%e6%88%90%e5%be%8c%ef%bc%8c%e6%87%89%e8%a9%b2%e8%a6%81%e9%80%b2%e8%a1%8c%e5%a3%93%e5%8a%9b%e6%b8%ac%e8%a9%a6%e3%80%82/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 16:36:56 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2255</guid>
		<description><![CDATA[當一個網路應用程式完成後，通常會進行壓力測試，所謂壓力測試就是以程式模擬使用者的點擊，對網路應用程式進行相同/不同的動作。創造出高負載，並以此找出 bottleneck 在哪邊。 對於 WebAPP 來說有幾套壓力測試軟體(可做 HTTP 的)非常知名，免費像是 ab, siege, jmeter, 還有 MS 的 Web Application Stress Tool 等等。 一開始我都用 ab 或是 siege 來做，之前也有玩過強大的 jmeter (因為支援 Proxy 側錄動作，對於要進行複雜一連串操作的測試來說，非常有幫助。) 在上述軟體中，最容易上手的大概就是 ab 了！這玩意兒一開始只有在 Linux 下有，不過後來 Apache Software Foundation 非常貼心地準備了 for Win 版本的 Apache ，當然也附帶了 ab.exe 讓 Windows 下的用戶使用。 講了這麼多，不是要和大家分享怎麼用，因為我剛剛找到一篇中文的教學文章，寫的不錯，在這邊貼上他的連結：The Will Will Web &#8211; 使用 ApacheBench 進行網站的壓力測試 。如果大家有興趣可以測試看看。 [...]]]></description>
			<content:encoded><![CDATA[<p>當一個網路應用程式完成後，通常會進行壓力測試，所謂壓力測試就是以程式模擬使用者的點擊，對網路應用程式進行相同/不同的動作。創造出高負載，並以此找出 bottleneck 在哪邊。<br />
<span id="more-2255"></span><br />
對於 WebAPP 來說有幾套壓力測試軟體(可做 HTTP 的)非常知名，免費像是 ab, siege, jmeter, 還有 MS 的 Web Application Stress Tool 等等。</p>
<p>一開始我都用 ab 或是 siege 來做，之前也有玩過強大的 jmeter (因為支援 Proxy 側錄動作，對於要進行複雜一連串操作的測試來說，非常有幫助。)</p>
<p>在上述軟體中，最容易上手的大概就是 ab 了！這玩意兒一開始只有在 Linux 下有，不過後來 Apache Software Foundation 非常貼心地準備了 for Win 版本的 Apache ，當然也附帶了 ab.exe 讓 Windows 下的用戶使用。</p>
<p>講了這麼多，不是要和大家分享怎麼用，因為我剛剛找到一篇中文的教學文章，寫的不錯，在這邊貼上他的連結：<a href="http://blog.miniasp.com/post/2008/06/Using-ApacheBench-ab-to-to-Web-stress-test.aspx">The Will Will Web  &#8211; 使用 ApacheBench 進行網站的壓力測試 </a>。如果大家有興趣可以測試看看。</p>
<p>如果覺得那篇文章太長的話，重點其實只有兩個：</p>
<ol>
<li>下載 <a href="http://ftp.mirror.tw/pub/apache/httpd/binaries/win32/apache_2.2.11-win32-x86-no_ssl.msi">Win32 Binary without crypto (no mod_ssl) (MSI Installer) </a>並且安裝</li>
<li>找出 ab.exe </li>
<li>範例：一次 1000 個連線，並且進行 1000 次，使用 Keep-Alive 方式連線。<pre class="crayon-plain-tag">ab.exe -n 1000 -c 1000 -k http://www.example.com/index.aspx</pre></li>
</ol>
<p>有寫好的 WebAPP 不妨進行壓力測試看看，設法找出 performance bottleneck <img src='http://blog.roga.tw/wp-includes/images/smilies/icon_smile.gif' alt=':smile:' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2009/06/%e7%95%b6%e7%b6%b2%e8%b7%af%e6%87%89%e7%94%a8%e7%a8%8b%e5%bc%8f%e5%ae%8c%e6%88%90%e5%be%8c%ef%bc%8c%e6%87%89%e8%a9%b2%e8%a6%81%e9%80%b2%e8%a1%8c%e5%a3%93%e5%8a%9b%e6%b8%ac%e8%a9%a6%e3%80%82/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>昨天半夜被 Google 擋掉</title>
		<link>http://blog.roga.tw/2009/06/%e6%98%a8%e5%a4%a9%e5%8d%8a%e5%a4%9c%e8%a2%ab-google-%e6%93%8b%e6%8e%89/</link>
		<comments>http://blog.roga.tw/2009/06/%e6%98%a8%e5%a4%a9%e5%8d%8a%e5%a4%9c%e8%a2%ab-google-%e6%93%8b%e6%8e%89/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 05:00:55 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2217</guid>
		<description><![CDATA[要問一個網站的 Pagerank 值可以透過這個方法得到： http://www.google.com/search?client=navclient-auto&#038;ch=67767091331025190914&#038;features=Rank&#038;q=info:http://sitestates.com 會得到一個內容會像是：Rank_1:1:8 (表示 PageRank =8)，這時候再用 explode 或是 regex 把 8 弄出來，就是你的 PR 值。 P.S. 第一個粗體標示的參數可以透過運算得到，方法這邊省略，第二個粗體標示的參數表示你想查詢網站的 URL 。 &#8211; 然後上面不是重點 &#8211; 當我們想知道大量 URL 的 PageRank 是多少時，就得想個辦法分批去問 Google 。因為同時開一堆連線去問 Google ，問不到一千次就會被擋掉 (吐 403 Forbidden 給你)，然後謝謝再聯絡。 所以很久以前，我設計了一個很簡單的快取機制：每次要顯示 PageRank 之前，都會先去檢查本地的 PageRank Cache 如果有 Cache 而且沒有 expire 的話，那就讀本地的 Cache 不要去打擾 Google， 如果那一筆 Cache 資料已經 Expire 掉了，那就乖乖去問 Google [...]]]></description>
			<content:encoded><![CDATA[<p>要問一個網站的 Pagerank 值可以透過這個方法得到：<br />
<span id="more-2217"></span><br />
<code>http://www.google.com/search?client=navclient-auto&#038;ch=6<strong>7767091331025190914</strong>&#038;features=Rank&#038;q=info:<strong>http://sitestates.com</strong></code></p>
<p>會得到一個內容會像是：Rank_1:1:8  (表示 PageRank =8)，這時候再用 explode 或是 regex 把 8 弄出來，就是你的 PR 值。</p>
<p>P.S. 第一個粗體標示的參數可以透過運算得到，方法這邊省略，第二個粗體標示的參數表示你想查詢網站的 URL 。</p>
<p>&#8211; 然後上面不是重點 &#8211;</p>
<p>當我們想知道大量 URL 的 PageRank 是多少時，就得想個辦法分批去問 Google 。因為同時開一堆連線去問 Google ，問不到一千次就會被擋掉 (吐 403 Forbidden 給你)，然後謝謝再聯絡。</p>
<p>所以很久以前，我設計了一個很簡單的快取機制：每次要顯示 PageRank 之前，都會先去檢查本地的 PageRank Cache 如果有 Cache 而且沒有 expire 的話，那就讀本地的 Cache 不要去打擾 Google， 如果那一筆 Cache 資料已經 Expire 掉了，那就乖乖去問 Google 新的 PageRank 是多少。</p>
<p>這是個好設計，不過壞就壞在我很懶惰，所以之前所有的 PR 都存硬碟的檔案系統中。(慘慘慘)</p>
<p>昨晚我想更動這個設計，把 PageRank 存到資料庫中，因為我懶得寫轉換程式，加上當時深夜了，腦袋不清楚，所以弄錯了一些地方，於是我就被 Google 檔掉了，接著我發揮鍥而不捨的精神，換個 IP 再來一次，然後我又被擋掉了。</p>
<p>就這樣，昨天懷著忐忑不安的心情入睡，今天早上到了公司還是很悶，忍不住偷偷再試了一下，沒想到 Google 已經自動幫我解開了(我超開心，這樣就不用寫信去道歉懺悔了，真是大好人啊啊啊，是看在我是初犯的份上嗎？ A_Ay )，因為 Google 放過了我，所以我乖乖寫了轉換程式，把硬碟裡面舊的資料全數轉換到資料庫中 (轉出三千多筆尚未過期的資料，這樣可以少問 Google 三千多次)，然後再故意把幾筆測試資料弄過期，以便測試，嗯！幾經折騰一切看起來都沒問題了&#8230;</p>
<p>感謝 Google 原諒我，我以後寫程式一定會先測試好再放到網路上的！</p>
<p><a href="http://gallery.roga.tw/d/37742-1/mysql.png" rel="lightbox"><img src="http://gallery.roga.tw/d/37743-2/mysql.png" alt="" /></a><br />
轉換後的結果</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2009/06/%e6%98%a8%e5%a4%a9%e5%8d%8a%e5%a4%9c%e8%a2%ab-google-%e6%93%8b%e6%8e%89/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>實在是太害羞了&#8230;</title>
		<link>http://blog.roga.tw/2009/06/%e5%af%a6%e5%9c%a8%e6%98%af%e5%a4%aa%e5%ae%b3%e7%be%9e%e4%ba%86/</link>
		<comments>http://blog.roga.tw/2009/06/%e5%af%a6%e5%9c%a8%e6%98%af%e5%a4%aa%e5%ae%b3%e7%be%9e%e4%ba%86/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 08:36:45 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2214</guid>
		<description><![CDATA[真的是太害羞了，我其實很久沒有 Google 自己了，沒想到一 Google 就發現了這篇文章：網頁攻擊的漏洞 &#8211; 是程式設計的錯 ? 還是你的錯 ? 其實這個 Vulnerability 是一個 known issue ，只是不好解，因為既有的使用者太多，要大家一一改網址不是很方便。至於不要用 auto_increment 的值來當 index 其實是個好建議，這可以降低被批次大量下載的機會，但還是防不了有心人一直下載同一張圖就是了。 (再強調一次把原本當作 index 的 ID 換成用另一組自己產生的 hash key 來查是個很好的作法 &#8211; 整篇文章的重點就在這兒) 針對這類問題，最好的解法是限制同一 IP 的流量或是連線數量，不過這可能要用到 Squid 算算術，太難了，以後再來研究&#8230; 最近有玩一下 CodeIgniter ，也趁機把架構改寫了，檢核機制應該比以前好很多(我是指被 XSS 或是 SQL Injection 的機率，但拜託不要因為這句話來爆破我)。我想應該未來幾年都可以基於這個架構做功能的增加 (WebMVC 的好處就是開發真的很快) 不過&#8230;俗話說「死道友不死貧道」，所以其實抵禦此類攻擊最佳解法是把主機託管 XD]]></description>
			<content:encoded><![CDATA[<p>真的是太害羞了，我其實很久沒有 Google 自己了，沒想到一 Google 就發現了這篇文章：<a href="http://blog.corausir.org/programing/ausir-870">網頁攻擊的漏洞 &#8211; 是程式設計的錯 ? 還是你的錯 ?</a><br />
<span id="more-2214"></span><br />
其實這個 Vulnerability 是一個 known issue ，只是不好解，因為既有的使用者太多，要大家一一改網址不是很方便。至於不要用 auto_increment 的值來當 index 其實是個好建議，這可以降低被批次大量下載的機會，但還是防不了有心人一直下載同一張圖就是了。</p>
<p>(再強調一次把原本當作 index 的 ID 換成用另一組自己產生的 hash key 來查是個很好的作法 &#8211; 整篇文章的重點就在這兒)</p>
<p>針對這類問題，最好的解法是限制同一 IP 的流量或是連線數量，不過這可能要用到<a href="http://admin.pixnet.net/blog/post/505742"> Squid 算算術</a>，太難了，以後再來研究&#8230;</p>
<p>最近有玩一下 CodeIgniter ，也趁機把架構改寫了，檢核機制應該比以前好很多(我是指被 XSS 或是 SQL Injection 的機率，但拜託不要因為這句話來爆破我)。我想應該未來幾年都可以基於這個架構做功能的增加 (WebMVC 的好處就是開發真的很快)</p>
<p>不過&#8230;俗話說「死道友不死貧道」，所以其實抵禦此類攻擊最佳解法是把主機託管 XD</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2009/06/%e5%af%a6%e5%9c%a8%e6%98%af%e5%a4%aa%e5%ae%b3%e7%be%9e%e4%ba%86/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>[note] Exchanging images with VirtualBox</title>
		<link>http://blog.roga.tw/2009/05/note-exchanging-images-with-virtualbox/</link>
		<comments>http://blog.roga.tw/2009/05/note-exchanging-images-with-virtualbox/#comments</comments>
		<pubDate>Thu, 28 May 2009 06:47:48 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2206</guid>
		<description><![CDATA[因為要把 VDI 檔匯出成 RAW Image 所以筆記一下步驟： Compact: VBoxManage modifyvdi /full/path/to/test.vdi compact Convert: VBoxManage internalcommands converttoraw file.vdi file.raw @see: http://en.wikibooks.org/wiki/QEMU/Images#Exchanging_images_with_VirtualBox]]></description>
			<content:encoded><![CDATA[<p>因為要把 VDI 檔匯出成 RAW Image 所以筆記一下步驟：<br />
<span id="more-2206"></span><br />
Compact:<br />
<code>VBoxManage modifyvdi /full/path/to/test.vdi compact</code><br />
Convert:<br />
<code>VBoxManage internalcommands  converttoraw file.vdi file.raw</code></p>
<p>@see: <a href="http://en.wikibooks.org/wiki/QEMU/Images#Exchanging_images_with_VirtualBox">http://en.wikibooks.org/wiki/QEMU/Images#Exchanging_images_with_VirtualBox</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2009/05/note-exchanging-images-with-virtualbox/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>在我的 VAIO 安裝 Ubuntu 9.04 (Jaunty Jackalope)</title>
		<link>http://blog.roga.tw/2009/05/%e5%9c%a8%e6%88%91%e7%9a%84-vaio-%e5%ae%89%e8%a3%9d-ubuntu-9-04-jaunty-jackalope/</link>
		<comments>http://blog.roga.tw/2009/05/%e5%9c%a8%e6%88%91%e7%9a%84-vaio-%e5%ae%89%e8%a3%9d-ubuntu-9-04-jaunty-jackalope/#comments</comments>
		<pubDate>Mon, 04 May 2009 04:09:33 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2191</guid>
		<description><![CDATA[上次安裝 Ubuntu 是 7.04 (Feisty Fawn) 的事情了，隔了幾年，因為工作上用不到，所以都沒在碰 Ubuntu 。這次從 OSWD.TW 拜拜回來之後，我就想在我的 VAIO 上面重新安裝 Ubuntu ，查了一下版號，發現已經進步到 9.04 (Jaunty Jackalope) 了！ 現在的 Ubuntu 支援&#8221;不切分割區直接安裝&#8221;的方式，簡單的說就是在 Windows 格式化好的分割區上面(例如 C:\)建立一個映像檔，類似虛擬機器，映像檔裡面儲存整個作業系統，然後在 Windows 的 Bootloader 載入開機程式的時候，換掉 Windows 原本的開機程式，改成 X:\wubildr.mbr 以進行接下來的開機作業。(這個玩意兒叫做 WUBI) 當然，這種作法對效能有些犧牲，檔案系統我記得也只能用預設的 EXT3，不過對於不想另外切分割區的 User 來說，是非常簡便安全的一種安裝方法。 用這種方法安裝好的 Ubuntu ，系統會把原本 Windows 的檔案掛載到 /host 下面，而且預設就已經支援 NTFS 的讀寫。 附上我的截圖一張：]]></description>
			<content:encoded><![CDATA[<p>上次安裝 Ubuntu 是 7.04 (Feisty Fawn) 的事情了，隔了幾年，因為工作上用不到，所以都沒在碰 Ubuntu 。這次從 OSWD.TW 拜拜回來之後，我就想在我的 VAIO 上面重新安裝 Ubuntu ，查了一下版號，發現已經進步到 9.04 (Jaunty Jackalope) 了！<br />
<span id="more-2191"></span><br />
現在的 Ubuntu 支援&#8221;不切分割區直接安裝&#8221;的方式，簡單的說就是在 Windows 格式化好的分割區上面(例如 C:\)建立一個映像檔，類似虛擬機器，映像檔裡面儲存整個作業系統，然後在 Windows 的 Bootloader 載入開機程式的時候，換掉 Windows 原本的開機程式，改成 X:\wubildr.mbr 以進行接下來的開機作業。(這個玩意兒叫做 WUBI)</p>
<p>當然，這種作法對效能有些犧牲，檔案系統我記得也只能用預設的 EXT3，不過對於不想另外切分割區的 User 來說，是非常簡便安全的一種安裝方法。</p>
<p>用這種方法安裝好的 Ubuntu ，系統會把原本 Windows 的檔案掛載到 /host 下面，而且預設就已經支援 NTFS 的讀寫。</p>
<p>附上我的截圖一張：<br />
<a href="http://gallery.roga.tw/d/37696-2/Screenshot_001.png" rel="lightbox"><img src="http://gallery.roga.tw/d/37697-4/Screenshot_001.png" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2009/05/%e5%9c%a8%e6%88%91%e7%9a%84-vaio-%e5%ae%89%e8%a3%9d-ubuntu-9-04-jaunty-jackalope/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>麻煩事&#8230;</title>
		<link>http://blog.roga.tw/2009/04/%e9%80%99%e5%85%a9%e5%a4%a9%e9%81%87%e5%88%b0%e7%9a%84%e9%ba%bb%e7%85%a9%e4%ba%8b%e6%83%85/</link>
		<comments>http://blog.roga.tw/2009/04/%e9%80%99%e5%85%a9%e5%a4%a9%e9%81%87%e5%88%b0%e7%9a%84%e9%ba%bb%e7%85%a9%e4%ba%8b%e6%83%85/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 09:06:21 +0000</pubDate>
		<dc:creator>roga</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.roga.tw/?p=2186</guid>
		<description><![CDATA[這兩天在重灌我的伺服器，花了不少精力！ 1. VirtualBox 不是很穩定，對記憶體的管理不好，很難讓 Guest 和 host 同時把記憶體用到極致，而且一旦發生錯誤，整個就 Crash 掉，正在認真考慮換成 VMWare ESXi 。 2. Lab3 BBS 的 tgz 檔沒有辦法完整解開，倒楣！ 3. Gallery2 的 DB 很愛出事，倒楣！ 4. snmp、Postfix、Shorewall、VSFTPD、bind..等等服務都還沒設定完 UPDATE.20090428: 結果把每個 guest 使用的記憶體降低到 2048MB ，系統就稍微穩了些，現在當機的原因我想主要還是 VirtualBox 對記憶體管理的問題。另外 VMWare ESXi 目前不支援我的主機板晶片組 (僅支援ICH10不支援ICH10R)，如果要支援必須再做一些修改&#8230;]]></description>
			<content:encoded><![CDATA[<p>這兩天在重灌我的伺服器，花了不少精力！<br />
<span id="more-2186"></span><br />
1. VirtualBox 不是很穩定，對記憶體的管理不好，很難讓 Guest 和 host 同時把記憶體用到極致，而且一旦發生錯誤，整個就 Crash 掉，正在認真考慮換成 VMWare ESXi 。</p>
<p>2. Lab3 BBS 的 tgz 檔沒有辦法完整解開，倒楣！</p>
<p>3. Gallery2 的 DB 很愛出事，倒楣！</p>
<p>4. snmp、Postfix、Shorewall、VSFTPD、bind..等等服務都還沒設定完</p>
<p><strong>UPDATE.20090428:</strong> 結果把每個 guest 使用的記憶體降低到 2048MB ，系統就稍微穩了些，現在當機的原因我想主要還是 VirtualBox 對記憶體管理的問題。另外 VMWare ESXi 目前不支援我的主機板晶片組 (僅支援ICH10不支援ICH10R)，如果要支援必須再做一些修改&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roga.tw/2009/04/%e9%80%99%e5%85%a9%e5%a4%a9%e9%81%87%e5%88%b0%e7%9a%84%e9%ba%bb%e7%85%a9%e4%ba%8b%e6%83%85/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

