<?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; Java</title>
	<atom:link href="http://blog.frost.tw/tag/java/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.frost.tw</link>
	<description>夢醒之時，驚覺一切都是虛幻。前行吧！迷途者。</description>
	<lastBuildDate>Wed, 26 Oct 2011 13:28:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<atom:link rel='hub' href='http://blog.frost.tw/?pushpress=hub'/>
		<item>
		<title>Comet Caht on GAE 筆記</title>
		<link>http://blog.frost.tw/code/poston-2010-10-21/postid-777</link>
		<comments>http://blog.frost.tw/code/poston-2010-10-21/postid-777#comments</comments>
		<pubDate>Thu, 21 Oct 2010 11:11:00 +0000</pubDate>
		<dc:creator>蒼時弦や</dc:creator>
				<category><![CDATA[程式語言]]></category>
		<category><![CDATA[Comet]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[程式]]></category>

		<guid isPermaLink="false">http://blog.frost.tw/?p=777</guid>
		<description><![CDATA[昨晚默默的把Core寫出一個雛型。 雖然不知道在 Http Servlet 上用 loop 去延遲Response是否有效。 不過，也算是在基本狀況上完成了模型。 而架構，大致上就如昨天的網誌紀錄一樣。 今天則是概述我做的處理。 經過實做之後，主要做了一些調整。 因為是個簡單的 Chat Room 所以就只有兩個檔案去完成。 chatCore.java 與 User.java 兩個。 chatCore物件繼承HttpServlet並且重寫doGet方法。 在doGet方法中，我又針對請求的網址做了另外處理。 （在Web設定中有 /join , /get , /quit , /post 四個路徑。） 當然，首要就是分辨是哪個路徑。 因此從HttpServletRequest物件路徑資料並且加以處理。 目前僅將 join 方法實做。 當開啟 /join 路徑時，則呼叫 join 方法。 &#8230; <a href="http://blog.frost.tw/code/poston-2010-10-21/postid-777">Continue reading <span class="meta-nav">&#8594;</span></a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-10-20%2Fpostid-776&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-10-21%2Fpostid-777">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java的物件導向與Comet</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-10-30%2Fpostid-800&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-10-21%2Fpostid-777">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Node.js 的 Comet Chat</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-01%2Fpostid-683&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-10-21%2Fpostid-777">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GAE (Java) 的 HttpServlet 和 UrlFetch API</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-10-21%2Fpostid-777">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[GAE] 研究 Json 的使用 on JAVA</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>昨晚默默的把Core寫出一個雛型。<br />
雖然不知道在 Http Servlet 上用 loop 去延遲Response是否有效。<br />
不過，也算是在基本狀況上完成了模型。</p>
<p>而架構，大致上就如昨天的網誌紀錄一樣。<br />
今天則是概述我做的處理。<br />
<span id="more-777"></span><br />
經過實做之後，主要做了一些調整。<br />
因為是個簡單的 Chat Room 所以就只有兩個檔案去完成。<br />
chatCore.java 與 User.java 兩個。</p>
<p>chatCore物件繼承HttpServlet並且重寫doGet方法。<br />
在doGet方法中，我又針對請求的網址做了另外處理。<br />
（在Web設定中有 /join , /get , /quit , /post 四個路徑。）<br />
當然，首要就是分辨是哪個路徑。<br />
因此從HttpServletRequest物件路徑資料並且加以處理。</p>
<p>目前僅將 join 方法實做。<br />
當開啟 /join 路徑時，則呼叫 join 方法。</p>
<pre class="brush:java">public static int join(String username){
  User session = new User(username);
  sessions.add(session);
  return sessions.indexOf(session);
}
</pre>
<p>也就只是「建立一個 User 物件」<br />
不過我想之後對 Session 的處理會依靠 HttpServelt 來處理「客戶端可更動使用者」的問題。</p>
<p>而 User 物件就只有簡單的建構式，並且紀錄username而已。</p>
<p>在Java上，其static和共用進程的方式。<br />
跟PHP比起來，可以節省更多資源。<br />
這算是我在Java上開發Comet Chat時感受到的方便性吧！</p>
<p>期待我完成的那一天。<br />
（如果有颱風假，大概就會完成吧……）<!-- PHP 5.x --></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-10-20%2Fpostid-776&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-10-21%2Fpostid-777">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java的物件導向與Comet</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-10-30%2Fpostid-800&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-10-21%2Fpostid-777">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Node.js 的 Comet Chat</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-01%2Fpostid-683&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-10-21%2Fpostid-777">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GAE (Java) 的 HttpServlet 和 UrlFetch API</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-10-21%2Fpostid-777">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[GAE] 研究 Json 的使用 on JAVA</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.frost.tw/code/poston-2010-10-21/postid-777/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java 聊天室製作進度 &#8211; 伺服端</title>
		<link>http://blog.frost.tw/life/poston-2010-09-25/postid-724</link>
		<comments>http://blog.frost.tw/life/poston-2010-09-25/postid-724#comments</comments>
		<pubDate>Sat, 25 Sep 2010 11:15:48 +0000</pubDate>
		<dc:creator>蒼時弦や</dc:creator>
				<category><![CDATA[生活雜記]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[生活]]></category>
		<category><![CDATA[程式]]></category>

		<guid isPermaLink="false">http://blog.frost.tw/?p=724</guid>
		<description><![CDATA[如果記憶沒錯，我應該是昨晚開始寫 Java 聊天室的。 今天上午，終於把簡易的伺服端完成了！ 我的Java路徑，大致上為 入門 &#62; 中斷 &#62; 入門加強 &#62; Socket Server &#62; 文字編輯器(Swing) &#62; Java 聊天室 雖然目前還有部份沒辦法靠自己。 不過，比起上次寫 Socket 來說，算是進步不少了！ 這次的 Java 聊天室有加上 GUI 的功能。 之前寫Socket Server 時，因為沒有 GUI Client 的關係，部份網友沒有玩到。 而且使用 Telnet 連線，還會有各種奇異的現象。 這次，我決定用 Swing 當作建構 GUI &#8230; <a href="http://blog.frost.tw/life/poston-2010-09-25/postid-724">Continue reading <span class="meta-nav">&#8594;</span></a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">一個 Java 的啟發！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 修煉之路</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[GAE] 研究 Json 的使用 on JAVA</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>如果記憶沒錯，我應該是昨晚開始寫 Java 聊天室的。<br />
今天上午，終於把簡易的伺服端完成了！</p>
<p>我的Java路徑，大致上為 入門 &gt; 中斷 &gt; 入門加強 &gt; Socket Server &gt; 文字編輯器(Swing) &gt; Java 聊天室<br />
雖然目前還有部份沒辦法靠自己。<br />
不過，比起上次寫 Socket 來說，算是進步不少了！<br />
<span id="more-724"></span><br />
這次的 Java 聊天室有加上 GUI 的功能。<br />
之前寫Socket Server 時，因為沒有 GUI Client 的關係，部份網友沒有玩到。<br />
而且使用 Telnet 連線，還會有各種奇異的現象。</p>
<p>這次，我決定用 Swing 當作建構 GUI 的方法，來開發聊天室。<br />
目前已經將 Server 端完成了！<br />
目前我實做出來的功能大致有這些：</p>
<ol>
<li>多人連線（基本）</li>
<li>自訂 Port （創建時詢問）</li>
<li>設定暱稱（指令方式）</li>
</ol>
<p>其實很功能很簡易，我想在我把 Client 端做出來後，還會加上線上列表吧！</p>
<p>而且我在過程中，又發現了不少我概念不清楚的地方。<br />
像是 static 的詳細，我又更了解了！<br />
（在static方法裡面，使用this是不行的，我一開始也不知道）<br />
不過我腦中還是對 static 修飾字有一個認知「他是記憶體共用」的指定方法。<br />
（我用這個方法理解沒辦法用this的話，就是因為他是全部通用，而this是指特定一個……）</p>
<p>不過，我在GUI創建上，還是花了好多心思。<br />
不知道我何時可以把他分成一個個小部份來做呢……</p>
<p>據說 Thread 概念，就是Java希望大家把每項功能做成小零件才強調的。<br />
不過，我現在似乎還不能將其分成小零件呢……</p>
<p>希望哪一天我再次寫 Java 聊天事時，可以更加完善運用這項特性。<!-- PHP 5.x --></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">一個 Java 的啟發！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 修煉之路</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[GAE] 研究 Json 的使用 on JAVA</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.frost.tw/life/poston-2010-09-25/postid-724/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>第一個 Java GUI 程式</title>
		<link>http://blog.frost.tw/life/poston-2010-09-22/postid-719</link>
		<comments>http://blog.frost.tw/life/poston-2010-09-22/postid-719#comments</comments>
		<pubDate>Wed, 22 Sep 2010 11:28:03 +0000</pubDate>
		<dc:creator>蒼時弦や</dc:creator>
				<category><![CDATA[生活雜記]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[生活]]></category>
		<category><![CDATA[程式]]></category>

		<guid isPermaLink="false">http://blog.frost.tw/?p=719</guid>
		<description><![CDATA[今天早上，終於完成了！ 我的第一個用Java寫出來的GUI應用程式。 雖然是看著教學慢慢做出來的，但我還是完成了任務！ 不過，還有很多東西要學呢！ 我使用的是 Swing 這款 API 來製作 GUI 介面。 使用上我算是基本都掌握，不過還是有一些不熟的部份。 像是 EventListener 部份，目前只是粗略了解。 對於詳細的事件功能，我還沒辦法掌握。 而 Swing 眾多的 API 功能，其實我也沒有掌握。 在 I/O 技術方面，雖然我已經知道如何使用。 不過在每種 I/O 物件的使用時機，我也不能完全清楚。 概觀而言，我算是能夠簡易運用 Java 上的技巧了！ 再來下一步，大概就是再繼續熟悉使用 Java 吧…… 我想我會把之前的 Socket Server 改良成 Chat Room 的系統。 &#8230; <a href="http://blog.frost.tw/life/poston-2010-09-22/postid-719">Continue reading <span class="meta-nav">&#8594;</span></a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">一個 Java 的啟發！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 聊天室製作進度 – 伺服端</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[GAE] 研究 Json 的使用 on JAVA</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 修煉之路</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>今天早上，終於完成了！<br />
我的第一個用Java寫出來的GUI應用程式。<br />
雖然是看著教學慢慢做出來的，但我還是完成了任務！</p>
<p>不過，還有很多東西要學呢！<br />
<span id="more-719"></span><br />
我使用的是 Swing 這款 API 來製作 GUI 介面。<br />
使用上我算是基本都掌握，不過還是有一些不熟的部份。</p>
<p>像是 EventListener 部份，目前只是粗略了解。<br />
對於詳細的事件功能，我還沒辦法掌握。<br />
而 Swing 眾多的 API 功能，其實我也沒有掌握。</p>
<p>在 I/O 技術方面，雖然我已經知道如何使用。<br />
不過在每種 I/O 物件的使用時機，我也不能完全清楚。</p>
<p>概觀而言，我算是能夠簡易運用 Java 上的技巧了！<br />
再來下一步，大概就是再繼續熟悉使用 Java 吧……</p>
<p>我想我會把之前的 Socket Server 改良成 Chat Room 的系統。<br />
搭配上 Swing 上的運用，做成GUI之類的。<br />
我想應該會不錯……</p>
<p>不過，我還得把九月之前該處理的事情做完呢！<br />
（總覺得今天詞窮……）<!-- PHP 5.x --></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">一個 Java 的啟發！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 聊天室製作進度 – 伺服端</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[GAE] 研究 Json 的使用 on JAVA</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 修煉之路</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.frost.tw/life/poston-2010-09-22/postid-719/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java 用 Swing 建立 GUI</title>
		<link>http://blog.frost.tw/code/poston-2010-09-21/postid-718</link>
		<comments>http://blog.frost.tw/code/poston-2010-09-21/postid-718#comments</comments>
		<pubDate>Tue, 21 Sep 2010 10:53:26 +0000</pubDate>
		<dc:creator>蒼時弦や</dc:creator>
				<category><![CDATA[程式語言]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[程式]]></category>

		<guid isPermaLink="false">http://blog.frost.tw/?p=718</guid>
		<description><![CDATA[昨晚打開 IDE 之後，卻發現不知道要做什麼 Java 練習。 所以只好找網友談談摟！ 經過一番討論之後，決定來製作「筆記本」這個軟體。 理由，其實很簡單，主要是因為我做過 Socket 的物件導向了！ 那麼網友思考之後，認為有I/O和可建立物件導向觀念的練習，就是「筆記本」了！ 不過，因為我先前只是粗略看過 Swing 的使用，因此並不清楚使用方法。 所以我就上網Google資料，並且嘗試學習摟！ 第一個GUI其實可以用程式簡單完成。 HelloSwing.java import javax.swing.*; public class HelloWsing{ public static void createGUI(){ JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("Hello World!"); frame.getContentPane().add(label); frame.pack(); &#8230; <a href="http://blog.frost.tw/code/poston-2010-09-21/postid-718">Continue reading <span class="meta-nav">&#8594;</span></a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-21%2Fpostid-718">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-02-27%2Fpostid-422&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-21%2Fpostid-718">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">初嘗 Java – 九久乘法表</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-19%2Fpostid-716&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-21%2Fpostid-718">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 的 Socket 與 Thread</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-21%2Fpostid-718">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">一個 Java 的啟發！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>昨晚打開 IDE 之後，卻發現不知道要做什麼 Java 練習。<br />
所以只好找網友談談摟！</p>
<p>經過一番討論之後，決定來製作「筆記本」這個軟體。<br />
理由，其實很簡單，主要是因為我做過 Socket 的物件導向了！<br />
那麼網友思考之後，認為有I/O和可建立物件導向觀念的練習，就是「筆記本」了！<br />
<span id="more-718"></span><br />
不過，因為我先前只是粗略看過 Swing 的使用，因此並不清楚使用方法。<br />
所以我就上網Google資料，並且嘗試學習摟！</p>
<p>第一個GUI其實可以用程式簡單完成。</p>
<p>HelloSwing.java</p>
<pre class="brush:java">import javax.swing.*;

public class HelloWsing{
  public static void createGUI(){
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLabel label = new JLabel("Hello World!");
    frame.getContentPane().add(label);

    frame.pack();
    frame.setVisible(true);
  }

  public static void main(){
    javax.swing.SwingUtilities.invokeLater(new Runnable(){
      public void run() {
        createGUI();
      }
    });
  }
}</pre>
<p>其實還算簡單。<br />
（以上依靠印象，可能有誤……）</p>
<p>不過，當我往下翻頁後，卻發現原來 NetBeans 可以直接新建 JFrame 的物件。<br />
而這個物件，可以使用類似 VB 的方式來產生 GUI （就是用拖曳的方式）</p>
<p>不過，基於寫程式的樂趣，我就放棄這個方法了！<br />
希望明天可以成功把簡易的筆記本寫出來……<!-- PHP 5.x --></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-21%2Fpostid-718">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-02-27%2Fpostid-422&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-21%2Fpostid-718">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">初嘗 Java – 九久乘法表</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-19%2Fpostid-716&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-21%2Fpostid-718">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 的 Socket 與 Thread</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-21%2Fpostid-718">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">一個 Java 的啟發！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.frost.tw/code/poston-2010-09-21/postid-718/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java 的 Socket 與 Thread</title>
		<link>http://blog.frost.tw/code/poston-2010-09-19/postid-716</link>
		<comments>http://blog.frost.tw/code/poston-2010-09-19/postid-716#comments</comments>
		<pubDate>Sun, 19 Sep 2010 11:01:16 +0000</pubDate>
		<dc:creator>蒼時弦や</dc:creator>
				<category><![CDATA[程式語言]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[程式]]></category>

		<guid isPermaLink="false">http://blog.frost.tw/?p=716</guid>
		<description><![CDATA[昨晚稍微搞清楚 Socket 和 Thread 之後，今天早上就開始實做了～ 雖然是個有點「艱辛」的過程。 不過，還算是成功吧！ 而且我也更清楚 Thread 的運作和 Socket 的使用了！ 以下是我時做的程式碼。 Main.java package simplesocketserver; import java.io.*; /* * To change this template, choose Tools &#124; Templates * and open the template in the editor. */ /** * * &#8230; <a href="http://blog.frost.tw/code/poston-2010-09-19/postid-716">Continue reading <span class="meta-nav">&#8594;</span></a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-19%2Fpostid-716">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-02-27%2Fpostid-422&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-19%2Fpostid-716">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">初嘗 Java – 九久乘法表</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-19%2Fpostid-716">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 聊天室製作進度 – 伺服端</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-19%2Fpostid-716">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">一個 Java 的啟發！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>昨晚稍微搞清楚 Socket 和 Thread 之後，今天早上就開始實做了～<br />
雖然是個有點「艱辛」的過程。<br />
不過，還算是成功吧！</p>
<p>而且我也更清楚 Thread 的運作和 Socket 的使用了！<br />
<span id="more-716"></span><br />
以下是我時做的程式碼。</p>
<p>Main.java</p>
<pre class="brush:java">package simplesocketserver;

import java.io.*;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author 蒼時弦也
 */
public class Main {

    /**
     * @param args the command line arguments
     */

    private static final int port = 1001;

    public static void main(String[] args) throws IOException {
        final socketServer server = new socketServer(port);

        Thread thread;

        thread = new Thread(new Runnable(){

            public void run() {
                System.out.println("等待連接……");
                try{
                    while(true){
                        server.waitClient();
                    }
                }catch(IOException e){
                    System.out.println("IOException : " + e.getMessage());
                }
            }

        });
        thread.setDaemon(true);
        thread.start();

        thread = new Thread(new Runnable(){

            public void run() {
                try{
                    while(true){
                        Thread.sleep(3000);
                        server.delClient();
                    }
                }catch(InterruptedException e){
                    System.out.println("Server: " + e.getMessage());
                }
            }

        });
        thread.setDaemon(true);
        thread.start();

        BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
        String adminMsg;

        while((adminMsg = buf.readLine()) != null){
            if(adminMsg.equals("/close")){
                server.shutdown();
            }
        }

    }

}</pre>
<p>socketServer.java</p>
<pre class="brush:java">/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package simplesocketserver;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author 蒼時弦也
 */
public class socketServer {

    private static ServerSocket server;
    private static ArrayList clients = new ArrayList();

    public socketServer(int port){
        try{
            server = new ServerSocket(port);
            System.out.println("伺服器建立 on Port " + server.getLocalPort());
        }catch(IOException e){
            System.out.println("伺服器建立錯誤");
            System.out.println("IOException: " + e.getMessage());
        }
    }

    public void waitClient() throws IOException{
        Socket socket;
        synchronized(server){
            socket = server.accept();
        }

        subServer client = new subServer(socket, this);
        clients.add(client);
        Thread thread = new Thread(client);
        thread.setDaemon(true);
        thread.start();
        this.sendMessage("Client " + socket.getRemoteSocketAddress() + " is connected!");
    }

    public void delClient(){
        List dead = new ArrayList();
        Iterator i = clients.iterator();
        subServer sub;
        while(i.hasNext()){
            sub = (subServer) i.next();
            if(sub.isColse()){
                dead.add(sub);
            }
        }
        removeDead(dead);
    }

    public void shutdown(){

        Iterator i = clients.iterator();
        subServer sub;
        while(i.hasNext()){
            sub = (subServer) i.next();
            sub.shutdown();
        }

        removeDead(clients);

        try{
            server.close();
        }catch(IOException e){
            System.out.println("關閉伺服器發生錯誤！");
            System.out.println("IOException: " + e.getMessage());
        }
    }

    public void removeDead(List list){
        Iterator i = list.iterator();
        subServer sub;
        while(i.hasNext()){
            sub = (subServer) i.next();
            System.out.println("Client " + sub.getName() + " is removed!");
        }

        clients.removeAll(list);
    }

    public void sendMessage(String msg){
        Iterator i = clients.iterator();
        subServer sub;
        while(i.hasNext()){
            sub = (subServer) i.next();
            sub.sendMsg(msg);
        }
    }
}</pre>
<p>subServer.java</p>
<pre class="brush:java">/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package simplesocketserver;

import java.io.*;
import java.net.Socket;

/**
 *
 * @author 蒼時弦也
 */
public class subServer implements Runnable {

    private Socket socket;
    private static socketServer parent;
    private PrintStream out;
    private BufferedReader in;

    public subServer(Socket s, socketServer p) throws IOException{
        socket = s;
        parent = p;
        in = new BufferedReader(new InputStreamReader(socket.getInputStream(), "UTF-8"));
        out = new PrintStream(socket.getOutputStream(), true, "UTF-8");
    }

    @Override
    public void run(){
        System.out.println("使用者連線 : " + socket.getInetAddress());
        out.print("&gt;");
        try {
            String msg;

            while ((msg = in.readLine()) != null) {
                //out.println("Recived data : " + msg);
                System.out.println("System recived : " + msg);
                parent.sendMessage("Client \"" + getName() + "\" send : " + msg);
                out.print("&gt;");
            }

        } catch (IOException e) {
            System.out.println("IOException : " + e.getMessage());
        }finally{
            try {
                socket.close();
            } catch (IOException ex) {
               System.out.println("IOException : " + ex.getMessage());
            }
        }
    }

    public boolean isColse(){
        return socket.isClosed();
    }

    public void shutdown(){
       try{
            socket.close();
        }catch(IOException e){
            System.out.println("關閉連接發生錯誤！");
            System.out.println("IOException: " + e.getMessage());
        }
    }

    public String getName(){
        return socket.getRemoteSocketAddress().toString();
    }

    public void sendMsg(String msg){
        out.println(msg);
    }
}</pre>
<p>我使用的IDE是NetBeans 所以自動產生了一些註解。<br />
整體上就是一個非常簡易的 Socket 伺服器摟！</p>
<p>功能也很簡單，大致上就是：<br />
建立伺服器 &gt; 監聽 &gt; (新客戶端連入) &gt; 監聽(客戶端發出訊息) &gt; 發送(全部客戶端)<br />
程式是參考良葛格的學習筆記撰寫的。</p>
<p>不過我也藉此更清楚了解 Socket 的運用，還有 Thread 的處理。<br />
測試時我是使用 Telnet 來測試，後來改為 Putty 的 Telnet Client 因此編碼才設定為UTF-8<br />
（支援中文這個問題讓我小小蒐集了資料，也讓我了解幾種 I/O 的編碼設置。）</p>
<p>不過我暫時還是會繼續練習物件導向吧！<br />
（很多網友都建議我把基礎練好～～）<!-- PHP 5.x --></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-19%2Fpostid-716">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-02-27%2Fpostid-422&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-19%2Fpostid-716">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">初嘗 Java – 九久乘法表</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-19%2Fpostid-716">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 聊天室製作進度 – 伺服端</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-19%2Fpostid-716">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">一個 Java 的啟發！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.frost.tw/code/poston-2010-09-19/postid-716/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java 與執行緒</title>
		<link>http://blog.frost.tw/life/poston-2010-09-18/postid-715</link>
		<comments>http://blog.frost.tw/life/poston-2010-09-18/postid-715#comments</comments>
		<pubDate>Sat, 18 Sep 2010 10:48:15 +0000</pubDate>
		<dc:creator>蒼時弦や</dc:creator>
				<category><![CDATA[生活雜記]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[生活]]></category>
		<category><![CDATA[程式]]></category>

		<guid isPermaLink="false">http://blog.frost.tw/?p=715</guid>
		<description><![CDATA[最近終於再次觸及 Thread &#8211; 執行緒。 不過，這次似乎仍然沒有搞懂呢！ 看起來，我想突破的話，就得搞懂這東西。 目前正在向網友請教，畢竟這樣能找出一些疑點～ 不過，網友還是建議我買書。 要怎麼說呢？ 網路上的資料不完全，他是這樣告訴我的。 我稍微 Google 了一下之後，果真，不是很完全。 在討論的，幾乎都是如何使用 Thread 或者實做 Runnable 等等…… 但，還是沒有觸及到所謂的 Thread 這個核心。 執行緒，到底在做什麼？ 何時會發生他的作用？ 這些都不得而知，最多，也只知道 Thread 會不斷輪流。 但是，輪流和多執行緒，關係又何在呢？ 這些我想是對於了解它很重要的關鍵，不過現在卻也卡在這裡。 唔…… 只好繼續思考摟！<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-18%2Fpostid-715">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-18%2Fpostid-715">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[GAE] 研究 Json 的使用 on JAVA</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-18%2Fpostid-715">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 修煉之路</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-01%2Fpostid-683&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-18%2Fpostid-715">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GAE (Java) 的 HttpServlet 和 UrlFetch API</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>最近終於再次觸及 Thread &#8211; 執行緒。<br />
不過，這次似乎仍然沒有搞懂呢！</p>
<p>看起來，我想突破的話，就得搞懂這東西。<br />
目前正在向網友請教，畢竟這樣能找出一些疑點～<br />
<span id="more-715"></span><br />
不過，網友還是建議我買書。<br />
要怎麼說呢？<br />
網路上的資料不完全，他是這樣告訴我的。</p>
<p>我稍微 Google 了一下之後，果真，不是很完全。<br />
在討論的，幾乎都是如何使用 Thread 或者實做 Runnable 等等……</p>
<p>但，還是沒有觸及到所謂的 Thread 這個核心。<br />
執行緒，到底在做什麼？<br />
何時會發生他的作用？</p>
<p>這些都不得而知，最多，也只知道 Thread 會不斷輪流。<br />
但是，輪流和多執行緒，關係又何在呢？</p>
<p>這些我想是對於了解它很重要的關鍵，不過現在卻也卡在這裡。<br />
唔……<br />
只好繼續思考摟！<!-- PHP 5.x --></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-18%2Fpostid-715">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-18%2Fpostid-715">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[GAE] 研究 Json 的使用 on JAVA</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-18%2Fpostid-715">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 修煉之路</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-01%2Fpostid-683&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-18%2Fpostid-715">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GAE (Java) 的 HttpServlet 和 UrlFetch API</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.frost.tw/life/poston-2010-09-18/postid-715/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Java 修煉之路</title>
		<link>http://blog.frost.tw/life/poston-2010-09-10/postid-701</link>
		<comments>http://blog.frost.tw/life/poston-2010-09-10/postid-701#comments</comments>
		<pubDate>Fri, 10 Sep 2010 11:05:39 +0000</pubDate>
		<dc:creator>蒼時弦や</dc:creator>
				<category><![CDATA[生活雜記]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[生活]]></category>
		<category><![CDATA[程式]]></category>

		<guid isPermaLink="false">http://blog.frost.tw/?p=701</guid>
		<description><![CDATA[最近經常找時間來練習 Java, 技巧也不斷成長。 雖然還在基本的程度，不過隨著閱讀文件，能力也提高許多。 如 Map, Collection 等之前沒有掌握的能力。 回想起半年前，初次接觸 Java 撰寫時，我僅能撰寫出九九乘法表。 而現在，我甚至能利用GAE寫個簡單的網站。 雖然這次也才是第二次閱讀，不過整體的進步提昇很多。 我想和第一次相比，我改為分批閱讀，效果才變好的吧！ 第一次閱讀時，我大約在兩、三天之內，就把文件讀完。 也沒有接觸其他原始碼或者API文件。 不過這次因為 GAE 的關係，接觸了不少 Java 原始碼。 也讀了一些 Servlet 之類的 API 文件，增長了不少見識。 而為了處理一個接一個的問題，我也打開教學重新閱讀一遍。 此時，我才發現，我學到的東西其實還很少。 現在高三了，除了考上大學之外，我還要為了往後大學的花費準備。 當然，交給爸媽負擔也許會太大吧！ 我是打算自己把一切花費處理好，至少可以省下很多開銷。 那麼，我拿什麼和其他人比呢？ 大概只有程式、設計吧！ 繪畫，我的能力還不夠，設計的話，勉強可以。 在畢業之前的修煉，我想會改變我往後的人生吧！ （雖然我比許多人先走了一步，但我不認為到達可以凌駕其他人的狀態。）<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[GAE] 研究 Json 的使用 on JAVA</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 聊天室製作進度 – 伺服端</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-01%2Fpostid-683&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GAE (Java) 的 HttpServlet 和 UrlFetch API</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>最近經常找時間來練習 Java, 技巧也不斷成長。<br />
雖然還在基本的程度，不過隨著閱讀文件，能力也提高許多。</p>
<p>如 Map, Collection 等之前沒有掌握的能力。<br />
回想起半年前，初次接觸 Java 撰寫時，我僅能撰寫出九九乘法表。<br />
而現在，我甚至能利用GAE寫個簡單的網站。<br />
<span id="more-701"></span><br />
雖然這次也才是第二次閱讀，不過整體的進步提昇很多。<br />
我想和第一次相比，我改為分批閱讀，效果才變好的吧！</p>
<p>第一次閱讀時，我大約在兩、三天之內，就把文件讀完。<br />
也沒有接觸其他原始碼或者API文件。</p>
<p>不過這次因為 GAE 的關係，接觸了不少 Java 原始碼。<br />
也讀了一些 Servlet 之類的 API 文件，增長了不少見識。<br />
而為了處理一個接一個的問題，我也打開教學重新閱讀一遍。</p>
<p>此時，我才發現，我學到的東西其實還很少。<br />
現在高三了，除了考上大學之外，我還要為了往後大學的花費準備。<br />
當然，交給爸媽負擔也許會太大吧！<br />
我是打算自己把一切花費處理好，至少可以省下很多開銷。</p>
<p>那麼，我拿什麼和其他人比呢？<br />
大概只有程式、設計吧！<br />
繪畫，我的能力還不夠，設計的話，勉強可以。</p>
<p>在畢業之前的修煉，我想會改變我往後的人生吧！<br />
（雖然我比許多人先走了一步，但我不認為到達可以凌駕其他人的狀態。）<!-- PHP 5.x --></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[GAE] 研究 Json 的使用 on JAVA</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 聊天室製作進度 – 伺服端</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-01%2Fpostid-683&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GAE (Java) 的 HttpServlet 和 UrlFetch API</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.frost.tw/life/poston-2010-09-10/postid-701/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>一個 Java 的啟發！</title>
		<link>http://blog.frost.tw/life/poston-2010-09-07/postid-694</link>
		<comments>http://blog.frost.tw/life/poston-2010-09-07/postid-694#comments</comments>
		<pubDate>Tue, 07 Sep 2010 10:53:21 +0000</pubDate>
		<dc:creator>蒼時弦や</dc:creator>
				<category><![CDATA[生活雜記]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[生活]]></category>
		<category><![CDATA[程式]]></category>

		<guid isPermaLink="false">http://blog.frost.tw/?p=694</guid>
		<description><![CDATA[先前在製作 Comet Chat on GAE 時，碰上了瓶頸。 於是我便去問教我Java的網友。 而我最後是接受了「將基礎練好」的建議。 因此也放下了製作任務，暫時將心力集中在課業和Java基礎。 而今天某一節下課，心血來潮，就到圖書館使用網路。 不過因為沒有計畫，所以就隨手輸入了一些 Keyword 進去。 因為最近腦子充滿挺多 GAE 的相關資訊。 因此就輸入了 java channel api google 等關鍵字。 我再次打開過去看過的討論串，無意間回顧了曾經看過的一組 GAE 原始碼（在Google Code上） 一個名叫「Dance-Dance-Robot」的程式。 仔細一看原始碼，才發現了一些驚人的資訊。 （對我自己來說……） 此時，我才發覺我在撰寫 Comet Server 上，使用了和 Java 不太相配的程式概念。 （大概是把 PHP, JavaScript 等等那一套用上了……） 也許過一陣子還會「再次挑戰」吧！ &#8230; <a href="http://blog.frost.tw/life/poston-2010-09-07/postid-694">Continue reading <span class="meta-nav">&#8594;</span></a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 修煉之路</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-18%2Fpostid-715&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 與執行緒</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 聊天室製作進度 – 伺服端</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>先前在製作 Comet Chat on GAE 時，碰上了瓶頸。<br />
於是我便去問教我Java的網友。</p>
<p>而我最後是接受了「將基礎練好」的建議。<br />
因此也放下了製作任務，暫時將心力集中在課業和Java基礎。<br />
<span id="more-694"></span><br />
而今天某一節下課，心血來潮，就到圖書館使用網路。<br />
不過因為沒有計畫，所以就隨手輸入了一些 Keyword 進去。</p>
<p>因為最近腦子充滿挺多 GAE 的相關資訊。<br />
因此就輸入了 java channel api google 等關鍵字。</p>
<p>我再次打開過去看過的討論串，無意間回顧了曾經看過的一組 GAE 原始碼（在Google Code上）<br />
一個名叫「Dance-Dance-Robot」的程式。<br />
仔細一看原始碼，才發現了一些驚人的資訊。<br />
（對我自己來說……）</p>
<p>此時，我才發覺我在撰寫 Comet Server 上，使用了和 Java 不太相配的程式概念。<br />
（大概是把 PHP, JavaScript 等等那一套用上了……）</p>
<p>也許過一陣子還會「再次挑戰」吧！</p>
<p>而 Dacne-Dance-Robot 的原始碼也推薦大家看看：<a href="http://code.google.com/p/dance-dance-robot/">http://code.google.com/p/dance-dance-robot/</a><br />
（肚子突然痛起來！？跑廁所……）<!-- PHP 5.x --></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 修煉之路</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-18%2Fpostid-715&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 與執行緒</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 聊天室製作進度 – 伺服端</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-07%2Fpostid-694">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.frost.tw/life/poston-2010-09-07/postid-694/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[GAE] 噗浪機器人 using JAVA</title>
		<link>http://blog.frost.tw/code/poston-2010-09-03/postid-687</link>
		<comments>http://blog.frost.tw/code/poston-2010-09-03/postid-687#comments</comments>
		<pubDate>Fri, 03 Sep 2010 10:53:25 +0000</pubDate>
		<dc:creator>蒼時弦や</dc:creator>
				<category><![CDATA[程式語言]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[程式]]></category>

		<guid isPermaLink="false">http://blog.frost.tw/?p=687</guid>
		<description><![CDATA[經過幾天的測試，大致上歸納出使用Google App Engine開發噗浪機器人的技術。 雖然社刊光碟很趕，不過基於「開發者的欲望」還是無法忍受停下這動作。 因此打算假日犧牲，今晚就把整個 Package 寫出來。 Note. GAE是一個Web Server, 因此 Cron Job 也只能訪問 WebPage, 實做檢查噗時，是採用 HttpServlet來處理。 整體預估會使用的技術、設定： HttpServlet JSON urlfetch (Google App Engine API) Cronjob 運作上大致如下： HttpServlet 撰寫 handler 來監聽，利用 Cronjob 每分鐘呼叫一次。 handler 內部則檢查各噗，並且依照 Keyword 回應。 而使用 Plurk API &#8230; <a href="http://blog.frost.tw/code/poston-2010-09-03/postid-687">Continue reading <span class="meta-nav">&#8594;</span></a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-03%2Fpostid-687">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[GAE] 研究 Json 的使用 on JAVA</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-03%2Fpostid-687">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-03%2Fpostid-687">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 聊天室製作進度 – 伺服端</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-18%2Fpostid-715&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-03%2Fpostid-687">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 與執行緒</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>經過幾天的測試，大致上歸納出使用Google App Engine開發噗浪機器人的技術。</p>
<p>雖然社刊光碟很趕，不過基於「開發者的欲望」還是無法忍受停下這動作。<br />
因此打算假日犧牲，今晚就把整個 Package 寫出來。<br />
Note. GAE是一個Web Server, 因此 Cron Job 也只能訪問 WebPage, 實做檢查噗時，是採用 HttpServlet來處理。<br />
<span id="more-687"></span><br />
整體預估會使用的技術、設定：</p>
<ol>
<li>HttpServlet</li>
<li>JSON</li>
<li>urlfetch (Google App Engine API)</li>
<li>Cronjob</li>
</ol>
<p>運作上大致如下：<br />
HttpServlet 撰寫 handler 來監聽，利用 Cronjob 每分鐘呼叫一次。<br />
handler 內部則檢查各噗，並且依照 Keyword 回應。<br />
而使用 Plurk API 則是採用 urlfetch 模仿 Http Client 去運行。</p>
<p>整體大致如上，今天預計把幾個簡單功能實做。<br />
並且加入發噗、回噗、加好友的基本功能。</p>
<p>因為之前友網友要求開發完成後要公開原始碼，所以我會在最近幾天把原始碼公開。<br />
（包含GAE的相關目錄，如war網頁存放目錄等……）</p>
<p>套件我是使用 tw.frost.plurk_robot 和 tw.frost.gae_for_plurk 兩組。<br />
（而 tw.frost 應該很簡單可以知道是 frost.tw ）<br />
Note. 套件命名規則因為暫時找不到好的方法，所以先以此種方法命名。</p>
<p>那麼，我就繼續做開發摟！<!-- PHP 5.x --></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-03%2Fpostid-687">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[GAE] 研究 Json 的使用 on JAVA</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-03%2Fpostid-687">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-03%2Fpostid-687">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 聊天室製作進度 – 伺服端</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-18%2Fpostid-715&from=http%3A%2F%2Fblog.frost.tw%2Fcode%2Fposton-2010-09-03%2Fpostid-687">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 與執行緒</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.frost.tw/code/poston-2010-09-03/postid-687/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>[GAE] 研究 Json 的使用 on JAVA</title>
		<link>http://blog.frost.tw/life/poston-2010-09-02/postid-685</link>
		<comments>http://blog.frost.tw/life/poston-2010-09-02/postid-685#comments</comments>
		<pubDate>Thu, 02 Sep 2010 10:54:34 +0000</pubDate>
		<dc:creator>蒼時弦や</dc:creator>
				<category><![CDATA[生活雜記]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[生活]]></category>
		<category><![CDATA[程式]]></category>

		<guid isPermaLink="false">http://blog.frost.tw/?p=685</guid>
		<description><![CDATA[呼～ 昨晚測試了 Url Fetch 的使用。 意外發現可以在 Plurk API 上正常運用。 仔細一看，原來 Google App Engine 也有 httpclient 的 JRE 暗藏其中。 （不過 urlfetch 大概是限制使用吧……） 但是既然可以用於 Plurk API 那麼就不需計較了！ 但是，處理完 Http Client 的問題後，就是序列化資料的處理。 （搜尋之後發現 JSON 似乎屬於序列化的資料。） 我找了很久資料，卻一直無法找到方法。 其一，在GAE中並無內建JSON處理。 其二，在GAE中的repackaged中有 JSON RPC 處理函式，但無 docs 可調用查閱。 &#8230; <a href="http://blog.frost.tw/life/poston-2010-09-02/postid-685">Continue reading <span class="meta-nav">&#8594;</span></a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-01%2Fpostid-683&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GAE (Java) 的 HttpServlet 和 UrlFetch API</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 修煉之路</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 聊天室製作進度 – 伺服端</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>呼～<br />
昨晚測試了 Url Fetch 的使用。<br />
意外發現可以在 Plurk API 上正常運用。<br />
仔細一看，原來 Google App Engine 也有 httpclient 的 JRE 暗藏其中。<br />
（不過 urlfetch 大概是限制使用吧……）</p>
<p>但是既然可以用於 Plurk API 那麼就不需計較了！<br />
<span id="more-685"></span><br />
但是，處理完 Http Client 的問題後，就是序列化資料的處理。<br />
（搜尋之後發現 JSON 似乎屬於序列化的資料。）</p>
<p>我找了很久資料，卻一直無法找到方法。<br />
其一，在GAE中並無內建JSON處理。<br />
其二，在GAE中的repackaged中有 JSON RPC 處理函式，但無 docs 可調用查閱。</p>
<p>就這兩點，我就頭痛的要死。</p>
<p>不過，經過 JSON PRC 這個關鍵字的查詢，就找到了相關網站。<br />
（大約是十幾分鐘前才發現的，目前正在努力閱讀範例。）</p>
<p>雖然不知道有沒有 JSON String to JSON Object 的方法。<br />
（昨晚用 new JSONObject().getJSONObject(jsonString) 的方法似乎不可行……）<br />
不過我想還是有了新的希望。</p>
<p>而 JSON RPC 又是何物呢？<br />
根據資料來看，似乎是 Java Script 和 Server 溝通的工具。<br />
詳細使用也只有看到 Google 寫了一篇 Python 的說明。</p>
<p>看來，還是得花些時間來處理呢！<br />
今天也要努力！！<!-- PHP 5.x --></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜歡：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-22%2Fpostid-719&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">第一個 Java GUI 程式</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-01%2Fpostid-683&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GAE (Java) 的 HttpServlet 和 UrlFetch API</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-10%2Fpostid-701&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 修煉之路</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-25%2Fpostid-724&from=http%3A%2F%2Fblog.frost.tw%2Flife%2Fposton-2010-09-02%2Fpostid-685">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Java 聊天室製作進度 – 伺服端</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.frost.tw/life/poston-2010-09-02/postid-685/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

