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

<channel>
	<title>聰明的生活2 &#187; server</title>
	<atom:link href="http://blog.yslifes.com/archives/tag/server/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.yslifes.com</link>
	<description>自己寫java程式的一些筆記</description>
	<lastBuildDate>Wed, 08 Feb 2012 02:26:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://blog.yslifes.com/?pushpress=hub'/>
		<item>
		<title>JApplet與Web Server做溝通</title>
		<link>http://blog.yslifes.com/archives/934</link>
		<comments>http://blog.yslifes.com/archives/934#comments</comments>
		<pubDate>Tue, 26 Apr 2011 11:50:00 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[程式]]></category>
		<category><![CDATA[applet]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[gson]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[Socket]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/934</guid>
		<description><![CDATA[Applet除非是內部或自己使用時，可以直接使用JDBC來連接資料庫，而一般對外開放的服務如果讓Applet直接連接到資料庫，需要開port讓Clinet 的Applet來使用，在安全性上相對的十分危險。 此時可以利用一個中繼的Sokcet Server或是Web Server來當與資料庫連接的proxy代理服務器，如此Apllet只要連接Web Server，對Server提出需求，而Server會依需求與資料庫做溝通，並回傳Applet要求之資料，如此可以做成多層式的架構來解決Applet資料取得之問題。 範例設計上有一個輸入框JTextField可以輸入要傳給Server的資料內容，而下方的JTextArea是承接從Server回傳的資料內容，按鈕則可進行動作Action。 輸入傳送的字串後，按下”按我”可進行資料的傳送POST。 try &#123; &#160; com.yslifes.connect.WebModule web = new com.yslifes.connect.WebModule&#40;&#41;; //使用post把資料傳送到web server端 web.doPost&#40;&#34;http://localhost:8080/AppletGUIServer/Info.jsp&#34;, &#34;data=&#34;+getJTextField&#40;&#41;.getText&#40;&#41;+&#34;&#38;p=1&#34;, null, &#34;utf-8&#34;&#41;; //取回回傳的json資料 com.google.gson.JsonObject json = web.getJSON&#40;&#41;; getJTextArea&#40;&#41;.setText&#40;json.get&#40;&#34;msg&#34;&#41;.getAsString&#40;&#41;&#41;; &#160; &#160; &#160; &#125;catch&#40;Exception ex&#41; &#123; ex.printStackTrace&#40;&#41;; logger.info&#40;ex&#41;; &#160; &#125; 這裡使用到的WebModule可以參考HttpURLConnection來實作get及post動作。 在Console視窗可以看到傳送出去的資料內容： 而在WebServer方面，則可利用request來取得需要資料做處理，再回傳out.print給Applet。 &#60;%@ page language=&#34;java&#34; contentType=&#34;text/html; charset=UTF-8&#34; pageEncoding=&#34;UTF-8&#34; %&#62;&#60;% request.setCharacterEncoding&#40;&#34;utf-8&#34;&#41;; &#160; //取得傳來的參數 System.out.println&#40;&#34;data=&#34;+request.getParameter&#40;&#34;data&#34;&#41;&#41;; System.out.println&#40;&#34;p=&#34;+request.getParameter&#40;&#34;p&#34;&#41;&#41;; &#160; //回傳json [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/934/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache lucene-取得html內容建立索引檔</title>
		<link>http://blog.yslifes.com/archives/915</link>
		<comments>http://blog.yslifes.com/archives/915#comments</comments>
		<pubDate>Wed, 06 Apr 2011 23:04:52 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[架站]]></category>
		<category><![CDATA[程式]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[lucene]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/915</guid>
		<description><![CDATA[之前有介紹過怎麼讀取檔案來製作lucene的索引檔，這裡再提供另一個類似的方法，先從網路上取得網頁的html內容，有點像網路的爬蟲，爬取資料後再來建立索引檔。 程式有簡單的html資料取得的方式，需要更進階的方法可以參考URLConnection來實作get及post動作這一篇。 原始碼如下： 取得網頁資料建立索引內容 package testlucene; &#160; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.util.Date; import org.apache.lucene.document.Document; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriter; &#160; public class LuceneIndexHtml &#123; &#160; private IndexWriter writer = null; &#160; // 做測試的網址 private String url&#91;&#93; = &#123; &#34;http://catyku.pixnet.net/blog/post/22417532&#34;, &#34;http://catyku.pixnet.net/blog/post/22393052&#34;, &#34;http://catyku.pixnet.net/blog/post/22561736&#34; &#125;; &#160; private Document doc = null; &#160; [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/915/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>apache lucene-建立自己的搜尋引擎-刪除已建立索引資料</title>
		<link>http://blog.yslifes.com/archives/914</link>
		<comments>http://blog.yslifes.com/archives/914#comments</comments>
		<pubDate>Wed, 06 Apr 2011 15:27:10 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[架站]]></category>
		<category><![CDATA[程式]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[lucene]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/914</guid>
		<description><![CDATA[當索引資料已被建立，需要刪除此筆資document料時，只要利用索引key值查到此筆資料document，然後利用deleteDocuments來刪除此筆資料document。 lucene有二種索引存放方式 RAM Directory記憶體，速度快，但程式結束後資料就不見了 FS Directory檔案系統，資料永久存在，一般比較常用 程式範例先建立二筆資料document，然後對第一筆資料document的test這個key field做刪除動作。此範例使用Ram Directory記憶體來存放索引值，可以與上一篇範例製作索引檔做比較。 原始碼： package testlucene; &#160; import org.apache.lucene.analysis.standard.*; import org.apache.lucene.document.*; import org.apache.lucene.index.*; import org.apache.lucene.queryParser.QueryParser; import org.apache.lucene.search.*; &#160; public class DeleteTest &#123; public static void main&#40;String&#91;&#93; args&#41; throws Exception &#123; &#160; // 建構兩個文件檔案物件 Document doc1 = new Document&#40;&#41;; doc1.add&#40;new Field&#40;&#34;name&#34;, &#34;key1 key2 key3&#34;, Field.Store.YES, Field.Index.TOKENIZED&#41;&#41;; //做為刪除的索引key值 doc1.add&#40;new Field&#40;&#34;test&#34;, &#34;testword&#34;, [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/914/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache lucene-建立自己的搜尋引擎-查詢資料</title>
		<link>http://blog.yslifes.com/archives/913</link>
		<comments>http://blog.yslifes.com/archives/913#comments</comments>
		<pubDate>Wed, 06 Apr 2011 14:51:39 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[架站]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[lucene]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/913</guid>
		<description><![CDATA[搜尋引擎最重要的功能就是查詢資料了，當建立好索引檔後，就可以針對索引檔內容進行查詢，索引資料可分為有做分詞及未做分詞，未做分詞的索引資料，只有全部內容均相同才會找到此筆資料，有做分詞者，則依分詞類型，可能有單字索引，雙字索引或中文字詞索引等，索引做的越好，搜尋到的資料會越精準。 資料Field也分成儲存及不存儲二種，當選擇儲存Store.YES時，查詢到此筆資料時則可以直接取用，不過此方法會佔用較多的空間，不存儲方法Store.NO則相反。 索引資料內容如下： 原始碼如下： package testlucene; import java.util.Date; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.index.IndexReader; import org.apache.lucene.queryParser.QueryParser; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.search.Hits; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; &#160; public class LuceneSearch &#123; private IndexSearcher searcher = null; private Query query = null; private Analyzer analyzer = new StandardAnalyzer&#40;&#41;; &#160; public LuceneSearch&#40;&#41; &#123; try &#123; //建立查詢器 searcher = new [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/913/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>apache lucene-建立自己的搜尋引擎-索引檔</title>
		<link>http://blog.yslifes.com/archives/910</link>
		<comments>http://blog.yslifes.com/archives/910#comments</comments>
		<pubDate>Wed, 06 Apr 2011 14:06:09 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[架站]]></category>
		<category><![CDATA[程式]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[lucene]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/910</guid>
		<description><![CDATA[apachelucene是一套opensource的Search-Engine，搜尋效果比直接使用資料庫條件like還要來的好，而且也不會佔用到資料庫的資源，只需要使用到硬碟的IO，所以可以把搜尋引擎另外做到另一個硬碟，或是放到另一台主機上，單獨成搜尋引擎Server，設計成Multi-Tires架構。 在使用apache lucene時，需要先把資料建立成索引檔，搜尋時則直接取用索引資料，來加快查詢的速度，不同類型的資料可以依需求建立成不同的搜尋索引檔，以下範例是如何建立一組索引檔。 索引檔內容如下圖： 需要使用到的jar classpath為lucene-x.x.x.jar，可由官網下載，此範例使用2.3版本，新版本可能用法會不太一樣，如果需要中文的切詞器，可以找到庖丁解字這個opensource的framework。 原始碼如下： package testlucene; import java.io.*; import java.util.Date; import org.apache.lucene.document.Document; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriter; &#160; &#160; public class LuceneIndex &#123; &#160; private IndexWriter writer = null ; &#160; public LuceneIndex&#40;&#41; &#123; try &#123; //建立index的寫入器 //使用標準的分詞器 //重新建立索引檔,也就是之前的檔案會全數重建 writer = new IndexWriter&#40;&#34;d:\\index&#34;, new StandardAnalyzer&#40;&#41;,true&#41;; &#125; catch&#40;Exception e&#41; &#123; &#160; &#125; [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/910/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Windows XP環境Apache出現失敗的模組ntdll.dll</title>
		<link>http://blog.yslifes.com/archives/747</link>
		<comments>http://blog.yslifes.com/archives/747#comments</comments>
		<pubDate>Thu, 21 Oct 2010 15:28:48 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[教學]]></category>
		<category><![CDATA[架站]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[eeebox]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[WINDOWS]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/747</guid>
		<description><![CDATA[最近流量有一點點增長，不過網站的速度跟常常出現失敗的模組ntdll.dll錯誤，搞的主機會停住很久才回應網頁，之前流量小點時不太常出現，而查看方向也一直在Apache跟mysql的調整上，不過似乎沒什麼用，google一下，幾乎都說是中毒了、重灌就好了，不過重灌似乎不是很好的解決方式。 失敗的事件內容可以從控制台－＞系統管理工具－＞事件檢視器－＞Windows記錄（應用程式） 失敗的應用程式httpd.exe，版本2.2.8.0，失敗的模組 ntdll.dll，版本5.1.2600.5755，錯誤位址 0x0001aa21。 其實這是因為網路的連線數超過xp的上限而出現的錯誤，中毒或是使用BitComet P2P等軟體都有可能會發生，所以解決的方式就是把連線數調高就可以了，可以使用 TCP/IP Patcher這個軟體來調高XP SP3的連線數，不過vista、windows 7好像不能使用。 軟體下載及介紹可以參考 重灌狂人-「TCP/IP Patcher」破解Windows XP SP3連線數限制！ ps.調太高也不太好，如果真的中毒了會一直對外發送大量的封包]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/747/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DNS Server –BIND 9 in Windows XP PART1</title>
		<link>http://blog.yslifes.com/archives/77</link>
		<comments>http://blog.yslifes.com/archives/77#comments</comments>
		<pubDate>Tue, 28 Apr 2009 00:15:00 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[架站]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[WINDOWS]]></category>
		<category><![CDATA[XP]]></category>
		<category><![CDATA[安裝]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/77</guid>
		<description><![CDATA[Windows XP要架DNS Server可以使用RIND 9 ，簡單又方便，而且免費Free的。 官網 https://www.isc.org/products/BIND 下載點 Menu https://www.isc.org/downloadables/11 Download Seed http://oldwww.isc.org/sw/bind/view/?release=9.6.0-P1&#38;noframes=1 或是 http://www.yslifes.com/Download/BIND9.6.0-P1.zip 下載後解壓縮然後執行裡面的安裝檔 BINDInstall.exe 然後出現安裝視窗 把Target Directory填入你想安裝的路徑，可以使用預設的，不過建議選擇其它目錄 Service Account Name與Service Account Password則填入要啟動此Service的帳號密碼 你可以先填入你的帳號及密碼，之後再來改 Automatic Startup則是啟動Windows時是否自動啟動，請依狀況設定。 Keep Config File After Uninstall 這是在Uninstall保留你的設定檔，安裝時無做用。 Start Bind Service After Install 則是在安裝後是否啟動服務，因為還沒有設定檔存在，故先不打勾。 然後選擇Install 然後會出現以下畫面，大概意思是，＂選擇的帳號需有很多權限，你是選選擇另一個帳號？＂ 選擇＂否＂繼續安裝，按＂是＂則會回來的畫面。 如果是選擇另外的目錄，而此目錄尚未存在時，則會出現以下畫面。 選擇＂是＂。 則會進入安裝畫面，如下： 然後就可以看到安裝完成，按下＂確定＂。再來按Exit離開BIND 9的安裝。 再來我們設定一下BIND 9的Serivce。 選擇＂控制台＂－＞＂系統管理工具＂－＞＂服務＂ 然後找到 ISC BIND ，然後看到登入身份是剛才設定的帳號，雙擊點開可以看到如右側畫面。 [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/77/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

