本來這個blog是記錄開發輸入法的點滴的,後來越來越雜,現在什麼都記錄了。

2009年4月14日 星期二

修好了「歪林輸入法不能對 MSN 9.0 輸出中文字」的 Bug

自從 MSN 9.0 出來後,很多人都發現「歪林輸入法」不能對它輸出中文!

在 Windows XP,在 MSN 9.0 以外的其他程式,當用戶按下鍵盤鍵時,ylam TSF 會收到兩個 event: OnTestKeyDown() 和 OnKeyDown();但在 MSN 9.0 裡面,我只收到 OnKeyDown() Event。

在 Windows Vista 裡面更怪,MSN 9.0 在啟動時,用戶按鍵 ylam TSF 是會收到 OnTestKeyDown() 和 OnKeyDown() event;當 MSN 9.0 一旦失去 Keyboard Focus 後,重新拿回 focus後,用戶按鍵 ylam TSF 只收到 OnKeyDown() 。

由於以前分析用戶按鍵的源碼部分放在 OnTestKeyDown() 和 另外一部分則放在 OnKeyDown(),以致歪林輸入法不能對 MSN 9.0 正常輸出中文。這些問題都修正了。

天啊!為甚麼是這樣的呢? 微軟故意搞出來的嗎? 是否想殺死其他輸入法,不讓他們存在呢?

請大家來這裡更新吧!

2009年3月16日 星期一

微軟近來推出 MSN 9.0 (Windows Live Messenger 2009) 之後,不少網友都陸續安裝了,這又是我頭痕的時候!我近来収到 4 個投訴,說我的輸入法不能在 MSN 9.0 運作。這幾天,我安装了 MSN 9.0 試試,結果如下:

1) 在 Windows XP,歪林輸入法完全不能對 MSN 9.0 運作!
2) 在 Windows Vista,歪林輸入法有時 對 MSN 運作,當用 mouse 切換其他程式工作,然後返回 MSN , MSN 只能打英文了。要按鈕 輸入法 Windows 的 「x」鍵,然後再按 Shift Space,那麼輸入法又能輸入中文了。

這是為什麼呢? 網上有人說,連微軟自己的拼音輸入法,都對 MSN 9.0 不能正常運作!這是什麼道理?

2009年3月13日 星期五

一百万零一夜 Slumdog Millionaire

近來看了一百萬零一夜,我不覺得很好看,但卻令我非常懷念香港的百萬富翁。

電影中主持叫電腦鎖定答案時,經常說 Computer-ji lock kiya jaye:


我完全聽不明白這句話的意思。今天終於明白了。

日本人,尊称某男士時,通常会加「生」字尾。例如某人叫 Michael,日本人尊稱他為 Michael-san.

在印度,尊稱年長的人,也喜歡加 ji 字尾,例如某年長的人叫 Michael, 會尊稱他做 Michael-ji. 所以 computer-ji 其實即 尊稱「電腦」的意思。

"Lock kiya-jaye" 其實是 印度版的百萬富翁,主持Amitabh Bachchan 經常說的一句,意思和陳啟泰經常說的「最後答案」一樣。

這句話困擾我很久了,現在終於明白意思,很開心。

2009年2月6日 星期五

Howto convert TV recorded program (trp format) with subtitle to mkv format?

  1. Install the following free software
    • K-lite codec pack,
    • Virtual Dub
    • VobSub
    • Project-X
    • TSRemux
    • mkvtoolnix
    • AviSynth
    • ffmpeg (WinFF)
    • Son2VSub
       
  2. Assume the video files are recorded and are in
    • D:\temp\~DATA\DATA00.trp
    • D:\temp\~DATA\DATA01.trp
    • D:\temp\~DATA\DATA02.trp


  3. Join the 3 trp files into one.
    • In START menu, Run, type cmd.
    • Type the following:
      • d:
      • cd d:\temp\~DATA
      • type DATA00.trp DATA01.trp DATA02.trp > final.trp
        Microsoft Windows [? 6.0.6001]
        Copyright (c) 2006 Microsoft Corporation. All rights reserved.

        C:\Users\ylam>d:

        D:\>d:

        D:\>cd d:\temp

        d:\temp>cd ~DATA

        d:\temp\~DATA>type DATA00.trp DATA01.trp DATA02.trp > final.trp

        DATA00.trp

        DATA01.trp

        DATA02.trp

        d:\temp\~DATA>

  4. Extract subtitle information:
    • Open Project-X http://sourceforge.net/projects/project-x
    • In menu Presettings -> subtitle tab:
      • Simulate DVB subpictures IRD color model, choose NRX
      • tick "additional export as VobSub (idx+sub)



         
      • Choose to export only subtitle

         
      • Add final.trp, choose Quick start

         
      • You should be able to see many files generated.
        Keep only final.sup.sub, final.sub.idx and remove other files generated
         
  5. Use TSRemux to convert the final.trp to final.ts.
    Choose only 1 video and 1 audio stream.
    Note: for audio stream, the one with smaller number is the original language.

     
  6. Adjust the subtitle color:
    • Open the program SubResync in VobSub.
    • Drag final.sup.idx into SubResync.
    • Quickly browse the subtitle, you will find some of them are not very clear:

      To fix this problem:
      • Save the subtitle in DVDMaestro format in a separate directory, say "son".
      • In son\final.sup.son, modify it from:
        Directory .
        Subtitle final.sup
        Display_Area (0 2 719 575)
        Contrast (15 15 15 0)

        SP_NUMBER START END FILE_NAME
        Color (1 14 0 15)
        Contrast (15 15 0 15)

        0001 00:01:00:20 00:01:02:13 final.sup_0001.bmp
        Color (1 2 0 8)
        Contrast (11 15 0 15)

        0002 00:01:09:11 00:01:13:23 final.sup_0002.bmp
        Color (15 2 0 13)
        Contrast (8 15 0 15)

        0003 00:01:14:01 00:01:17:11 final.sup_0003.bmp
        to

        Subtitle    final.sup
        Display_Area  (0 2 719 575)
        Contrast   (15 15 0 15)
        Color       (1 2 0 3)

        SP_NUMBER START    END        FILE_NAME
        0001  00:02:44:13  00:02:46:06   final.sup_0001.bmp
        0002  00:02:46:10  00:02:49:03   final.sup_0002.bmp
        0003  00:02:59:21  00:03:01:05   final.sup_0003.bmp


        Note that color with index 0 is a transparent color.
         
      • Start the Son2VSub program.
        Open the son\final.sup.son directory.
        Change the output from 720x480 to 720x576

         
      • In the output file son\final.idx file, change from

        # The original palette of the DVD in PGC#1
        palette: 000060, 2b2b2b, 2c2c2c, 353535, 535353, 414141, 626262, 7c7c7c, a9a9a9, c8c8c8, 8f8f8f, ebebeb, b8b8b8, dbdbdb, 9c9c9c, 2b2b2b


        to

        # The original palette of the DVD in PGC#1
        palette:
        000000, 000000, 000000, ffffff, 535353, 414141, 626262, 7c7c7c, a9a9a9, c8c8c8, 8f8f8f, ebebeb, b8b8b8, dbdbdb, 9c9c9c, 2b2b2b
         
      • The subtitle now looks better:


         

  7. Adjust the subtitle time:
    • Find the first subtitle in final.sup.idx
    • Play D:\temp\~DATA\final.ts in Media Player Classic (in K-lite Codec pack).
      Play until the first subtitle is heard. Write down the time of the first subtitle.
    • In SubResync, right click the subtitle chosen 2 times, until seeing the red triangle
    • Enter the correct time of the subtitle chosen. Save as final.idx
    • Reopen final.ts in Media Player Classic. The subtitle time should be correct now.
       
  8. Find the cropping details for movie, in Virtual Dub.
    • In D:\temp\~DATA\, create a file called final.avs (using notepad) with the following content:

      DirectShowSource("final.ts")
      LoadPlugin("c:\Program Files\K-Lite Codec Pack\Filters\vsfilter.dll")
      VobSub("final.idx")
       
    • Drag "final.avs" into Virtual Dub.
    • In Virtual Dub, "Video" Menu, choose "Filter".
    • Add "Null Transformation"
    • Choose "Cropping...".
    • Determine the cropping details (i.e. Write down X1, X2, Y1, Y2. Note they must be even number):
         
       
  9. Using ffmpeg to convert final.ts to XVID encoded (MPEG4) AVI file final.avi:
    • Start a command prompt.
    • type the following:
      • d:
      • cd d:\temp\~DATA
      • "C:\Program Files\WinFF\ffmpeg.exe" -i final.ts -vcodec xvid -vtag XVID -deinterlace -croptop 76 -cropbottom 76 -cropleft 4 -cropright 4 -s 640x360 -qmin 4 -qmax 4 -bufsize 4096 -mbd 2 -bf 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -g 300 -acodec mp3 -ar 44100 -ab 128k -ac 2 final.avi
    • Note:
      • replace the value for croptop, cropbottom, cropleft, cropright with the values found in Y1, Y2, X1 and X2 found in Step (8).
      • for the best quality video, set qmin, qmax to 1. (the smaller value the better video quality)
      • -g 300 means for every 300 fames (12seconds), there is a I frame. Set to a smaller value if you need to editing.
      • the above example uses 44100kbps, 128kpbs 2-channels mp3 audio. you can modify as your wish
         
  10. Merge final.avi, final.idx into final.mkv
    • Start mkvtoolnix\mmg.exe, add final.avi, final.idx. Press "Start muxing".

2009年1月29日 星期四

東梅古道 (香港奧運徑)

今天又行了東梅古道(東涌至梅窩)。

今天(年初三),天氣寒冷,於是又去行東梅古道。東梅古道的其中一節,即白芒到梅窩一段,被政府修成為了「香港奧運徑」。但絕少有網頁介紹怎樣由東涌去白芒,有的又語焉不詳,所以今天我來寫一下怎樣去:

  • 沿着位於東涌地鐵站D出口對面的富東街一直走:

      
      

  • 在單車徑的盡頭登上石級

       
     
  • 後左轉。有兩條樓梯,記住選擇左手的樓梯


     
  • 再從石級登上長長的水泥小徑,

     
     
     
  • 一路沿着小徑向東北方向走,途經荒廢了的果園及跨越了數條的山澗。遇到這些難過的山澗,請不要放棄,繼續向前。

     
     
  • 這一段路都可以看到在左邊的北大嶼山公路及機場的景色。

     
     
  • 再走30分鐘後,便看到「奧運林」的牌。


     
  • 走過了這一段由水泥路及山路相互交替的路段後,便沿着石級下降至海旁。
     
  • 沿着位於石級右邊的水泥路向東南方向走,便到達了白芒。


     
  • 奧運徑就此開始了。