Sunday, June 28, 2015

My Favorite Music Artists

Rough classification, just for memo:

Chinese

  • Jam Hsiao
  • Eason Chan

Japanese
  • Angela Aki

English
  • Rachael Yamagata
  • Priscilla Ahn
  • Coldplay

Others

Saturday, May 21, 2011

為什麼希臘人會將錢幣放在死者的雙眼?

Why?

之前在電影「特洛伊木馬屠城記上看到希臘人會將錢幣放在死者的雙眼上, 像底下連結中的圖片這樣:
http://www.flickr.com/photos/47248668@N00/3296701172/
就很好奇他們的動機是啥?
The largely obsolete custom of placing coins over a dead person's eyes or in their mouth was done to provide the deceased with money to pay Charon for his services.

從上面這段說明, 我們可以知道這些錢幣是為了讓亡者可以得到Charon的某種幫助, 那麼, Charon是誰呢? 又提供什麼service?
In the Greek mythology, Charon (mythology) was the ferryman.

是這樣子的, 在希臘的傳統上認定Charon是個渡亡靈之神, 他可以幫助死者渡過冥河(Acheron), 而亡者雙眼的錢幣就是要給Charon的 QQ (但是網路上又有人說其實Charon是不收費的 XD)


其實, 在台灣也有類似的習俗, 例如: 「腳尾錢」目的之一就是提供亡魂在陰間的交通費用 QQ


Reference 
  1. http://www.conservapedia.com/Styx

Monday, May 2, 2011

耶路撒冷 (Jerusalem)



Why Jerusalem?
前幾天看了王者天下這部電影,除了被薩拉丁的胸襟感動再次被雷利史考特的作品震撼奧蘭多布魯很帥依娃葛林很正;除此之外我其實對十字軍東征沒啥太特別的感想,第一是因為本人年幼時對歷史這類要大量記憶的課程完全排斥而導致對很多歷史不熟,另外即使到了2011年的現在以巴衝突」仍舊不斷發生, 戰爭這類的感想就留給專家來評論吧。

整部片最吸引我的一句話快劇終時奧蘭多布魯問薩拉丁「耶路撒冷有何價值? 值得死傷那麼多人」薩拉丁說「Nothing......Everything」,可見耶路撒冷的價值是無形的,這讓我對耶路撒冷產生更大的興趣,我在這邊單純想小小紀錄一下各個宗教在這座城市中的著名景點 (搞不好日後有機會可以去好好參觀一下科科),但不對它背後龐大的歷史意義做評論。




Jerusalem
耶路撒冷被很多宗教視為聖地,光這點就很特別了,它基督教猶太教和伊斯蘭教的發源地
  • 基督教
    根據聖經記載
    耶穌被釘在十字架的地方,就耶路撒冷的聖墓教堂基址,底下是聖墓教堂的入口處


         而耶穌在被釘上十字架前走的路,稱為「受難路,下圖是受難路其中一段


  • 猶太教
    最值得提的應該就是西牆(哭牆)
    ,背後歷史意義不提,這面牆是猶太教最神聖的地點之一


          此外您還可以把祝福或心願寫在紙上插入牆上細縫處






  •  伊斯蘭教
    圓頂清真寺(The Dome of the Rock)可說是
    耶路撒冷最醒目的地標之一




Reference
  • http://en.wikipedia.org/wiki/Jerusalem
  • http://big5.xinhuanet.com/gate/big5/news.xinhuanet.com/ziliao/2005-05/16/content_2963177.htm
  • http://zh.wikipedia.org/wiki/%E8%A5%BF%E5%A2%99

Sunday, January 30, 2011

TD-LTE and Its Future

Abstract
最近很頻繁地看到這個詞兒,就索性survey一下它到底是何方神聖! 但對於網通的領域實在一竅不通,只能紀錄點TD-LTE的皮毛跟未來發展。



TD-LTE and Its Future
  • 我們知道大陸人多地廣,因此凡事很喜歡自成一格,TD-SCDMA就是大陸自定的標準,國內的晶片大廠「發哥」及「早晨看星星」早已在TD-SCDMA佔有一席之地。然而,高通以及一些晶片廠選擇退出或根本不加入TD-SCDMA的戰局,轉而投資TD-LTE,而現在,TD-LTE將成為「全球」引頸注目的新標準。

  • TD-LTE與LTE採用了截然不同的Duplexing Scheme,TD-LTE採用了TDD(Time Division Duplex),而LTE採用的是FDD(Frequency Division Duplex)。差別由底下兩張圖可以很清楚的看出[1]:





    在現今有限的頻段中,使用TDD的技術可以減少頻段的使用量,並可以使downlink跟uplink在比例上更具彈性,而FDD需對稱。另外,TDD的成本也較低,因此獲得不少業者青睞。


  • 當然,TD-LTE不只這些特性,我們來看看擁有TD-LTE技術的大廠「Qualcomm」是怎麼介紹它的 [3]:
    高通(Qualcomm)公司宣佈,該公司 TDD LTE 產品即將邁向商用化,且目前正於2010上海世博會展示使用該項技術產品。展示產品使用高通 MDM92002x2 MIMO 技術,以2.3GHz頻段進行傳輸展示。 解決方案,同時具備 高通的相關產品佈局包括支援 TDD LTE 、整合基頻與射頻的產品,如 MDM9200 。 MDM9200 為首款多模 3G / LTE 單晶片,可同時支援分頻雙工(FDD)與分時雙工(TDD) LTE。首款採用高通晶片的 TDD LTE 產品預計2011年中正式推出。
    ......
    高通通訊科技無線通訊產品事業群資深副總Cristiano Amon表示,高通承諾協助客戶於2011年推出 TDD LTE 產品。 TDD LTE 技術可協助電信營運商有效運用非對稱頻譜資產,並提供使用者絕佳的行動寬頻體驗。 TDD LTE 的展示與營運商測試將於2010年底進行。

  • 2011 Las Vegas CES Verizon 買了高通的單 [4],並提出預計在2013年的美國,4G LTE將全面取代目前的3G [5]
    全球先進無線技術、產品及服務創始者暨領導廠商高通(Qualcomm)與Verizon Wireless於2011年國際消費性電子展 (CES) 共同宣布, Verizon Wireless多款 4G LTE裝置,將採用高通Snapdragon MSM8655處理器及MDM9600 LTE數據機晶片組。[4]
 
At CES, Verizon Wireless announced 10 upcoming devices that will run on its 4G LTE network by middle of this year. [5]




Conclusion
  • TD-LTE前景可期

  • WiMAX前途堪虞?




Reference
  1. http://www.conniq.com/WiMAX/tdd-fdd.htm
  2. http://www.c114.net/news/116/a490397.html 
  3. http://www.eettaiwan.com/ART_8800620795_675327_NP_9857c373.HTM
  4. http://www.digitimes.com.tw/tw/dt/n/shwnws.asp?cnlid=13&cat=5&id=0000215601_590500XJ18EZ2U065I0CL
  5. http://www.techztalk.com/techwebsite/01-06-11-verizon-reveals-10-4g-lte-devices
  6. http://network4g.verizonwireless.com/#/4g-network-verizon-wireless

Tuesday, December 21, 2010

Why not to Root your Android phone?


I trial by error to Root the 「SAMSUNG Galaxy Tab」 in the last weekend. Two observation results are listed below: 
  • Universal Androot [2] provides an easy way to Root/Unroot your Android phone, unfortunately, Galaxy Tab is not belong to the suitable list according to my experimental result.  
  • z4root [4] would be helpful.



What i say... it just wastes time to Root the Android phone through some kinds of apps. More specifically, you have to find out the applicable app firstly, and you need to learn how to utilize the tool. Why can't we have the privilege to control our Android phone? Oh come on, it's Open Source. Ten Reasons To Root Your Android Phone [5], and the last reason: Because You Can!

Well, the latest news,

It’s not “rooting”, it’s openness


from Android Developers Blog.





Ref.
  1. http://galaxytab.samsungmobile.com/
  2. http://blog.23corner.com/2010/08/30/universal-androot-1-6-2-beta-5/#more-407
  3. http://android-developers.blogspot.com/?hl=en
  4. http://forum.xda-developers.com/showthread.php?t=833953
  5. http://www.addictivetips.com/mobile/top-10-reasons-to-root-your-android-phone-2/
  6. http://android-developers.blogspot.com/2010/12/its-not-rooting-its-openness.html
  7. http://androidcommunity.com/android-security-team-proclaims-openness-not-rooting-20101220/

Tuesday, November 30, 2010

Brand New Start

Abstract
明天將是人生中的一個新起點, C'mon




















My New Room
  • 首先是一進門就是三個大衣櫃, 加個門簾會更美觀, 這邊算是玄關, 因此還有下一道門

 
  • 房間以及浴室外觀



  • 浴室基本上可乾濕分離


  • 大鏡子及「免治馬桶」(不習慣用Orz)

  • 有點像「閨房」



Epilogue
  • 兩面採光, 14F, 大坪數, 還有開放式大衣櫥


















 



  • Beginnings by Carl Bard [2]





















Reference 
  1. http://crossroadsmag.eu/2009/12/  
  2. http://www.success.net/fx/  
  3. 信義房屋2010廣告

Sunday, November 14, 2010

Hardware Abstraction Layer (HAL)

Introduction
退伍後,在最近的工作面試中,曾經有位主管提到了Hardware Abstraction Layer (HAL),主管稍微解釋了它的概念,其實我這個菜逼八沒碰過這玩意兒,在面試之前,對HAL的瞭解大概只有在Android那邊survey到的一個記憶:「HAL在Android的角色之一是它可以讓廠商避免掉利用Android來開發自家產品時所發生的GPL版權上的問題」( ~想盡量口語化卻讓一句話變得好冗長 囧rz )實際上,HAL並非只有上述的好處,在嵌入式系統中HAL更是使得系統具有更好的架構,且使得系統更portablereusable。 

本文將概念性解釋HAL在整個系統架構中所扮演的角色,之後舉出幾個例子來描述不同系統上對於HAL的使用狀況


Hardware Abstraction Layer (HAL)
wiki[1]上對於HAL的描述,第一句是這樣說的
A hardware abstraction layer (HAL) is an abstraction layer, implemented in software, between the physical hardware of a computer and the software that runs on that computer. Its function is to hide differences in hardware from most of the operating system kernel, so that most of the kernel-mode code does not need to be changed to run on systems with different hardware.
最後一句是這樣結束的
Operating systems having a defined HAL are easily portable across different hardware. This is especially important for embedded systems that run on dozens of different platforms.
介紹HAL的資料很多但是它的精神從wiki的前後兩個句子大概可以看出個端倪
  
更換了底層硬體平台或是零件,driver就必須重寫此時如果有HAL將有以下的好處:
  1. 上層AP不需更改code 
  2. 若在HAL落實Hardware Abstraction,將使得之後開發更便利
針對上面兩點好處底下做個說明:
  1. HAL提供API供上層呼叫,因此就算更換了不同硬體,只要API的部份仍依照當初制定的規格來撰寫、修改,則上層的code將不用做任何修改(亦即上層根本不需知道底層如何實作出該API)
  2. 在HAL開發API時應該多考慮Portability,盡量使得該API能在不同硬體上run


HAL implementation with various platforms
HAL其實可以算是一個「概念」,這個概念就是提供一個「界面」,而這個界面的精神是要分隔kernel space及user space因此,接下來舉出兩個不同平台對於HAL的應用方式:

  • Android
 2008年, Patrick Brady在Google I/O的演講「Anatomy & Physiology of an Android」中提到了HAL [2], 在Android中, HAL使得:
  1. 開發廠商可以不需要open source且不會違反GPL
     
  2. 任何硬體方面的改變, 可以不用修改到Kernel 

  • Nios® II processor
The HAL is a lightweight runtime environment that provides a simple device driver interface for programs to connect to the underlying hardware. The HAL application program interface (API) is integrated with the ANSI C standard library. The HAL API allows you to access devices and files using familiar C library functions, such as printf(), fopen(), fwrite(), etc. [3] 
上面提到的Android是一套OS, 在這套OS中可以實作出HAL這個概念。 而Nios® II processor, 它是一個處理器, 這個處理器上層需要driver, 這些driver上層就是HAL的實作加上ANSI C standard library的整合, 作用及精神上也符合HAL的概念。


Conclusion
本文首先介紹了HAL的概念
,接著瀏覽HAL這個概念在Android及Nios® II processor上的應用至於這個概念在更細部上是如何實作的,各家做法不盡相同,網路上也有許多參考文件可參考,這裡就不重覆敘述了。 
 

Reference
  1. http://en.wikipedia.org/wiki/Hardware_abstraction_layer
  2. http://sites.google.com/site/io/anatomy--physiology-of-an-android
  3. http://www.altera.com/literature/hb/nios2/n2sw_nii52003.pdf

Sunday, October 10, 2010

Interrupt Service Routines (ISRs) and its declaring in C language

About Interrupt Service Routines (ISRs) & Interrupt
對於Interrupt Service Routines(ISRs)各家有各種版本的解釋,但其實內容大同小異,例如,微軟在Windows CE 5.0的線上文件中對於ISRs有著這樣的說法,
An interrupt service routine (ISR) is a software routine that hardware invokes in response to an interrupt. ISRs examine an interrupt and determine how to handle it. ...... An ISR must perform very fast to avoid slowing down the operation of the device and the operation of all lower priority ISRs. [1]
由上面的最後一句話,我們可以知道ISRs的執行必須是快速的、有效率的,否則可能影響整個系統的運作。另外在Raj Kamal [2]的書上,對於ISR有這麼一段定義:
ISR is also called device driver in case of the devices and called exception or signal or trap handler in case of software interrupts.

Raj Kamal把ISR分成軟體及硬體的面相來說明。的確, Interrupt在我們修OS時,恐龍本OS [3]將Interrupt分成三類:
  1. External Interrupt: 由CPU外的週邊硬體所發出, 如: I/O complete...
  2. Internal Interrupt: CPU執行指令時發生, 如: Overflow, divide by zero...
  3. Software Interrupt: User Program在執行期間需要某項服務(如I/O request)而對OS發出Interrupt
當OS收到Interrupt,會保存目前process的執行狀態且暫停process,而去執行所對應的ISR。 


Declaring ISRs using C language
在C語言中,對於如何使用ISR,並沒有制定一個標準,因此不同的compiler會有不同的宣告方式,底下舉出各種compiler的宣告方式:
  • Borland C
/* Borland C */
void interrupt interrupt_handler(void)
{
    /* do something */
}
  • Watcom C/C++
/* Watcom C/C++ */
void _interrupt interrupt_handler(void)
{
    /* do something */
}
  • IAR
/* IAR declares an ISR like so: */
#pragma vector=TIMER0_OVF_vect
__interrupt void MotorPWMBottom()
{
    // code
}
  • AVR GCC
/* AVR GCC declares an ISR like so: */
ISR(PCINT1_vect)
{
  //code
}

其中, AVR GCC是以macro的方式呈現, 因此需要include底下這個header file
#include <avr/interrupt.h>

An ISR example
在筆者之前一篇文章「How to program the Pololu 3pi Robot using C language - "Motor Control"」中提到, ATmega328p有兩個8-bit timers: Timer0Timer2, 它們被用來控制電流, 因此時間的控制是很重要的, 假如某個timer發生了overflow就應該做出一些中斷措施, 底下的例子就是每當程式執行中, timer2發生overflow時, ISR的呼叫情形

// this ISR is called every time timer2 overflows
ISR(TIMER2_OVF_vect)
{
 us_times_10 += 1024;
 if (us_times_10 >= 10000)
 {
  timer0_millis++;
  us_times_10 -= 10000;
 }
}

Conclusion
本文收集了不同書本、網站對於Interrupt Service Routines的介紹, 並複習了OS課程中, 「恐龍本」所分類的幾種Interrupt情況, 分成了軟體及硬體兩個面相來描述。另外也介紹四種不同的編譯器對於ISR的使用方式, 最後舉出一個例子, 來介紹「AVR」單晶片在這方面的應用。


Reference
  1. http://msdn.microsoft.com/en-us/library/ms892408.aspx
  2. Embedded Systems: Architecture, Programming and Design, 2/e, by Raj Kamal, Tata McGraw-Hill, 2006
  3. Silberschatz, Galvin, and Gagne, “Operating System Concept,” Sixth Edition, John Wiley & Sons, Inc., 2002.
  4. http://wiki.osdev.org/Interrupt_Service_Routines
  5. AVR-Libc user manual (v1.6.6)

Thursday, October 7, 2010

[C++] convert int to string with the employment of STL / sstream


Abstract
在C語言中, 當「int」型別要轉換成「char *」型別時, 可以透過「sprintf()」來實作。而在C++中, 當「int」型別要轉換成「string」型別時,我們則可以透過stringstream來實作。本文目的是紀錄如何透過stringstream」來將int型別為「string型別



Example
/*
Author      : Trek
Description : Convert int to string with the employment of STL/sstream
Compiler    : g++

http://seeyababy.blogspot.com
*/

/* To use the stringstream, we must include the sstream header */
#include <iostream>
#include <sstream>
#include <string>

using namespace std;

int main ()
{
    /* initialization */
    int a = 7207;
    string s;

    /* creates a stringstream that holds a copy of the string s */
    stringstream ss(s);

    /* auto formatting across an arithmetic type and a string type */
    ss << a;

    /* use the str member to obtain a copy of the string associated with the stringstream we just created. */
    s = ss.str();

    cout << s << endl;

    return 0;
}


Postscript
會有這麼一篇筆記的原因是, 筆者在coding時常常需要同時output許多圖片到某個資料夾, 此時如果將數字轉成字串, 那麼就可以"方便地append"在一些路徑下了 :)
 

Reference
  • C++ Primer, 4th Edition, S. B. Lippman, J. Lajoie and B. E. Moo

Friday, September 24, 2010

[Debug] error: stray ‘\xxx’ in program

「The key to eliminating bugs from your code is learning from your mistakes.」
~ by Jerry Jongerius


「人非聖賢,孰能無過」,再厲害的programmer也無法百分之百肯定自己的code是bug-free的 [Ref.1]。以目前Trek的等級,無法長篇大論只能先case by case的來舉出平常實作當中所遇到的小問題,小Bug」但初學者往往忽略了這些小細節而浪費了許多時間就像Jerry在本文開頭所言,至少我們需要記住這隻臭蟲,那麼,它將不再出現



這篇文章目的要紀錄一個例子
  • 試想,當我們在coding時,可能使用了不同的Editor,不同的compiler,甚至是在不同的OS底下執行的由於不同系統採用了不同的編碼方式,導致compilercompile無法辨認某一種編碼規格此時便會產生錯誤


  • 案例:友人在windows底下用msn傳了份code給筆者, 而筆者此時是在使用Linux系統, 當筆者利用g++編譯時, 問題產生了,如底下截圖:


  • 問題及解決方法:會產生這個error的原因是, 筆者直接從msn的對話框中複製了該份code, 並直接使用, 而它的編碼方式與g++所認定的方法不一樣, 因此Bug產生。但我們code明明沒有寫錯, 再怎麼trace code也無法找出Bug。了解原因後, 解決方法就變簡單了, 您可以使用常用的Editor, 親自寫出code, 而不是直接從某個您不知道它編碼方式的文件複製/貼上code

  • 另外, 這種情況也常發生在直接複製網頁上的code, 例如:直接複製簡體中文的網頁, 往往會因為編碼問題而產生錯誤


  • 更多Bug方面的深入探討請見Reference. 1


Reference
  1. http://blog.joycode.com/jiangsheng/archive/2006/02/05/71101.aspx
  2. http://s428.photobucket.com/home/rbrovillos