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

<channel>
	<title>雨季來了 &#187; 程式設計</title>
	<atom:link href="http://blog.pptpb.org/category/working/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.pptpb.org</link>
	<description>那就可以開始期待下一個天晴了。</description>
	<lastBuildDate>Sun, 04 Sep 2011 11:52:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>link notes</title>
		<link>http://blog.pptpb.org/2010/08/21/337/link-notes</link>
		<comments>http://blog.pptpb.org/2010/08/21/337/link-notes#comments</comments>
		<pubDate>Sat, 21 Aug 2010 00:14:43 +0000</pubDate>
		<dc:creator>pptpb</dc:creator>
				<category><![CDATA[程式設計]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[網站]]></category>

		<guid isPermaLink="false">http://blog.pptpb.org/?p=337</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top: 60%;
left: 70px;
}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;

padding-bottom:2px;
}


#bottomcontainerBox {
height: 30px;
width:50%;
padding-top:1px;
}

#bottomcontainerBox .buttons {
float:left;
height: 30px;
margin:4px 4px 4px 4px;
}

</style>
整理一些要看的文章連結。 HTML5 HTML5 技術體系, HTML5 的現況 HTML5ROCKS, [HTML5 presentation] HTML5 預設模板 TOSSUG HTML5 分享補充 PHP Kirby : A clean PHP Toolkit PHP調試技術手冊 CSS CSS3 playground CSS Sticky Footer]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top: 60%;
left: 70px;
}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;

padding-bottom:2px;
}


#bottomcontainerBox {
height: 30px;
width:50%;
padding-top:1px;
}

#bottomcontainerBox .buttons {
float:left;
height: 30px;
margin:4px 4px 4px 4px;
}

</style>
<p>整理一些要看的文章連結。</p>
<ul>
<li>HTML5
<ul>
<li><a href="http://ccckmit.wikidot.com/html5:main" class="external external">HTML5 技術體系</a>, <a href="http://ccckmit.wikidot.com/html5:now" >HTML5 的現況</a></li>
<li><a href="http://www.html5rocks.com/" class="external external">HTML5ROCKS</a>, [<a href="http://slides.html5rocks.com/" >HTML5 presentation</a>]</li>
<li><a href="http://html5boilerplate.com/" class="external">HTML5 預設模板</a></li>
<li><a href="http://blog.othree.net/log/2010/07/24/tossug-html5-talk/" class="external">TOSSUG HTML5 分享補充</a></li>
</ul>
</li>
<li>PHP
<ul>
<li><a rel="nofollow" href="http://getkirby.com/" class="external">Kirby : A clean PHP Toolkit</a></li>
<li><a rel="nofollow" href="http://www.laruence.com/2010/06/21/1608.html" class="external">PHP調試技術手冊</a></li>
</ul>
</li>
<li>CSS
<ul>
<li><a href="http://css3.mikeplate.com/" class="external">CSS3 playground</a></li>
<li><a rel="nofollow" href="http://www.cssstickyfooter.com/" class="external">CSS Sticky Footer</a></li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.pptpb.org/2010/08/21/337/link-notes/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>實做 Web-UI ftp browser (Apache, PHP, Perl)</title>
		<link>http://blog.pptpb.org/2010/05/18/200/%e5%af%a6%e5%81%9a-web-ui-ftp-browser-apache-php-perl</link>
		<comments>http://blog.pptpb.org/2010/05/18/200/%e5%af%a6%e5%81%9a-web-ui-ftp-browser-apache-php-perl#comments</comments>
		<pubDate>Tue, 18 May 2010 00:23:48 +0000</pubDate>
		<dc:creator>pptpb</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[程式設計]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.pptpb.org/?p=200</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top: 60%;
left: 70px;
}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;

padding-bottom:2px;
}


#bottomcontainerBox {
height: 30px;
width:50%;
padding-top:1px;
}

#bottomcontainerBox .buttons {
float:left;
height: 30px;
margin:4px 4px 4px 4px;
}

</style>
這篇只是當作 comment 用，因為我實在沒有邊 coding 邊寫 comment 的習慣。 狀況提要 幫某個團體架設的 ftp 站，以 pure-ftpd 管理，並使用 utf-8 編碼。但使用成員大多不熟悉 ftp client 使用，就算會用也因為編碼問題常常看到亂碼。 想法 於是上個週末用一個晚上試著寫寫看能不能利用 Web browser 實做 ftp 瀏覽 (read only) 的功能。我知道 Apache 有 Options Indexes 的功能，搭配基本的認證可以達到限定特定使用者存取，但因此法的帳號密碼會被瀏覽器 cache 住，且也無法登出，所以才想自行動手。 作法 先用 Perl (cgi like) &#8230; <a href="http://blog.pptpb.org/2010/05/18/200/%e5%af%a6%e5%81%9a-web-ui-ftp-browser-apache-php-perl">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top: 60%;
left: 70px;
}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;

padding-bottom:2px;
}


#bottomcontainerBox {
height: 30px;
width:50%;
padding-top:1px;
}

#bottomcontainerBox .buttons {
float:left;
height: 30px;
margin:4px 4px 4px 4px;
}

</style>
<p>這篇只是當作 comment 用，因為我實在沒有邊 coding 邊寫 comment 的習慣。</p>
<h4>狀況提要</h4>
<p>幫某個團體架設的 ftp 站，以 <a href="http://www.pureftpd.org" class="external">pure-ftpd</a> 管理，並使用 utf-8 編碼。但使用成員大多不熟悉 ftp client 使用，就算會用也因為編碼問題常常看到亂碼。</p>
<h4>想法</h4>
<p>於是上個週末用一個晚上試著寫寫看能不能利用 Web browser 實做 ftp 瀏覽 (read only) 的功能。我知道 Apache 有<a href="http://httpd.apache.org/docs/1.3/mod/core.html#options" class="external external"> Options Indexes</a> 的功能，搭配基本的<a href="http://httpd.apache.org/docs/1.3/howto/auth.html" >認證</a>可以達到限定特定使用者存取，但因此法的帳號密碼會<a href="http://httpd.apache.org/docs/1.3/howto/auth.html#basicworks" class="external external">被瀏覽器 cache 住</a>，且也<a title="Apache: How do I logout?" href="http://httpd.apache.org/docs/1.3/howto/auth.html#logout" >無法登出</a>，所以才想自行動手。<span id="more-200"></span></p>
<h4>作法</h4>
<p>先用 Perl (cgi like) 實做 file listing 與 directory traversal 的基本操作，再以 PHP session 檢查使用者是否已登入，決定是否開放頁面存取。</p>
<h4>問題解決</h4>
<ol>
<li>使用 Apache <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html">mod_rewrite</a> 蓋掉PHP內部的 get method sending，使瀏覽網址與實際使用 ftp 時所見目錄路徑一致。</li>
<li>ftp 實際檔案位置不應放在網頁伺服器根路徑下，否則知道檔案路徑的人就能抓到檔案。下載檔案時使用 PHP <a href="http://php.net/manual/en/function.readfile.php" class="external">readfile()</a> 處理。但 readfile 遇到大檔案時有 buffer 限制，要注意一下。</li>
<li>承上，因為放不同路徑，所以檔案讀取權限要設定一下，讓 ftp 與 www server 能同時讀取檔案。（該伺服器架在 Fedora 上，設權限時其實遇到了些懸疑困難，我到現在還是不知道為什麼。後來是用有點 dirty 的方法解掉。）</li>
<li>避免未登入使用者得知Perl程式路徑而直接讀取，該 script 不放在 cgi-bin 目錄下，而是另外存放，以 PHP <a href="http://php.net/manual/en/function.system.php" class="external">system()</a> 呼叫。</li>
</ol>
<h4>改進</h4>
<ol>
<li>使用<a href="http://tinyurl.com" class="external"> Tinyurl</a> 的服務，讓每個網頁、檔案都能取得縮址，方便到其他地方（BBS, &#8230;）貼上與團體內部分享。</li>
<li>Perl script 部份有空應該改用 Apache <a href="http://perl.apache.org/docs/" class="external">mod_perl</a> 處理。</li>
<li>有時間再加個上傳功能吧，但上面提到的檔案權限問題其實有點棘手。</li>
</ol>
<h4>後記</h4>
<p>早知道這篇寫得那麼落落長，我當初就應該乖乖地寫 comment&#8230;</p>
<p>Screenshot:</p>
<p><a href="http://blog.pptpb.org/wp-content/uploads/2010/05/snapshot17.png" rel="lightbox[200]"><img class="alignnone size-medium wp-image-208" title="snapshot" src="http://blog.pptpb.org/wp-content/uploads/2010/05/snapshot17-300x225.png" alt="" width="300" height="225" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pptpb.org/2010/05/18/200/%e5%af%a6%e5%81%9a-web-ui-ftp-browser-apache-php-perl/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C array 初始化</title>
		<link>http://blog.pptpb.org/2006/10/12/75/c-array-%e5%88%9d%e5%a7%8b%e5%8c%96</link>
		<comments>http://blog.pptpb.org/2006/10/12/75/c-array-%e5%88%9d%e5%a7%8b%e5%8c%96#comments</comments>
		<pubDate>Thu, 12 Oct 2006 06:45:19 +0000</pubDate>
		<dc:creator>pptpb</dc:creator>
				<category><![CDATA[程式設計]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[電腦資訊]]></category>

		<guid isPermaLink="false">http://pptpb.folk.tw/?p=75</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top: 60%;
left: 70px;
}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;

padding-bottom:2px;
}


#bottomcontainerBox {
height: 30px;
width:50%;
padding-top:1px;
}

#bottomcontainerBox .buttons {
float:left;
height: 30px;
margin:4px 4px 4px 4px;
}

</style>
從在臺大唸研究所的同學那兒看來的，非常神奇的對 C 陣列作初始化的方法。 int main() { int x[10] = { [1]=2, [9]=7, [6]=4, [3]=1, [0]=5, [2]=8, [4]=9, [5]=6, [7]=0, [8]=3, }; int i; for (i = 0; i &#60; 10; i++) printf("x[%d]=%d\n", i, x[i]); return 0; } 結果： x[0]=5 x[1]=2 &#8230; <a href="http://blog.pptpb.org/2006/10/12/75/c-array-%e5%88%9d%e5%a7%8b%e5%8c%96">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
float:left;
position: fixed;
top: 60%;
left: 70px;
}

#leftcontainerBox .buttons {
float:left;
clear:both;
margin:4px 4px 4px 4px;

padding-bottom:2px;
}


#bottomcontainerBox {
height: 30px;
width:50%;
padding-top:1px;
}

#bottomcontainerBox .buttons {
float:left;
height: 30px;
margin:4px 4px 4px 4px;
}

</style>
<p>從在臺大唸研究所的同學那兒看來的，非常神奇的對 C 陣列作初始化的方法。<br />
<span id="more-75"></span><br />
int main()<br />
{<br />
int x[10] =<br />
{<br />
[1]=2, [9]=7, [6]=4, [3]=1, [0]=5,<br />
[2]=8, [4]=9, [5]=6, [7]=0, [8]=3,<br />
};</p>
<p>int i;<br />
for (i = 0; i &lt; 10; i++)<br />
printf("x[%d]=%d\n", i, x[i]);</p>
<p>return 0;<br />
}</p>
<p>結果：<br />
x[0]=5<br />
x[1]=2<br />
x[2]=8<br />
x[3]=1<br />
x[4]=9<br />
x[5]=6<br />
x[6]=4<br />
x[7]=0<br />
x[8]=3<br />
x[9]=7</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pptpb.org/2006/10/12/75/c-array-%e5%88%9d%e5%a7%8b%e5%8c%96/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

