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

<channel>
	<title>憂藍夢境‧部落格 &#187; Other</title>
	<atom:link href="http://blog.linym.net/archives/category/program/other/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.linym.net</link>
	<description>我的學習心得、筆記</description>
	<lastBuildDate>Fri, 09 Dec 2011 12:33:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>使用 C# 呼叫 MATLAB Function</title>
		<link>http://blog.linym.net/archives/564</link>
		<comments>http://blog.linym.net/archives/564#comments</comments>
		<pubDate>Thu, 10 Sep 2009 07:49:21 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[程式筆記]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[MATLAB]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.linym.net/?p=564</guid>
		<description><![CDATA[最近在寫一些演算法的程式，經常要在一堆程式和檔案切換來切換去的，跑完數據還要開 MATLAB 畫圖，一直重複這些動作實在是很麻煩，所以把它寫成 Windows Form 用滑鼠點一點就 OK 了，其中繪圖部份就要利用 C# 去 call MATLAB 來作，查了許多資料，發現有很多種方法，但比較簡單方便的應該是用 MATLAB Builder NE for .NET 將 MATLAB 程式編譯成 .NET 可執行的元件。 1. 首先準備好你要 compiler 的 M-file，測試的 M-file 如下(由檔案讀取 x, y 數據曲線圖)： function rmse(file) data = load(file); x = data(:,1); y = data(:,2); plot(x,y,&#039;LineWidth&#039;,1); xlabel(&#039;Iteration&#039;); ylabel(&#039;RMS error&#039;); 2. 開啟 MATLAB 並在 command windows 輸入：deploytool [...]]]></description>
			<content:encoded><![CDATA[<p>最近在寫一些演算法的程式，經常要在一堆程式和檔案切換來切換去的，跑完數據還要開 MATLAB 畫圖，一直重複這些動作實在是很麻煩，所以把它寫成 Windows Form 用滑鼠點一點就 OK 了，其中繪圖部份就要利用 C# 去 call MATLAB 來作，查了許多資料，發現有很多種方法，但比較簡單方便的應該是用 <a href="http://www.mathworks.com/products/netbuilder/" target="_blank">MATLAB Builder NE for .NET</a> 將 MATLAB 程式編譯成 .NET 可執行的元件。</p>
<p>1. 首先準備好你要 compiler 的 M-file，測試的 M-file 如下(由檔案讀取 x, y 數據曲線圖)：</p>
<pre title="code" class="cpp">

function rmse(file)

data = load(file);
x = data(:,1);
y = data(:,2);

plot(x,y,&#039;LineWidth&#039;,1);

xlabel(&#039;Iteration&#039;);
ylabel(&#039;RMS error&#039;);
</pre>
<p>2. 開啟 MATLAB 並在 command windows 輸入：<strong>deploytool</strong><br />
    新建一個 project，名稱為 rmse。<br />
    <a href="http://blog.linym.net/wp-content/uploads/2009/09/01.JPG"><img src="http://blog.linym.net/wp-content/uploads/2009/09/01.JPG" alt="New Project" title="New Project" width="646" height="451" class="alignnone size-full wp-image-567" /></a><br />
    選擇 .NET component<br />
    <a href="http://blog.linym.net/wp-content/uploads/2009/09/2.JPG"><img src="http://blog.linym.net/wp-content/uploads/2009/09/2.JPG" alt=".NET component" title=".NET component" width="510" height="510" class="alignnone size-full wp-image-571" /></a><br />
    將 M-file 加入，然後按<strong> Build the project</strong>，編譯完成會產生 rmse.dll<br />
<a href="http://blog.linym.net/wp-content/uploads/2009/09/3.JPG"><img src="http://blog.linym.net/wp-content/uploads/2009/09/3.JPG" alt="Add file" title="Add file" width="646" height="451" class="alignnone size-full wp-image-574" /></a></p>
<p>3. 將 .dll 加入 Visual Studio 參考(Reference)<br />
   在方案總管右鍵選「加入參考」>「瀏覽」，將剛剛編譯完成的 .dll 以及 MATLAB 安裝目錄底下的 toolbox\dotnetbuilder\bin\win32\v2.0\MWArray.dll 加入。</p>
<p>4. 加入 Namespace<br />
using MathWorks.MATLAB.NET.Arrays;<br />
using rmse;</p>
<p>5. 使用方式<br />
    Rmse demo = new Rmse();<br />
    MWArray fileName = @"rmse.txt";<br />
    demo.rmse(fileName);</p>
<p>※ <a href='http://blog.linym.net/wp-content/uploads/2009/09/CSharp_Matlab.rar'>demo 範例原始碼下載</a></p>
<p>※ 如果想在沒安裝 MATLAB 的電腦上執行，需安裝 MATLAB Compiler Runtime (MCR)，檔案在安裝目錄的 toolbox\compiler\deploy\win32\MCRInstaller.exe，大小約 150MB</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/564/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Windows PPPoE 自動重撥 Script</title>
		<link>http://blog.linym.net/archives/522</link>
		<comments>http://blog.linym.net/archives/522#comments</comments>
		<pubDate>Sat, 25 Jul 2009 10:51:09 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[程式筆記]]></category>
		<category><![CDATA[系統筆記]]></category>
		<category><![CDATA[adsl]]></category>
		<category><![CDATA[pppoe]]></category>
		<category><![CDATA[WSH]]></category>
		<category><![CDATA[自動連線]]></category>

		<guid isPermaLink="false">http://blog.linym.net/?p=522</guid>
		<description><![CDATA[隨著 ADSL 及經濟型光纖網路的普及，有許多人都會在自家架設 server 主機，但如果沒有用分享器而是直接透過 PPPoE 撥接上網的，就很怕網路突然斷線(如忘記繳錢被停掉)，雖然說 Windows 內建的連線程式有一個「斷線後重新撥號」的選項，但其實並不好用。比較保險的作法是系統定期檢查對外連線的狀況(ping)，一旦發現斷線就自動重新連線。 在網路上可以找到很多這種作法的 Linux 版本，如「Debian Linux: ADSL PPPoE 自動重撥 Script」，但相對 Windows 的討論卻很少，所以就自己寫了一個重撥的 WSH(Windows Script Host)，搭配工作排程就可以達到目的。 ※ 本方法適用於 XP 以後之 Windows。 Step 1：將下列程式存為 repppoe.vbs，修改連線資訊並放置在安全的地方 DIALNAME = &#34;寬頻連線&#34; &#039;連線名稱 DIALUSER = &#34;12345678@ip.hinet.net&#34; &#039;連線帳號 DIALPASS = &#34;xxxxxxxx&#34; &#039;連線密碼 Set WshShell = CreateObject(&#34;WScript.Shell&#34;) RetCode = WshShell.Run(&#34;ping www.hinet.net&#34;, 0, true) If RetCode &#60;&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>隨著 ADSL 及經濟型光纖網路的普及，有許多人都會在自家架設 server 主機，但如果沒有用分享器而是直接透過 PPPoE 撥接上網的，就很怕網路突然斷線(如忘記繳錢被停掉)，雖然說 Windows 內建的連線程式有一個「斷線後重新撥號」的選項，但其實並不好用。比較保險的作法是系統定期檢查對外連線的狀況(ping)，一旦發現斷線就自動重新連線。</p>
<p>在網路上可以找到很多這種作法的 Linux 版本，如「<a href="http://plog.longwin.com.tw/programming/2007/08/24/adsl_repppoe_script_2007" target="_blank">Debian Linux: ADSL PPPoE 自動重撥 Script</a>」，但相對 Windows 的討論卻很少，所以就自己寫了一個重撥的 WSH(Windows Script Host)，搭配工作排程就可以達到目的。<br />
<span style="color:red">※ 本方法適用於 XP 以後之 Windows。</span></p>
<p><strong>Step 1：將下列程式存為 <span style="color:blue">repppoe.vbs</span>，修改連線資訊並放置在安全的地方</strong></p>
<pre title="code" class="vb">

DIALNAME = &quot;寬頻連線&quot;              &#039;連線名稱
DIALUSER = &quot;12345678@ip.hinet.net&quot; &#039;連線帳號
DIALPASS = &quot;xxxxxxxx&quot;              &#039;連線密碼

Set WshShell = CreateObject(&quot;WScript.Shell&quot;)
RetCode = WshShell.Run(&quot;ping www.hinet.net&quot;, 0, true)
If RetCode &lt;&gt; 0 Then
	WshShell.Run &quot;rasdial &quot; &amp; DIALNAME &amp; &quot; /DISCONNECT&quot;, 0, true
	WScript.Sleep(3000)
	WshShell.Run &quot;rasdial &quot; &amp; DIALNAME &amp; &quot; &quot; &amp; DIALUSER &amp; &quot; &quot; &amp; DIALPASS, 0
End If
</pre>
<p><strong>Step 2：設定 Windows 工作排程。</strong>(控制台->排定的工作->新增排定的工作)</p>
<p><a href="http://blog.linym.net/wp-content/uploads/2009/07/1.JPG"><img src="http://blog.linym.net/wp-content/uploads/2009/07/1.JPG" alt="1" title="1" width="522" height="326" class="alignnone size-full wp-image-535" /></a><br />
‧選擇步驟 1 的 repppoe.vbs 檔案</p>
<p><a href="http://blog.linym.net/wp-content/uploads/2009/07/2.JPG"><img src="http://blog.linym.net/wp-content/uploads/2009/07/2.JPG" alt="2" title="2" width="522" height="326" class="alignnone size-full wp-image-538" /></a></p>
<p><a href="http://blog.linym.net/wp-content/uploads/2009/07/3.JPG"><img src="http://blog.linym.net/wp-content/uploads/2009/07/3.JPG" alt="3" title="3" width="522" height="326" class="alignnone size-full wp-image-539" /></a></p>
<p><a href="http://blog.linym.net/wp-content/uploads/2009/07/4.JPG"><img src="http://blog.linym.net/wp-content/uploads/2009/07/4.JPG" alt="4" title="4" width="522" height="326" class="alignnone size-full wp-image-541" /></a><br />
‧輸入具有 Administrator 權限的使用者及密碼</p>
<p><a href="http://blog.linym.net/wp-content/uploads/2009/07/5.JPG"><img src="http://blog.linym.net/wp-content/uploads/2009/07/5.JPG" alt="5" title="5" width="522" height="326" class="alignnone size-full wp-image-542" /></a></p>
<p><a href="http://blog.linym.net/wp-content/uploads/2009/07/6.JPG"><img src="http://blog.linym.net/wp-content/uploads/2009/07/6.JPG" alt="6" title="6" width="406" height="416" class="alignnone size-full wp-image-543" /></a></p>
<p><a href="http://blog.linym.net/wp-content/uploads/2009/07/7.JPG"><img src="http://blog.linym.net/wp-content/uploads/2009/07/7.JPG" alt="7" title="7" width="368" height="252" class="alignnone size-full wp-image-544" /></a><br />
‧表示每 30 分鐘檢查一次連線狀況，可依需求修改，然後收工。</p>
<p>※ 備註：<br />
之所以選擇 ping www.hinet.net 而不用 IP 是因為經實驗結果，若網卡有設定 Default gateway，則可能會因為 gateway response 影響連線判斷。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/522/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WordPress 2.3.2 無法中文化問題</title>
		<link>http://blog.linym.net/archives/214</link>
		<comments>http://blog.linym.net/archives/214#comments</comments>
		<pubDate>Thu, 10 Jan 2008 13:38:05 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[程式筆記]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[中文化]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/214</guid>
		<description><![CDATA[WordPress 最近已經更新到 2.3.2 版了，趁著最近專題發表結束的空閒來更新一下，到官方抓了新版以及 Kirin Lin 的中文語系，由於 2.3.2 只是些 bug 及安全性修正，所以就直接採用覆蓋大法更新了。完工之後，咦？怎麼變英文介面了，wp-config.php 設定沒錯阿，於是求助 google 大神，馬上就找到了這篇，原來在 PHP 5.2.x 以及 64bit 系統下會有這個問題，登入 BlueHost 主機的後台看一下，果然沒錯，開始修正囉！ 其實只要修正一行即可： wp-includes/gettext.php LINE:117 if ($magic == ($MAGIC1 &#38; 0xFFFFFFFF) &#124;&#124; $magic == ($MAGIC3 &#38; 0xFFFFFFFF)) { // to make sure it works for 64-bit platforms 更改成： if ($magic == $MAGIC1 &#124;&#124; $magic == $MAGIC3) [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress 最近已經更新到 2.3.2 版了，趁著最近專題發表結束的空閒來更新一下，到官方抓了新版以及 <a href="http://kirin.lin.googlepages.com/">Kirin Lin</a> 的中文語系，由於 2.3.2 只是些 bug 及安全性修正，所以就直接採用覆蓋大法更新了。完工之後，咦？怎麼變英文介面了，wp-config.php 設定沒錯阿，於是求助 google 大神，馬上就找到了<a href="http://www.wordpress.com.tw/wp/?p=80" target="_blank">這篇</a>，原來在 PHP 5.2.x 以及 64bit 系統下會有這個問題，登入 BlueHost 主機的後台看一下，果然沒錯，開始修正囉！</p>
<p>其實只要修正一行即可：<br />
wp-includes/gettext.php  LINE:117</p>
<pre title="code" class="php">

if ($magic == ($MAGIC1 &amp; 0xFFFFFFFF) || $magic == ($MAGIC3 &amp; 0xFFFFFFFF)) { // to make sure it works for 64-bit platforms
</pre>
<p>更改成：</p>
<pre title="code" class="php">

if ($magic == $MAGIC1 || $magic == $MAGIC3) { // &lt;- 64 BIT FIX: CHANGE THIS LINE!
</pre>
<p>ok!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/214/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Google Map 地圖定位</title>
		<link>http://blog.linym.net/archives/213</link>
		<comments>http://blog.linym.net/archives/213#comments</comments>
		<pubDate>Thu, 10 Jan 2008 12:40:38 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[程式筆記]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/213</guid>
		<description><![CDATA[Google Map 提供的 API 實在是強大又好用，結合 GPS 很快就可以做出地圖定位的網站，將之前的 Urmap 範例修改了一下，成為 Google Map 地圖定位系統，為了能夠展示所以將座標先寫好讓它自己動態更新，其中按下停止按鈕會畫出所有紀錄點的連線，可做路徑追蹤。 Google Map API 網路上的資源已經相當豐富了，在此就不多敘述，比較特別的是畫折線(polyline)的部份，如果用原始的 GPolyline 方法來畫，大概幾十個點就需要運算很久，甚至導致瀏覽器 crash，所以 API 後來又加入了編碼折線(encodedPolyline)的功能，先將所有的點用特定演算法轉換成一串文字符號，再丟給 GPolyline.fromEncoded 顯示，幾乎是馬上就顯示出來了，差很多喔，而這個編碼演算法也已經有人寫好囉！請看：Encoding polylines for Google Maps]]></description>
			<content:encoded><![CDATA[<p>Google Map 提供的 <a href="http://code.google.com/apis/maps/documentation/" target="_blank">API</a> 實在是強大又好用，結合 GPS 很快就可以做出地圖定位的網站，將之前的 Urmap 範例修改了一下，成為 <a href="http://map.linym.net/" target="_blank">Google Map 地圖定位系統</a>，為了能夠展示所以將座標先寫好讓它自己動態更新，其中按下停止按鈕會畫出所有紀錄點的連線，可做路徑追蹤。</p>
<p><a href="http://code.google.com/apis/maps/documentation/" target="_blank">Google Map API</a> 網路上的資源已經相當豐富了，在此就不多敘述，比較特別的是畫折線(polyline)的部份，如果用原始的 GPolyline 方法來畫，大概幾十個點就需要運算很久，甚至導致瀏覽器 crash，所以 API 後來又加入了編碼折線(encodedPolyline)的功能，先將所有的點用特定演算法轉換成一串文字符號，再丟給 GPolyline.fromEncoded 顯示，幾乎是馬上就顯示出來了，差很多喔，而這個編碼演算法也已經有人寫好囉！請看：<a href="http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/" target="_blank">Encoding polylines for Google Maps</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/213/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>編譯 ZD1211 無線網卡驅動</title>
		<link>http://blog.linym.net/archives/209</link>
		<comments>http://blog.linym.net/archives/209#comments</comments>
		<pubDate>Mon, 19 Nov 2007 11:36:22 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[硬體筆記]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[wireless]]></category>
		<category><![CDATA[zd1211]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/209</guid>
		<description><![CDATA[關於如何編譯 ZD1211/ZD1211B 晶片的 USB 無線網卡 driver，經常在各大討論區及 BBS 看到有人提出相同的問題，因此來寫個教學。 前往 ZD1211 專案網站可以知道目前有三種版本的驅動，其中建議使用 zd1211rw 這個版本，因為它持續在更新且已納入 Linux 2.6.18 以後的 kernel 裡。zd1211rw 支援這三種晶片： ZyDAS ZD1211 ZyDAS ZD1211B Atheros AR5007UG 不過既然都已經納入 kernel 了為什麼還要編譯驅動？因為還是有很多產品的 USB ID 不能被 zd1211rw 所辨識(我的 PCI GW-US54GXS 就是)，當然就沒辦法驅動囉！這篇要做的就是從 kernel 裡的 zd1211rw source code 加入對應的 USB ID，主機環境是 ubuntu 7.10，其他版本應該也差不多。 首先要安裝編譯相關套件 &#038; 下載 linux source $ sudo apt-get install [...]]]></description>
			<content:encoded><![CDATA[<p>關於如何編譯 ZD1211/ZD1211B 晶片的 USB 無線網卡 driver，經常在各大討論區及 BBS 看到有人提出相同的問題，因此來寫個教學。</p>
<p>前往 <a href="http://zd1211.wiki.sourceforge.net/" target="_blank">ZD1211</a> 專案網站可以知道目前有三種版本的驅動，其中建議使用 <a href="http://www.linuxwireless.org/en/users/Drivers/zd1211rw" target="_blank">zd1211rw</a> 這個版本，因為它持續在更新且已納入 Linux 2.6.18 以後的 kernel 裡。zd1211rw 支援這三種晶片：</p>
<ul>
<li>ZyDAS ZD1211</li>
<li>ZyDAS ZD1211B</li>
<li>Atheros AR5007UG</li>
</ul>
<p>不過既然都已經納入 kernel 了為什麼還要編譯驅動？因為還是有很多產品的 USB ID 不能被 zd1211rw 所辨識(我的 PCI GW-US54GXS 就是)，當然就沒辦法驅動囉！這篇要做的就是從 kernel 裡的 zd1211rw source code 加入對應的 USB ID，主機環境是 ubuntu 7.10，其他版本應該也差不多。</p>
<p><strong>首先要安裝編譯相關套件 &#038; 下載 linux source</strong><br />
$ sudo apt-get install build-essential kernel-package linux-source</p>
<p><strong>切換至 src 目錄並解開 linux source</strong><br />
$ cd /usr/src<br />
$ sudo tar -xjvf linux-source-2.6.22.tar.bz2</p>
<p><strong>拷貝 kernel 設定檔(.config) 至 linux source</strong><br />
$ sudo cp linux-headers-2.6.22-14-generic/.config linux-source-2.6.22</p>
<p><strong>編輯 zd_usb.c 加入新 USB ID，可利用 lsusb 指令可以找出網卡的 ID，如：2019:5303</strong><br />
$ cd linux-source-2.6.22<br />
$ sudo vim drivers/net/wireless/zd1211rw/zd_usb.c<br />
在檔案開頭不遠處可以看到一堆 USB ID 號碼，就是要加進這裡面，GW-US54GXS 是 ZD1211B 晶片，所以在 ZD1211B 下方增加一行：<br />
/* ZD1211B */<br />
{ USB_DEVICE(0x2019, 0x5303), .driver_info = DEVICE_ZD1211B },<br />
確認後就存檔離開</p>
<p><strong>開始編譯驅動</strong><br />
$ sudo mkdir .tmp_versions<br />
$ sudo make drivers/net/wireless/zd1211rw/zd1211rw.ko</p>
<p><strong>沒錯誤就會產生 zd1211rw.ko，將它覆蓋原本系統中的</strong><br />
$ sudo cp drivers/net/wireless/zd1211rw/zd1211rw.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless/zd1211rw<br />
$ sudo depmod -a</p>
<p>重開機應該就可以正確驅動了:D</p>
<p>參考資料：<br />
<a href="http://www.linuxwireless.org/en/users/Drivers/zd1211rw/AddID" target="_blank">Adding new device IDs to zd1211rw</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/209/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>建立網頁縮圖(Webthumb)</title>
		<link>http://blog.linym.net/archives/196</link>
		<comments>http://blog.linym.net/archives/196#comments</comments>
		<pubDate>Fri, 05 Oct 2007 15:45:22 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[程式筆記]]></category>
		<category><![CDATA[Webthumb]]></category>
		<category><![CDATA[網頁]]></category>
		<category><![CDATA[縮圖]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/196</guid>
		<description><![CDATA[目前不少網站都有自動產生網頁縮圖的功能，像是 HEMiDEMi、funP 推推王、Alexa 等等，雖然很想知道其中所使用的技術，不過似乎很難找到相關文章，大多是倚賴提供縮圖服務的網站居多。 Bluga.net WebThumb 我覺得很不錯的縮圖服務網站，每個月可免費建立 250 組縮圖，且提供 API 可以應用在程式上，產生縮圖速度算滿快的，大約 2~5 分鐘即可顯示。 artViper Website Tools 這網站有提供一些 Website Tools，其中就有網頁縮圖的功能。 Website Thumbnail Generator 這個是不需要依賴其他網站的，使用了 IECapt 這個小工具，所以主機只能是 Windows，配合 PHP 來自動產生縮圖。 延伸閱讀： Website Thumbnail Creators (Website Snapshot Generators)]]></description>
			<content:encoded><![CDATA[<p>目前不少網站都有自動產生網頁縮圖的功能，像是 <a href="http://www.hemidemi.com/" target="_blank">HEMiDEMi</a>、<a href="http://funp.com/" target="_blank">funP 推推王</a>、<a href="http://www.alexa.com/" target="_blank">Alexa</a> 等等，雖然很想知道其中所使用的技術，不過似乎很難找到相關文章，大多是倚賴提供縮圖服務的網站居多。</p>
<p><a href="http://webthumb.bluga.net/" target="_blank">Bluga.net WebThumb</a><br />
我覺得很不錯的縮圖服務網站，每個月可免費建立 250 組縮圖，且提供 API 可以應用在程式上，產生縮圖速度算滿快的，大約 2~5 分鐘即可顯示。</p>
<p><a href="http://www.artviper.com/tools.php" target="_blank">artViper Website Tools</a><br />
這網站有提供一些 Website Tools，其中就有網頁縮圖的功能。</p>
<p><a href="http://www.zubrag.com/scripts/website-thumbnail-generator.php" target="_blank">Website Thumbnail Generator</a><br />
這個是不需要依賴其他網站的，使用了 IECapt 這個小工具，所以主機只能是 Windows，配合 PHP 來自動產生縮圖。</p>
<p>延伸閱讀：<br />
<a href="http://www.zubrag.com/articles/create-website-snapshot-thumbnail.php" target="_blank">Website Thumbnail Creators (Website Snapshot Generators)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/196/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript 讀取外部文字檔</title>
		<link>http://blog.linym.net/archives/165</link>
		<comments>http://blog.linym.net/archives/165#comments</comments>
		<pubDate>Thu, 02 Aug 2007 17:40:43 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[程式筆記]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/165</guid>
		<description><![CDATA[想要利用 JavaScript 來讀取一個檔案內容，搜尋到的方法很多都是用 ActiveX 物件來達成，這樣缺點就只能 IE Only 了。不過後來發現其實用 Ajax 就可以達成了。 搭配 JQuery 使用： $.get(&#039;content.txt&#039;, function(data){ alert(data); }); 這裡透過 Ajax 發出 GET Request 到 content.txt，就會直接將檔案的內容傳回輸出，很簡單吧^^ 但是由於 Ajax 考慮到安全性，所以只能作用在同網域底下。如果要讀的檔案是遠端主機上的呢？這時可以利用其他程式當作中間人，例如透過 PHP 去取得不同網域下的檔案。 JS 內容: $.get(&#039;readfile.php&#039;, function(data){ alert(data); }); PHP 內容: &#60;?php echo file_get_contents(&#34;http://aaa.com.tw/content.txt&#34;); ?&#62;]]></description>
			<content:encoded><![CDATA[<p>想要利用 JavaScript 來讀取一個檔案內容，搜尋到的方法很多都是用 ActiveX 物件來達成，這樣缺點就只能 IE Only 了。不過後來發現其實用 Ajax 就可以達成了。</p>
<p>搭配 <a href="http://jquery.com/" target="_blank">JQuery</a> 使用：</p>
<pre title="code" class="javascript">

$.get(&#039;content.txt&#039;, function(data){
	alert(data);
});
</pre>
<p>這裡透過 Ajax 發出 GET Request 到 content.txt，就會直接將檔案的內容傳回輸出，很簡單吧^^</p>
<p>但是由於 Ajax 考慮到安全性，所以只能作用在同網域底下。如果要讀的檔案是遠端主機上的呢？這時可以利用其他程式當作中間人，例如透過 PHP 去取得不同網域下的檔案。</p>
<p><strong>JS 內容:</strong></p>
<pre title="code" class="javascript">

$.get(&#039;readfile.php&#039;, function(data){
	alert(data);
});
</pre>
<p><strong>PHP 內容:</strong></p>
<pre title="code" class="php">

&lt;?php
echo file_get_contents(&quot;http://aaa.com.tw/content.txt&quot;);
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/165/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>UrMap API 基本應用</title>
		<link>http://blog.linym.net/archives/164</link>
		<comments>http://blog.linym.net/archives/164#comments</comments>
		<pubDate>Thu, 02 Aug 2007 17:13:14 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[程式筆記]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[UrMap]]></category>
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/164</guid>
		<description><![CDATA[UrMap 和 Google Map 都是很不錯的線上圖資系統，不過由於 UrMap 是由國人開發維護的，所以目前還是比較適合台灣人使用，尤其在查詢街道方面比 Google 精確。 而這兩套系統也都有釋出各自的 API，讓我們可以做許多的應用，這次幫同學的專題作一個簡單的 Demo，功能是假設有個程式會透過 GPS 接收器取得座標，然後將座標寫入檔案，Web Server 網頁則會定時讀取及更新地圖，標示出目標現在的位置，算是一個基本應用囉！ 首先不管是 UrMap API 還是 Google Map API，使用之前都要先申請授權碼(Key)，並且將它加入您的網頁裡面，所以只能在您登錄的網址顯示地圖。 接下來顯示地圖部份請參考 Demo 網頁原始碼，其他功能在 API 說明文件都寫得很詳盡。]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.urmap.com/" target="_blank">UrMap</a> 和 Google Map 都是很不錯的線上圖資系統，不過由於 UrMap 是由國人開發維護的，所以目前還是比較適合台灣人使用，尤其在查詢街道方面比 Google 精確。</p>
<p>而這兩套系統也都有釋出各自的 API，讓我們可以做許多的應用，這次幫同學的專題作一個簡單的 <a href="http://map.linym.net/" target="_blank">Demo</a>，功能是假設有個程式會透過 GPS 接收器取得座標，然後將座標寫入檔案，Web Server 網頁則會定時讀取及更新地圖，標示出目標現在的位置，算是一個基本應用囉！</p>
<p>首先不管是 <a href="http://www.urmap.com/SearchEngine/api/" target="_blank">UrMap API</a> 還是 <a href="http://www.google.com/apis/maps/" target="_blank">Google Map API</a>，使用之前都要先申請授權碼(Key)，並且將它加入您的網頁裡面，所以只能在您登錄的網址顯示地圖。</p>
<p>接下來顯示地圖部份請參考 <a href="http://map.linym.net/" target="_blank">Demo</a> 網頁原始碼，其他功能在 API 說明文件都寫得很詳盡。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/164/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>幾個 Text Database</title>
		<link>http://blog.linym.net/archives/104</link>
		<comments>http://blog.linym.net/archives/104#comments</comments>
		<pubDate>Sat, 03 Jun 2006 08:43:16 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[程式筆記]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[資料庫]]></category>

		<guid isPermaLink="false">http://lym.fyman.idv.tw/blog/archives/104</guid>
		<description><![CDATA[雖然 PHP 搭配 MySQL 來開發程式可以較快速又方便管理，但多少會遇到一些主機無法支援如 MySQL 等資料庫的 case，只好使用文字檔來儲存資料，不過因為沒有欄位及索引這些東西，開發起來就會麻煩許多，所幸就有人寫出 text base 的資料庫程式，讓我們使用純文字檔存取資料時，可以較接近資料庫操作，加快開發速度。 ‧SQLite 這套可以說是目前最火紅的，一堆語言都有支援它，PHP 當然也不例外，可使用 SQL 語法操作，PEAR::DB 也有支援。 只是需要載入 extension，所以要是主機沒有安裝或開啟，就只能以 shell 執行 SQLite 的執行檔來操作了，不過也失去資料庫的特性了。 ‧PHP Text DB API 這套是 PHP class，可以使用 SQL 語法、PEAR::DB 的用法，也不用另外載入 extension，並且有包含小型的 GUI 管理程式，非常值得一試。 ‧PHP Text DataBase API 這套是對岸的人士寫的，只要一個 class 檔就可以使用了，雖然它不支援 SQL 語法，但是簡單易用，大概花個 10 分鐘看完 manual 及範例就可以上手了，非常適合開發簡單的小程式。 如果有找到更好用的，歡迎來推薦一下哦！]]></description>
			<content:encoded><![CDATA[<p>雖然 PHP 搭配 MySQL 來開發程式可以較快速又方便管理，但多少會遇到一些主機無法支援如 MySQL 等資料庫的 case，只好使用文字檔來儲存資料，不過因為沒有欄位及索引這些東西，開發起來就會麻煩許多，所幸就有人寫出 text base 的資料庫程式，讓我們使用純文字檔存取資料時，可以較接近資料庫操作，加快開發速度。</p>
<p><a href="http://www.sqlite.org/">‧SQLite</a><br />
這套可以說是目前最火紅的，一堆語言都有支援它，PHP 當然也不例外，可使用 SQL 語法操作，PEAR::DB 也有支援。<br />
只是需要載入 extension，所以要是主機沒有安裝或開啟，就只能以 shell 執行 SQLite 的執行檔來操作了，不過也失去資料庫的特性了。</p>
<p><a href="http://www.c-worker.ch/txtdbapi/index_eng.php">‧PHP Text DB API</a><br />
這套是 PHP class，可以使用 SQL 語法、PEAR::DB 的用法，也不用另外載入 extension，並且有包含小型的 GUI 管理程式，非常值得一試。</p>
<p><a href="http://www.3ants.org/dev/txtdb/">‧PHP Text DataBase API</a><br />
這套是對岸的人士寫的，只要一個 class 檔就可以使用了，雖然它不支援 SQL 語法，但是簡單易用，大概花個 10 分鐘看完 manual 及範例就可以上手了，非常適合開發簡單的小程式。</p>
<p>如果有找到更好用的，歡迎來推薦一下哦！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/104/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>[Perl] Port Scanner</title>
		<link>http://blog.linym.net/archives/93</link>
		<comments>http://blog.linym.net/archives/93#comments</comments>
		<pubDate>Tue, 02 May 2006 10:33:15 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[程式筆記]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://lym.fyman.idv.tw/blog/archives/93</guid>
		<description><![CDATA[這是課堂上練習的程式，可以掃瞄某主機哪些 Port 有開放。 利用 Perl::Socket 建立 socket 後 connent() 主機，如果回應 true 表示連線正確 (Port 有開啟)。 使用方法： portscan.pl &#60;主機名稱&#62; #!/usr/bin/perl use strict; use Socket; my $host = shift; print &#34;Enter scan port start:&#34;; my $port = &#60;&#62;; print &#34;Enter scan port end:&#34;; my $port_end = &#60;&#62;; my $protocol = getprotobyname(&#039;tcp&#039;); $host = inet_aton($host) or die &#34;$host failed&#34;; [...]]]></description>
			<content:encoded><![CDATA[<p>這是課堂上練習的程式，可以掃瞄某主機哪些 Port 有開放。<br />
利用 Perl::Socket 建立 socket 後 connent() 主機，如果回應 true 表示連線正確 (Port 有開啟)。<br />
使用方法：<br />
portscan.pl &lt;主機名稱&gt;</p>
<pre title="code" class="c">

#!/usr/bin/perl
use strict;
use Socket;

my $host = shift;
print &quot;Enter scan port start:&quot;;
my $port = &lt;&gt;;
print &quot;Enter scan port end:&quot;;
my $port_end = &lt;&gt;;

my $protocol = getprotobyname(&#039;tcp&#039;);
$host = inet_aton($host) or die &quot;$host failed&quot;;

for (my $i = $port; $i &lt;= $port_end; $i++) {
    socket(SOCK , AF_INET , SOCK_STREAM , $protocol) or die &quot;socket() failed: $!&quot;;
    my $dest_addr = sockaddr_in($i , $host);
    if (connect(SOCK , $dest_addr)) {
        print &quot;Port: $i is open\n&quot;;
    }
    close SOCK;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/93/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用文言文寫 Perl</title>
		<link>http://blog.linym.net/archives/83</link>
		<comments>http://blog.linym.net/archives/83#comments</comments>
		<pubDate>Fri, 14 Apr 2006 08:28:16 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[程式筆記]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://lym.fyman.idv.tw/blog/archives/83</guid>
		<description><![CDATA[詳情請看這篇討論串 真是服了這位高人，讓 Perl 可以用文言文寫 目前這個 module 已經放上 CPAN，名稱為「Lingua::Sinica::PerlYuYan」 有興趣的可以試看看。 不過我想對現代人來說，英文應該是比文言文好懂吧!]]></description>
			<content:encoded><![CDATA[<p><a href="http://groups.google.com/group/tw.bbs.comp.lang.perl/browse_thread/thread/f0f95423c7cd71c5/bb1374f3f8cf10cf">詳情請看這篇討論串</a></p>
<p>真是服了這位高人，讓 Perl 可以用文言文寫<br />
目前這個 module 已經放上 CPAN，名稱為「<a href="http://search.cpan.org/%7Eautrijus/Lingua-Sinica-PerlYuYan-0.03/PerlYuYan.pm">Lingua::Sinica::PerlYuYan</a>」<br />
有興趣的可以試看看。<br />
不過我想對現代人來說，英文應該是比文言文好懂吧! </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/83/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[作業­2] 由檔案讀取成績並計算平均 - Perl</title>
		<link>http://blog.linym.net/archives/79</link>
		<comments>http://blog.linym.net/archives/79#comments</comments>
		<pubDate>Tue, 14 Mar 2006 10:45:14 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[程式筆記]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://lym.fyman.idv.tw/blog/archives/79</guid>
		<description><![CDATA[功能說明： 讀取成績檔內容並計算平均，最後寫入新檔。 成績資料檔：testdata.txt (檔名改為 testdata) 實作： #!/usr/bin/perl use strict; open FILE, &#34;testdata&#34; or die &#34;Can not open file: $!&#34;; my @lines; foreach (&#60;FILE&#62;) { chomp; split(/__/); my @grades = split(/,/, $_[1]); my $total = 0; my $average = 0; foreach my $grade (@grades) { $total += $grade; } $average = $total/@grades; my $line = $_[0].&#039;__&#039;.$_[1].&#039;=&#62;&#039;.$average.&#34;\n&#34;; [...]]]></description>
			<content:encoded><![CDATA[<p>功能說明：</p>
<blockquote><p>讀取成績檔內容並計算平均，最後寫入新檔。<br />
成績資料檔：<a href="http://blog.linym.net/wp-content/uploads/2006/04/testdata.txt">testdata.txt</a> (檔名改為 testdata)</p></blockquote>
<p>實作：</p>
<pre title="code" class="c">

#!/usr/bin/perl
use strict; 

open FILE, &quot;testdata&quot; or die &quot;Can not open file: $!&quot;; 

my @lines;
foreach (&lt;FILE&gt;) {
    chomp;
    split(/__/);
    my @grades = split(/,/, $_[1]);
    my $total = 0;
    my $average = 0;
    foreach my $grade (@grades) {
        $total += $grade;
    }
    $average = $total/@grades;
    my $line = $_[0].&#039;__&#039;.$_[1].&#039;=&gt;&#039;.$average.&quot;\n&quot;;
    push @lines, $line;
} 

open OUT_FILE, &quot;&gt;testdata2&quot; or die &quot;Can not open file: $!&quot;;
print OUT_FILE @lines; 

close FILE;
close OUT_FILE;
</pre>
<p><strong>筆記：</strong><br />
chop 和 chomp 的差異。<br />
這兩個都可以刪除尾端的換行字元，但使用 chomp 是比較安全的，因為 chop 會把尾端是 0 的一併刪除，造成錯誤結果。 </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/79/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[作業­1] 串列與陣列練習 - Perl</title>
		<link>http://blog.linym.net/archives/77</link>
		<comments>http://blog.linym.net/archives/77#comments</comments>
		<pubDate>Tue, 14 Mar 2006 10:44:27 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://lym.fyman.idv.tw/blog/archives/77</guid>
		<description><![CDATA[題目： 1. 試著把串列 (24, 33, 65, 42, 58, 24, 87) 放入陣列中，並讓使用者輸入索引值 (0…6)，然後印出陣列中相對應的值。 2. 把剛剛的陣列進行排序，並且印出排序後的結果。 3. 取出陣列中大於40的所有值。 4. 將所有陣列中的值除以 10 後印出。 實作： #!/usr/bin/perl use strict; my @array = (24, 33, 65, 42, 58, 24, 87); while (1) { print &#34;1) Select No.1 \n&#34;; print &#34;2) Select No.2 \n&#34;; print &#34;3) Select No.3 \n&#34;; print &#34;4) Select [...]]]></description>
			<content:encoded><![CDATA[<p>題目：</p>
<blockquote><p>1. 試著把串列 (24, 33, 65, 42, 58, 24, 87) 放入陣列中，並讓使用者輸入索引值 (0…6)，然後印出陣列中相對應的值。<br />
2. 把剛剛的陣列進行排序，並且印出排序後的結果。<br />
3. 取出陣列中大於40的所有值。<br />
4. 將所有陣列中的值除以 10 後印出。</p></blockquote>
<p>實作：</p>
<pre title="code" class="c">

#!/usr/bin/perl
use strict; 

my @array = (24, 33, 65, 42, 58, 24, 87); 

while (1) {
    print &quot;1) Select No.1 \n&quot;;
    print &quot;2) Select No.2 \n&quot;;
    print &quot;3) Select No.3 \n&quot;;
    print &quot;4) Select No.4 \n&quot;;
    print &#039;Please enter a number: &#039;; chomp($_ = &lt;&gt;); 

    if ($_ == 1) {
        while (1) {
            print &quot;Please enter 0-6 (&#039;q&#039; to exit): &quot;;
            chomp($_ = &lt;&gt;);
            last if ($_ eq &#039;q&#039;);
            print $array[$_].&quot;\n&quot;;
        }
    } elsif ($_ == 2) {
        my @array_sort = sort(@array);
        print &quot;$_\t&quot; for @array_sort;
        print &quot;\n&quot;;
    } elsif ($_ == 3) {
        my @sift = grep {$_ &gt; 40} @array;
        print &quot;$_\t&quot; for @sift;
        print &quot;\n&quot;
    } elsif ($_ == 4) {
        my @answer = map {$_ / 10} @array;
        print &quot;$_\t&quot; for @answer;
        print &quot;\n&quot;;
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/77/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

