• Set your browser encoding to UTF-8.

Weblog

Tuesday, 04 August 2009

  • Firefox度改語文

    Firefox改語文。
    C:\Program Files\Mozilla Firefox\res\langGroups.properties

    #
    # ***** BEGIN LICENSE BLOCK *****
    # Version: MPL 1.1/GPL 2.0/LGPL 2.1
    #
    # The contents of this file are subject to the Mozilla Public License Version
    # 1.1 (the "License"); you may not use this file except in compliance with
    # the License. You may obtain a copy of the License at
    # http://www.mozilla.org/MPL/
    #
    # Software distributed under the License is distributed on an "AS IS" basis,
    # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    # for the specific language governing rights and limitations under the
    # License.
    #
    # The Original Code is mozilla.org code.
    #
    # The Initial Developer of the Original Code is
    # Netscape Communications Corporation.
    # Portions created by the Initial Developer are Copyright (C) 2000
    # the Initial Developer. All Rights Reserved.
    #
    # Contributor(s):
    #   Erik van der Poel
    #   Jungshik Shin
    #   Katsuhiko Momoi
    #   Henri Sivonen
    #
    # Alternatively, the contents of this file may be used under the terms of
    # either of the GNU General Public License Version 2 or later (the "GPL"),
    # or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    # in which case the provisions of the GPL or the LGPL are applicable instead
    # of those above. If you wish to allow use of your version of this file only
    # under the terms of either the GPL or the LGPL, and not to allow others to
    # use your version of this file under the terms of the MPL, indicate your
    # decision by deleting the provisions above and replace them with the notice
    # and other provisions required by the GPL or the LGPL. If you do not delete
    # the provisions above, a recipient may use your version of this file under
    # the terms of any one of the MPL, the GPL or the LGPL.
    #
    # ***** END LICENSE BLOCK *****
    #
    # References: http://www.omniglot.com/writing/atoz.htm
    #             http://www.loc.gov/standards/iso639-2/englangn.html
    #             http://www.ethnologue.com
    #             http://www.worldlanguage.com/Languages/
    #             http://www.rosettaproject.org/
    #             http://www.sweb.cz/ls78/diacritics.htm
    #    see also toolkit/locales/en-US/chrome/global/languageNames.properties
    #             and bug 178491
    #
    #ab=x-cyrillic
    # Strictly speaking, Avestan did not use Arabic script but Aramaic
    # (arc)/Avestan script.)
    #ae=ar

    af=x-western
    alg=x-cans
    am=x-ethi
    ar=ar
    as=x-beng
    be=x-cyrillic
    bg=x-cyrillic
    bn=x-beng
    br=x-western
    bs=x-central-euro
    ca=x-western
    ce=x-central-euro
    ch=x-western
    co=x-western
    cr=x-cans
    cs=x-central-euro
    #cu=x-cyrillic
    cv=x-cyrillic
    # XXX Latin Ext. A is also used for cy.
    cy=x-western
    da=x-western
    de=x-western
    #dv=Thaanna
    #dz=Tibetan
    #ee=x-western(?) (Ewe uses characters outside Latin-1 as well)
    el=el
    en=x-western
    # Esperanto: Latin-3
    eo=x-western
    es=x-western
    et=x-baltic
    eu=x-western
    fa=ar
    #ff=x-western(?) : Fulfulde
    fi=x-western
    # XXX Latin Ext. A is also used for fj.
    fj=x-western
    fo=x-western
    fr=x-western
    fy=x-western
    ga=x-western
    #XXX Latin Ext. A and Ext. additional block are used for Gaelic (8859-14)
    gd=x-western
    # gl : ISO-8859-13
    gl=x-western
    #ha=x-western : Latin and Ajami scripts
    gu=x-gujr
    he=he
    hi=x-devanagari
    ht=x-western
    hr=x-central-euro
    # XXX Latin Ext. A is also used for hsb.
    hsb=x-western
    hu=x-central-euro
    hy=x-armn
    ia=x-western
    id=x-western
    ie=x-western
    is=x-western
    it=x-western
    iu=x-cans
    ja=ja
    ka=x-geor
    km=x-khmr
    kn=x-knda
    ko=ko
    ks=ar
    #ku=ar
    # XXX Latin Ext. A is also used for kw(Cornish).
    kw=x-western
    #ky=x-cyrillic
    # XXX Latin Ext. A is also used for Latin.
    la=x-western
    lb=x-western
    lt=x-baltic
    lv=x-baltic
    #XXX  Latin Ext. A is also used for Maori.
    mi=x-western
    mk=x-cyrillic
    ml=x-mlym
    #mo=x-central-euro / x-cyrillic
    mr=x-devanagari
    ms=x-western
    # Maltese: Latin-3
    mt=x-western
    nb=x-western
    ne=x-devanagari
    nl=x-western
    nn=x-western
    no=x-western
    # XXX : x-central-euro may be better
    nv=x-western
    oc=x-western
    oj=x-cans
    om=x-ethi
    or=x-orya
    os=x-cyrillic
    #pa: Punjabi is usually written in Gurmukhi script in India and Arabic script
    #    in Pakistan. We make pa default to Gurmukhi based on comments in bug 248690
    pa-in=x-guru
    pa-pk=ar
    pa=x-guru
    pl=x-central-euro
    ps=ar
    pt=x-western
    qu=x-western
    rm=x-western
    ro=x-central-euro
    ru=x-cyrillic
    sa=x-devanagari
    sc=x-western
    sd=ar
    # African language (but related with French)
    sg=x-western
    sh=x-central-euro
    si=x-sinh
    sk=x-central-euro
    sl=x-central-euro
    so=x-western
    sq=x-western
    sr=x-cyrillic
    sv=x-western
    sw=x-western
    ta=x-tamil
    te=x-telu
    th=th
    tig=x-ethi
    tk=x-cyrillic
    #tk=tr # (The country declared in 1992 to gradually move to Latin script)
    tlh=x-western
    tr=tr
    tt=tr
    uk=x-cyrillic
    ur=ar
    # XXX : Vietnamese may need be put into a script group of its own
    vi=x-western
    vo=x-western
    wa=x-western
    yi=he
    #Latin Ext. A and Latin Extended Additional block are used for Yoruba.
    #yo=x-western
    zh-cn=zh-CN
    # XXX : The following two entries are added as a quick fix (bug 251241).
    # When we have a general solution for ISO 15924 (script codes), the issue has
    # to be revisited.
    zh-hans=zh-CN
    zh-hant=zh-TW
    zh-tw=zh-TW
    zh-hk=zh-HK
    zh=zh-HK
    zh-yue=zh-HK
    yue=zh-HK
    zh-min-nan=x-western
    zu=x-western
    #
    #==============================
    #
    # mapping mozilla's internal x-* to themselves (see bug 256257)
    x-western=x-western
    x-central-euro=x-central-euro
    x-cyrillic=x-cyrillic
    # el
    # tr
    # he
    # ar
    x-baltic=x-baltic
    # th
    # ja
    # zh-CN
    # ko
    # zh-TW
    x-tamil=x-tamil
    x-devanagari=x-devanagari
    x-unicode=x-unicode
    x-user-def=x-user-def
    x-armn=x-armn
    x-geor=x-geor
    # These self-mappings are not necessary unless somebody use them to specify
    # lang in (X)HTML/XML documents, which they shouldn't. (see bug 256257)
    #x-beng=x-beng
    #x-cans=x-cans
    #x-ethi=x-ethi
    #x-guru=x-guru
    #x-gujr=x-gujr
    #x-khmr=x-khmr
    #x-mlym=x-mlym


Monday, 19 January 2009

  • 裝Attachment_fu

    裝attachment_fu畀Rails用好易。

    首先裝咗ImageScience先。
    裝法:
    $ sudo gem install image_science

    跟住作去Rails嗰個App嘅目錄,裝attachment_fu
    $ script/plugin install http://svn.techno-weenie.net/projects/plugins/attachment_fu/

    之後,起個class table畀啲file
    class CreateUploadFile < ActiveRecord::Migration
    def self.up
    create_table :upload_files do |t|
     # 所有都用
    t.string :content_type
    t.string :filename
    t.integer :size
    # image 用
    t.integer :width
    t.integer :height
    # thumbnail 用
    t.string :thumbnail
    t.integer :parent_id
    # 如果揀用database儲file
    t.references :db_file
    end
    end
    def self.down
    drop_table :upload_files
    end
    end

    #如果用database儲
    def CreateDbFiles < ActiveRecord::Migration
    def self.up
    create_table :db_files do
    t.binary :data
    end
    end
    def self.down
    drop_table :db_files
    end
    end
    係咁樣,搞掂。

    個class UploadFile入便,
    加has attachment同佢一堆option搞掂。

    跟住係整view或controller控制。


Thursday, 15 January 2009

  • Rails format

    Rails要回返啲嘢畀client之前,會check返有client有send啲乜Accept過來。

    畀個例
    首先要/objects/1.html
    Client交呢個Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Rails就會搵html個項
    respond_to do |format|
      format.html ...
      format.xml ...
      format.jpg ...
      format.all ...
    end

    對個對法係來自個type有無做Mime.register
    Mime.register其中一行,有mime type係text/html,extension係html,symbol係:html
    咁對html, 搵有:html,咁就夾format.html

    咁Rails交出之時,就會對下Accept有無:html嘅mime type,對到有text/html,咁就send出去。

    如果client無話可以Accept,就會話406 Not Accepted。

    之不過Rails唔夠聰明,就算*都要指明,唔係佢唔識handle㗎。不過佢留有*/*來map去:all,咁format.all就會handle得到。


Thursday, 08 January 2009

  • 地名

    想砌下地名對譯,個表會不時更新。

    基隆
    Keelung
    1928-04-28


    龍門




    日本
    Japan



    門司
    毛之
    Moji


    上海
    Shanghai



    省城
    Canton



    西貢
    Saigon



    星加波
    星架波

    石叻
    Singapore


    Selat



    廣州灣




    小呂宋




    海口
    Hoihow



    濱角




    張家口
    Kalgan



    廣東
    Kwangtung



    河內
    Honoi



    涵館
    Hakodate



    牛莊
    牛庄
    Newchwang



    大連




    鎮江
    Chinkiang



    盧州
    Lu how?



    神戶
    Kobe



    大阪
    Osaka



    橫濱
    Yokohama



    汕頭
    Swatow



    青島




    三水




    梧州




    毛厘士
    Maurice

    毛里裘斯
    Mauritis
    布旺
    Bourbon

    留尼旺
    Réunion
    南斐洲
    South Africa



    八打威
    Batavia



    三孖冷
    Semarang



    泗水
    Soerabaja


    Surabaja
    孟加失
    Mangkasar


    Makassar/Macassar
    舊金山
    California
    San Francisco



    羅省
    Los Angelos



    美國
    花旗
    United States of America



    中南美洲




    域多利
    Victoria (Canada)



    溫高華
    咸水埠
    Vancouver



    加拿大
    Canada



    檀香山
    檀山
    Honolulu



    墨西哥
    Mexico



    中美洲
    Central America



    舍路
    Seattle



    北海
    Pakhoi



    巴拿馬
    巴剌孖
    吧拿堡
    Panama



    巴波啞
    Balboa



    告郎
    Colón



    鳥約
    New York



    廈門
    Amoy


    Xiamen
    安南
    Annam



    海防
    Haiphong



    打狗
    Takao

    高雄
    Kao Hsiung
    赤坎




    希路
    Hilo



    文成李祐
    Manzanillo



    秘魯
    Peru
    Perú



    智利
    Chile



    瑞典
    Sweden



    哥林堡
    哥霖步
    Colombo



    庇能
    Penang

    檳城

    仰光




    架厘吉打
    架剌吉打
    Calcutta



    大連




    威海衞
    Weihaiwei



    烟台
    煙台




    天津




    河口




    英京
    倫敦
    London



    山打根
    Sandakan



    笠包
    Rabaul



    雪梨
    Sydney


    美利伴
    美利畔
    Melbourne


    阿地利埠
    Adelaide



    福州




    暹邏
    Siam



    孟米
    Bombay



    馬些
    Marseille



    夏華
    Havre



    律打担
    Rotterdam



    咸北
    Hamburg



    他士爹島
    Thursday Island



    湯士威路
    Townsville



    庇利士彬
    Brisbane



    新金山
    Australia



    波士頓
    Boston



    打畸
    Durban



    刦當
    Cape Town



    南美洲
    South America



    意大利
    Italy



    歐洲
    Europe



    錫蘭
    Ceylon



    斐洲
    Africa



    埃及
    Egypt



    渣華
    Java



    台灣




    美洲
    America



    印度
    India



    雅典
    Aden? Athens?



    紐西蘭
    New Zealand



    肇慶





































































Wednesday, 07 January 2009

  • Rails migration 整數改咗rule

    家下Rails class Migration::Base之下

    以前咁寫
    t.integer :amount
    預設係MySQL int(11),係幾個數字。
    家下Rails改咗用byte計,咁:limit個數字就唔同咗意思。
    1 byte等於MySQL tinyint
    2 byte係smallint
    3 byte係mediumint
    4 byte係int(11)
    5..8 byte係bigint

    咁為咗同舊時一樣nil同11作同等同家下4,即係default都係4
    大過8, rails migration會鬧你。

ruby_omnibus

  • Visit ruby_omnibus's Xanga Site
    • Name: ruby_omnibus
    • Gender: Male
    • Member Since: 1/22/2008
    • True

About Me

  • I'm working on Ruby on Rails. I am Cantonese speaker and thus my blog is mainly in Cantonese. I am comprehensible in English, Cantonese, modern Chinese and classic Chinese. Also, I learnt a little bit Japanese especially with more Kanji. Please feel free to write to me.¶ Below is in Cantonese.¶ 歡迎大家留言、寫下回應、同埋同我傾偈。

Weblog Archives

Don't worry - your calendar is here… to see it in action just click "Save" above and refresh the page.

Blogrings

[no blogrings]

Pulse

ruby_omnibus has no pulse!...

Recommended

[no recommendations]