<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8385485320669302122</id><updated>2024-09-11T11:26:09.954-07:00</updated><category term="Ubuntu學習"/><category term="JAVA"/><category term="文章分享"/><category term="開發筆記"/><category term="Eclipse"/><category term="2008 IBM 開發者新秀大賽"/><category term="Android開發"/><category term="Facebook"/><category term="IBM開發筆記"/><category term="Objective-C"/><category term="SubVersion"/><category term="Object-Oriented Design Heuristics"/><category term="SOA專欄"/><category term="struts2"/><category term="網路技巧"/><category term="行動應用開發"/><title type='text'>Oliver&amp;#39;s Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>49</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-8427372400672969604</id><published>2012-10-03T22:40:00.000-07:00</published><updated>2012-10-03T22:40:30.689-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="struts2"/><title type='text'>struts2之form標籤theme屬性說明</title><content type='html'>&lt;br /&gt;
struts2中theme屬性包括xhtml,html,simple,ajax 。默認是xhtml&lt;br /&gt;
theme：設置struts2標籤的主題，預設為xhtml。 theme=xhtml時：會默認額外生成tr,td。 theme=simple時：就生成標籤所對應的html標籤形式。&lt;br /&gt;
在預設情況下,表單元素是分佈在不同行的。如下代碼：&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
&amp;lt;s:form action=&quot;login2&quot;&amp;gt;&amp;lt;s:textfield label=&quot;用戶名&quot; name=&quot;username&quot;/&amp;gt;&amp;lt;s:password label=&quot;密碼&quot;name=&quot;password&quot;/&amp;gt;&amp;lt;s:submit label=&quot;提交&quot;/&amp;gt; &amp;lt;/s:form&amp;gt;&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
我們看著以上的代碼跟HTML的差不了多少，但是因為struts2表單默認將表單內的每一個元素都分在單獨的一行，label屬性就如同我們在HTML 中在&amp;lt;input type=&quot;text&quot;/&amp;gt;前面的文字標籤一樣。如果我們不想讓它自動換行，那就應該寫成如下格式：&lt;br /&gt;
&lt;code&gt;
&amp;lt;s:form action=&quot;login2&quot; theme=&quot;simple&quot;&amp;gt;&amp;lt;s:textfield label=&quot;用戶名&quot; name=&quot;username&quot;/&amp;gt;&amp;lt;s:password label=&quot;密碼 ”name=&quot;password&quot;/&amp;gt;&amp;lt;s:submit label=&quot;提交&quot;/&amp;gt; &amp;lt;/s:form&amp;gt;&lt;/code&gt;&lt;br /&gt;
但在設置theme=&quot;simple&quot;後,表單元素的label屬性將失效，這時我們就得在表單元素前面加入想用label顯示的文字。如：&lt;br /&gt;
&lt;code&gt;
&amp;lt;s:form action=&quot;login2&quot; theme=&quot;simple&quot;&amp;gt;用戶名：&amp;lt;s:textfield label=&quot;用戶名&quot; name=&quot;username&quot;/&amp;gt;密碼：&amp;lt;s:password label=&quot;密碼&quot; name=&quot;password&quot;/&amp;gt;&amp;lt;s:submit label=&quot;提交&quot;/&amp;gt; &amp;lt;/s:form&amp;gt;&lt;/code&gt;&lt;br /&gt;
此時顯示的為將不在是label中的值，而是顯示文字方塊前面的文字，按鈕則顯示它原來的預設值：sbumit。&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/8427372400672969604/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/8427372400672969604' title='21 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/8427372400672969604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/8427372400672969604'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2012/10/blog-post.html' title='struts2之form標籤theme屬性說明'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>21</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-2005825081729471094</id><published>2012-06-19T19:21:00.002-07:00</published><updated>2012-06-19T19:25:53.319-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android開發"/><title type='text'>Ununti 12.04安裝Android筆記!</title><content type='html'>1.JDK&amp;amp;Eclipse都準備好了！&lt;br /&gt;
&lt;div style=&quot;color: red;&quot;&gt;
2.安裝ia32-libs:sudo install ia32-libs(64bit版本一定要安裝)&lt;/div&gt;
3.開啓Eclipse-&amp;gt;Help-&amp;gt;Install New Software&lt;br /&gt;
4.新增&lt;a href=&quot;http://dl-ssl.google.com/android/eclipse/site.xml&quot;&gt;http://dl-ssl.google.com/android/eclipse/site.xml&lt;/a&gt;更新並進行下載&lt;br /&gt;
5.至http://developer.android.com/sdk/index.html下載LINUX版的SDK並解壓縮&lt;br /&gt;
6.點選Eclipse-&amp;gt;Window-&amp;gt;Perferences-&amp;gt;Android，將SDK Location設為剛解壓縮的SDK目錄&lt;br /&gt;
7.點選Eclipse-&amp;gt;Window-&amp;gt;Android SDK Manager&lt;br /&gt;
8.勾選Tools、及欲安裝的SDK版本</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/2005825081729471094/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/2005825081729471094' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/2005825081729471094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/2005825081729471094'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2012/06/ununti-1204android.html' title='Ununti 12.04安裝Android筆記!'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-953519924084902749</id><published>2012-06-18T02:25:00.000-07:00</published><updated>2012-06-18T02:25:18.707-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android開發"/><title type='text'>在Eclipse安裝apk timeout問題!</title><content type='html'>修改Eclipse中Window-&amp;gt;Preference-&amp;gt;Android-&amp;gt;DDMS中的ADB connection time out(ms)數值</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/953519924084902749/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/953519924084902749' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/953519924084902749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/953519924084902749'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2012/06/eclipseapk-timeout.html' title='在Eclipse安裝apk timeout問題!'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-1851692450342020769</id><published>2012-04-16T07:29:00.004-07:00</published><updated>2012-04-16T07:29:56.040-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><title type='text'>Jjava 記憶體參數說明</title><content type='html'>JVM的記憶體空間如下：
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.sapgeek.net/wp-content/uploads/2010/11/image3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;346&quot; src=&quot;http://www.sapgeek.net/wp-content/uploads/2010/11/image3.png&quot; width=&quot;376&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
(出處：&lt;a href=&quot;http://www.sapgeek.net/2010/11/java-jvm-memory-structure/&quot;&gt;http://www.sapgeek.net/2010/11/java-jvm-memory-structure/&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsGyvET3jvAsnKQYu6FqvsI9W2m84gprIUBSeUV0Sy-ZCxBvluiKZQCp-vsm6dkwycTUrMGZi7pdcy1SZI9pwQC84SNtdI0ym60VvWXFh5VojBZayvkU3xEOmlQBWHqIhsAS-STBeBcEs/s1600/20110620214259055327.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;261&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsGyvET3jvAsnKQYu6FqvsI9W2m84gprIUBSeUV0Sy-ZCxBvluiKZQCp-vsm6dkwycTUrMGZi7pdcy1SZI9pwQC84SNtdI0ym60VvWXFh5VojBZayvkU3xEOmlQBWHqIhsAS-STBeBcEs/s400/20110620214259055327.gif&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
METHOD AREA：存放要載入類別的各種資訊，當要使用的記憶體超出允許的大小時，會抛出OutOfMemory的錯誤資訊，在JDK中這塊區域對應Permanet Generation，預設最小值為16MB，最大值為64MB，可透過&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;-XX:PermSize&lt;/b&gt;&lt;/span&gt;及&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;-XX:MaxPermSize&lt;/span&gt;&lt;/b&gt;來指定最小值和最大值！&lt;br /&gt;
&lt;br /&gt;
HEAP：Heap用於儲存物件實例及陣列值，可認為Java中所有透過new建立物件都在此分配，在32bit電腦上最大限制為2GB，64bit無此限制，可透過&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;-Xms&lt;/span&gt;&lt;/b&gt;和&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;-Xmx&lt;/span&gt;&lt;/b&gt;控制！HEAP有包含New Generation及Old Generation：&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;New Generation：可透過&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;-Xmn&lt;/b&gt;&lt;/span&gt;指定大小&lt;/li&gt;
&lt;li&gt;Old Generation：即&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;-Xmx減去-Xmn&lt;/span&gt;&lt;/b&gt;的大小&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
NATIVE METHOD STACK：儲存每個native method呼叫的狀態，如C&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
JAVA STACK &amp;amp; PROGRAM COUNTER REGISTER：PC REGISTER存放的為CPU暫存器或OS記憶體；JAVA STACK存放的為OS記憶體，當JAVA STACK不足時會抛出StackOverflowError，可透過&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;-Xss&lt;/b&gt;&lt;/span&gt;指定大小！&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
JDK參數設定策略：&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;一般設置&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: Verdana, sans-serif; font-size: 11.5pt;&quot;&gt;:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Verdana, sans-serif; font-size: 11.5pt;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;java -Xmx3550m -Xms3550m -Xmn2g -Xss128k&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;-Xmx3550m&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;設置&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;JVM&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;最大可用記憶體為&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;3550M.&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 11.5pt;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;-Xms3550m&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;設置&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;JVM&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;促使記憶體為&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;3550m.&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;此值可以設置與&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;-Xmx&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;相同&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;以避免每次垃圾回收完成後&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;JVM&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;重新分配記憶體&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;.&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 11.5pt;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;-Xmn2g&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;設置&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;New
Generation&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;大小為&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;2G.&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;整個&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;stack&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;大小&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt; &lt;span lang=&quot;EN-US&quot;&gt;= New Generation + Old Generation&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;！此值對系統性能影響較大，&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Sun&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;官方推薦配置為整個堆的&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;3/8&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;！&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 11.5pt;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;-Xss128k&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;設置每個執行緒的&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Stack&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;大小。&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;JDK5.0&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;以後每個執行緒&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Stack&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;大小為&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;1M&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;，以前每個執行緒&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Stack&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;大小為&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;256K&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;！更具應用的執行緒所需記憶體大小進行調整。在相同實體記憶體下！減小這個值能生成更多的執行緒。但是作業系統對一個進程內的執行緒數還是有限制的。不能無限生成，大約在&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;3000~5000&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;左右。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Verdana, sans-serif; font-size: 11.5pt;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 11.5pt;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 11.5pt;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana, sans-serif; font-size: 11.5pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;java -Xmx3550m -Xms3550m -Xss128k
-XX:NewRatio=4 -XX:SurvivorRatio=4 -XX:MaxPermSize=16m -XX:MaxTenuringThreshold=0&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana, sans-serif; font-size: 11.5pt;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;-XX:NewRatio=4&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana, sans-serif; font-size: 11.5pt;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;設置&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;　&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Generation (&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;包括&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Eden&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;和兩個&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Survivor&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;區&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;與&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Old Generation&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;的比值&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;設置為&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;，則&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;　&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Generation&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;與&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Old Generation&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;所占比值為&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;1:4&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;，&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;　&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Generation&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;占整個&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Stack&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;的&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;1/5&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;。&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-size: 11.5pt;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;-XX:SurvivorRatio=4&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;將&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;　&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Generation&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;中&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Eden&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;區與&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Survivor&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;區的大小比值設置為&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;，則兩個&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Survivor&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;區與一個&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Eden&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;區的比值為&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;2:4&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;，一個&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Survivor&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;區占整個&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;　&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Generation&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;的&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;1/6&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;。&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-size: 11.5pt;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;-XX:MaxPermSize=16m&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-size: 11.5pt;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;設置&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Permanet
Generation&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;大小為&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;16m&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;。&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-size: 11.5pt;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;-XX:MaxTenuringThreshold=0&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;設置垃圾最大年齡&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;如果設置為&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;的話&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;則&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;　&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Generation&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;物件不經過&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Survivor&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;區&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;直接進入&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Old Generation&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;。對於&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Old Generation&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;有比較多的應用話可以提高效率。如果將此值設置為一個較大值&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;則&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;　&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Generation&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;物件會在&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Survivor&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;區進行多次複製&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;這樣可以增加物件再&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;　&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Generation&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;的存活時間，減少在&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;　&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;Generation&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-family: 新細明體, serif; font-size: 11.5pt;&quot;&gt;即被回收的概論。&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: 新細明體, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/1851692450342020769/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/1851692450342020769' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/1851692450342020769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/1851692450342020769'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2012/04/jjava.html' title='Jjava 記憶體參數說明'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsGyvET3jvAsnKQYu6FqvsI9W2m84gprIUBSeUV0Sy-ZCxBvluiKZQCp-vsm6dkwycTUrMGZi7pdcy1SZI9pwQC84SNtdI0ym60VvWXFh5VojBZayvkU3xEOmlQBWHqIhsAS-STBeBcEs/s72-c/20110620214259055327.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-7134517855260782376</id><published>2012-02-09T06:53:00.000-08:00</published><updated>2012-02-09T06:53:52.306-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><title type='text'>Eclipse SVN帳密儲存位置</title><content type='html'>Eclipse在使用SVN時會要求記錄帳密，但如果以後要更換帳密怎麼辦呢？&lt;BR&gt;
Eclipse並沒有提供更換帳密的介面，所以要自己把Eclipse儲存的帳號刪除！&lt;BR&gt;
以Windows7為例儲存位置就在&quot;C:\Users\登入帳號\AppData\Roaming\Subversion\auth\svn.simple&quot;&lt;BR&gt;
AppData的資料夾預設會被隱藏，所以必須要在檔案總管顯示可看見隱藏的系統資料夾才行喔！&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/7134517855260782376/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/7134517855260782376' title='12 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/7134517855260782376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/7134517855260782376'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2012/02/eclipse-svn.html' title='Eclipse SVN帳密儲存位置'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-1184112723325828719</id><published>2011-11-28T22:37:00.001-08:00</published><updated>2011-11-28T22:40:33.902-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><title type='text'>利用 java進行中文字轉碼</title><content type='html'>翻譯國外程式變成中文版時,一般程式使用 utf-8碼,但是中文通常用big5 碼 &lt;br&gt;
此時翻譯的 中文檔案 需要先轉碼後才可以正確使用 否則會變成亂碼 &lt;br&gt;
可用以下方式: &lt;br&gt;
利用 java native2ascii 程式:&lt;br&gt;
 需要安裝 任何一版 java SDK&lt;br&gt;
於 安裝目錄下假設為 c:\java&lt;br&gt; 
則 java\bin\ 有一 nativeascii 程式 可轉碼&lt;br&gt;
假設原本檔案為 mydata.txt 要轉為 utf-8 輸出為 mydata_utf8.txt 請執行以下指令&lt;br&gt; 
java\bin\native2ascii -encoding big5 mydata.txt mydata_utf8.txt即可&lt;br&gt;
若想將轉換後 utf-8檔 變回 big5檔 ,執行以下指令
&lt;br&gt;
java\bin\native2ascii -reverse -encoding big5 mydata_utf8.txt mydata.txt
&lt;br&gt;
&lt;a href=&quot;http://docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/native2ascii.html&quot;&gt;native2ascii原文網址&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/1184112723325828719/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/1184112723325828719' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/1184112723325828719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/1184112723325828719'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2011/11/java.html' title='利用 java進行中文字轉碼'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-7420258096436666141</id><published>2011-10-18T07:44:00.000-07:00</published><updated>2011-10-18T07:56:57.559-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><title type='text'>Eclipse和MyEclipse優化~</title><content type='html'>1.關閉MyEclipse的自動validation &lt;br /&gt;  windows &gt; perferences &gt; myeclipse &gt; validation將Build下全部勾取消 &lt;br /&gt;  如果需要驗證某個檔的時候，可以單獨去驗證它。在需要驗證的檔上右鍵 &gt; MyEclipse &gt; Run Validation&lt;br /&gt;&lt;br /&gt;2.啟動優化，關閉不需要使用的模組，所以可以將一些不使用的模組禁止 載入啟動。 &lt;br /&gt;  Window &gt; Preferences &gt; General &gt; Startup andy Shutdown&lt;br /&gt;  在這裡列出的是MyEclipse啟動時載入的模組!&lt;br /&gt;&lt;br /&gt;3.去掉MyEclipse的拼寫檢查，拼寫檢查會帶來不少的麻煩，方法命名都會是單詞的縮寫，&lt;br /&gt;  MyEclipse也會提示有錯，將Window &gt; perferences &gt; General &gt; Editors &gt; Text Editors &gt; &lt;br /&gt;  Spelling &gt; 將Enable spell checking核取方塊的勾選去掉!&lt;br /&gt;&lt;br /&gt;4.修改MyEclipse編輯JSP頁面時的編輯工具&lt;br /&gt;  Window &gt; perferences &gt; General &gt; Editors &gt; File Associations &gt; 在File types 中選擇&lt;br /&gt;  *.jsp &gt; 在Associated editors 中將&quot;MyEclipse JSP Editor&quot;設置為默認；還有XML檔的默認編輯器!&lt;br /&gt;&lt;br /&gt;網路上還有很多優化方法可自行搜尋，但我只寫我有用到!</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/7420258096436666141/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/7420258096436666141' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/7420258096436666141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/7420258096436666141'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2011/10/eclipsemyeclipse.html' title='Eclipse和MyEclipse優化~'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-2149252316683773371</id><published>2011-01-17T09:33:00.000-08:00</published><updated>2011-01-17T09:42:57.383-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Objective-C"/><title type='text'>@class指令</title><content type='html'>使用@class的原因是當編譯器處理類別中的實體變數時，必須知道實體變數是一個類別！&lt;div&gt;因此使用@class，如果不使用@class，也可以使用#import！&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;差別在於若在類別中只會使用把實體變數當參數型態傳入傳出，則使用@class即可！&lt;/div&gt;&lt;div&gt;但若會在類別中使用到實體變數的方法，則就必須用#import！&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;原因為@class只知道實體變數是一個類別，但不知此類別裏有什麼方法，所以若需使用到此類別的方法則一定要用#import&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;通常使用@class會較有效率，因為編譯器不用處理整個類別介面檔！&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Sample&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;#import&lt;br /&gt;&lt;br /&gt;@class Point&lt;br /&gt;&lt;br /&gt;@interface Xyz : NSObject&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Point poing;&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/2149252316683773371/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/2149252316683773371' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/2149252316683773371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/2149252316683773371'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2011/01/class.html' title='@class指令'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-6990933438492172398</id><published>2010-12-27T08:55:00.000-08:00</published><updated>2010-12-27T08:57:11.940-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Objective-C"/><title type='text'>C語言-轉換字元的種類</title><content type='html'>&lt;table border=&quot;3&quot; width=&quot;85%&quot;&gt;&lt;caption&gt;&lt;big&gt;C語言-轉換字元的種類&lt;/big&gt;&lt;/caption&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;&lt;big&gt;種類 &lt;/big&gt;&lt;/th&gt;&lt;th&gt;&lt;big&gt;表示法 &lt;/big&gt;&lt;/th&gt;&lt;th&gt;&lt;big&gt;功能敘述 &lt;/big&gt;&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td rowspan=&quot;5&quot;&gt;&lt;big&gt;整數(integer) &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;d &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;以十進位方式印出。 &lt;/big&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;big&gt;o &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;以八進位方式印出。 &lt;/big&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;big&gt;x &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;以十六進位方式印出。 &lt;/big&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;big&gt;u &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;以不帶符號的十進位方式印出。 &lt;/big&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;big&gt;l &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;以長整數(long)方式印出。 &lt;/big&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td rowspan=&quot;2&quot;&gt;&lt;big&gt;浮點數(float) &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;f &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;以xxx.xxx方式印出。 &lt;/big&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;big&gt;e &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;以指數的方式印出。 &lt;/big&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td rowspan=&quot;2&quot;&gt;&lt;big&gt;字元(char) &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;c &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;以字元方式印出。 &lt;/big&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;big&gt;s &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;以字串方式印出。 &lt;/big&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td rowspan=&quot;4&quot;&gt;&lt;big&gt;其他(other) &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;- &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;向左邊靠齊印出。 &lt;/big&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;big&gt;dd &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;指定欄位寬。 &lt;/big&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;big&gt;. &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;分隔欄寬。 &lt;/big&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;big&gt;*.* &lt;/big&gt;&lt;/td&gt;&lt;td&gt;&lt;big&gt;指定浮點數之精確度。 &lt;/big&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/6990933438492172398/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/6990933438492172398' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/6990933438492172398'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/6990933438492172398'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/12/c.html' title='C語言-轉換字元的種類'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-628523811145351038</id><published>2010-12-15T01:21:00.000-08:00</published><updated>2010-12-15T02:53:38.811-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="行動應用開發"/><title type='text'>WURFL開發</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot;&gt;現在智慧手機的品牌、型號多到不行，每個月推陳出新，作業系統、瀏覽器、螢幕大小也都不盡相同！如果要寫個在可以在手機上瀏覽的網頁，可說是很難。一套衣服怎麼能讓不同身材的人穿呢～&lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;通常能想到的就是偵測每個request的User-Agent，依據瀏覽器版本調整畫面大小或元素等，通常User-Agent大概像是這樣&quot;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;courier new&#39;, monospace; &quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Nokia6600/1.0 (4.03.24) SymbianOS/6.1 Series60/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0&lt;/span&gt;&lt;/b&gt;&quot;。&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;courier new&#39;, monospace; font-size: 13px; &quot;&gt;User-Agent會記載手機裝置型號、作業系統、瀏覽器版本等等資訊，可說非常方便，但現在手機出新已是家常便飯，我們怎麼去判斷呢？又要怎麼掌握全世界所有的行動裝置型號呢？&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;courier new&#39;, monospace; font-size: 13px; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;courier new&#39;, monospace; font-size: 13px; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;WURFL&lt;/b&gt;&lt;/span&gt;就是在做這個事的，WURFL的全名是&lt;b&gt;&quot;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, &#39;Trebuchet MS&#39;; font-size: 12px; color: rgb(51, 51, 51); line-height: 16px; font-weight: bold; &quot;&gt;&lt;a href=&quot;http://wurfl.sourceforge.net/index.php&quot;&gt;Wireless Universal Resource File&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;courier new&#39;, monospace; font-size: 13px; &quot;&gt;&lt;b&gt;&quot;&lt;/b&gt;，這是一個Open Source Project，主旨在於透過社群的力量將全世界所有的行動裝置都收集在一起，可以先試試&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;a href=&quot;http://wurflpro.com/&quot;&gt;http://wurflpro.com/&lt;/a&gt;(如下圖)，在User-Agent輸入Apple按下Search即可看到Apple相關的設定檔！&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRqp_8syWb7xd-9gYlPj9Dt9BPkuKRpUUmgVCxdoOAFliyW6H7I4lpqlZneZ3dG7HDBWw3-DijgNEMkNWu9yFlG2Z1iH8DN6iZpOIQP0ppXtPamXBlMoH-eF05n1-23PHEYJRuK5nJ-2o/s800/Untitled.png&quot; style=&quot;cursor:pointer; cursor:hand;width: 800px; height: 500px;&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;接下來就要試寫一個最簡單的範例：&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;首先要有WURFL.xml，這個XML即記錄所有手機的資訊，大概說明一下內容的格式：&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;div&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/div&gt;&lt;div&gt;　　&amp;lt;wurfl&amp;gt;&lt;/div&gt;&lt;div&gt;　　　&amp;lt;version&amp;gt;...&amp;lt;/version&amp;gt;&amp;lt;!--說明WURFL的版本資訊--&amp;gt;&lt;/div&gt;&lt;div&gt;　　　&amp;lt;devices&amp;gt;&amp;lt;!--包含所有的設備資訊，devices包含了上千個device，而且持續成長中--&amp;gt;&lt;/div&gt;&lt;div&gt;　　　　&amp;lt;device user_agent=&quot;Nokia3100&quot; fall_back=&quot;nokia_generic_series40&quot; id=&quot;nokia_3100_ver1&quot;&amp;gt;&lt;/div&gt;&lt;div&gt;　　　　&amp;lt;!--指出一個裝置的資訊，user_agent為裝置型號，id指出該裝置在WURFL的ID號碼，fall_back為此裝置的上一層裝置的ID號碼--&amp;gt;&lt;/div&gt;&lt;div&gt;　　　　&amp;lt;!--在WURFL中的屬性是有繼承概念的，如果在當前設找不到某個屬性，就往所繼承的裝置尋找，直到找到或到最上一層的根--&amp;gt;&lt;/div&gt;&lt;div&gt;　　　　　&amp;lt;group id=&quot;product_info&quot;&amp;gt;&amp;lt;!--每個屬性都會按照類別分組，一個device下可以有很多的group--&amp;gt;&lt;/div&gt;&lt;div&gt;　　　　　　&amp;lt;capability name=&quot;model_name&quot; value=&quot;3100&quot;/&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;      &lt;/span&gt;&amp;lt;!--capability代表一個真正的屬性，每個Group可以擁有很多的capability--&amp;gt;&lt;/div&gt;&lt;div&gt;　　　　　　...&lt;/div&gt;&lt;div&gt;　　　　　&amp;lt;/group&amp;gt;&lt;/div&gt;&lt;div&gt;　　　　　...&lt;/div&gt;&lt;div&gt;　　　　&amp;lt;/device&amp;gt;&lt;/div&gt;&lt;div&gt;　　　　...&lt;/div&gt;&lt;div&gt;　　　&amp;lt;/devices&amp;gt;&lt;/div&gt;&lt;div&gt;　　&amp;lt;/wurfl&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;開始前要先準備幾樣東西：&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;下載&lt;a href=&quot;http://sourceforge.net/projects/wurfl/files/WURFL/2.0.26/wurfl-2.0.26.zip/download&quot;&gt;WURFL.zip&lt;/a&gt;，下載後不用解壓縮，因為在執行時期WURFL的lib會自行處理。&lt;/li&gt;&lt;li&gt;下載&lt;a href=&quot;http://sourceforge.net/projects/wurfl/files/WURFL%20Java%20API/1.2/wurfl-1.2.jar/download&quot;&gt;wurfl-1.2.jar&lt;/a&gt;，等下會用到的Lib。&lt;/li&gt;&lt;li&gt;準備backport-util-concurrent.jar、commons-collections-3.2.1.jar、commons-lang-2.5.jar、commons-logging-1.1.1.jar。&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;範例實作是參考&lt;a href=&quot;http://wurfl.sourceforge.net/njava/&quot;&gt;NEW WURFL Java API&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;建立一個個Web Project後，加入一個Servlet，此Servlet程式碼如下：&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;package net.sourceforge.wurfl.core.example;&lt;br /&gt;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;&lt;br /&gt;import java.util.HashMap;&lt;br /&gt;import java.util.Iterator;&lt;br /&gt;import java.util.Set;&lt;br /&gt;&lt;br /&gt;import javax.servlet.ServletException;&lt;br /&gt;import javax.servlet.http.HttpServlet;&lt;br /&gt;import javax.servlet.http.HttpServletRequest;&lt;br /&gt;import javax.servlet.http.HttpServletResponse;&lt;br /&gt;&lt;br /&gt;import net.sourceforge.wurfl.core.CapabilityNotDefinedException;&lt;br /&gt;import net.sourceforge.wurfl.core.Device;&lt;br /&gt;import net.sourceforge.wurfl.core.MarkUp;&lt;br /&gt;import net.sourceforge.wurfl.core.WURFLHolder;&lt;br /&gt;import net.sourceforge.wurfl.core.WURFLManager;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Servlet implementation class HelloWorld&lt;br /&gt;*/&lt;br /&gt;public class HelloWorld extends HttpServlet {&lt;br /&gt;private static final long serialVersionUID = 1L;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* 此範例不會以下的檔案...&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;private static final String XHTML_ADV = &quot;xhtmladv.jsp&quot;;&lt;br /&gt;private static final String XHTML_SIMPLE = &quot;xhtmlmp.jsp&quot;;&lt;br /&gt;private static final String CHTML = &quot;chtml.jsp&quot;;&lt;br /&gt;private static final String WML = &quot;wml.jsp&quot;;&lt;br /&gt;&lt;br /&gt;// private final Log log = LogFactory.getLog(getClass());&lt;br /&gt;&lt;br /&gt;protected void processRequest(HttpServletRequest request,&lt;br /&gt; HttpServletResponse response) throws ServletException, IOException {&lt;br /&gt;&lt;br /&gt;//取得WURFLHolder..&lt;br /&gt;WURFLHolder wurflHolder = (WURFLHolder) getServletContext()&lt;br /&gt;  .getAttribute(&quot;net.sourceforge.wurfl.core.WURFLHolder&quot;);&lt;br /&gt;&lt;br /&gt;//從WURFUL取得Manager...&lt;br /&gt;WURFLManager wurfl = wurflHolder.getWURFLManager();&lt;br /&gt;&lt;br /&gt;//從Manager取得Device資訊....&lt;br /&gt;Device device = wurfl.getDeviceForRequest(request);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;System.out.println(&quot;Device: &quot; + device.getId());&lt;br /&gt;&lt;br /&gt;//把Device所有屬性都印出來...&lt;br /&gt;HashMap map = (HashMap)device.getCapabilities();&lt;br /&gt;&lt;br /&gt;Set set = map.keySet();&lt;br /&gt;Iterator iter = set.iterator();&lt;br /&gt;&lt;br /&gt;System.out.println(&quot;device.getCapabilities.size = &quot; + map.size());&lt;br /&gt;while(iter.hasNext())&lt;br /&gt;{&lt;br /&gt; String key = (String)iter.next();&lt;br /&gt; System.out.println(&quot;Capability key = &quot; + key + &quot;,value = &quot; + map.get(key));&lt;br /&gt;}&lt;br /&gt;//把Device所有屬性都印出來...&lt;br /&gt;&lt;br /&gt;//根據MarkUp決定欲顯的網頁格式及頁面...&lt;br /&gt;MarkUp markUp = device.getMarkUp();&lt;br /&gt;String jspView = null;&lt;br /&gt;if (MarkUp.XHTML_ADVANCED.equals(markUp)) {&lt;br /&gt; jspView = XHTML_ADV;&lt;br /&gt;} else if (MarkUp.XHTML_SIMPLE.equals(markUp)) {&lt;br /&gt; jspView = XHTML_SIMPLE;&lt;br /&gt;} else if (MarkUp.CHTML.equals(markUp)) {&lt;br /&gt; jspView = CHTML;&lt;br /&gt;} else if (MarkUp.WML.equals(markUp)) {&lt;br /&gt; jspView = WML;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;System.out.println(&quot;View: &quot; + jspView);&lt;br /&gt;&lt;br /&gt;// MIME type is decided by JSP. Only in case of XHTML&lt;br /&gt;// will we need to multi-serve i.e text/html vs application/xml+xhtml vs&lt;br /&gt;// application/vnd.wap.xml+xhtml&lt;br /&gt;if (markUp == MarkUp.XHTML_ADVANCED || markUp == MarkUp.XHTML_SIMPLE) {&lt;br /&gt; String contentType = &quot;text/html&quot;;&lt;br /&gt; try {&lt;br /&gt;  contentType = device&lt;br /&gt;    .getCapability(&quot;xhtmlmp_preferred_mime_type&quot;);&lt;br /&gt; } catch (CapabilityNotDefinedException e) {&lt;br /&gt;  throw new RuntimeException(&lt;br /&gt;    &quot;Somethingh is seriously wrong with your WURFL:&quot;&lt;br /&gt;      + e.getLocalizedMessage(), e);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; request.setAttribute(&quot;contentType&quot;, contentType);&lt;br /&gt; System.out.println(&quot;ContentType: &quot; + contentType);&lt;br /&gt;}&lt;br /&gt;//根據MarkUp決定欲顯的網頁格式及頁面...&lt;br /&gt;&lt;br /&gt;request.setAttribute(&quot;markUp&quot;, markUp);&lt;br /&gt;request.setAttribute(&quot;device&quot;, device);&lt;br /&gt;&lt;br /&gt;request.getRequestDispatcher(&quot;WEB-INF/jsp/&quot; + jspView).forward(request,&lt;br /&gt;  response);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse&lt;br /&gt;*      response)&lt;br /&gt;*/&lt;br /&gt;protected void doGet(HttpServletRequest request,&lt;br /&gt; HttpServletResponse response) throws ServletException, IOException {&lt;br /&gt;// TODO Auto-generated method stub&lt;br /&gt;processRequest(request, response);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse&lt;br /&gt;*      response)&lt;br /&gt;*/&lt;br /&gt;protected void doPost(HttpServletRequest request,&lt;br /&gt; HttpServletResponse response) throws ServletException, IOException {&lt;br /&gt;// TODO Auto-generated method stub&lt;br /&gt;processRequest(request, response);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;最後要設定web.xml檔：&lt;/span&gt;&lt;div&gt;&lt;div&gt;&amp;lt;listener&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;listener-class&amp;gt;&lt;/div&gt;&lt;div&gt;     net.sourceforge.wurfl.core.web.WURFLServletContextListener&lt;/div&gt;&lt;div&gt;  &amp;lt;/listener-class&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;/listener&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;要加入listener才能取得WURFLHolder物件。&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; &quot;&gt;WURFL在執行時期要取得手機資訊得依賴之前下載的WURFL.zip，所以將WURFL.zip放到WEB-INF/，然後在web.xml中加入context-param：&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;&quot;&gt;&lt;div&gt;&amp;lt;context-param&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;param-name&amp;gt;wurfl&amp;lt;/param-name&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;param-value&amp;gt;/WEB-INF/wurfl.zip&amp;lt;/param-value&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;/context-param&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;如此；執行剛才建立的Servlet即可得知Device為何了，可利用Firefox的User Agent Switcher模擬iPhone 3.0可在Console中看到&quot;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Device: apple_iphone_ver3_sub7a341_enus&lt;/span&gt;&lt;/b&gt;&quot;。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;以上即為WURFL的簡單範例，WURFL還有PHP版本，台灣有一本翻譯的繁體書有寫WURFL的PHP版本：&lt;a href=&quot;http://tlsj.tenlong.com.tw/WebModule/BookSearch/bookSearchViewAction.do?isbn=9789861819624&amp;amp;sid=57828&quot;&gt;Smartphone 智慧型手機網路應用程式開發實戰&lt;/a&gt;。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;WURFL還有Patch_xx.xml的應用及整合Spring的範例，都可在WURFL官網查詢到。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;WURFL Java細節可參考&lt;a href=&quot;http://wurfl.sourceforge.net/njava/javadocs/&quot;&gt;WURFL API Docs&lt;/a&gt;。&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/628523811145351038/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/628523811145351038' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/628523811145351038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/628523811145351038'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/12/wurfl.html' title='WURFL開發'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRqp_8syWb7xd-9gYlPj9Dt9BPkuKRpUUmgVCxdoOAFliyW6H7I4lpqlZneZ3dG7HDBWw3-DijgNEMkNWu9yFlG2Z1iH8DN6iZpOIQP0ppXtPamXBlMoH-eF05n1-23PHEYJRuK5nJ-2o/s72-c/Untitled.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-795247982006581563</id><published>2010-11-22T08:30:00.000-08:00</published><updated>2010-11-22T08:32:17.307-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Facebook"/><title type='text'>取得access_token</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; color: rgb(51, 51, 51); &quot;&gt;&lt;h2 class=&quot;uiHeaderTitle&quot; style=&quot;font-size: 17px; color: rgb(28, 42, 71); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(51, 51, 51); font-size: 12px; line-height: 18px; &quot;&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt;參考&lt;a href=&quot;http://blog.iamjason.com/2010/05/facebook-open-graph_17.html&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot; style=&quot;cursor: pointer; color: rgb(59, 89, 152); text-decoration: none; &quot;&gt;http://blog.iamjason.com/2010/05/facebook-open-graph_17.html&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt; &lt;/p&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt;參考&lt;a href=&quot;http://developers.facebook.com/docs/authentication/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot; style=&quot;cursor: pointer; color: rgb(59, 89, 152); text-decoration: none; &quot;&gt;http://developers.facebook.com/docs/authentication/&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt; &lt;/p&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt;&lt;strong&gt;Available Platforms&lt;/strong&gt;&lt;/p&gt;&lt;ul style=&quot;list-style-type: square; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 10px; padding-bottom: 0px; padding-left: 25px; font-weight: normal; &quot;&gt;&lt;li&gt;&lt;a href=&quot;http://developers.facebook.com/docs/authentication/javascript&quot;&gt;JavaScript-based authentication&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://developers.facebook.com/docs/authentication/desktop&quot;&gt;Desktop application authentication&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt;利用Desktop application authentication!&lt;/p&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt; &lt;/p&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt;URL輸入&lt;/p&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;cursor: pointer;&quot;&gt;https://graph.facebook.com/oauth/authorize&lt;/span&gt;&lt;/span&gt;? client_id=151487178230642&amp;amp; redirect_uri=&lt;a href=&quot;http://www.facebook.com/connect/login_success.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot; style=&quot;cursor: pointer; color: rgb(59, 89, 152); text-decoration: none; &quot;&gt;http://www.facebook.com/connect/login_success.html&lt;/a&gt;&amp;amp; type=&lt;strong&gt;user_agent&lt;/strong&gt;&amp;amp; display=&lt;strong&gt;popup&lt;/strong&gt;&lt;/p&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt; &lt;/p&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt;&lt;strong&gt;151487178230642&lt;--是App ID&lt;/strong&gt;&lt;/p&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt; &lt;/p&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt;返回&lt;a href=&quot;http://www.facebook.com/connect/login_success.html?access_token=151487178230642%7C2.3h7qg3Bo_eLT__lHZavX8w__.3600.1290448800-100001469405770%7CqdZjnHg6XRRU0FQ1qChMLuLnf_k&amp;amp;expires_in=6250&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot; style=&quot;cursor: pointer; color: rgb(59, 89, 152); text-decoration: none; &quot;&gt;http://www.facebook.com/connect/login_success.html#access_token=151487178230642%7C2.3h7qg3Bo_eLT__lHZavX8w__.3600.1290448800-100001469405770%7CqdZjnHg6XRRU0FQ1qChMLuLnf_k&amp;amp;expires_in=6250&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt; &lt;/p&gt;&lt;p style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5em; font-weight: normal; &quot;&gt;151487178230642%7C2.3h7qg3Bo_eLT__lHZavX8w__.3600.1290448800-100001469405770%7CqdZjnHg6XRRU0FQ1qChMLuLnf_k&lt;--就是access_token&lt;/p&gt;&lt;/span&gt;&lt;/h2&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/795247982006581563/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/795247982006581563' title='51 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/795247982006581563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/795247982006581563'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/11/accesstoken.html' title='取得access_token'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>51</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-3899797583663877854</id><published>2010-11-22T08:21:00.000-08:00</published><updated>2010-11-22T08:30:20.723-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Facebook"/><title type='text'>查詢FaceBook的ID</title><content type='html'>&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;FaceBook主頁網址列有個id=XXXXX就是囉,請見下圖!&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8uWKCB6qjQ-XUFj08mlmgNTEbq64BPSBGv0FHQFCIKe6IE7C03Jpfvlpz0rGus5j53SyYSRIRycH3-cDLpD0_aGaTRLhivURonk8RnlxCirh11bpGVIg3MRhejcOmjIOWkiOmWuwWae3z/s800/Untitled.jpg&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 800px; height: 500px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8uWKCB6qjQ-XUFj08mlmgNTEbq64BPSBGv0FHQFCIKe6IE7C03Jpfvlpz0rGus5j53SyYSRIRycH3-cDLpD0_aGaTRLhivURonk8RnlxCirh11bpGVIg3MRhejcOmjIOWkiOmWuwWae3z/s800/Untitled.jpg&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;div&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8uWKCB6qjQ-XUFj08mlmgNTEbq64BPSBGv0FHQFCIKe6IE7C03Jpfvlpz0rGus5j53SyYSRIRycH3-cDLpD0_aGaTRLhivURonk8RnlxCirh11bpGVIg3MRhejcOmjIOWkiOmWuwWae3z/s800/Untitled.jpg&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/3899797583663877854/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/3899797583663877854' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/3899797583663877854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/3899797583663877854'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/11/facebookid.html' title='查詢FaceBook的ID'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8uWKCB6qjQ-XUFj08mlmgNTEbq64BPSBGv0FHQFCIKe6IE7C03Jpfvlpz0rGus5j53SyYSRIRycH3-cDLpD0_aGaTRLhivURonk8RnlxCirh11bpGVIg3MRhejcOmjIOWkiOmWuwWae3z/s72-c/Untitled.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-2133635727586451256</id><published>2010-03-28T06:20:00.000-07:00</published><updated>2010-03-28T07:30:13.417-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu學習"/><title type='text'>在Ubuntu中設定Maven2</title><content type='html'>安裝Maven2前須先安裝Java，而Maven2只需透過下列指令即可安裝：&lt;br /&gt;&lt;code&gt;sudo apt-get install maven2&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;安裝完成後Maven2的設定檔會存放在/etc/maven2/，可在此目錄看到m2.conf及setting.xml，說明如下：&lt;br /&gt;m2.conf：記錄Maven的Jar配置。&lt;br /&gt;setting.xml：記錄Maven2的全域設定。&lt;br /&gt;&lt;br /&gt;可輸入mvn -version如出下列資訊即表示安裝成功：&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Apache Maven 2.2.1 (rdebian-1)&lt;br /&gt;Java version: 1.6.0_15&lt;br /&gt;Java home: /usr/lib/jvm/java-6-sun-1.6.0.15/jre&lt;br /&gt;Default locale: zh_TW, platform encoding: UTF-8&lt;br /&gt;OS name: &quot;linux&quot; version: &quot;2.6.31-20-generic&quot; arch: &quot;i386&quot; Family: &quot;unix&quot;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;安裝完成後即可透過指令建立maven的項目。&lt;br /&gt;一般Java Project建立指令如下：&lt;br /&gt;&lt;code&gt;mvn archetype:create -DgroupId=com.codeline.commons -DartifactId=codelineCommons&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Web Project建立指令如下：&lt;br /&gt;&lt;code&gt;mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;groupId指的是此項目的唯一識別，也就是。&lt;br /&gt;artifactId指的是項目的名稱。&lt;br /&gt;archetypeArtifactId指的是項目的Type。&lt;br /&gt;&lt;br /&gt;archetypeArtifactId的類型很多，如果不填的話默認是maven-archetype-quickstart，其實Maven2支援另一種的建立項目方式，輸入下列指令：&lt;br /&gt;&lt;code&gt;mvn archetype:generate&lt;/code&gt;&lt;br /&gt;Maven會列出所有的archetype並要求輸入其中一種type，信息如下：&lt;br /&gt;&lt;code&gt;&lt;br /&gt;[INFO] Scanning for projects...&lt;br /&gt;[INFO] Searching repository for plugin with prefix: &#39;archetype&#39;.&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;[INFO] Building Maven Default Project&lt;br /&gt;[INFO]    task-segment: [archetype:generate] (aggregator-style)&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;[INFO] Preparing archetype:generate&lt;br /&gt;[INFO] No goals needed for project - skipping&lt;br /&gt;[INFO] Setting property: classpath.resource.loader.class =&gt; &#39;org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader&#39;.&lt;br /&gt;[INFO] Setting property: velocimacro.messages.on =&gt; &#39;false&#39;.&lt;br /&gt;[INFO] Setting property: resource.loader =&gt; &#39;classpath&#39;.&lt;br /&gt;[INFO] Setting property: resource.manager.logwhenfound =&gt; &#39;false&#39;.&lt;br /&gt;[INFO] [archetype:generate {execution: default-cli}]&lt;br /&gt;[INFO] Generating project in Interactive mode&lt;br /&gt;[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)&lt;br /&gt;Choose archetype:&lt;br /&gt;1: internal -&gt; appfuse-basic-jsf (AppFuse archetype for creating a web application with Hibernate, Spring and JSF)&lt;br /&gt;2: internal -&gt; appfuse-basic-spring (AppFuse archetype for creating a web application with Hibernate, Spring and Spring MVC)&lt;br /&gt;3: internal -&gt; appfuse-basic-struts (AppFuse archetype for creating a web application with Hibernate, Spring and Struts 2)&lt;br /&gt;4: internal -&gt; appfuse-basic-tapestry (AppFuse archetype for creating a web application with Hibernate, Spring and Tapestry 4)&lt;br /&gt;5: internal -&gt; appfuse-core (AppFuse archetype for creating a jar application with Hibernate and Spring and XFire)&lt;br /&gt;6: internal -&gt; appfuse-modular-jsf (AppFuse archetype for creating a modular application with Hibernate, Spring and JSF)&lt;br /&gt;7: internal -&gt; appfuse-modular-spring (AppFuse archetype for creating a modular application with Hibernate, Spring and Spring MVC)&lt;br /&gt;8: internal -&gt; appfuse-modular-struts (AppFuse archetype for creating a modular application with Hibernate, Spring and Struts 2)&lt;br /&gt;9: internal -&gt; appfuse-modular-tapestry (AppFuse archetype for creating a modular application with Hibernate, Spring and Tapestry 4)&lt;br /&gt;10: internal -&gt; maven-archetype-j2ee-simple (A simple J2EE Java application)&lt;br /&gt;11: internal -&gt; maven-archetype-marmalade-mojo (A Maven plugin development project using marmalade)&lt;br /&gt;12: internal -&gt; maven-archetype-mojo (A Maven Java plugin development project)&lt;br /&gt;13: internal -&gt; maven-archetype-portlet (A simple portlet application)&lt;br /&gt;14: internal -&gt; maven-archetype-profiles ()&lt;br /&gt;15: internal -&gt; maven-archetype-quickstart ()&lt;br /&gt;16: internal -&gt; maven-archetype-site-simple (A simple site generation project)&lt;br /&gt;17: internal -&gt; maven-archetype-site (A more complex site project)&lt;br /&gt;18: internal -&gt; maven-archetype-webapp (A simple Java web application)&lt;br /&gt;19: internal -&gt; jini-service-archetype (Archetype for Jini service project creation)&lt;br /&gt;20: internal -&gt; softeu-archetype-seam (JSF+Facelets+Seam Archetype)&lt;br /&gt;21: internal -&gt; softeu-archetype-seam-simple (JSF+Facelets+Seam (no persistence) Archetype)&lt;br /&gt;22: internal -&gt; softeu-archetype-jsf (JSF+Facelets Archetype)&lt;br /&gt;23: internal -&gt; jpa-maven-archetype (JPA application)&lt;br /&gt;24: internal -&gt; spring-osgi-bundle-archetype (Spring-OSGi archetype)&lt;br /&gt;25: internal -&gt; confluence-plugin-archetype (Atlassian Confluence plugin archetype)&lt;br /&gt;26: internal -&gt; jira-plugin-archetype (Atlassian JIRA plugin archetype)&lt;br /&gt;27: internal -&gt; maven-archetype-har (Hibernate Archive)&lt;br /&gt;28: internal -&gt; maven-archetype-sar (JBoss Service Archive)&lt;br /&gt;29: internal -&gt; wicket-archetype-quickstart (A simple Apache Wicket project)&lt;br /&gt;30: internal -&gt; scala-archetype-simple (A simple scala project)&lt;br /&gt;31: internal -&gt; lift-archetype-blank (A blank/empty liftweb project)&lt;br /&gt;32: internal -&gt; lift-archetype-basic (The basic (liftweb) project)&lt;br /&gt;33: internal -&gt; cocoon-22-archetype-block-plain ([http://cocoon.apache.org/2.2/maven-plugins/])&lt;br /&gt;34: internal -&gt; cocoon-22-archetype-block ([http://cocoon.apache.org/2.2/maven-plugins/])&lt;br /&gt;35: internal -&gt; cocoon-22-archetype-webapp ([http://cocoon.apache.org/2.2/maven-plugins/])&lt;br /&gt;36: internal -&gt; myfaces-archetype-helloworld (A simple archetype using MyFaces)&lt;br /&gt;37: internal -&gt; myfaces-archetype-helloworld-facelets (A simple archetype using MyFaces and facelets)&lt;br /&gt;38: internal -&gt; myfaces-archetype-trinidad (A simple archetype using Myfaces and Trinidad)&lt;br /&gt;39: internal -&gt; myfaces-archetype-jsfcomponents (A simple archetype for create custom JSF components using MyFaces)&lt;br /&gt;40: internal -&gt; gmaven-archetype-basic (Groovy basic archetype)&lt;br /&gt;41: internal -&gt; gmaven-archetype-mojo (Groovy mojo archetype)&lt;br /&gt;Choose a number:  (1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29/30/31/32/33/34/35/36/37/38/39/40/41) 15: :&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;在此我選擇18,即是maven-archetype-webapp，Maven又會繼續詢問其他的必要輸入資訊：&lt;br /&gt;&lt;code&gt;&lt;br /&gt;[INFO] artifact org.apache.maven.archetypes:maven-archetype-webapp: checking for updates from artifactory&lt;br /&gt;[INFO] artifact org.apache.maven.archetypes:maven-archetype-webapp: checking for updates from central&lt;br /&gt;Downloading: http://repo1.maven.org/maven2/org/apache/maven/archetypes/maven-archetype-webapp/1.0/maven-archetype-webapp-1.0.jar&lt;br /&gt;&lt;br /&gt;Define value for groupId: : com.sample.test&lt;br /&gt;Define value for artifactId: : oliversample&lt;br /&gt;Define value for version:  1.0-SNAPSHOT: :&lt;br /&gt;Define value for package:  com.sample.test: :&lt;br /&gt;Confirm properties configuration:&lt;br /&gt;groupId: com.sample.test&lt;br /&gt;artifactId: oliversample&lt;br /&gt;version: 1.0-SNAPSHOT&lt;br /&gt;package: com.sample.test&lt;br /&gt;Y: : y&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;如上所見，按著Maven的問題回答，最後就會建立一個完整的Sample。&lt;br /&gt;&lt;code&gt;&lt;br /&gt;[INFO] ----------------------------------------------------------------------------&lt;br /&gt;[INFO] Using following parameters for creating OldArchetype: maven-archetype-webapp:RELEASE&lt;br /&gt;[INFO] ----------------------------------------------------------------------------&lt;br /&gt;[INFO] Parameter: groupId, Value: com.sample.test&lt;br /&gt;[INFO] Parameter: packageName, Value: com.sample.test&lt;br /&gt;[INFO] Parameter: package, Value: com.sample.test&lt;br /&gt;[INFO] Parameter: artifactId, Value: oliversample&lt;br /&gt;[INFO] Parameter: basedir, Value: /home/oliver&lt;br /&gt;[INFO] Parameter: version, Value: 1.0-SNAPSHOT&lt;br /&gt;[INFO] ********************* End of debug info from resources from generated POM ***********************&lt;br /&gt;[INFO] OldArchetype created in dir: /home/oliver/oliversample&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;[INFO] BUILD SUCCESSFUL&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;[INFO] Total time: 1 minute 29 seconds&lt;br /&gt;[INFO] Finished at: Sun Mar 28 21:38:50 CST 2010&lt;br /&gt;[INFO] Final Memory: 10M/107M&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;如此一來就會建立一個完整的Maven項目。&lt;br /&gt;利用Maven2建立項目時會有資源庫的概念，如果按照Maven2的預設會在每次建立項目時至Maven2的資源庫下載所需的lib並存放在${user.home}/m2(m2/是隱藏的)，但如果要在團隊建立一個共用的資源庫，則可利用代理資源庫的方式，參考了很多代理資源庫，用最多的似乎是Artifactory。&lt;br /&gt;&lt;br /&gt;至Artifactory下載Artifactory-2.2.2，Artifactory已經內含jetty了，當然也可整合至Apache裏，可以直接進入Artifactory-2.2.2/bin執行下列指令：&lt;br /&gt;&lt;code&gt;./ artifactory.sh&lt;/code&gt;&lt;br /&gt;此時開啓瀏覽器輸入http://localhost:8081/artifactory，若看到下列畫面則表示設定成功。&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIyEXgB9qKV0DERJcLRb7maQH-KUtlIRX5Y960B0CrOP5bhc627ekCItkdbQtk4w3EDHi4XP7RQHUbK4t0MfEnqUq7tp-MaSYUuNVeAxt3Oj7RO1-3gNsVBMTSwJraDS4_wWFsxVfqSac/s1600/Screenshot.png&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width:100%;height:100%;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIyEXgB9qKV0DERJcLRb7maQH-KUtlIRX5Y960B0CrOP5bhc627ekCItkdbQtk4w3EDHi4XP7RQHUbK4t0MfEnqUq7tp-MaSYUuNVeAxt3Oj7RO1-3gNsVBMTSwJraDS4_wWFsxVfqSac/s400/Screenshot.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5453686443695053170&quot; /&gt;&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;切換到Artifacts可以發現Artifactory設定了許多的Repository，但總體來說只要在settings.xml的profiles中加入下列的設定：&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;profile&amp;gt;&lt;br /&gt;   &amp;lt;id&amp;gt;artifactory&amp;lt;/id&amp;gt;&lt;br /&gt;       &amp;lt;repositories&amp;gt;&lt;br /&gt;          &amp;lt;repository&amp;gt;&lt;br /&gt;              &amp;lt;id&amp;gt;artifactory&amp;lt;/id&amp;gt;&lt;br /&gt;              &amp;lt;name&amp;gt;local private artifactory&amp;lt;/name&amp;gt;&lt;br /&gt;              &amp;lt;url&amp;gt;http://127.0.0.1:8081/artifactory/repo/&amp;lt;/url&amp;gt;&lt;br /&gt;          &amp;lt;/repository&amp;gt;&lt;br /&gt;       &amp;lt;/repositories&amp;gt;&lt;br /&gt;   &amp;lt;/profile&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;另外再下profiles下方加入啓動profiles的設定即可：&lt;br /&gt;&lt;code&gt;&lt;br /&gt; &amp;lt;activeProfiles&amp;gt;&lt;br /&gt;   &amp;lt;activeProfile&amp;gt;artifactory&amp;lt;/activeProfile&amp;gt;&lt;br /&gt; &amp;lt;/activeProfiles&amp;gt;&lt;br /&gt;&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/2133635727586451256/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/2133635727586451256' title='9 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/2133635727586451256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/2133635727586451256'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/03/ubuntumaven2.html' title='在Ubuntu中設定Maven2'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIyEXgB9qKV0DERJcLRb7maQH-KUtlIRX5Y960B0CrOP5bhc627ekCItkdbQtk4w3EDHi4XP7RQHUbK4t0MfEnqUq7tp-MaSYUuNVeAxt3Oj7RO1-3gNsVBMTSwJraDS4_wWFsxVfqSac/s72-c/Screenshot.png" height="72" width="72"/><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-9038212805547499287</id><published>2010-03-28T00:15:00.000-07:00</published><updated>2010-03-28T00:26:53.086-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu學習"/><title type='text'>Ubuntu的Apache安裝</title><content type='html'>在Ubuntu中安裝Apache很簡單，只需執行下列的指令即可：&lt;br /&gt;&lt;br /&gt;&lt;code&gt;sudo apt-get install apache2&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;要注意是的下列目錄及文件：&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;/etc/apache2/  #--apache2.conf, httpd.conf&lt;/div&gt;&lt;div&gt;/usr/lib/apache2/modules #--*.so&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;/etc/init.d/apache2&lt;/div&gt;&lt;div&gt;/usr/sbin/apachectl &lt;/div&gt;&lt;div&gt;/usr/bin/htpasswd&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;/var/www/ #--webroot&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;/etc/init.d/apache2及/usr/sbin/apachet1效果是相同的，只是/etc/init.d/apache2會自動執行。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;如果有任何的設定需要變更需修改/etc/apache2/httpd.conf。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;針對Apache2的啓動與停止命令如下：&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;/etc/init.d/apache2 start&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;/etc/init.d/apache2 stop&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;/etc/init.d/apache2 restart&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;如果不清楚Apache2命令則直接輸入&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;/etc/init.d/apache2&lt;br&gt;* Usage: /etc/init.d/apache2 {start|stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean|status}&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/9038212805547499287/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/9038212805547499287' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/9038212805547499287'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/9038212805547499287'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/03/ubuntuapache.html' title='Ubuntu的Apache安裝'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-6677887938364410765</id><published>2010-03-27T23:50:00.000-07:00</published><updated>2010-03-28T00:01:14.237-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu學習"/><title type='text'>GRUB開機管理程式清單的修改</title><content type='html'>&lt;div&gt;在Ubuntu 9.10的開機管理程式用的是GRUB2，所以已經不再使用原本的menu.lst修改了。&lt;/div&gt;&lt;div&gt;GRUB2的目錄在/boot/grub，GRUB2若要修改開機選項清單必須修改grub.cfg，但是grub.cfg預設是唯讀文件，連root都無法修改，所以必須先修改crub.cfg的文件性質，命令如下：&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;sudo chmod +w /boot/grub/grub.cfg&lt;/code&gt;&lt;/div&gt;&lt;div&gt;　　或是&lt;/div&gt;&lt;div&gt;&lt;code&gt;sudo chown a=wr /boot/grub/grub.cfg&lt;/code&gt;&lt;/div&gt;&lt;div&gt;　　然後才能修改crub.cfg&lt;/div&gt;&lt;div&gt;&lt;code&gt;sudo gedit /boot/grub/grub.cfg&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;參考文件&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;http://wiki.ubuntu-tw.org/index.php?title=GRUB_2_%E4%B8%AD%E6%96%87%E6%8C%87%E5%8D%97&quot;&gt;GRUB2中文指南&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/6677887938364410765/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/6677887938364410765' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/6677887938364410765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/6677887938364410765'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/03/grub.html' title='GRUB開機管理程式清單的修改'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-4735537271239222547</id><published>2010-03-27T19:43:00.000-07:00</published><updated>2010-03-27T20:36:44.923-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu學習"/><title type='text'>Ubuntu目錄結構</title><content type='html'>&lt;code&gt;&lt;br /&gt;/   根目錄&lt;br /&gt;│&lt;br /&gt;├boot/      放置Linux核心與啓動相關文件，目錄下的VMLIUZ-xxx就核心文件。&lt;br /&gt;│    └grub/   GRUB相關文件，現已升級為GRUB2，如欲修改開機清單需修改grub.cfg 。&lt;br /&gt;│&lt;br /&gt;├dev/       存放與設備有關文件。&lt;br /&gt;├proc/      存放系統核心與執行程序資訊，啓動時自動載入記憶體，故不佔用硬碟空間。&lt;br /&gt;│&lt;br /&gt;├mnt/      默認掛載點。&lt;br /&gt;├media/    默認多媒體設備。&lt;br /&gt;│&lt;br /&gt;├root/     root用的的$HOME目錄。&lt;br /&gt;├home/  &lt;br /&gt;│    ├user/   普通用戶的$HOME目錄。&lt;br /&gt;│    └.../&lt;br /&gt;│&lt;br /&gt;├bin/      專門存放所有用戶執行Application的指令，有時此目錄會與usr/bin相同。&lt;br /&gt;├sbin/     存放系統管理員常用的程序。&lt;br /&gt;├lib/      在執行或編譯某些程序時要用到的library都在此目錄。&lt;br /&gt;├etc/      系統啓動過程需要讀取的設定檔都在此目錄。&lt;br /&gt;│   ├init.d/   所有服務默認的啓動script。&lt;br /&gt;│   ├network/  所有的網路環境配置script。&lt;br /&gt;│   ├X11/      與X WINDOWS有關的配置文件。&lt;br /&gt;│&lt;br /&gt;├usr/      存放程序與指令，類似WINDOWS下的Program Files。&lt;br /&gt;│   ├bin/    專門存放用戶執行Application的命令。&lt;br /&gt;│   ├sbin/   存放管理員執行Application的命令。&lt;br /&gt;│   ├lib/    在執行或編譯某些程序時要用到的library都在此目錄。&lt;br /&gt;│   ├share/  存放Application的資源及文件。&lt;br /&gt;│   ├src/    放置核心系統源始碼的默認目錄&lt;br /&gt;│   ├local/  Application默認安裝目錄，升級後的執行文件放在/usr/local/bin目錄下。&lt;br /&gt;│&lt;br /&gt;├var/      所有服務的登錄文件或錯誤信息文件(var/log)都在此。&lt;br /&gt;│&lt;br /&gt;├temp/     存放臨時文件&lt;br /&gt;├lost+found/   磁盤修復文件&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;特別注意的目錄&lt;br /&gt;&lt;ul&gt;&lt;li&gt;/etc                啓動與系統文件所在位置。&lt;/li&gt;&lt;li&gt;/etc/init.d/        存放啓動Ubuntu服務的Script。&lt;/li&gt;&lt;li&gt;/etc/rc.local/      存放啓動Ubuntu後的script，可執行使用者自行加入的系統指令。&lt;/li&gt;&lt;li&gt;xxx/bin/,xxx/sbin/  系統默認執行文件的目錄，Root常用的指令都在此，說明如下：&lt;/li&gt;&lt;li&gt;/bin : commands in this dir are all system installed user commands&lt;/li&gt;&lt;li&gt;/sbin:  commands in this dir are all system installed super user commands&lt;/li&gt;&lt;li&gt;/usr/bin: user commands for applications&lt;/li&gt;&lt;li&gt;/usr/sbin: super user commands for applications&lt;/li&gt;&lt;li&gt;/usr/X11R6/bin : X application user commands&lt;/li&gt;&lt;li&gt;/usr/X11R6/sbin: X application super user commands&lt;/li&gt;&lt;li&gt;/usr/share/man      放置各類套件說明文檔的地方。&lt;/li&gt;&lt;li&gt;/usr/local/man      放置各類套件說明文檔的地方。&lt;/li&gt;&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/4735537271239222547/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/4735537271239222547' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/4735537271239222547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/4735537271239222547'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/03/ubuntu.html' title='Ubuntu目錄結構'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-1988951550841497960</id><published>2010-01-17T07:10:00.000-08:00</published><updated>2010-01-17T07:43:44.864-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><title type='text'>在Java中使用JSON</title><content type='html'>&lt;b&gt;JSON&lt;/b&gt;(JavaScript Object Notation) 是一种轻量级的数据交换格式。 易于人阅读和编写。同时也易于机器解析和生成。 它基于&lt;a href=&quot;http://www.crockford.com/javascript&quot;&gt;JavaScript Programming Language&lt;/a&gt;,  &lt;a href=&quot;http://www.ecma-international.org/publications/files/ecma-st/ECMA-262.pdf&quot;&gt;Standard  ECMA-262 3rd Edition - December 1999&lt;/a&gt;的一个子集。 JSON采用完全独立于语言的文本格式，但是也使用了类似于C语言家族的习惯（包括C, C++, C#, Java, JavaScript, Perl, Python等）。 这些特性使JSON成为理想的数据交换语言。&lt;br /&gt;&lt;br /&gt;JSON目前慢慢的興起，也有人鼓吹取代複雜的XML格式，因此我在這次的專案中即使用JSON，也順便記錄一下。&lt;br /&gt;&lt;span style=&quot;display: block;&quot; id=&quot;formatbar_Buttons&quot;&gt;&lt;span class=&quot; on&quot; style=&quot;display: block;&quot; id=&quot;formatbar_CreateLink&quot; title=&quot;連結&quot; onmouseover=&quot;ButtonHoverOn(this);&quot; onmouseout=&quot;ButtonHoverOff(this);&quot; onmouseup=&quot;&quot; onmousedown=&quot;CheckFormatting(event);FormatbarButton(&#39;richeditorframe&#39;, this, 8);ButtonMouseDown(this);&quot;&gt;&lt;img src=&quot;http://www.blogger.com/img/blank.gif&quot; alt=&quot;連結&quot; class=&quot;gl_link&quot; border=&quot;0&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href=&quot;http://www.json.org/&quot;&gt;JSON的英文官網&lt;/a&gt;，&lt;a href=&quot;http://www.json.org/json-zh.html&quot;&gt;JSON的中文網頁&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;要在Java使用JSON必須要使&lt;a href=&quot;http://json-lib.sourceforge.net/&quot;&gt;JSON-lib&lt;/a&gt;。&lt;br /&gt;&lt;br /&gt;在開始使用之前還必須要一些其他的lib配合：&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Apache-commons-beanutils&lt;/li&gt;&lt;li&gt;Apache-commons-collections&lt;/li&gt;&lt;li&gt;Apache-commons-lang&lt;/li&gt;&lt;li&gt;Apache-commons-logging&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://ezmorph.sourceforge.net/&quot;&gt;EZMorph&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;其中EZMorph比較少見，EZMorph是一個簡單的將物件轉換(複製)成另一個物件的lib，類似於Apache commons BeanUtils的Bean Copy。&lt;br /&gt;而EZMorph本來就是負責JSON-lib裏物件的轉換，現在獨立成一個專案，EZMorph可以進行基本型別(Primitive)、物件(Object)及多維度的資料轉換等等...&lt;br /&gt;&lt;br /&gt;現在有一個Member物件，程式如下&lt;br /&gt;&lt;code&gt;&lt;br /&gt;public class Member&lt;br /&gt;{&lt;br /&gt;private String memberAccount;&lt;br /&gt;private String memberPassword;&lt;br /&gt;private String mailAddress;&lt;br /&gt;private String mobilePhone;&lt;br /&gt;private Integer activeType;&lt;br /&gt;public String getMemberAccount() {&lt;br /&gt;    return memberAccount;&lt;br /&gt;}&lt;br /&gt;public void setMemberAccount(String memberAccount) {&lt;br /&gt;    this.memberAccount = memberAccount;&lt;br /&gt;}&lt;br /&gt;public String getMemberPassword() {&lt;br /&gt;    return memberPassword;&lt;br /&gt;}&lt;br /&gt;public void setMemberPassword(String memberPassword) {&lt;br /&gt;    this.memberPassword = memberPassword;&lt;br /&gt;}&lt;br /&gt;public String getMailAddress() {&lt;br /&gt;    return mailAddress;&lt;br /&gt;}&lt;br /&gt;public void setMailAddress(String mailAddress) {&lt;br /&gt;    this.mailAddress = mailAddress;&lt;br /&gt;}&lt;br /&gt;public String getMobilePhone() {&lt;br /&gt;    return mobilePhone;&lt;br /&gt;}&lt;br /&gt;public void setMobilePhone(String mobilePhone) {&lt;br /&gt;    this.mobilePhone = mobilePhone;&lt;br /&gt;}&lt;br /&gt;public Integer getActiveType() {&lt;br /&gt;    return activeType;&lt;br /&gt;}&lt;br /&gt;public void setActiveType(Integer activeType) {&lt;br /&gt;    this.activeType = activeType;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public String toString()&lt;br /&gt;{&lt;br /&gt;    return &quot;memberAccount = &quot; + this.memberAccount + &quot;\n&quot; +&lt;br /&gt;           &quot;memberPassword = &quot; + this.memberPassword + &quot;\n&quot; +&lt;br /&gt;           &quot;memberMailAddress = &quot; + this.mailAddress + &quot;\n&quot; +&lt;br /&gt;           &quot;memberMobilePhone = &quot; + this.mobilePhone + &quot;\n&quot; +&lt;br /&gt;           &quot;memberActiveType = &quot; + this.activeType;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;JSON有獨特的書寫格式如下：&lt;br /&gt;&lt;code&gt;&lt;br /&gt;{&lt;br /&gt;     memberAccount:&quot;15320&quot;,&lt;br /&gt;     memberPassword: &quot;234567&quot;,&lt;br /&gt;     mailAddress: &quot;gh@ebsbu.com&quot;,&lt;br /&gt;     mobilePhone:&quot;13587344829&quot;,&lt;br /&gt;     activeType: &quot;1&quot;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;下面看個範例&lt;br /&gt;&lt;code&gt;&lt;br /&gt;public class JsonTest {&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * @param args&lt;br /&gt;   */&lt;br /&gt;  public static void main(String[] args) {&lt;br /&gt;      // TODO Auto-generated method stub&lt;br /&gt;&lt;br /&gt;      String jsonStr = &quot;{memberAccount: \&quot;15320\&quot;,&quot; +&lt;br /&gt;                      &quot;memberPassword: \&quot;234567\&quot;,&quot; +&lt;br /&gt;                      &quot;mailAddress: \&quot;gh@ebsbu.com\&quot;,&quot; +&lt;br /&gt;                      &quot;mobilePhone: \&quot;13587344829\&quot;,&quot; +&lt;br /&gt;                      &quot;activeType: \&quot;1\&quot;}&quot;;&lt;br /&gt;    &lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;       //建立JSON物件&lt;/span&gt;&lt;br /&gt;      JSONObject jsonObj = JSONObject.fromObject(jsonStr);&lt;br /&gt;      &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;//透過JSONArray印出JSON的內容&lt;/span&gt;&lt;br /&gt;      System.out.println(&quot;jsonArray = &quot; + JSONArray.fromObject(jsonObj));   &lt;br /&gt;      &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;//將JSONObject轉換給Member物件(用複製的說法會較為洽當)&lt;/span&gt;&lt;br /&gt;      Member member = (Member)JSONObject.toBean(jsonObj, Member.class);&lt;br /&gt;   &lt;br /&gt;      System.out.println(&quot;member = &quot; + member.toString());&lt;br /&gt;           &lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;看起來很簡單吧！其實JSON也是字串，主要就是利用JSONObject轉換成JSON物件，如果要看內容的話利用JSONArray印出，最後在利用JSONObject.toBean(....)轉換給Java物件。&lt;br /&gt;&lt;br /&gt;在我這次的專案中已經成功的與RestFul結合，透過RestFul與JSON讓JAVA與.NET平台溝通，寫法也很簡單，大家都可以試試。</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/1988951550841497960/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/1988951550841497960' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/1988951550841497960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/1988951550841497960'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/01/javajson.html' title='在Java中使用JSON'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-728211219287951987</id><published>2010-01-17T07:03:00.000-08:00</published><updated>2010-01-17T07:08:51.290-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu學習"/><title type='text'>Ubuntu中重新啓動iBus</title><content type='html'>iBus是由對岸同胞針對linux開發的輸入法，ubuntu 9.10也採用了iBus，但在使用時偶而會當掉，所以在網路上查了一下，如果當掉之後可以輸入ibus-daemon -d，就可以重新啓動了。&lt;br /&gt;&lt;br /&gt;如果不瞭解ibus的命令列，可輸入ibus-daemon --help。</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/728211219287951987/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/728211219287951987' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/728211219287951987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/728211219287951987'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/01/ubuntuibus.html' title='Ubuntu中重新啓動iBus'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-6844111230612909389</id><published>2010-01-10T07:12:00.000-08:00</published><updated>2010-01-10T07:22:03.278-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu學習"/><title type='text'>mount/umount指令</title><content type='html'>在Windows裏有許多的ISO掛載工具可以使用，在Ubuntu裏的掛載工具卻很少，其實只要利用mount/umount指令即可掛載與卸載。&lt;br /&gt;&lt;br /&gt;mount            指令為將周邊裝置掛入的指令，這個指令相當常用，所以了解熟悉是必備知識！&lt;br /&gt;&lt;br /&gt;格式：mount  -t  檔案系統類型  -o         選項    裝置   掛入點&lt;br /&gt;&lt;br /&gt;&lt;table style=&quot;color: rgb(0, 128, 0);&quot; cellpadding=&quot;3&quot; cellspacing=&quot;0&quot; width=&quot;400&quot; border=&quot;1&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; bg=&quot;&quot; style=&quot;color: rgb(0, 128, 0);&quot;&gt;&lt;p style=&quot;text-align: left;&quot;&gt;檔案系統&lt;/p&gt;       &lt;/td&gt;       &lt;/tr&gt;       &lt;tr&gt;         &lt;td width=&quot;100&quot; bgcolor=&quot;#ccffcc&quot;&gt;minix&lt;/td&gt;         &lt;td bgcolor=&quot;#ccffcc&quot;&gt;Linux 最早使用的檔案系統&lt;/td&gt;           &lt;/tr&gt;        &lt;tr&gt;          &lt;td width=&quot;100&quot; bgcolor=&quot;#ffccff&quot;&gt;ext2&lt;/td&gt;          &lt;td bgcolor=&quot;#ffccff&quot;&gt;Linux 目前使用的檔案系統&lt;/td&gt;           &lt;/tr&gt;        &lt;tr&gt;          &lt;td width=&quot;100&quot; bgcolor=&quot;#ccffcc&quot;&gt;msdos&lt;/td&gt;          &lt;td bgcolor=&quot;#ccffcc&quot;&gt;MS-DOS 的 FAT&lt;/td&gt;           &lt;/tr&gt;        &lt;tr&gt;          &lt;td width=&quot;100&quot; bgcolor=&quot;#ffccff&quot;&gt;vfat&lt;/td&gt;          &lt;td bgcolor=&quot;#ffccff&quot;&gt;Windows 95 的 FAT32&lt;/td&gt;           &lt;/tr&gt;        &lt;tr&gt;          &lt;td width=&quot;100&quot; bgcolor=&quot;#ccffcc&quot;&gt;nfs&lt;/td&gt;          &lt;td bgcolor=&quot;#ccffcc&quot;&gt;網路檔案系統&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;          &lt;td width=&quot;100&quot; bgcolor=&quot;#ffccff&quot;&gt;iso9660&lt;/td&gt;          &lt;td bgcolor=&quot;#ffccff&quot;&gt;光碟格式&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;          &lt;td width=&quot;100&quot; bgcolor=&quot;#ccffcc&quot;&gt;ntfs&lt;/td&gt;          &lt;td bgcolor=&quot;#ccffcc&quot;&gt;Windows NT 4.0 的檔案系統&lt;/td&gt;           &lt;/tr&gt;        &lt;tr&gt;          &lt;td width=&quot;100&quot; bgcolor=&quot;#ffccff&quot;&gt;hpfs&lt;/td&gt;          &lt;td bgcolor=&quot;#ffccff&quot;&gt;OS/2 的檔案系統&lt;/td&gt;           &lt;/tr&gt;        &lt;tr&gt;          &lt;td width=&quot;100&quot; bgcolor=&quot;#ccffcc&quot;&gt;auto&lt;/td&gt;          &lt;td bgcolor=&quot;#ccffcc&quot;&gt;自動偵測&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;掛載&lt;br /&gt;sudo mount -t iso9660 -o loop xxx.iso /media/cdrom0&lt;br /&gt;&lt;br /&gt;卸載&lt;br /&gt;sudo umount /media/cdrom0</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/6844111230612909389/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/6844111230612909389' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/6844111230612909389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/6844111230612909389'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/01/mountumount.html' title='mount/umount指令'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-5023328937873611735</id><published>2010-01-04T05:11:00.000-08:00</published><updated>2010-01-17T07:45:07.599-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><title type='text'>在Spring中利用XFire構建WebService</title><content type='html'>以往在建構Java的WebService時總是很偷懶的用Eclipse的Web Service工具，很直覺也很方便，但總是會自動生成一些很複雜也不太想看的代碼，這次碰到要在Spring中建構Web Service，便下定決心要好好研究一下如何建構Web Service。&lt;br /&gt;&lt;br /&gt;講到建構WebService馬上想到Apache的&lt;a href=&quot;http://ws.apache.org/axis2/&quot;&gt;Axis2&lt;/a&gt;，但是Axis對此次目標而言太過複雜，經過一番研究後決定使用&lt;a href=&quot;http://xfire.codehaus.org/&quot;&gt;XFire&lt;/a&gt;。&lt;br /&gt;&lt;p&gt; XFire是与Axis 2并列的新一代WebService框架。之所以并称为新一代，因为它：&lt;/p&gt; &lt;ul&gt;&lt;li&gt;支持一系列Web Service的新标准--JSR181、WSDL2.0 、JAXB2、&lt;a href=&quot;http://xfire.codehaus.org/WS-Security&quot; target=&quot;_blank&quot;&gt;WS-Security&lt;/a&gt;等     ;    &lt;/li&gt;&lt;li&gt;使用Stax解释XML,性能有了质的提高。XFire采用&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;&lt;span&gt;Woodstox&lt;/span&gt; &lt;/span&gt; 作Stax实现;   &lt;/li&gt;&lt;li&gt;Easily Create Services from POJOs;    &lt;/li&gt;&lt;li&gt;Spring的结合;    &lt;/li&gt;&lt;li&gt;灵活的Binding机制，包括默认的Aegis,xmlbeans,jaxb2,castor。&lt;/li&gt;&lt;/ul&gt;接下來說明如何在Spring中加入Web Service&lt;br /&gt;&lt;br /&gt;首先建立xfire-servlet.xml&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;br /&gt;&amp;lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;&lt;br /&gt;xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;br /&gt;xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;import resource=&quot;classpath:org/codehaus/xfire/spring/xfire.xml&quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;bean id=&quot;xmlbeansTypeRegistry&quot; class=&quot;org.codehaus.xfire.xmlbeans.XmlBeansTypeRegistry&quot; /&amp;gt;&lt;br /&gt;&amp;lt;bean id=&quot;webAnnotations&quot;&lt;br /&gt;class=&quot;org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations&quot; /&amp;gt;&lt;br /&gt;&amp;lt;bean id=&quot;handlerMapping&quot; class=&quot;org.codehaus.xfire.spring.remoting.Jsr181HandlerMapping&quot;&amp;gt;&lt;br /&gt;&amp;lt;property name=&quot;typeMappingRegistry&quot; ref=&quot;xmlbeansTypeRegistry&quot; /&amp;gt;&lt;br /&gt;&amp;lt;property name=&quot;xfire&quot; ref=&quot;xfire&quot; /&amp;gt;&lt;br /&gt;&amp;lt;property name=&quot;webAnnotations&quot; ref=&quot;webAnnotations&quot; /&amp;gt;&lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;bean class=&quot;org.springframework.web.servlet.handler.SimpleUrlHandlerMapping&quot;&amp;gt;&lt;br /&gt;&amp;lt;property name=&quot;urlMap&quot;&amp;gt;&lt;br /&gt;&amp;lt;map&amp;gt;&lt;br /&gt;&amp;lt;entry key=&quot;/&quot;&amp;gt;&lt;br /&gt;&amp;lt;ref bean=&quot;handlerMapping&quot; /&amp;gt;&lt;br /&gt;&amp;lt;/entry&amp;gt;&lt;br /&gt;&amp;lt;/map&amp;gt;&lt;br /&gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&amp;lt;/beans&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;再來是在web.xml中加入以下的片段&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;context-param&amp;gt;&lt;br /&gt;&amp;lt;param-name&amp;gt;contextConfigLocation&amp;lt;/param-name&amp;gt;&lt;br /&gt;&amp;lt;!--將xfire-servlet.xml加入--&amp;gt;&lt;br /&gt;&amp;lt;param-value&amp;gt;&lt;br /&gt;classpath:/beans.xml&lt;br /&gt;/WEB-INF/xfire-servlet.xml&lt;br /&gt;&amp;lt;/param-value&amp;gt;&lt;br /&gt;&amp;lt;/context-param&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;servlet&amp;gt;&lt;br /&gt;&amp;lt;servlet-name&amp;gt;xfire&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;&amp;lt;servlet-class&amp;gt;org.codehaus.xfire.spring.XFireSpringServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;&amp;lt;/servlet&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&amp;lt;!--任何經過/service/進入的都會被此Servlet攔下--&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;&amp;lt;servlet-name&amp;gt;xfire&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;&amp;lt;url-pattern&amp;gt;/services/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;最後是在beans.xml中宣告service&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;bean id=&quot;personService&quot; class=&quot;com.foxconn.service.impl.PersonServiceImpl&quot;&amp;gt;&lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;在beans.xml中的宣告一如往昔，完全不用修改。&lt;br /&gt;&lt;br /&gt;接下來即要進入程式的實現&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;package com.foxconn.service;&lt;br /&gt;&lt;br /&gt;import javax.jws.WebService;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;@WebService&lt;/span&gt;&lt;br /&gt;public interface PersonService&lt;br /&gt;{&lt;br /&gt;public void add();&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;注意到了嗎？在inteface上方要用annotation宣告此interface為WebService。&lt;br /&gt;&lt;br /&gt;再來是interface的實現&lt;br /&gt;&lt;code&gt;&lt;br /&gt;package com.foxconn.service.impl;&lt;br /&gt;&lt;br /&gt;import javax.jws.WebService;&lt;br /&gt;&lt;br /&gt;import com.foxconn.service.PersonService;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;@WebService(serviceName = &quot;person&quot;, endpointInterface = &quot;com.foxconn.service.PersonService&quot;)&lt;/span&gt;&lt;br /&gt;public class PersonServiceImpl implements PersonService {&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt;public void add()&lt;br /&gt;{&lt;br /&gt;// TODO Auto-generated method stub&lt;br /&gt;System.out.println(&quot;add....................&quot;);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;在此實做類別的上方也要用annotation宣告。&lt;br /&gt;serviceName指的是webservice的名稱。&lt;br /&gt;endpointInterface指的是webservice的進入點。&lt;br /&gt;&lt;br /&gt;完成後佈署啓動即可在瀏覽器輸入http://localhost:8080/XFireTest/services/person?wsdl&lt;br /&gt;就可以看到動態生成的WSDL了(XFireTest是專案名稱也就是站點名稱囉)。&lt;br /&gt;&lt;br /&gt;接下來要進行webService的測試。&lt;br /&gt;&lt;br /&gt;我建立了一個很單純的Java Project，並寫了如下的code&lt;br /&gt;&lt;code&gt;&lt;br /&gt;package com.test;&lt;br /&gt;import java.net.URL;&lt;br /&gt;&lt;br /&gt;import org.codehaus.xfire.client.Client;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class ClientTest {&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* @param args&lt;br /&gt;*/&lt;br /&gt;public static void main(String[] args)throws Exception&lt;br /&gt;{&lt;br /&gt;// TODO Auto-generated method stub&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;//利用XFire的Client建立WebService客戶端&lt;/span&gt;&lt;br /&gt;Client c = new Client(new URL(&quot;http://localhost:8080/XFireTest/services/person?wsdl&quot;));&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;  //呼叫服務,服務的方法為add,一定要傳入引數，但這個service並沒有引數，所以就隨便傳&lt;/span&gt;&lt;br /&gt;Object result[] = c.invoke(&quot;add&quot;,new Object[0]);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;最後執行即可看到Console印出add....................了&lt;br /&gt;在最後撰寫webservice Client端時我心血來潮將一個個要用到Jar放入並，整理如下：&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://xfire.codehaus.org/&quot;&gt;XFire&lt;/a&gt;：當然是最重要的，一定要放的。在這我使用的是XFire-1.2.6，而具只要加入xfire-all-1.2.6.jar即可。&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://commons.apache.org/logging/&quot;&gt;Logging1.1.1&lt;/a&gt;：Apache的Logging，好像哪都少不了它呢。&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://sourceforge.net/projects/wsdl4j/&quot;&gt;WSDL4j-1.6.2&lt;/a&gt;：因為會用到WSDL的原因，所以也是少不了的。&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://ws.apache.org/commons/XmlSchema/index.html&quot;&gt;XmlSchema-1.4.5&lt;/a&gt;：這也是必須的。&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://hc.apache.org/&quot;&gt;commons-httpClient-1.4.5&lt;/a&gt;：會須要此套件建立HttpClient。&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://commons.apache.org/codec/index.html&quot;&gt;commons-codec-1.4&lt;/a&gt;：進行URL的解碼。&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/5023328937873611735/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/5023328937873611735' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/5023328937873611735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/5023328937873611735'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/01/springxfirewebservice.html' title='在Spring中利用XFire構建WebService'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-1696381960718345428</id><published>2010-01-03T04:58:00.000-08:00</published><updated>2010-01-03T05:10:29.119-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="網路技巧"/><title type='text'>在Blogger插入有框的程式碼</title><content type='html'>在使用Blogger發表含有程式碼的文章時，總是要搞很久。如果要出現&lt;&gt;符號時，則必須要換成&lt;span style=&quot;color: rgb(255, 102, 102);&quot;&gt;＆lt; ＆gt;&lt;/span&gt;。&lt;br /&gt;&lt;br /&gt;其實只要到「&lt;a href=&quot;http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/Encode.aspx&quot; target=&quot;_blank&quot;&gt;HTML Encoder&lt;/a&gt;」將程式碼貼上，按下〔Encode〕按鈕，就可以在下方看到已經將「&lt;」和「&gt;」都轉好了，複製起來就可以用了。&lt;br /&gt;&lt;br /&gt;當然在這之前，我們要修改一下Blogger CSS了。接下來在的Blogger後台選擇&quot;版面配置&quot;-&gt;&quot;修改HTML&quot;，在&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;]]&amp;gt;&amp;lt;/b:skin&amp;gt;&lt;/span&gt;之前插入下列這段CSS程式碼：&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;code&amp;gt;code {&lt;br /&gt;display: block;&lt;br /&gt;font-family: &#39;Courier New&#39;;&lt;br /&gt;font-size: 9pt;&lt;br /&gt;overflow: auto;&lt;br /&gt;border: 1px solid #ccc;&lt;br /&gt;padding: 10px 10px 10px 21px;&lt;br /&gt;max-height: 1200px;&lt;br /&gt;line-height: 1.2em;&lt;br /&gt;letter-spacing: 0px;&lt;br /&gt;color: #000;&lt;br /&gt;white-space: pre;&lt;br /&gt;background: #ccc url(http://8961483303109839245-a-1802744773732722657-s-sites.googlegroups.com/site/oliverchenweb/blog/blogger-code.gif) left top repeat-y;&lt;br /&gt;}&amp;lt;/code&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;其中http://8961483303109839245-a-1802744773732722657-s-sites.googlegroups.com/site/oliverchenweb/blog/blogger-code.gif這個圖片因人而異，也就是看自己的圖片放哪個就貼那個URL即可。&lt;br /&gt;&lt;br /&gt;如此一來；以後貼程式碼時，只要前後加上&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;，就可以有很清楚的程式碼區了。</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/1696381960718345428/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/1696381960718345428' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/1696381960718345428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/1696381960718345428'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/01/blogger-lt-gt-html-encoder-encode-html.html' title='在Blogger插入有框的程式碼'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-7728371002068629340</id><published>2010-01-03T01:20:00.001-08:00</published><updated>2010-01-17T07:43:21.764-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><title type='text'>利用dom4j解構與解析XML(一)</title><content type='html'>利用&lt;a href=&quot;http://www.dom4j.org/&quot;&gt;dom4j&lt;/a&gt;可以進行XML的解析與建構，可到&lt;a href=&quot;http://dom4j.sourceforge.net/dom4j-1.6.1/index.html&quot;&gt;dom4J Sourceforge&lt;/a&gt;下載。&lt;br /&gt;&lt;br /&gt;在建構的時候必須要先建構一個Document物件，然後再往下加Element物件，透過這種方式，一步步的將XML建構出來。&lt;br /&gt;&lt;br /&gt;如下的程式碼：&lt;br /&gt;&lt;code&gt;&lt;br /&gt;package com;&lt;br /&gt;&lt;br /&gt;import java.util.ArrayList;&lt;br /&gt;import java.util.List;&lt;br /&gt;&lt;br /&gt;import org.dom4j.Document;&lt;br /&gt;import org.dom4j.DocumentHelper;&lt;br /&gt;import org.dom4j.Element;&lt;br /&gt;&lt;br /&gt;public class BuildTest {&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* @param args&lt;br /&gt;*/&lt;br /&gt;public static void main(String[] args)&lt;br /&gt;{&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;// 創建須放在XML裏的範例&lt;/span&gt;&lt;br /&gt;// TODO Auto-generated method stub&lt;br /&gt;ProductCategory category1 = new ProductCategory();&lt;br /&gt;category1.setProductCategoryId(&quot;0001&quot;);&lt;br /&gt;category1.setCategoryName(&quot;小說&quot;);&lt;br /&gt;category1.setCategoryLevel(&quot;B&quot;);&lt;br /&gt;category1.setParentId(&quot;001&quot;);&lt;br /&gt;category1.setCategoryDesc(&quot;電子書類別&quot;);&lt;br /&gt;category1.setOrderBy(&quot;1&quot;);&lt;br /&gt;&lt;br /&gt;ProductCategory category2 = new ProductCategory();&lt;br /&gt;category2.setProductCategoryId(&quot;0002&quot;);&lt;br /&gt;category2.setCategoryName(&quot;漫畫&quot;);&lt;br /&gt;category2.setCategoryLevel(&quot;B&quot;);&lt;br /&gt;category2.setParentId(&quot;002&quot;);&lt;br /&gt;category2.setCategoryDesc(&quot;電子書類別&quot;);&lt;br /&gt;category2.setOrderBy(&quot;1&quot;);&lt;br /&gt;&lt;br /&gt;List&lt;productcategory&gt; list = new ArrayList&lt;productcategory&gt; ();&lt;br /&gt;&lt;br /&gt;list.add(category1);&lt;br /&gt;list.add(category2);&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;// 呼叫buildeXML(...)&lt;/span&gt;&lt;br /&gt;BuildTest test = new BuildTest();&lt;br /&gt;System.out.println(test.buildXML(list));&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public String buildXML(List&lt;productcategory&gt; list) {&lt;br /&gt;Integer TotalRecordCount = list.size();&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;// 創建一個Document實例&lt;/span&gt;&lt;br /&gt;Document document = DocumentHelper.createDocument();&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;// 生成Document下的一個根節點&lt;/span&gt;&lt;br /&gt;Element root = document.addElement(&quot;Response&quot;);&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;// 生成root的一個節點&lt;/span&gt;&lt;br /&gt;Element apiName = root.addElement(&quot;BbPdtCategorySelRsp&quot;);&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;// 加入TotalRecordCount節點&lt;/span&gt;&lt;br /&gt;Element count = apiName.addElement(&quot;TotalRecordCount&quot;);&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;// 設置TotalRecordCount節點的值&lt;/span&gt;&lt;br /&gt;count.addText(TotalRecordCount.toString());&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;// 加入CategoryInfoList節點&lt;/span&gt;&lt;br /&gt;Element categoryInfoList = apiName.addElement(&quot;CategoryInfoList&quot;);&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;// 加入多個CategoryInfoList節點&lt;/span&gt;&lt;br /&gt;for (ProductCategory temp : list) {&lt;br /&gt;   Element categoryInfo = categoryInfoList.addElement(&quot;CategoryInfo&quot;);&lt;br /&gt;&lt;br /&gt;   Element categoryID = categoryInfo.addElement(&quot;CategoryID&quot;);&lt;br /&gt;   categoryID.addText(temp.getProductCategoryId() == null ? &quot;&quot; : temp&lt;br /&gt;           .getProductCategoryId().toString());&lt;br /&gt;   Element categoryName = categoryInfo.addElement(&quot;CategoryName&quot;);&lt;br /&gt;   categoryName.addText(temp.getCategoryName() == null ? &quot;&quot; : temp&lt;br /&gt;           .getCategoryName());&lt;br /&gt;   Element parentID = categoryInfo.addElement(&quot;ParentID&quot;);&lt;br /&gt;   parentID.addText(temp.getParentId() == null ? &quot;&quot; : temp&lt;br /&gt;           .getParentId().toString());&lt;br /&gt;   Element categoryDesc = categoryInfo.addElement(&quot;CategoryDesc&quot;);&lt;br /&gt;   categoryDesc.addText(temp.getCategoryDesc() == null ? &quot;&quot; : temp&lt;br /&gt;           .getCategoryDesc());&lt;br /&gt;   Element categoryLevel = categoryInfo.addElement(&quot;CategoryLevel&quot;);&lt;br /&gt;   categoryLevel.addText(temp.getCategoryLevel() == null ? &quot;&quot; : temp&lt;br /&gt;           .getCategoryLevel().toString());&lt;br /&gt;   Element orderBy = categoryInfo.addElement(&quot;OrderBy&quot;);&lt;br /&gt;   orderBy.addText(temp.getOrderBy() == null ? &quot;&quot; : temp.getOrderBy()&lt;br /&gt;           .toString());&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;//傳回建構過很的XML&lt;br /&gt;return document.asXML();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/productcategory&gt;&lt;/productcategory&gt;&lt;/productcategory&gt;&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/7728371002068629340/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/7728371002068629340' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/7728371002068629340'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/7728371002068629340'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/01/package-com-import-java.html' title='利用dom4j解構與解析XML(一)'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-5401294284025042441</id><published>2010-01-02T21:36:00.000-08:00</published><updated>2010-01-17T07:42:55.697-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><title type='text'>Apache Common Digester</title><content type='html'>&lt;p align=&quot;left&quot;&gt;&lt;a href=&quot;http://commons.apache.org/digester/&quot;&gt;Apache Common Digester&lt;/a&gt;是專門解析XML文件的工具，目前已發布到2.0版。&lt;/p&gt;&lt;p align=&quot;left&quot;&gt;在開始之前必須先下載&lt;a href=&quot;http://commons.apache.org/logging/&quot;&gt;Logging&lt;/a&gt;及&lt;a href=&quot;http://commons.apache.org/beanutils/&quot;&gt;BeanUtils&lt;/a&gt;。&lt;br /&gt;&lt;/p&gt;&lt;p align=&quot;left&quot;&gt;例如有個XML文檔如下：&lt;/p&gt;&lt;br /&gt;&lt;div class=&quot;code&quot; style=&quot;border: 0.5pt solid windowtext; padding: 2px 2.4pt; background: rgb(230, 230, 230) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 95%;&quot;&gt;&lt;div class=&quot;codeContent&quot;&gt;&lt;br /&gt;&lt;pre class=&quot;code-xml&quot;&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;code-tag&quot;  style=&quot;font-size:78%;&quot;&gt;&amp;lt;Request&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;             &#39;Request&#39;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;code-tag&quot;  style=&quot;font-size:78%;&quot;&gt;&amp;lt;BbPdtCategorySelReq&amp;gt; &lt;/span&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;&#39;Request/BbPdtCategorySelReq&#39;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;code-tag&quot;  style=&quot;font-size:78%;&quot;&gt;&amp;lt;ParameterList&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;       &#39;Request/BbPdtCategorySelReq/ParameterList&#39;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;code-tag&quot;  style=&quot;font-size:78%;&quot;&gt;&amp;lt;Parameter&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;           &#39;Request/BbPdtCategory/ParameterList/Parameter&#39;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;code-tag&quot;  style=&quot;font-size:78%;&quot;&gt;&amp;lt;Name&amp;gt;Oliver&amp;lt;/Name&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;   &#39;Request/BbPdtCategory/ParameterList/Parameter/Name&#39;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;code-tag&quot;  style=&quot;font-size:78%;&quot;&gt;&amp;lt;Value&amp;gt;Good&amp;lt;/Value&amp;gt;   &lt;/span&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;&#39;Request/BbPdtCategory/ParameterList/Parameter/Value&#39;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;code-tag&quot;  style=&quot;font-size:78%;&quot;&gt;&amp;lt;/Parameter&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;code-tag&quot;  style=&quot;font-size:78%;&quot;&gt;&amp;lt;Parameter&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;           &#39;Request/BbPdtCategory/ParameterList/Parameter&#39;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;code-tag&quot;  style=&quot;font-size:78%;&quot;&gt;&amp;lt;Name&amp;gt;Joyce&amp;lt;/Name&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;    &#39;Request/BbPdtCategory/ParameterList/Parameter/Name&#39;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;code-tag&quot;  style=&quot;font-size:78%;&quot;&gt;&amp;lt;Value&amp;gt;Gool&amp;lt;/Value&amp;gt;   &lt;/span&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;&#39;Request/BbPdtCategory/ParameterList/Parameter/Value&#39;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;code-tag&quot;  style=&quot;font-size:78%;&quot;&gt;&amp;lt;/Parameter&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;code-tag&quot;  style=&quot;font-size:78%;&quot;&gt;&amp;lt;/ParameterList&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;code-tag&quot;  style=&quot;font-size:78%;&quot;&gt;&amp;lt;/BbPdtCategorySelReq&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;code-tag&quot;  style=&quot;font-size:78%;&quot;&gt;&amp;lt;/Request&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Digester是利用路徑的概念進行解析，可以由上述的範例看出每個XML Tag所對應，相當的直覺。&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;text-align: left;&quot;&gt;首先必須建立欲解析的Bean，利用上述的範例為ParameterList及Parameter&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;code&quot; style=&quot;border: 0.5pt solid windowtext; padding: 2px 2.4pt; background: rgb(230, 230, 230) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 95%;&quot;&gt;&lt;div class=&quot;codeContent&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;package com;&lt;br /&gt;&lt;/span&gt;&lt;pre class=&quot;code-java&quot;&gt;&lt;span class=&quot;code-keyword&quot;  style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;import java.util.ArrayList;&lt;br /&gt;import java.util.List;&lt;br /&gt;&lt;br /&gt;public class ParameterList {&lt;br /&gt;private List&lt;parameter&gt; parameters = new ArrayList&lt;parameter&gt;();&lt;br /&gt;&lt;br /&gt;public List&lt;parameter&gt; getParameters() {&lt;br /&gt;return parameters;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void addParameter(Parameter parameter) {&lt;br /&gt;this.parameters.add(parameter);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;/parameter&gt;&lt;/parameter&gt;&lt;/parameter&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;code&quot; style=&quot;border: 0.5pt solid windowtext; padding: 2px 2.4pt; background: rgb(230, 230, 230) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 95%;&quot;&gt;&lt;div class=&quot;codeContent&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;pre class=&quot;code-java&quot;&gt;&lt;span class=&quot;code-keyword&quot;  style=&quot;font-size:85%;&quot;&gt;package com;&lt;br /&gt;&lt;br /&gt;public class Parameter {&lt;br /&gt;private String name;&lt;br /&gt;private String value;&lt;br /&gt;&lt;br /&gt;public String getName() {&lt;br /&gt;return name;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void setName(String name) {&lt;br /&gt;this.name = name;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public String getValue() {&lt;br /&gt;return value;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void setValue(String value) {&lt;br /&gt;this.value = value;&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;text-align: left;&quot;&gt;最後是XML的解析&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;code&quot; style=&quot;border: 0.5pt solid windowtext; padding: 2px 2.4pt; background: rgb(230, 230, 230) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 95%;&quot;&gt;&lt;div class=&quot;codeContent&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;pre class=&quot;code-java&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;package com;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;import java.io.StringReader;&lt;br /&gt;import java.util.ArrayList;&lt;br /&gt;import java.util.List;&lt;br /&gt;&lt;br /&gt;import org.apache.commons.digester.Digester;&lt;br /&gt;import org.xml.sax.SAXException;&lt;br /&gt;&lt;br /&gt;public class DigesterTest {&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* @param args&lt;br /&gt;*/&lt;br /&gt;public static void main(String[] args) {&lt;br /&gt;// TODO Auto-generated method stub&lt;br /&gt;String xmlDocp = “&amp;lt;Request&amp;gt;&amp;lt;BbPdtCategorySelReq&amp;gt;“＋&lt;br /&gt;                         ”&amp;lt;ParameterList&amp;gt;&amp;lt;Parameter&amp;gt;“＋&lt;br /&gt;                         ”&amp;lt;Name&amp;gt;Oliver&amp;lt;/Name&amp;gt;”＋&lt;br /&gt;                         “&amp;lt;Value&amp;gt;Good&amp;lt;/Value&amp;gt;”＋&lt;br /&gt;                         “&amp;lt;/Parameter&amp;gt;”＋&lt;br /&gt;                         “&amp;lt;Parameter&amp;gt;”＋&lt;br /&gt;                         “&amp;lt;Name&amp;gt;Joyce&amp;lt;/Name&amp;gt;”＋&lt;br /&gt;                         “&amp;lt;Value&amp;gt;Gool&amp;lt;/Value&amp;gt;”＋&lt;br /&gt;                         “&amp;lt;/Parameter&amp;gt;”＋&lt;br /&gt;                         “&amp;lt;/ParameterList&amp;gt;”＋&lt;br /&gt;                         “&amp;lt;/BbPdtCategorySelReq&amp;gt;“&lt;br /&gt;                         “&amp;lt;/Request&amp;gt;”;&lt;br /&gt;&lt;br /&gt;try {&lt;br /&gt;   // 調用解析方法&lt;br /&gt;&lt;br /&gt;   DigesterTest t = new DigesterTest();&lt;br /&gt;&lt;br /&gt;   ParameterList parameterList = t.parseByDigesterP(xmlDocp);&lt;br /&gt;   // 循環所有的Parameter&lt;br /&gt;   for (Parameter p : parameterList.getParameters())&lt;br /&gt;   {&lt;br /&gt;       p.getName(); // 取得NAME&lt;br /&gt;       p.getValue(); // 取得對應的VALUE&lt;br /&gt;   }&lt;br /&gt;} catch (IOException e) {&lt;br /&gt;   // TODO 自動產生 catch 區塊&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;} catch (SAXException e) {&lt;br /&gt;   // TODO 自動產生 catch 區塊&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public ParameterList parseByDigesterP(String xmlDoc) throws IOException,&lt;br /&gt;   SAXException {&lt;br /&gt;&lt;br /&gt;System.out.println(xmlDoc);&lt;br /&gt;&lt;br /&gt;StringReader read = new StringReader(xmlDoc);&lt;br /&gt;&lt;br /&gt;System.out.println(read);&lt;br /&gt;&lt;br /&gt;ParameterList parameterList = new ParameterList();&lt;br /&gt;// 實例Digester物件&lt;br /&gt;Digester d = new Digester();&lt;br /&gt;// DTD檔進行驗證&lt;br /&gt;d.setValidating(false);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 0, 0);font-size:85%;&quot; &gt;// push:放入一个根节点物件，要從哪個節點放入就設哪一個&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;。&lt;br /&gt;d.push(parameterList);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 0, 0);font-size:85%;&quot; &gt;// 對節點Parameter創建一個Parameter的物件&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;d.addObjectCreate(&lt;br /&gt;  &quot;Request/BbPdtCategorySelReq/ParameterList/Parameter&quot;,&lt;br /&gt;  Parameter.class);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 0, 0);font-size:85%;&quot; &gt;// 相當于調用Parameter中的setName()&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;d.addBeanPropertySetter(&lt;br /&gt;  &quot;Request/BbPdtCategorySelReq/ParameterList/Parameter/Name&quot;,&lt;br /&gt;  &quot;name&quot;);&lt;br /&gt;d.addBeanPropertySetter(&lt;br /&gt;  &quot;Request/BbPdtCategorySelReq/ParameterList/Parameter/Value&quot;,&lt;br /&gt;  &quot;value&quot;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 0, 0);font-size:85%;&quot; &gt;// 想當與調用ParameterList中的addParameter()&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;d.addSetNext(&lt;br /&gt;  &quot;Request/BbPdtCategorySelReq/ParameterList/Parameter&quot;,&lt;br /&gt;  &quot;addParameter&quot;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 0, 0);font-size:85%;&quot; &gt;// 得到相應的ParameterList物件&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;parameterList = (ParameterList) d.parse(read);&lt;br /&gt;&lt;br /&gt;return parameterList;&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href=&quot;http://sites.google.com/site/oliverchenweb/java-xue-xi/DigesterTest.tar.gz?attredirects=0&amp;amp;d=1&quot;&gt;範例文檔&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: left;&quot;&gt;參考文件：&lt;br /&gt;&lt;a href=&quot;http://www.javaworld.com.tw/confluence/pages/viewpage.action?pageId=421&quot;&gt;用Digester簡化XML配置文件處理&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/5401294284025042441/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/5401294284025042441' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/5401294284025042441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/5401294284025042441'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2010/01/apache-common-digester.html' title='Apache Common Digester'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-6873977938135321808</id><published>2009-12-29T08:05:00.000-08:00</published><updated>2012-06-18T10:44:17.709-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu學習"/><title type='text'>Ununtu 12.04安裝JDK6</title><content type='html'>下載jdk-6u33-linux-x64.bin&lt;br /&gt;
變更檔案權限chmod +x&amp;nbsp;
jdk-6u33-linux-x64.bin&amp;nbsp;&amp;lt;--更改檔案權限..+x是可以執行的...&lt;br /&gt;
sudo cp&amp;nbsp;&lt;span style=&quot;background-color: white;&quot;&gt;jdk-6u33-linux-x64.bin /usr/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;./&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;jdk-6u33-linux-x64.bin&amp;lt;--會解壓縮成為jdk1.6.0_33資料夾&lt;/span&gt;&lt;br /&gt;
sudo update-alternatives --install /usr/bin/java java /usr/jdk1.6.0_33/bin/java 60&amp;lt;--將JDK1.6.0_33設為預設的JAVA&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
sudo update-alternatives --config java&amp;lt;--若有多個JAVA版本可以在此選擇，若沒有則顯&lt;span style=&quot;font-family: 微软雅黑, Verdana, sans-serif, 宋体;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24px;&quot;&gt;示&quot;There is only one alternatives in link group....&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/6873977938135321808/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/6873977938135321808' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/6873977938135321808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/6873977938135321808'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2009/12/ubuntujava.html' title='Ununtu 12.04安裝JDK6'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8385485320669302122.post-4232984794153542162</id><published>2009-09-22T21:18:00.000-07:00</published><updated>2009-09-22T21:20:34.625-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu學習"/><title type='text'>Ubuntu 安裝 Postgres SQL 8.3</title><content type='html'>&lt;p&gt;&lt;strong&gt;Install PostgreSQL&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Install the postgresql-8.3 package from Synaptic or apt-get:&lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt;$ sudo apt-get install postgresql-8.3&lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;You might also want to install the pgadmin3 tool to help you manage your database:&lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt;$ sudo apt-get install pgadmin3&lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;&lt;strong&gt;Reset the password of the postgres user&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;The default superuser, called ‘postgres’, does not have a password by default. We need to add one:&lt;/p&gt; &lt;pre style=&quot;padding-left: 30px;&quot;&gt;$ sudo su postgres -c psql template1&lt;br /&gt;template1=# ALTER USER postgres with PASSWORD &#39;password&#39;;&lt;br /&gt;template1=# \q&lt;/pre&gt; &lt;p&gt;Where ‘password’ is your password. After this we need to modify the password of the postgres UNIX user:&lt;/p&gt; &lt;pre style=&quot;padding-left: 30px;&quot;&gt;$ sudo passwd -d postgres&lt;br /&gt;$ sudo su postgres -c passwd&lt;/pre&gt; &lt;p&gt;You will be asked for a new password, enter the same password with the one you specify in the ALTER USER statement above.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allow local users to access the server&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;The default PostgreSQL installation in Ubuntu requires that a PostgreSQL user must also be a unix user. I don’t like it this since it makes it hard for us to create a new PostgreSQL user. I want a PostgreSQL user to be different than a UNIX user. To do this, we need to change the configuration in the pg_hba.conf file:&lt;/p&gt; &lt;pre style=&quot;padding-left: 30px;&quot;&gt;$ sudo gedit /etc/postgresql/8.3/main/pg_hba.conf&lt;/pre&gt; &lt;p&gt;Replace out the line (comment it out by adding a ‘#’ in front of it):&lt;/p&gt; &lt;pre style=&quot;padding-left: 30px;&quot;&gt;local all all ident sameuser&lt;/pre&gt; &lt;p&gt;With this line:&lt;/p&gt; &lt;pre style=&quot;padding-left: 30px;&quot;&gt;local all all md5&lt;/pre&gt; &lt;p&gt;After that you will need to restart the server:&lt;/p&gt; &lt;pre style=&quot;padding-left: 30px;&quot;&gt;$ sudo /etc/init.d/postgresql-8.3 restart&lt;/pre&gt; &lt;p&gt;Now you’re all set. All you need to do is to create a new user, and a database and start coding.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Some important commands to remember:&lt;/strong&gt;&lt;/p&gt; &lt;ol&gt;&lt;li&gt;&lt;strong&gt;Creating a new PostgreSQL user&lt;/strong&gt; &lt;pre style=&quot;padding-left: 30px;&quot;&gt;$ sudo -u postgres createuser -d -R -P &lt;new&gt;&lt;/pre&gt; &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Create a new database owned by &lt;username&gt;&lt;/strong&gt; &lt;pre style=&quot;padding-left: 30px;&quot;&gt;$ sudo -u postgres createdb -O &lt;usename&gt; &lt;database&gt;&lt;/pre&gt; &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Executing an SQL file&lt;/strong&gt; &lt;pre style=&quot;padding-left: 30px;&quot;&gt;$ psql -f &lt;filename&gt; &lt;database&gt; &lt;username&gt;&lt;/pre&gt; &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Removing a database&lt;/strong&gt; &lt;pre style=&quot;padding-left: 30px;&quot;&gt;$ dropdb -U &lt;username&gt; &lt;database&gt;&lt;/pre&gt; &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Removing a &lt;/strong&gt;&lt;strong&gt;PostgreSQL&lt;/strong&gt;&lt;strong&gt; user&lt;/strong&gt; &lt;pre style=&quot;padding-left: 30px;&quot;&gt;$ sudo -u postgres dropuser &lt;usernamen&gt;&lt;span style=&quot;font-family: Georgia,serif;&quot;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/li&gt;&lt;/ol&gt;參考資料 &lt;a href=&quot;http://solyaris.wordpress.com/2008/08/09/setup-postgres-in-ubuntu/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link to &amp;quot;Setup PostgreSQL in Ubuntu&amp;quot;&quot;&gt;Setup PostgreSQL in Ubuntu&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://www-oliver.blogspot.com/feeds/4232984794153542162/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8385485320669302122/4232984794153542162' title='19 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/4232984794153542162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8385485320669302122/posts/default/4232984794153542162'/><link rel='alternate' type='text/html' href='http://www-oliver.blogspot.com/2009/09/ubuntu-postgres-sql-83.html' title='Ubuntu 安裝 Postgres SQL 8.3'/><author><name>Oliver</name><uri>http://www.blogger.com/profile/16477635078251891838</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>19</thr:total></entry></feed>