<?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>韋伯d賽的Blog部落格-網路創業、免費架站軟體介紹、網站SEO教學、影像軟體技術、網頁設計大小事。</title>
	<atom:link href="http://www.webdsai.idv.tw/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.webdsai.idv.tw</link>
	<description>網路創業、免費架站軟體介紹、網站SEO教學、影像軟體技術、網頁設計大小事。</description>
	<lastBuildDate>Mon, 05 Sep 2011 03:51:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>PHP資料庫網站裡的文章或商品要更換排序</title>
		<link>http://www.webdsai.idv.tw/?p=2877</link>
		<comments>http://www.webdsai.idv.tw/?p=2877#comments</comments>
		<pubDate>Mon, 05 Sep 2011 03:46:54 +0000</pubDate>
		<dc:creator>韋伯d賽</dc:creator>
				<category><![CDATA[學習->PHP]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.webdsai.idv.tw/?p=2877</guid>
		<description><![CDATA[之前曾經寫過變換排序的文章，經過一段時間後，對於排序的方法有了較清析的想法。
當然主要還是要避免更換排序後，發生不可預期的錯誤。]]></description>
			<content:encoded><![CDATA[<p>之前曾經寫過變換排序的文章，經過一段時間後，對於排序的方法有了較清析的想法。<br />
當然主要還是要避免更換排序後，發生不可預期的錯誤。</p>
<p>為了讓觀念較清析，先使用最簡單的陣列來模擬。</p>
<p><span style="color: #ff0000;">解說1：</span><br />
先建立一個陣列，使用預設的數字索引，自動由0開始編號。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2877code1'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p28771"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2877code1"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'A'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'B'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'C'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'D'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'E'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><img src="http://www.webdsai.idv.tw/wp-content/uploads/2011/09/001.gif" alt="" title="001" width="134" height="175" class="alignnone size-full wp-image-2878" /></p>
<p>假設我們現在希望更換 C 的位置。<br />
<span style="color: #ff0000;">解說2：</span><br />
先使用array_search得到 C 的索引值，再使用unset刪除索引為2的值。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2877code2'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p28772"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2877code2"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$tmp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_search</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'C'</span><span style="color: #339933;">,</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$tmp</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><img src="http://www.webdsai.idv.tw/wp-content/uploads/2011/09/002.gif" alt="" title="002" width="134" height="140" class="alignnone size-full wp-image-2879" /></p>
<p><span style="color: #ff0000;">解說3：</span><br />
接下來，重新排列陣列，最簡單的方法就是把值倒到另一個新陣列。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2877code3'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p28773"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2877code3"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$b</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><img src="http://www.webdsai.idv.tw/wp-content/uploads/2011/09/003.gif" alt="" title="003" width="134" height="150" class="alignnone size-full wp-image-2880" /></p>
<p><span style="color: #ff0000;">解說4：</span><br />
假設我們希望把C插入第2個位置，可以使用array_splice()函式，說明如下：<br />
array_splice(參數1,參數2,參數3,參數4)<br />
參數1：陣列<br />
參數2：新位置，由0開始<br />
參數3：取代的數量，若為0則插入，1為取代1個值<br />
參數4：取代的值</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2877code4'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p28774"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2877code4"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">array_splice</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$b</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'C'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><img src="http://www.webdsai.idv.tw/wp-content/uploads/2011/09/004.gif" alt="" title="004" width="134" height="170" class="alignnone size-full wp-image-2881" /></p>
<p>當然實際運用時，到了最後必需再把新排序寫入資料庫中。<br />
可以運用在文章、商品排序中。<br />
例如以下的例子，就是希望可以隨時調整場次的順序。<br />
<img src="http://www.webdsai.idv.tw/wp-content/uploads/2011/09/005.gif" alt="" title="005" width="500" height="190" class="alignnone size-full wp-image-2882" /></p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=[推到twitter]PHP%E8%B3%87%E6%96%99%E5%BA%AB%E7%B6%B2%E7%AB%99%E8%A3%A1%E7%9A%84%E6%96%87%E7%AB%A0%E6%88%96%E5%95%86%E5%22%81%E8%A6%81%E6%9B%B4%E6%8F%9B%E6%8E%27%E5%BA%8Fwww.tinyurl.com/3hmvagg" title="推到Twitter"><img class="nothumb" src="http://www.webdsai.idv.tw/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a target="_blank" class="tt" href="http://twitter.com/home/?status=[推到twitter]PHP%E8%B3%87%E6%96%99%E5%BA%AB%E7%B6%B2%E7%AB%99%E8%A3%A1%E7%9A%84%E6%96%87%E7%AB%A0%E6%88%96%E5%95%86%E5%22%81%E8%A6%81%E6%9B%B4%E6%8F%9B%E6%8E%27%E5%BA%8Fwww.tinyurl.com/3hmvagg" title="推到Twitter">推到Twitter</a>&nbsp; <a target="_blank" class="tt" href="http://plurk.com/?status=[推到twitter]PHP%E8%B3%87%E6%96%99%E5%BA%AB%E7%B6%B2%E7%AB%99%E8%A3%A1%E7%9A%84%E6%96%87%E7%AB%A0%E6%88%96%E5%95%86%E5%22%81%E8%A6%81%E6%9B%B4%E6%8F%9B%E6%8E%27%E5%BA%8Fwww.tinyurl.com/3hmvagg" title="推到Plurk"><img class="nothumb" src="http://www.webdsai.idv.tw/wp-content/plugins/tweet-this/icons/tt-plurk.png" alt="[Post to Plurk]" border="0" /></a> <a target="_blank" class="tt" href="http://plurk.com/?status=[推到twitter]PHP%E8%B3%87%E6%96%99%E5%BA%AB%E7%B6%B2%E7%AB%99%E8%A3%A1%E7%9A%84%E6%96%87%E7%AB%A0%E6%88%96%E5%95%86%E5%22%81%E8%A6%81%E6%9B%B4%E6%8F%9B%E6%8E%27%E5%BA%8Fwww.tinyurl.com/3hmvagg" title="推到Plurk">推到Plurk</a>&nbsp; </p>]]></content:encoded>
			<wfw:commentRss>http://www.webdsai.idv.tw/?feed=rss2&amp;p=2877</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>更換UBUNTU的開機磁碟</title>
		<link>http://www.webdsai.idv.tw/?p=2871</link>
		<comments>http://www.webdsai.idv.tw/?p=2871#comments</comments>
		<pubDate>Tue, 19 Jul 2011 06:32:15 +0000</pubDate>
		<dc:creator>韋伯d賽</dc:creator>
				<category><![CDATA[學習->Linux 相關]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.webdsai.idv.tw/?p=2871</guid>
		<description><![CDATA[試了好幾天，終於完成Ubuntu的搬家動作了。
將原本的Ubuntu開機磁碟(sda7，20GB)，更換到較大的磁碟(sda10，106GB)。
將原本的家目錄(sda8，35GB)，更換到較大的磁碟(sda11，210GB)。]]></description>
			<content:encoded><![CDATA[<p>試了好幾天，終於完成Ubuntu的搬家動作了。</p>
<p>將原本的Ubuntu開機磁碟(sda7，20GB)，更換到較大的磁碟(sda10，106GB)。</p>
<p><img class="alignnone size-full wp-image-2872" title="2011-07-19-01" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/2011-07-19-01.gif" alt="" width="404" height="312" /></p>
<p>將原本的家目錄(sda8，35GB)，更換到較大的磁碟(sda11，210GB)。</p>
<p><img class="alignnone size-full wp-image-2873" title="2011-07-19-02" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/2011-07-19-02.gif" alt="" width="404" height="312" /></p>
<p>首先如同之前文章提到的方法：</p>
<ol>
<li>使用live cd進入系統，在/media中建立目錄並掛載。</li>
<li>將舊的根目錄和家目錄分別拷貝至新的磁碟機或分割區。</li>
<li>修改新根目錄(/media/掛載名稱)裡的/etc/fstab開機掛載的uuid。</li>
<li>然後再重新安裝grub2。</li>
</ol>
<p>關於重新安裝grub這件事，試過用修改的方式，但仍無法開機。</p>
<p>不過若是重新安裝grub的話，則可以正常進入系統。</p>
<p><span style="color: #ff0000;">以上是在同一台硬碟中不同的分割區中搬家，如果是搬家到不同的硬碟原理也相同。</span></p>
<p><span style="font-size: small;"><strong><span style="color: #ffff00;"><span style="background-color: #ff0000;">另外，如果是要修改grub，原本名稱為/boot/grub/menu.lst，現在已經改名為/boot/grub/grub.cfg。</span></span></strong></span></p>
<p>參考自己的文章&#8230;</p>
<p><strong><a title="Permanent Link to GRUB損毀無法開機，畫面顯示GRUB Loading stage1然後卡住" rel="bookmark" href="http://www.webdsai.idv.tw/?p=2860">GRUB損毀無法開機，畫面顯示GRUB LOADING STAGE1然後卡住</a></strong></p>
<h2><a title="Permanent Link to 增加Ubuntu的硬碟空間" rel="bookmark" href="http://www.webdsai.idv.tw/?p=2844">增加UBUNTU的硬碟空間</a></h2>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=[推到twitter]%E6%9B%B4%E6%8F%9BUBUNTU%E7%9A%84%E9%96%8B%E6%A9%9F%E7%A3%81%E7%A2%9Fwww.tinyurl.com/43mxgft" title="推到Twitter"><img class="nothumb" src="http://www.webdsai.idv.tw/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a target="_blank" class="tt" href="http://twitter.com/home/?status=[推到twitter]%E6%9B%B4%E6%8F%9BUBUNTU%E7%9A%84%E9%96%8B%E6%A9%9F%E7%A3%81%E7%A2%9Fwww.tinyurl.com/43mxgft" title="推到Twitter">推到Twitter</a>&nbsp; <a target="_blank" class="tt" href="http://plurk.com/?status=[推到twitter]%E6%9B%B4%E6%8F%9BUBUNTU%E7%9A%84%E9%96%8B%E6%A9%9F%E7%A3%81%E7%A2%9Fwww.tinyurl.com/43mxgft" title="推到Plurk"><img class="nothumb" src="http://www.webdsai.idv.tw/wp-content/plugins/tweet-this/icons/tt-plurk.png" alt="[Post to Plurk]" border="0" /></a> <a target="_blank" class="tt" href="http://plurk.com/?status=[推到twitter]%E6%9B%B4%E6%8F%9BUBUNTU%E7%9A%84%E9%96%8B%E6%A9%9F%E7%A3%81%E7%A2%9Fwww.tinyurl.com/43mxgft" title="推到Plurk">推到Plurk</a>&nbsp; </p>]]></content:encoded>
			<wfw:commentRss>http://www.webdsai.idv.tw/?feed=rss2&amp;p=2871</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GRUB損毀無法開機，畫面顯示GRUB Loading stage1然後卡住</title>
		<link>http://www.webdsai.idv.tw/?p=2860</link>
		<comments>http://www.webdsai.idv.tw/?p=2860#comments</comments>
		<pubDate>Fri, 15 Jul 2011 02:32:29 +0000</pubDate>
		<dc:creator>韋伯d賽</dc:creator>
				<category><![CDATA[學習->Linux 相關]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.webdsai.idv.tw/?p=2860</guid>
		<description><![CDATA[一時手賤...自己在系統中格式化了磁碟分割，導致GRUB損毀無法開機，畫面顯示GRUB Loading stage1然後就卡住了。
google許多網路上的文件，大多數都是使用以下方法：
使用live cd開機，然後開終端機執行grub]]></description>
			<content:encoded><![CDATA[<p>一時手賤&#8230;自己在系統中格式化了磁碟分割，導致GRUB損毀無法開機，畫面顯示GRUB Loading stage1然後就卡住了。</p>
<p>google許多網路上的文件，大多數都是使用以下方法：</p>
<p>使用live cd開機，然後開終端機執行grub</p>
<p>find /boot/grub/stage1</p>
<p>root (hd0,0)</p>
<p>setup(hd0)</p>
<p>quit</p>
<p><span style="color: #0000ff;">以上那個(hd0,0)的編號每個人的電腦設定不同。</span></p>
<p>但是重開機後還是無法解決&#8230;.。</p>
<p>國外的論壇有提到重新安裝GRUB，也有提到GRUB的stage1.5檔案有問題，要手動更名，但仍無法解決我的問題&#8230;。</p>
<p>就這樣，</p>
<p>試了5個小時後&#8230;.，</p>
<p>終於找到一篇文章提出另一種解法&#8230;.</p>
<p><span style="color: #ff0000;">安裝GRUB2</span></p>
<ol>
<li>一樣先進Live CD</li>
<li>然後建立一個目錄用來掛載原本安裝的Ubuntu系統碟</li>
<li>sudo mkdir /media/root</li>
<li>sudo mount /dev/sda8 /media/root ( sda8的編號每個人依狀況不同 )</li>
<li>sudo mount -t proc none /media/root/proc</li>
<li>sudo mount -o bind /dev /media/root/dev</li>
<li>sudo chroot /media/root</li>
<li>aptitude install grub2</li>
<li>grub-install /dev/sda</li>
<li>update-grub</li>
<li>reboot</li>
</ol>
<p><span style="color: #ff0000;">備註：如果無法執行 aptitude 和 grub 先用指令安裝。</span></p>
<p>然後重開後就可以看到GRUB的選單了，但看不到Windows。</p>
<p>原本網路上的方法是說修改/boot/grub/menu.lst，手動增加Windows的選項，但我找不到這個檔案，有可能使用的是GRUB2，所以配置不一樣。</p>
<p><img class="alignnone size-full wp-image-2861" title="012" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/012.gif" alt="" width="434" height="87" /></p>
<p>不過在Ubuntu裡，打開系統-&gt;管理-&gt;開機管理程式，執行後會自動增加Windows，下次重開就可以進Windows了。</p>
<p><img class="alignnone size-full wp-image-2862" title="013" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/013.gif" alt="" width="550" height="300" /></p>
<p>感謝主、感謝佛陀，感謝網友，一切恢復正常。</p>
<p>方法來源：<span style="color: #ff0000;">http://hi.baidu.com/txcode/blog/item/12109f226142a1fed7cae2f8.html</span></p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=[推到twitter]GRUB%E6%90%8D%E6%AF%80%E7%84%A1%E6%B3%95%E9%96%8B%E6%A9%9F%EF%BC%8C%E7%95%AB%E9%9D%A2%E9%A1%AF%E7%A4%BAGRUB+Loading+stage1%E7%84%B6%E5%BE%8C%E5%8D%A1%E4%BD%8Fwww.tinyurl.com/64ubmhf" title="推到Twitter"><img class="nothumb" src="http://www.webdsai.idv.tw/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a target="_blank" class="tt" href="http://twitter.com/home/?status=[推到twitter]GRUB%E6%90%8D%E6%AF%80%E7%84%A1%E6%B3%95%E9%96%8B%E6%A9%9F%EF%BC%8C%E7%95%AB%E9%9D%A2%E9%A1%AF%E7%A4%BAGRUB+Loading+stage1%E7%84%B6%E5%BE%8C%E5%8D%A1%E4%BD%8Fwww.tinyurl.com/64ubmhf" title="推到Twitter">推到Twitter</a>&nbsp; <a target="_blank" class="tt" href="http://plurk.com/?status=[推到twitter]GRUB%E6%90%8D%E6%AF%80%E7%84%A1%E6%B3%95%E9%96%8B%E6%A9%9F%EF%BC%8C%E7%95%AB%E9%9D%A2%E9%A1%AF%E7%A4%BAGRUB+Loading+stage1%E7%84%B6%E5%BE%8C%E5%8D%A1%E4%BD%8Fwww.tinyurl.com/64ubmhf" title="推到Plurk"><img class="nothumb" src="http://www.webdsai.idv.tw/wp-content/plugins/tweet-this/icons/tt-plurk.png" alt="[Post to Plurk]" border="0" /></a> <a target="_blank" class="tt" href="http://plurk.com/?status=[推到twitter]GRUB%E6%90%8D%E6%AF%80%E7%84%A1%E6%B3%95%E9%96%8B%E6%A9%9F%EF%BC%8C%E7%95%AB%E9%9D%A2%E9%A1%AF%E7%A4%BAGRUB+Loading+stage1%E7%84%B6%E5%BE%8C%E5%8D%A1%E4%BD%8Fwww.tinyurl.com/64ubmhf" title="推到Plurk">推到Plurk</a>&nbsp; </p>]]></content:encoded>
			<wfw:commentRss>http://www.webdsai.idv.tw/?feed=rss2&amp;p=2860</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>增加Ubuntu的硬碟空間</title>
		<link>http://www.webdsai.idv.tw/?p=2844</link>
		<comments>http://www.webdsai.idv.tw/?p=2844#comments</comments>
		<pubDate>Fri, 15 Jul 2011 02:09:21 +0000</pubDate>
		<dc:creator>韋伯d賽</dc:creator>
				<category><![CDATA[學習->Linux 相關]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.webdsai.idv.tw/?p=2844</guid>
		<description><![CDATA[我工作用的電腦是安裝雙系統，Ubuntu 系統只佔了20Gb，Ubuntu的家目錄佔了35Gb。
現在想增加Ubuntu家目錄的空間，應該講搬家...。]]></description>
			<content:encoded><![CDATA[<p>我工作用的電腦是安裝雙系統，Ubuntu 系統只佔了20Gb，Ubuntu的家目錄佔了35Gb。</p>
<p>不過大部份時間都在Ubuntu下寫程式，結果空間開始不夠用了。</p>
<p>現在想增加Ubuntu家目錄的空間，應該講搬家&#8230;。</p>
<p><a href="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/001.gif"><img class="alignnone size-medium wp-image-2845" title="001" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/001-300x146.gif" alt="" width="300" height="146" /></a></p>
<p>打開/etc/fstab，將原本開機時要掛載的SOFT碟註解掉，讓它下次開機不掛載。</p>
<p>然後重新開機，或取消它的掛載。</p>
<p><a href="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/0021.gif"><img class="alignnone size-medium wp-image-2856" title="002" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/0021-300x158.gif" alt="" width="300" height="158" /></a></p>
<p>用磁碟公用程式格式化成ext4的格式。</p>
<p><img class="alignnone size-full wp-image-2847" title="003" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/003.gif" alt="" width="368" height="341" /></p>
<p>使用Ubuntu的檔案總管，可以看到原本的SOFT不見了，多了一個106Gb檔案系統。</p>
<p><img class="alignnone size-full wp-image-2848" title="004" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/004.gif" alt="" width="276" height="372" /></p>
<p>然後手動掛載這個106Gb檔案系統，在media或用mount指令掛載。</p>
<p><img class="alignnone size-full wp-image-2849" title="005" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/005.gif" alt="" width="372" height="340" /></p>
<p>使用root身份將目前的home目錄拷貝到106Gb檔案系統裡，要用sudo cp -a 來源 目地，拷貝過去的權限要一樣。</p>
<p><a href="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/006.gif"><img class="alignnone size-full wp-image-2850" title="006" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/006.gif" alt="" width="580" height="127" /></a></p>
<p>然後在編輯/etc/fstab 將原本開機所掛載的/home改為新的磁碟。</p>
<p><a href="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/007.gif"><img class="alignnone size-medium wp-image-2851" title="007" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/007-300x198.gif" alt="" width="300" height="198" /></a></p>
<p>原本只剩下16.7Gb，重新開機後&#8230;</p>
<p><img class="alignnone size-full wp-image-2852" title="008" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/008.gif" alt="" width="301" height="27" /></p>
<p>/home目錄變成78.1Gb了。</p>
<p><img class="alignnone size-full wp-image-2853" title="009" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/009.gif" alt="" width="220" height="26" /></p>
<p><span style="color: #ff0000;">註：要看磁碟的UUID編號，可用指令 ls -l /dev/disk/by-uuid</span></p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=[推到twitter]%E5%A2%9E%E5%8A%A0Ubuntu%E7%9A%84%E7%A1%AC%E7%A2%9F%E7%A9%BA%E9%96%22www.tinyurl.com/6a6p6aa" title="推到Twitter"><img class="nothumb" src="http://www.webdsai.idv.tw/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a target="_blank" class="tt" href="http://twitter.com/home/?status=[推到twitter]%E5%A2%9E%E5%8A%A0Ubuntu%E7%9A%84%E7%A1%AC%E7%A2%9F%E7%A9%BA%E9%96%22www.tinyurl.com/6a6p6aa" title="推到Twitter">推到Twitter</a>&nbsp; <a target="_blank" class="tt" href="http://plurk.com/?status=[推到twitter]%E5%A2%9E%E5%8A%A0Ubuntu%E7%9A%84%E7%A1%AC%E7%A2%9F%E7%A9%BA%E9%96%22www.tinyurl.com/6a6p6aa" title="推到Plurk"><img class="nothumb" src="http://www.webdsai.idv.tw/wp-content/plugins/tweet-this/icons/tt-plurk.png" alt="[Post to Plurk]" border="0" /></a> <a target="_blank" class="tt" href="http://plurk.com/?status=[推到twitter]%E5%A2%9E%E5%8A%A0Ubuntu%E7%9A%84%E7%A1%AC%E7%A2%9F%E7%A9%BA%E9%96%22www.tinyurl.com/6a6p6aa" title="推到Plurk">推到Plurk</a>&nbsp; </p>]]></content:encoded>
			<wfw:commentRss>http://www.webdsai.idv.tw/?feed=rss2&amp;p=2844</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>即時產生圖表與事先產生圖表</title>
		<link>http://www.webdsai.idv.tw/?p=2833</link>
		<comments>http://www.webdsai.idv.tw/?p=2833#comments</comments>
		<pubDate>Tue, 05 Jul 2011 01:25:46 +0000</pubDate>
		<dc:creator>韋伯d賽</dc:creator>
				<category><![CDATA[學習->PHP]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.webdsai.idv.tw/?p=2833</guid>
		<description><![CDATA[又學到一個經驗了，關於系統效能與方便。原本的圖表產生方式是由後台輸入數值...]]></description>
			<content:encoded><![CDATA[<p>又學到一個經驗了，關於系統效能與方便性的選擇。</p>
<p>原本的圖表產生方式是由後台輸入數值，</p>
<p><img class="alignnone size-full wp-image-2835" title="2011-07-05-05" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/2011-07-05-05.gif" alt="" width="550" height="249" /></p>
<p>然後網友在前台觀看時，動態產生檔案，檔名是使用資料表中的id名稱命名，所以是數字，</p>
<p><img class="alignnone size-full wp-image-2836" title="2011-07-05-06" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/2011-07-05-06.gif" alt="" width="277" height="248" /></p>
<p>前台再透過html語法把圖叫出來。</p>
<p><img title="2011-07-05-04" src="../wp-content/uploads/2011/07/2011-07-05-04.gif" alt="" width="213" height="250" /></p>
<p>但是，後來發現這種作法有個問題。</p>
<p>就是每一次的瀏覽都會產生一次圖片，不管數值有沒有不同。所以同時間如果有多人瀏覽，可能會造成系統效能降低。</p>
<p>只好把它修改成：</p>
<p>前台單純只叫圖，在後台多做一個產生「新圖表」的按鈕，點了按鈕，才會運作產生圖表的函數。</p>
<p><img class="alignnone size-full wp-image-2837" title="2011-07-05-07" src="http://www.webdsai.idv.tw/wp-content/uploads/2011/07/2011-07-05-07.gif" alt="" width="550" height="179" /></p>
<p>不過，做完後又發現一個新問題！</p>
<p>瀏覽器會有暫存檔案，變成有些使用者要按 F5 才能讀到新的圖表。</p>
<p>再修改，前台叫出圖片的php函數裡最前面加上以下程式碼：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2833code5'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p28335"><td class="code" id="p2833code5"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control: no-cache, must-revalidate&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Expires: Mon, 26 Jul 1997 05:00:00 GMT&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>這樣就用戶就不用一直按 F5 重新整理了。</p>
<p>只是網站後台管理者，要自己記得按「產生新圖表」。</p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=[推到twitter]%E5%8D%B3%E6%99%82%E7%22%A2%E7%22%9F%E5%9C%96%E8%A1%A8%E8%88%87%E4%BA%8B%E5%85%88%E7%22%A2%E7%22%9F%E5%9C%96%E8%A1%A8www.tinyurl.com/3jpj348" title="推到Twitter"><img class="nothumb" src="http://www.webdsai.idv.tw/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a target="_blank" class="tt" href="http://twitter.com/home/?status=[推到twitter]%E5%8D%B3%E6%99%82%E7%22%A2%E7%22%9F%E5%9C%96%E8%A1%A8%E8%88%87%E4%BA%8B%E5%85%88%E7%22%A2%E7%22%9F%E5%9C%96%E8%A1%A8www.tinyurl.com/3jpj348" title="推到Twitter">推到Twitter</a>&nbsp; <a target="_blank" class="tt" href="http://plurk.com/?status=[推到twitter]%E5%8D%B3%E6%99%82%E7%22%A2%E7%22%9F%E5%9C%96%E8%A1%A8%E8%88%87%E4%BA%8B%E5%85%88%E7%22%A2%E7%22%9F%E5%9C%96%E8%A1%A8www.tinyurl.com/3jpj348" title="推到Plurk"><img class="nothumb" src="http://www.webdsai.idv.tw/wp-content/plugins/tweet-this/icons/tt-plurk.png" alt="[Post to Plurk]" border="0" /></a> <a target="_blank" class="tt" href="http://plurk.com/?status=[推到twitter]%E5%8D%B3%E6%99%82%E7%22%A2%E7%22%9F%E5%9C%96%E8%A1%A8%E8%88%87%E4%BA%8B%E5%85%88%E7%22%A2%E7%22%9F%E5%9C%96%E8%A1%A8www.tinyurl.com/3jpj348" title="推到Plurk">推到Plurk</a>&nbsp; </p>]]></content:encoded>
			<wfw:commentRss>http://www.webdsai.idv.tw/?feed=rss2&amp;p=2833</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

