Posts

Showing posts from February, 2012

[English] Vocabulary In Context

Repetition is often the key to success and studies show that most repetitive tasks become part of a person's inventory of skills over time. 每個單詞都有 denotation 跟 connotation, 所以要猜出單詞的意義通常透過 (1) 字根、字尾 (2) 前後文 在推斷句子中單詞意義時, 有4種線索:    a. restatement    b. positive / negative    c. contrast    d. specific detail Example A Handi suddenly found himself destitute , so poor that he could barely afford to eat.   restatement: destitute and poor, negative: so poor, barely   => destitute: extremely poor Example B Sarah had worked so hard for the past few weeks that she decided she owed herself a day of complete indolence . Saturday, she slept until noon, ordered take-out so she wouldn't have to cook , and left the dishes in the sink. She left her chores for another day and spent the afternoon lying on the couch, reading and watching television. But on Sunday, she was back to her old assiduous self, and by noon, she had already cleaned her whole apartment, does her grocery shopping, and pa

[讀書心得] ffmpeg tutorial (三) Playing sound

這集主要是介紹透過 SDL 播放 sound. Audio -   (1) 由一連串 streams 所組成, 每個 stream 又稱為一個 sample, 表示 audio waveform.   (2) 如何撥放 audio 是由 sampling rate 決定, 表示每秒播放 N samples. Ex. 22050 for radio, 44100 for CD.   (3) multichannels for stereo or surround   (4) 當我們得到 video 的部份 data 時, 會得到一個完整的 samples. 也就是說: 我們無法預期得到的 sample 數, 但 ffmpeg 也不會將 samples 分成數段. SDL 播放 audio 的做法為:   10 Audio information Setup, including sampling rate (named frequency in SDL), number of channels, callback function, userdata, etc.   20 Call callback function and fill audio data into SDL_AduioSpecs.   30 Call SDL_OpenAudio()   40 Back 20 until finished

[讀書心得] ffmpeg tutorial (二) Drawing images to screen

這集介紹透過 ffmpeg 將 stream 轉為 Images 輸出, 採用的是 SDL (Simple Direct Layer).   SDL 的簡單說明:      (1) Simple DirectMedia Layer      (2) written by c, but C++ compatible.      (3) cross-platform (Linux, Windows, Windows CE, BeOS, MacOS, Mac OS X, FreeBSD, OpenBSD, BSD/OS, Solaris and QNX)      (4) low level access to hardware device, ex. keyboard, audio, mose, joystick, 3D hardware(via OpenGL), 2D video framebuffer.      (5) GNU LGPL v2 (表示只要透過dynamic library, 即可作為商業用途; 只有再修改SDL源碼才要公布修改的部分跟使用的代碼)      (6) Language biding (ex. C#, Java, Lisp, Lua, Object-C, PHP, Python, Ruby and smalltalk)      (7) DirectX之於Windows, 等同SDL之於nonWindows      (8) Current Version 1.2.15 (Jan. 20, 2012) resource click here . SDL 對於呈現 image 很多方法, 這裡介紹一種 YUV overlay.(這以前在學校有接觸過, 可當時根本不知道在幹嘛... ) YUV(technically, YCbrCr) 是一種儲存 raw image 的格式, 其他的格式像是 RGB. Y: brightness/luma component, U and V: color compoents. SDL接受4種不同的 YUV format, 而 處理速度YV12 是最快的. 另外有個 format YUV420P, 指的是 subsampling rate 4:2:0, 每 4 luma samp

[Japanese] (轉)日文學習心得

參考 網址 1. 一天都別中斷,哪怕只有10分鐘 2. 若是厭倦了,改用其他方式像是廣播、音樂 3. 隨時記下並背熟常用的套句 4. 盡可能心譯你接觸到的東西,像是廣告或話題 5. 抄錄、記憶句子跟慣用語要用第一人稱 6. 學外語好比攻碉堡,必須四面八方向它圍攻:報紙、廣播、電影、演講、課本、聊天等。 7. 敢說出口 日語學習順口溜  學習日語不能急,慢慢悠悠出才子, 一天三詞一個句,一年就是一千詞, 三年學會九百句,勝過大專沒問題。  學習日語不能聽,開口才能練真功, 一詞讀上一百遍,一分鐘內可搞完, 聽力憑的是機器,無法練成鐵嘴皮。  日語敬語特別難,日本人也很為難, 何況我們異國人,拋在腦後先別問, 抓住簡體練半年,再練敬語也不完。  語句子有特點,就像農民壘磚牆, 句子主幹是單詞,助詞粘單詞的泥, 初學不要講順序,能粘一起就表意。  動詞簡單有規律,變變詞尾就可以, 自動他動分兩類,他動及物賓語追, 自動無賓也無悔,「方向」「對像」配成對。  五十音圖八卦陣,既可表意又表音, 十行五段要記心,當心鄰居什麼人, 順序方位都要記,動詞變化全在裡。

[讀書心得] ffmpeg tutorial (一) Making Screencaps

Media files 種類分成 music, image, video. 每個 file 自身又稱為 container , 各自的格式如下:   -music container : AIFF(mac), WAV(windows), XMF(extensible music format), etc.   -image container : TIFF, FITS, etc.   -video container : 3GP, AVI, ASF, Matroska, Quick Time, MPEG, MP4, RM, etc. container type 決定了 儲存於 file 的資訊(這不廢話...) container 由 streams  (audio/video) 所構成, 每個 stream又可以分成數個 frames . 其中 streams 被各種 codec 以 encode 方式儲存於 container.  codec 定義了 stream 如何被 enCOde 跟 DECode, 如 H.264, Xvid, MP3.  不過在傳送時,  streams 是以數個 decoded 的 raw frames 為單位, 稱作 packet. 一個簡單的處理程序如下: 10 OPEN video_stream FROM video.avi 20 READ packet FROM video_stream INTO frame 30 IF frame NOT COMPLETE GOTO 20 40 DO SOMETHING WITH frame 50 GOTO 20 不過這裡有幾個疑問(Q1):     (1) packet 是固定大小的 frames?      (2) 一個 image 由固定大小的 frames 組成? audio 又是怎麼傳輸?          恩, 直覺上最簡單的做法是每次收 data frames 時先檢查大小.           25 READ list FOR X frames transfer (先記著, 回頭再來check) 這裡的example 是"開一個 file, 將它的 stream 取出, 在

[windows] wamp 啟動錯誤(Aestan Tray Menu error)

今天下午在裝WAMP時跳出一個錯誤視窗: " Aestan Tray Menu has stopped working " blah blah...  網路找到一堆解法大致上是 (1) navigator 設定錯誤 (主要是IE6跟IE的路徑問題, 我把他改成chrome沒問題就不鳥他了) (2) Port 80, 443被占用. 可以使用 command "netstat -ab" 檢查. (3) 少裝了 VC++ redistributable. (從 stackoverflow 上得知) 本來還想說自己各別裝好了, 好在可以work.. lol 主要原因還是因為那台電腦作業系統重灌, 少了什麼我也不知道... windows環境就是這樣(茶...

[django] views

Views:     主要是針對webpage的部份,指的是各種不同類的view, ex. homepage, archive page 等等,     大多是用來提供特定的functions或templates. django裡透過 ROOT_URLCONF (settings.py) 設定URLConf. For example, MyApp/     .__init__     models.py     urls.py     views.py (1) 設定 ROOT_URLCONF = 'MyApp.urls' (2) 撰寫 urls.py, 增加欲提供服務的 urlpatterns           urlpatterns = ( regular expression, python callback function [, optional dictionary] ) urlpatterns = patterns('MyApp.views',  url(r'^gg/$', 'index'), url(r'^gg/(?P \d+/$', 'search'), ) 當user 詢問 MyApp/gg/123/ 時, ( I)  django會針對ROOT_URLCONF內對應的APP(MyApp), (II)  搜尋它urls.py內符合RE的pattern (III) load 指定的 callback function(views.py). 從這個例子可以知道 callback function會像這樣:   search(request= , search_id='123') (Supplement) *一個domain下可以有多個web apps, ROOT_URLCONF我搞錯了, 他只能指定一個路徑, 正確的做法應該是指定一個 urls.py, 然後使用 include() MyProject/     .__init__.py     m

test test test

[QList] iApp, DLNA, Lua

1. 寫iphone/ipad app不是只有 object-c, 原來也有提供其他語言的 SDK, 像是angry bird就是用 Corona (Lua)寫的. 不過既然是SDK, 肯定就會有功能上的限制, 就看各自需求了. 2. Lua 是一種 script, 可以很容易被C/C++使用, 反之也可以使用C/C++函數. (這感覺是linux下我們寫c調用shell script的方式?! windows下寫.bat?! 不過它可以反過來用 c/c++涵式真是威猛! 有空瞧瞧) 3. 有空找個 iPhone JB試試. 4. iOS上作streaming還是脫離不開ffmpeg(茶...)   ffmepg4iphone  開源碼 5.  Oplayer 作者的 blog 6. DLNA 似乎目前仍是 移動終端多媒體共享的最佳解決方案 .... 似乎家電大廠、網路通訊業、電信業跟網路服務業等,想的到的公司都是 它的members ... 另外學長提供的一個 development tool for upnp and dlna. 7. 這幾天再回顧DLNA的缺點, 我覺得是: (1) 功能強大的Server(Windows Media Center, XBOX) 對optional的檔案格式不支援(這應該是要裝plug-in) (2) 再播放高畫質影片時, ex. avi, 需要較久的延遲. (3) 試了一堆players, 遇到的問題(不完全是WMC)大多是要碼就是無法 VCR, 要碼就是檔案格式不支援, 要碼就無法迅速切換。這些要釐清是Server/Player/network的問題對工程師而言真是個夢靨... lol  更何況是還有 conroller... 不知道目前作到最佳使用者體驗的產品有哪些??? 8. XBMC , 一個跨平台的多媒體解決方案, 值得關注。