<?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/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>霧中風景 &#187; 程設</title>
	<atom:link href="http://www.lulalala.com/wordpress/archives/category/%e7%a8%8b%e8%a8%ad/feed" rel="self" type="application/rss+xml" />
	<link>http://www.lulalala.com/wordpress</link>
	<description>總是會慢人家一拍的動漫畫以及遊戲感想</description>
	<lastBuildDate>Wed, 21 Jul 2010 14:19:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>程式設計師對於人名的錯誤認知</title>
		<link>http://www.lulalala.com/wordpress/archives/2202</link>
		<comments>http://www.lulalala.com/wordpress/archives/2202#comments</comments>
		<pubDate>Fri, 09 Jul 2010 05:44:40 +0000</pubDate>
		<dc:creator>lulalala</dc:creator>
				<category><![CDATA[程設]]></category>

		<guid isPermaLink="false">http://www.lulalala.com/wordpress/?p=2202</guid>
		<description><![CDATA[在這一篇文章 Falsehoods Programmers Believe About Names: MicroISV on a Shoestring 提到了程式設計師對於名字所保持的錯誤認知，我覺得很有趣，簡單的翻譯了各點。這張清單有些玩笑，也有些項目是使用西歐語系的人們才會有的問題。 每個人都只有一個正式的名字 每個人都只使用一個名字 每個人，在這個時間點，只有一個正式的名字 每個人，在這個時間點，只有使用一個名字 每個人有正好 N 個名字（N可以是任何數量） 每個人的名字都能放進某個訂定數量的空位中 每個人的名字都不會改變 每個人的名字雖然會變，但是只會在特別的一些時候時會變。 每個人的名字都是用 ASCII 編碼寫的。 每個人的名字都是只由一個編碼寫的。 每個人的名字都能對應到 Unicode 字元 人名是有區分（英文）大小寫。 人名沒有區分（英文）大小寫。 有些人的名字有前綴或後綴，但是你能夠安全地忽略這些。 人名不會含有數目字 人名不會全都是（英文）大寫 人名不會全都是（英文）小寫 人名可以排序。所有系統只要使用一樣的排序方法排同批名字，就會得到相同的排序結果。 每個人的姓跟名必須是不同的。 每個人與親戚都使用一樣姓氏。 每個人的人名都是獨一無二的。 每個人的人名幾乎都是獨一無二的。 好吧但是人名應該夠多元，所以不會有百萬個人同用一個名字。 我的系統永遠不用管中國來的名字。 或者是日本名字。 或是韓國名字。 或者是愛爾蘭，英國，美國，西班牙，墨西哥，巴西，秘魯，俄國，瑞典，波札那，南非，千里達，海地，法國，或者是克林貢帝國。這些都有常見卻奇特的命名方式。 那個克林貢帝國只是個玩笑對吧？ 你那該死的文化相對論！在我的社會中，人們至少同意了一套名命標準。 世界上有個能夠無損地把名字轉換後再反轉回來的演算法。（對，只要你的演算法能傳回輸入值。你得一顆星星。） 我可以安全地假設這本髒話字典中不包涵任何人的名字。 每個人的名字都是出生時拿到的。 OK，也許不是出生時，但至少很接近出生時。 好啦，好啦，在出生後一年內。 五年內？ 你在開玩笑，對吧？ 當兩個不同的系統有同一人的資料時，會用這個人的同一個名字。 在一個設計優良的系統中，兩個不同的資料輸入端拿到一個人的名字時，一定會輸入在位元上都相同的字串。 [...]]]></description>
			<content:encoded><![CDATA[<p>在這一篇文章 <a href="http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/" target="_blank">Falsehoods Programmers Believe About Names: MicroISV on a Shoestring</a> 提到了程式設計師對於名字所保持的<strong>錯誤認知</strong>，我覺得很有趣，簡單的翻譯了各點。這張清單有些玩笑，也有些項目是使用西歐語系的人們才會有的問題。</p>
<ol>
<li>每個人都只有一個正式的名字</li>
<li>每個人都只使用一個名字</li>
<li>每個人，在這個時間點，只有一個正式的名字</li>
<li>每個人，在這個時間點，只有使用一個名字</li>
<li>每個人有正好 N 個名字（N可以是任何數量）</li>
<li>每個人的名字都能放進某個訂定數量的空位中</li>
<li>每個人的名字都不會改變</li>
<li>每個人的名字雖然會變，但是只會在特別的一些時候時會變。</li>
<li>每個人的名字都是用 ASCII 編碼寫的。</li>
<li>每個人的名字都是只由一個編碼寫的。</li>
<li>每個人的名字都能對應到 Unicode 字元</li>
<li>人名是有區分（英文）大小寫。</li>
<li>人名沒有區分（英文）大小寫。</li>
<li>有些人的名字有前綴或後綴，但是你能夠安全地忽略這些。</li>
<li>人名不會含有數目字</li>
<li>人名不會全都是（英文）大寫</li>
<li>人名不會全都是（英文）小寫</li>
<li>人名可以排序。所有系統只要使用一樣的排序方法排同批名字，就會得到相同的排序結果。</li>
<li>每個人的姓跟名必須是不同的。</li>
<li>每個人與親戚都使用一樣姓氏。</li>
<li>每個人的人名都是獨一無二的。</li>
<li>每個人的人名<em>幾乎</em>都是獨一無二的。</li>
<li>好吧但是人名應該夠多元，所以不會有百萬個人同用一個名字。</li>
<li>我的系統永遠不用管中國來的名字。</li>
<li>或者是日本名字。</li>
<li>或是韓國名字。</li>
<li>或者是愛爾蘭，英國，美國，西班牙，墨西哥，巴西，秘魯，俄國，瑞典，波札那，南非，千里達，海地，法國，或者是克林貢帝國。這些都有常見卻奇特的命名方式。</li>
<li>那個克林貢帝國只是個玩笑對吧？</li>
<li>你那該死的文化相對論！在<strong>我的社會</strong>中，人們至少同意了一套名命標準。</li>
<li>世界上有個能夠無損地把名字轉換後再反轉回來的演算法。（對，只要你的演算法能傳回輸入值。你得一顆星星。）</li>
<li>我可以安全地假設這本髒話字典中不包涵任何人的名字。</li>
<li>每個人的名字都是出生時拿到的。</li>
<li>OK，也許不是出生時，但至少很接近出生時。</li>
<li>好啦，好啦，在出生後一年內。</li>
<li>五年內？</li>
<li>你在開玩笑，對吧？</li>
<li>當兩個不同的系統有同一人的資料時，會用這個人的同一個名字。</li>
<li>在一個設計優良的系統中，兩個不同的資料輸入端拿到一個人的名字時，一定會輸入在位元上都相同的字串。</li>
<li>那些名字能把我系統弄壞的人是奇怪的異類。他們應該有個像是「田中太郎」一樣可接受的名字。（譯註：這是在英文句子裡插入日文的常用名字，反而變得不常用）</li>
<li>每個人都有名字。</li>
</ol>
<p>之後的回應還加了幾條：</p>
<ul>
<li>人名不會含有標點符號</li>
<li>人名不會含有除了單引號外的標點符號</li>
<li>每個人在不同國家的名字都一樣</li>
<li>每個人只能有一個社會地位稱謂（在德國，有兩個學位的人會用兩個 Dr 表示）</li>
<li>每個人都有姓跟名</li>
<li>名字一定有兩個字母以上</li>
</ul>
<p>還有一些奇怪名字的人</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Nicholas_Barbon" target="_blank">Nicholas If-Jesus-Christ-Had-Not-Died-For-Thee-Thou-Hadst-Been-Damned  Barbon</a>（奇特的宗教性質中間名）</li>
<li><a href="http://en.wikipedia.org/wiki/Prince_%28musician%29" target="_blank">那個原本叫做 Prince 的人</a>（原本叫做 Prince 的知名音樂家，自己後來改名為一個不能發音的符號，導致大家開始這樣稱呼他）</li>
<li><a href="http://en.wikipedia.org/wiki/N%C7%83xau" target="_blank">Nǃxau</a> 演上帝也瘋狂的主角</li>
<li><a href="http://en.wikipedia.org/wiki/Agust%C3%ADn_Lara" target="_blank">Ángel Agustín María Carlos Fausto Mariano Alfonso del Sagrado Corazón de Jesús Lara y Aguirre del Pino</a></li>
<li>Standing beside the road waiting for a bus</li>
</ul>
<p>在 Slashdot 上的<a href="http://developers.slashdot.org/story/10/06/17/2347257/Falsehoods-Programmers-Believe-About-Names?from=rss" target="_blank">討論</a>中，有幾個人提到了解決的方法：不要把名字特別區分為姓跟名分開來儲存，而是讓使用者直接輸入完整的姓名，存在一個 Unicode 的文字欄位中。此外也提供另一個文字欄位，讓使用者輸入他的日常生活常用名。而系統可以在法律需要時使用完整姓名，而在一般問候時使用常用名稱。</p>
<p>雖然這張清單有很多都是極端的例子，不過我覺得最重要的，還是「人名不會含有除了單引號外的標點符號」這條。有像是 O&#8217;Raily 之類名字的人，常常會因為 SQL injection 的因故，而不能在網站上使用自己正確的名字。程式設計師在處理姓名時，還是應該使用正確的方式好好處理標點符號，而不是直接把他們拒絕掉。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lulalala.com/wordpress/archives/2202/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>山窮水盡疑無路</title>
		<link>http://www.lulalala.com/wordpress/archives/2204</link>
		<comments>http://www.lulalala.com/wordpress/archives/2204#comments</comments>
		<pubDate>Thu, 08 Jul 2010 14:52:06 +0000</pubDate>
		<dc:creator>lulalala</dc:creator>
				<category><![CDATA[程設]]></category>

		<guid isPermaLink="false">http://www.lulalala.com/wordpress/?p=2204</guid>
		<description><![CDATA[這幾天，我一直在嘗試著寫一個簡單的程式，能夠在解壓縮 7Zip 中的 BMP 時順便將之轉成 JPG。在記憶體中作轉換可以有效節省硬碟讀取次數跟所需的硬碟空間。在各種嘗試下的抵達了終點，可是才發現有個很重要的問題無法解決，所有心血算是白費了。 我首先是想直接修改 7Zip 本身，不過自己身為 C++ 的新手，實在無法瞭解要怎樣才能修改。而想嘗試使用 7z.dll ，卻無法理解 dll 要怎樣使用。最後連 LZMA 的 source 都看過了，還是覺得霧煞煞。幸好偶然發現有個叫做 C# (.NET) Interface for 7-Zip Archive DLLs ，之後更發現了繼承其精神的 SevenZipSharp ，讓工程大有突破。 在研究 SevenZipSharp 以後，我決定還是使用 C# 來當開發的工具。C#就像是 Java ，提供了很完整的資料庫，開發小型的圖形化程式十分方便。終於，克服了重重 bugs ，終於開發出了能夠解壓縮 bmp 又順便轉換成 jpg 的程式。 可惜的是，當我測試某個有 1000 張 bmp 的 7z 檔案時，發現解壓縮需要好幾個小時。這才發現，原來我使用的這個 ExtractFile 函式，因為一次只會解壓縮一個檔案，而因為 7Z 是種 solid 壓縮檔，所以解壓縮一個檔案就必須把這個檔案之前的所有檔案都算一遍。原本解壓縮時 [...]]]></description>
			<content:encoded><![CDATA[<p>這幾天，我一直在嘗試著寫一個簡單的程式，能夠在解壓縮 7Zip 中的 BMP 時順便將之轉成 JPG。在記憶體中作轉換可以有效節省硬碟讀取次數跟所需的硬碟空間。在各種嘗試下的抵達了終點，可是才發現有個很重要的問題無法解決，所有心血算是白費了。</p>
<p>我首先是想直接修改 7Zip 本身，不過自己身為 C++ 的新手，實在無法瞭解要怎樣才能修改。而想嘗試使用 7z.dll ，卻無法理解 dll 要怎樣使用。最後連 LZMA 的 source 都看過了，還是覺得霧煞煞。幸好偶然發現有個叫做 <a href="http://www.codeproject.com/KB/DLL/cs_interface_7zip.aspx">C# (.NET) Interface for 7-Zip Archive DLLs</a> ，之後更發現了繼承其精神的 <a href="http://sevenzipsharp.codeplex.com/">SevenZipSharp</a> ，讓工程大有突破。</p>
<p>在研究 SevenZipSharp 以後，我決定還是使用 C# 來當開發的工具。C#就像是 Java ，提供了很完整的資料庫，開發小型的圖形化程式十分方便。終於，克服了重重 bugs ，終於開發出了能夠解壓縮 bmp 又順便轉換成 jpg 的程式。</p>
<p>可惜的是，當我測試某個有 1000 張 bmp 的 7z 檔案時，發現解壓縮需要好幾個小時。這才發現，原來我使用的這個 ExtractFile 函式，因為一次只會解壓縮一個檔案，而因為 7Z 是種 solid 壓縮檔，所以解壓縮一個檔案就必須把這個檔案之前的所有檔案都算一遍。原本解壓縮時 7Zip 有最佳化，會依序解壓縮並保持計算過的進度，所以時間上不會很緩慢，但是這個 SevenZipSharp 的 API 沒有作到這麼完善，等於說解壓縮這個測試檔就要花 500 倍的時間。而要修改 API 本身對我來說還是太困難，所以自己的心血算是白費了。</p>
<p>唉，實在是山窮水盡疑無路，目前的柳暗花明又一村還遙遙無期。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lulalala.com/wordpress/archives/2204/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speex &#8211; 一個專門為語音設計的檔案格式</title>
		<link>http://www.lulalala.com/wordpress/archives/2138</link>
		<comments>http://www.lulalala.com/wordpress/archives/2138#comments</comments>
		<pubDate>Wed, 24 Mar 2010 08:07:04 +0000</pubDate>
		<dc:creator>lulalala</dc:creator>
				<category><![CDATA[程設]]></category>

		<guid isPermaLink="false">http://www.lulalala.com/wordpress/?p=2138</guid>
		<description><![CDATA[Speex 是一種專門設計來紀錄語音的檔案格式，在壓縮語音這方面，會比 Ogg Vorbis 還要好上二到四倍，所以 Speex 非常適合用在遊戲的語音上。它是一種開源的自由軟體，所以不用付授權費即可使用。 Speex 的官方網站在 http://www.speex.org/ ，上面有提供命令列的編碼與解碼器。不過 http://www.rarewares.org/others.php 有提供一個叫做 Speexdrop 的視窗程式，能讓一般的使用者也能直接把 wave 檔案拖到這個程式視窗中來進行轉換。 雖然 Speex 是設計接受 8kHz 16kHz 還有 32 kHz 的輸入檔案的，但是我發覺一般的語音要是變成 32kHz 會讓很多高音的感覺消失，感覺變得鈍鈍的。所以我還是不做任何處理就把 Wav 丟給 Speex 處理。目前能用 Foobar2000 直接播放 Speex 檔案。 這裡可以下載語音測試檔，有 Wav, Ogg Vorbis 還有 Speex 檔案，我把設定調到讓產生的 Ogg Vorbis 跟 Speex 檔案大小大約一樣，各位可以自己聽聽看有何不同。 使用 Speex ，製作少於 200MB 的語音 AVG 再也不成問題。]]></description>
			<content:encoded><![CDATA[<p>Speex 是一種專門設計來紀錄語音的檔案格式，在壓縮語音這方面，會比 Ogg Vorbis 還要好上二到四倍，所以 Speex 非常適合用在遊戲的語音上。它是一種開源的自由軟體，所以不用付授權費即可使用。</p>
<p>Speex 的官方網站在 <a href="http://www.speex.org/" target="_blank">http://www.speex.org/</a> ，上面有提供命令列的編碼與解碼器。不過 <a href="http://www.rarewares.org/others.php" target="_blank">http://www.rarewares.org/others.php</a> 有提供一個叫做 Speexdrop 的視窗程式，能讓一般的使用者也能直接把 wave 檔案拖到這個程式視窗中來進行轉換。</p>
<p>雖然 Speex 是設計接受 8kHz 16kHz 還有 32 kHz 的輸入檔案的，但是我發覺一般的語音要是變成 32kHz 會讓很多高音的感覺消失，感覺變得鈍鈍的。所以我還是不做任何處理就把 Wav 丟給 Speex 處理。目前能用 Foobar2000 直接播放 Speex 檔案。</p>
<p>這裡可以<a href="http://www.lulalala.com/wordpress/wp-content/uploads/2010/03/spx_sample.7z">下載語音測試檔</a>，有 Wav, Ogg Vorbis 還有 Speex 檔案，我把設定調到讓產生的 Ogg Vorbis 跟 Speex 檔案大小大約一樣，各位可以自己聽聽看有何不同。</p>
<p>使用 Speex ，製作少於 200MB 的語音 AVG 再也不成問題。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lulalala.com/wordpress/archives/2138/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My guidelines for using tags/categories, and a proposal to a new tag system</title>
		<link>http://www.lulalala.com/wordpress/archives/1704</link>
		<comments>http://www.lulalala.com/wordpress/archives/1704#comments</comments>
		<pubDate>Tue, 28 Apr 2009 04:00:12 +0000</pubDate>
		<dc:creator>lulalala</dc:creator>
				<category><![CDATA[程設]]></category>
		<category><![CDATA[網路]]></category>

		<guid isPermaLink="false">http://www.lulalala.com/wordpress/?p=1704</guid>
		<description><![CDATA[I often become confused when I publish a post on WordPress, because it offers both the tagging and categorising. Some of the confusion are caused by the two functionalities having overlapping areas, and some related to the lack of functionality. Overtime I came up with a few guielines to avoid some of these confusion, but [...]]]></description>
			<content:encoded><![CDATA[<div>
<div>
<p>I often become confused when I publish a post on WordPress, because it offers both the tagging and categorising. Some of the confusion are caused by the two functionalities having overlapping areas, and some related to the lack of functionality. Overtime I came up with a few guielines to avoid some of these confusion, but not all of them. I want to list those rules first, and then I want to talk about a new system and explain how it can solve the rest of the problems.</p>
<p>First, both categories and tags offer the reader an easier way to search your writings. A review about a particular episode of an animation series may not have the word &#8216;animation&#8217; in it, but tagging / categorising allows the users to search for all writing related to this topic.</p>
<p>Since one article can belong to multiple categories, the distinction between the current tags and categories is only that categories can have parent-child relationships. This relationship is best applied to chronological ordering (2009 series -&gt; autumn series). A good thing about this relationship is that selecting a parent category will show all the entries in the child categories. This offers a control of granularity for the grouping of posts. Usually I won&#8217;t have too many layers of categories. Keeping it at the minimum makes the site map easier to digest, and the category section on the side bar will not be cluttered (which in term decreases the usability).</p>
<p>Tagging is less restrictive to users, which means it can vary greatly to the same writer even in different period of time. I am not a believer in tag clouds. because I loses my focus when I see a sea of links, most of which are seldom used/ less meaningful. I think tagging is more suited for adding keywords. I use it as the source for generating keyword meta tags.</p>
<p>In essence, category gives the reader a general idea of your blog (what kind of writing there are, what is the site structure). It makes it easier for one to navigate through your site. Tags on the otherhand allows users to access your article using external search engines.</p>
<p>However, these guidelines sill cannot fully resolve the following questions. For example:</p>
<ul>
<li>Deciding if one label is more appropriate as a tag or as a category</li>
<li>Worrying if the synonyms should be included as a tag</li>
<li>Worrying if the category section becomes bloated when adding new sections.</li>
</ul>
<p>I thought about these question for a while, and came up with a solution. The new system I am proposing will have the table structure like the following (this is only a prototype):</p>
<p><strong>Tag table:</strong><br />
tag(pk)</p>
<p><strong>TagRelation table:</strong><br />
subjectTag(pk fk)<br />
objectTag(pk fk)<br />
relationship(pk)</p>
<p><strong>Category table:</strong><br />
category(pk)</p>
<p><strong>TagCategory</strong><br />
category(pk fk)<br />
tag(pk)</p>
<p>First, even when I use the guidelines I mentioned above, at times it can still be difficult to decide what should be a tag, what should be a category. This can be eliminated by only allow users to enter the tags. You may want to ask: "then how can I categorise posts?" The answer is, the software will do it for you. For example, one can associate the tag "Gundam" with the category "Animation I watched". In another word, category now is dependent on tags. This means the user no longer chooses the category for each writing directly, but when tags are applied the writing will also be categorised automatically. A few good thing about this are: categories can be associate with multiple tags; the user can have a more personalised category name like "My Jukebox".</p>
<p>This model allows relationships other than the parent-child relationship. This is good for future extension. For example, why not add a "part of" relationship which is more flexible than the parent-child relationship (the ability to have more than one parent so to say)? We can say "Final Fantasy" is part of "SqureEnix" company, but is also part of "RPG".</p>
<p>Often I am feel that one particular key word is not adequate, and its synonyms are needed as well. For example I add "Final Fantasy", "FF" and even the title in Japanese as the tags, because even I use these as search terms interchangeably as well. Adding those one by one everytime can be tiring, and having those all listed in the post is messy. But if we allow the "synonym" relationship, we can just choose "FF", and the post will still be automatically be linked to the "Final Fantasy" tag.</p>
<p>More freedom should be given to the user on organising the categories. In this system the user can set up rules to link categories to the tags. Other than that, I think it will be useful to allow users to choose which categories to display on the side menu. This way the user will not fear that a new category will make the side menu more bloated, but instead only list out the important sections. Additional functionalities can also be offered for the visitors to drill down to see further sub categories. The same goes to tags. The user should be able to set which tags can appear in the tag cloud. Having too many items in the tag cloud can never be a good thing.</p></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.lulalala.com/wordpress/archives/1704/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
