2010年9月29日 星期三

Windows Locale Codes Sorted by Locale ID (LCID)

As defined by Microsoft, a locale is either a language or a language in combination with a country. See Microsoft definitions of locale(http://msdn.microsoft.com/en-us/goglobal/bb964662.aspx).

Locale Language
code
LCID
string
Decimal Hexadecimal Codepage
Afrikaansafaf10784361252
Albaniansqsq10521250
Amharicamam1118
Arabic - Algeriaarar-dz512114011256
Arabic - Bahrainarar-bh153611256
Arabic - Egyptarar-eg30731256
Arabic - Iraqarar-iq20498011256
Arabic - Jordanarar-jo112651256
Arabic - Kuwaitarar-kw1331334011256
Arabic - Lebanonarar-lb1228930011256
Arabic - Libyaarar-ly409710011256
Arabic - Moroccoarar-ma614518011256
Arabic - Omanarar-om819320011256
Arabic - Qatararar-qa1638540011256
Arabic - Saudi Arabiaarar-sa10254011256
Arabic - Syriaarar-sy1024128011256
Arabic - Tunisiaarar-tn71691256
Arabic - United Arab Emiratesarar-ae1433738011256
Arabic - Yemenarar-ye921724011256
Armenianhyhy1067
Assameseasas1101
Azeri - Cyrillicazaz-az20921251
Azeri - Latinazaz-az10681254
Basqueeueu10691252
Belarusianbebe10594231251
Bengali - Bangladeshbnbn2117845
Bengali - Indiabnbn1093445
Bosnianbsbs5146
Bulgarianbgbg10264021251
Burmesemymy1109455
Catalancaca10274031252
Chinese - Chinazhzh-cn2052804
Chinese - Hong Kong SARzhzh-hk3076
Chinese - Macau SARzhzh-mo51241404
Chinese - Singaporezhzh-sg41001004
Chinese - Taiwanzhzh-tw1028404
Croatianhrhr10501250
Czechcscs10294051250
Danishdada10304061252
Divehi; Dhivehi; Maldiviandvdv1125465
Dutch - Belgiumnlnl-be20678131252
Dutch - Netherlandsnlnl-nl10434131252
Edo1126466
English - Australiaenen-au30811252
English - Belizeenen-bz1024928091252
English - Canadaenen-ca410510091252
English - Caribbeanenen-cb922524091252
English - Great Britainenen-gb20578091252
English - Indiaenen-in163934009
English - Irelandenen-ie615318091252
English - Jamaicaenen-jm820120091252
English - New Zealandenen-nz512914091252
English - Phillippinesenen-ph1332134091252
English - Southern Africaenen-za71771252
English - Trinidadenen-tt112731252
English - United Statesenen-us10334091252
English - Zimbabween1229730091252
Estonianetet10614251257
Faroesefofo10804381252
Farsi - Persianfafa10654291256
Filipino1124464
Finnishfifi10351252
French - Belgiumfrfr-be20601252
French - Cameroonfr11276
French - Canadafrfr-ca30841252
French - Congofr9228
French - Cote d'Ivoirefr12300
French - Francefrfr-fr10361252
French - Luxembourgfrfr-lu51321252
French - Malifr13324
French - Monacofr61561252
French - Moroccofr14348
French - Senegalfr10252
French - Switzerlandfrfr-ch41081252
French - West Indiesfr7180
Frisian - Netherlands1122462
FYRO Macedoniamkmk10711251
Gaelic - Irelandgdgd-ie2108
Gaelic - Scotlandgdgd1084
Galiciangl11104561252
Georgianka1079437
German - Austriadede-at30791252
German - Germanydede-de10314071252
German - Liechtensteindede-li512714071252
German - Luxembourgdede-lu410310071252
German - Switzerlanddede-ch20558071252
Greekelel10324081253
Guarani - Paraguaygngn1140474
Gujaratigugu1095447
Hebrewhehe10371255
HID (Human Interface Device)1279
Hindihihi1081439
Hungarianhuhu10381250
Icelandicisis10391252
Igbo - Nigeria1136470
Indonesianidid10574211252
Italian - Italyitit-it10404101252
Italian - Switzerlanditit-ch20648101252
Japanesejaja1041411
Kannadaknkn1099
Kashmiriksks1120460
Kazakhkkkk10871251
Khmerkmkm1107453
Konkani1111457
Koreankoko1042412
Kyrgyz - Cyrillic10884401251
Laololo1108454
Latinlala1142476
Latvianlvlv10624261257
Lithuanianltlt10634271257
Malay - Bruneimsms-bn21101252
Malay - Malaysiamsms-my10861252
Malayalammlml1100
Maltesemtmt1082
Manipuri1112458
Maorimimi1153481
Marathimrmr1102
Mongolianmnmn2128850
Mongolianmnmn11044501251
Nepalinene1121461
Norwegian - Bokmlnbno-no10444141252
Norwegian - Nynorsknnno-no20688141252
Oriyaoror1096448
Polishplpl10454151250
Portuguese - Brazilptpt-br10464161252
Portuguese - Portugalptpt-pt20708161252
Punjabipapa1094446
Raeto-Romancermrm1047417
Romanian - Moldovaroro-mo2072818
Romanian - Romaniaroro10484181250
Russianruru10494191251
Russian - Moldovaruru-mo2073819
Sami Lappish1083
Sanskritsasa1103
Serbian - Cyrillicsrsr-sp30981251
Serbian - Latinsrsr-sp20741250
Sesotho (Sutu)1072430
Setsuanatntn1074432
Sindhisdsd1113459
Sinhala; Sinhalesesisi1115
Slovaksksk10511250
Slovenianslsl10604241250
Somalisoso1143477
Sorbiansbsb1070
Spanish - Argentinaeses-ar112741252
Spanish - Boliviaeses-bo163941252
Spanish - Chileeses-cl133221252
Spanish - Colombiaeses-co92261252
Spanish - Costa Ricaeses-cr51301252
Spanish - Dominican Republiceses-do71781252
Spanish - Ecuadoreses-ec122981252
Spanish - El Salvadoreses-sv174181252
Spanish - Guatemalaeses-gt41061252
Spanish - Honduraseses-hn184421252
Spanish - Mexicoeses-mx20581252
Spanish - Nicaraguaeses-ni194661252
Spanish - Panamaeses-pa61541252
Spanish - Paraguayeses-py153701252
Spanish - Perueses-pe102501252
Spanish - Puerto Ricoeses-pr204901252
Spanish - Spain (Traditional)eses-es10341252
Spanish - Uruguayeses-uy143461252
Spanish - Venezuelaeses-ve82021252
Swahiliswsw10894411252
Swedish - Finlandsvsv-fi20771252
Swedish - Swedensvsv-se10531252
Syriac1114
Tajiktgtg1064428
Tamiltata1097449
Tatartttt10924441251
Telugutete1098
Thaithth1054
Tibetanbobo1105451
Tsongatsts1073431
Turkishtrtr10551254
Turkmentktk1090442
Ukrainianukuk10584221251
UnicodeUTF-8065001
Urduurur10564201256
Uzbek - Cyrillicuzuz-uz21158431251
Uzbek - Latinuzuz-uz10914431254
Venda1075433
Vietnamesevivi10661258
Welshcycy1106452
Xhosaxhxh1076434
Yiddishyiyi1085
Zuluzuzu1077435


  • Reference
http://www.science.co.il/language/Locale-Codes.asp

2010年9月28日 星期二

Use WebATM with Ez-100PU on Ubuntu 10.04

  • 安裝讀卡機相關工具 (pcscd , pcsc-tools)
$ sudo apt-get install pcscd pcsc-tools
  •  安裝  Ez-100PU Linux 驅動程式 
wget http://www.casauto.com.tw/db/pictures/modules/PDT/PDT060207001/200910202021270555.gz -O EZUSB_Linux_x86_v1.4.9.tar.gz 
tar zxvf EZUSB_Linux_x86_v1.4.9.tar.gz
cd EZUSB_Linux_x86_v1.4.9/driver_ezusb_v1.4.9/

確認系統環境
./check_env
 
若都沒有出現error 或 file not found訊息,再執行安裝驅動程式指令
 sudo ./install 
  • 重新起動 pcsc daemon
sudo /etc/init.d/pcscd restart

使用前可以使用 pcsc_scan差詢讀卡機狀態,應該會有下列的顯示
$ pcsc_scan 
PC/SC device scanner
V 1.4.16 (c) 2001-2009, Ludovic Rousseau 
Compiled with PC/SC lite version: 1.5.3
Scanning present readers...
Waiting for the first reader...found one
Scanning present readers...
0: CASTLES EZ100PU 00 00

Tue Sep 28 15:07:40 2010
 Reader 0: CASTLES EZ100PU 00 00
  Card state: Card removed, 


備註:
    • Reference 
    http://jackden-diary.blogspot.com/2010/01/webatm-on-ubuntu-910-use-ez-100pu.html
    http://trac.nchc.org.tw/grid/wiki/jazz/UNR_Tuning

    2010年9月26日 星期日

    幾個跟 udev 相關的文章收錄

    • dev 撰寫規則
    http://www.reactivated.net/writing_udev_rules.html
    • udev , 出自DebianWiki
    http://www.debian.org.tw/index.php/udev
    • Udev (正體中文)
    http://wiki.archlinux.org/index.php/Udev

    Install Windows relative programs over wine on Ubuntu Lucid

    • Install wine and download winetricks
    $ sudo apt-get install wine ; wget http://www.kegel.com/wine/winetricks
    • Execute winetricks to install programs
     $ sh winetricks
    Then it should pop up a box with tools you can install and simply select IE8 or other goodies to choose from
    • Start up IE
    $ wine "C:\Program Files\Internet Explorer\iexplore"
    • Reference
    http://blog.sidmitra.com/install-ie-on-ubuntu-lucid#
    http://stream-recorder.com/forum/install-internet-explorer-7-ie7-ubuntu-10-t6721.html?s=33fba047c64110a0fe151c2e0e82d4be&

    HowTo - Linux 下如何從 flv 取出聲音成 mp3

    • Use  mplayer
    Lets begin with mplayer. To extract audio from video files, use -dumpaudio option and specified the output filename with -dumpfile

    $ mplayer -dumpaudio nodame_theme.flv -dumpfile nodame_theme.mp3

    Then check out the output:

    $ file nodame_theme.mp3

    Output:

    MPEG ADTS, layer III, v2,   8 kBits, 22.05 kHz, Monaural

    • Use ffmpeg
    $ ffmpeg -i nodame_theme.flv -ab 128 -ar 44100 nodame_theme.mp3
    or 
    $ ffmpeg -i video.flv -f mp3 -vn -acodec copy carsounds2.mp3

    -i is to specified input file, -ab audio bitrate, -ar audio sampling frequency

    Let say what file tells you.

    MPEG ADTS, layer II, v1, 128 kBits, 44.1 kHz, Monaural
    • How about record online stream?
    First, find an online radio cast to try, you can have plenty of it from shoutcast.
    $ mplayer -dumpstream http://64.236.34.97:80/stream/1005 -dumpfile smoothjazz.mp3
    or
    $ ffmpeg -i http://64.236.34.97:80/stream/1005 -ab 128 -ar 44100 smoothjazz.mp3

    • Reference
    http://linux.byexamples.com/archives/229/extract-audio-from-video-or-online-stream/

    使用 Sound Juicer 將 CD 轉成 MP3

    • Install
    $ sudo apt-get install sound-juicer gstreamer0.10-plugins-ugly-multiverse
    (instead gstreamer0.10-lame in Ubuntu 10.04) 
    • Configuration for MP3 encoder
    Basic one:
    audio/x-raw-int,rate=44100,channels=2 ! lame name=enc ! id3mux
    Add bit-rate setting:
    audio/x-raw-int,rate=44100,channels=2 ! lame name=enc vbr=0 bitrate=128
    Advanced one:
    audio/x-raw-int,rate=44100,channels=2 ! lame name=enc mode=1 vbr=4 quality=1 preset=1001 vbr-max-bitrate=320 ! xingmux ! id3v2mux
    The meat and potatoes of this line is preset=insane, which tells Lame to use the Insane quality preset, and will give you a fixed-bitrate MP3 file at CBR 320Kbps. This preset will usually be overkill for most people and most situations, but if you must have the absolute highest quality with no regard to filesize (as do I), this is the way to go. This is the highest preset quality available. Of course, there are other presets available–all of them variable bitrate (VBR):

    preset=medium

    This preset should provide near transparency to most people on most music. The resulting bitrate should be in the 150-180kbps range, according to music complexity.

    preset=standard

    This preset should generally be transparent to most people on most music and is already quite high in quality. The resulting bitrate should be in the 170-210kbps range, according to music complexity.

    preset=extreme

    If you have extremely good hearing and similar equipment, this preset will provide slightly higher quality than the “standard” mode. The resulting bitrate should be in the 200-240kbps range, according to music complexity.
    • More detail configuration for gstreamer-lamp
    $ gst-inspect-0.10 lame

    • Reference
    http://wiki.ubuntu-tw.org/index.php?title=HowtoGripMusic
    http://www.calebscreek.com/2008/09/howto-enable-mp3-ripping-in-sound-juicer-2220/

    Use pdftk to Merge/Split/Rotate PDF files

    !!! 注意:PDF 檔名不能有中文 !!!

    • Merge Two or More PDFs into a New Document 
    pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf
    • or (Using Handles):
    pdftk A=1.pdf B=2.pdf cat A B output 12.pdf


    or (Using Wildcards):

    pdftk *.pdf cat output combined.pdf

    • Split Select Pages from Multiple PDFs into a New Document

    pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf

    • Rotate the First Page of a PDF to 90 Degrees Clockwise

    pdftk in.pdf cat 1E 2-end output out.pdf

    • Rotate an Entire PDF Document's Pages to 180 Degrees

    pdftk in.pdf cat 1-endS output out.pdf

    • Reference
    http://www.accesspdf.com/pdftk/

    LPI模擬試題

    • LPI - Exam Emulation
    http://www.linux-praxis.de/lpisim/lpi.html

    • LPI 101 Certification Practice Test
    http://gnosis.cx/publish/programming/exam101.html

    • LPI 102 Certification Practice Test
    http://gnosis.cx/publish/programming/exam102.html

    • ICE:ICE(home)
    https://certify.torolab.ibm.com/ice/displayPage/en;jsessionid=PDGDAUJ3LZ1FUN3MI331RGY

    • Linux (LPI, RHCE..) 認證討論區
    http://phorum.vbird.org/viewforum.php?f=7&sid=1c6030b4edc5ac482b894f351cb6d06e

    在 Linux 中新增一個 PDF 虛擬印表機的方式

    1. 上安裝 cups-pdf 套件
    sudo apt-get install cups-pdf

    2. 至[系統]->[管理]->[列印] 修改相關屬性

    • Reference
    http://www.ubuntu-tw.net/modules/newbb/viewtopic.php?topic_id=3509&forum=7&post_id=12141

    在 initrd 中如何判斷多張網卡狀態

    遇到網路卡兩張,initrd中沒有ethtool的狀態下dhcp client沒有優先去用有插上線的網卡來查詢

    解法:
    可以查
    /sys/class/net/eth0/operstate
    只要是up or unknown,就是有連線,而沒連線就是down.
    不過查詢/sys/class/net/eth0/operstate之前,要先
    ifconfig eth0 0.0.0.0
    先把網路卡叫起來一下,才能判斷,要不然/sys/class/net/eth0/operstate會是
    空的。
    這樣修改的mkpxeinitrd-net就會優先由有連線的網卡去要IP address了。

    [Archive]ubuntu 8.04 從原始碼來編譯安裝pidgin 2.5.2/Pidgin-Encryption

    1. prepare :Install necessary packages:
    sudo apt-get install libnss3-dev libnspr4-dev libgtk2.0-dev libxml2-dev \
    gettext libgstreamer0.10-dev

    Install optional packages:
    sudo apt-get install  libmeanwhile-dev libgtkspell-dev libstartup-notification0-dev \
    libxss-dev libdbus-glib-1-dev network-manager-dev libperl-dev tcl8.4-dev tk8.4-dev \
    libavahi-client-dev libavahi-glib-dev

    2. Download source , configure , compile , install
    * Download source form http://www.pidgin.im/download/source/ , unpack tarball:
    tar jxvf pidgin-2.5.2.tar.bz2
    cd pidgin-2.5.2

    * Configure
    ./configure --prefix=/opt/pidgin

    * compile
    make ; sudo make install

    --------------------------------------------------------------
    1. Download Pidgin-Encryption source code :http://pidgin-encrypt.sourceforge.net/ , unpack
    tar xzvf pidgin-encryption-3.0.tar.gz
    cd pidgin-encryption-3.0


    2. Configure , compile
    ./configure --prefix=/opt/pidgin-2.5.2/
    make

    3. Install
    sudo make install

    ----------------------------------------------------------
    3. 移除 complie 需要的 libs /dev
    sudo apt-get remove --purge  libnss3-dev libnspr4-dev libgtk2.0-dev libxml2-dev gettext \
    libgstreamer0.10-dev libmeanwhile-dev libgtkspell-dev libstartup-notification0-dev libxss-dev \
    libdbus-glib-1-dev network-manager-dev libperl-dev tcl8.4-dev tk8.4-dev libavahi-client-dev libavahi-glib-dev

    再清乾淨一點
    sudo apt-get autoremove;sudo apt-get autoclean;sudo apt-get clean

    • Reference:
    http://jhcore.com/2007/06/04/install-pidgin-in-ubuntu/
    http://blog.yam.com/lijohnson/article/15805391

    HowTo - Linux 下如何批次 resize/rotate 圖檔

    • 方法一 :Use imagemagick
    $ sudo apt-get install imagemagick
    • 可使用 mogrify
    $ mogrify -resize 640 *.jpg
    or
    $ mogrify -resize 640×480! *.jpg
    較方便

    • 方法二 :使用 convert 轉換整個資料夾的檔案
    $ for i in `ls *.jpg`; do convert -resize 1200x900 -verbose $i $i ; done
    • 方法三 :Use nautilus-image-converter
    $ sudo apt-get install nautilus-image-converter

    2010年9月19日 星期日

    如何轉換VMWare 的硬碟檔讓 Virtualbox 使用(convert vmdk to vdi)

    • 所需套件 : qemu, virtualbox
    sudo apt-get install qemu, virtualbox
    • 如果原有的 vmdk 不是單一檔案,先進行轉換
    vmware-vdiskmanager -r source_multiples.vmdk -t 0 single_file.vmdk

    • 利用 qemu 轉換成 .bin 檔
    qemu-img convert  single_file.vmdk  single_file.bin
    • 將 .bin 轉換為 vdi 檔
    VBoxManage convertfromraw  single_file.bin single_file.vdi

    英文餐廳菜單選集

    Ubuntu下大量轉換ID3之編碼 : python-mutagen

    • 安裝 python-mutagen
    sudo apt-get install python-mutagen

    • 執行
    cd ~your-mp3-folder; mid3iconv -e big5 *.mp3


    or 配合 find 轉換目前目錄下所有子目錄的 mp3 :

    find . -iname "*.mp3" -execdir mid3iconv -e big5 {} \;

    Reference:
    http://david50.pixnet.net/blog/post/22253957

    PDF 處理工具 : pdftk

    !!! 注意:PDF 檔名不能有中文 !!!
    • Merge Two or More PDFs into a New Document
    pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf

    or (Using Handles):
    pdftk A=1.pdf B=2.pdf cat A B output 12.pdf

    or (Using Wildcards):
    pdftk *.pdf cat output combined.pdf
    • Split Select Pages from Multiple PDFs into a New Document
    pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf

    • Rotate the First Page of a PDF to 90 Degrees Clockwise
    pdftk in.pdf cat 1E 2-end output out.pdf
    • Rotate an Entire PDF Document's Pages to 180 Degrees
    pdftk in.pdf cat 1-endS output out.pdf

    Reference:
    http://www.accesspdf.com/pdftk/

    2010年9月3日 星期五

    GPT vs MBR : use parted 切 gpt 分割區

    Create a GPT partition via parted
    • 確認要切割的為 /dev/sdb
    cat /proc/partitions
    major minor  #blocks  name

       8     0  142577664 sda
       8     1   11719386 sda1
       8     2          1 sda2
       8     5   48829536 sda5
       8     6   82027858 sda6
       8    16 5855465280 sdb
    • run the follow in parted ( sudo parted /dev/sdb)
    • 確認空間與單位數
    print free
    Model: LSI MegaRAID SAS RMB (scsi)
    Disk /dev/sdb: 5996GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt

    Number  Start   End     Size    File system  Name  Flags
            17.4kB  5996GB  5996GB  Free Space   
    • 使用 GPT格式並分割一塊 xfs 的分割區
    mklabel gpt
    mkpartfs primary xfs 0 5996G
    • 離開,並格式化
    quit
    sudo mkfs.xfs /dev/sdb1
    • Done


    GPT(GUID Partition Table)

    一、定義簡說
    二、OS支援
    三、GPT、NTFS轉換
    四、問題、應用

    一、定義簡說

    由於使用上的限制,Intel+Microsoft在2004年合作開發EFI(Extensible Firmware Interface)計畫,算是一種主機板、儲存磁碟的升級方案,GPT(GUID Partition Table)為計畫裡的一部分,不過,並非一定要搭配EFI才能用,搭配一般BIOS也能用,只是不能作為開機系統。

    MBR磁碟的Partition資料,存放在Master(我們俗稱第0軌)
    GPT磁碟的每個Partition資料,都有各自的GUID,此為主要差異。

    GPT磁碟有保護區,小小佔用空間,依照作業系統不同:
    • Windows:128MB
    • MAC:200MB

    支援分割區單一分割區最高容量
    MBR(Master Boot Record) 4(延伸分割不計) 2TB
    GPT(GUID Partition Table) 沒有限制,但是Windows只能128個 18TB

    二、OS支援(Windows)
    1.一般支援:
    • Windows XP 64 Bit
    • Windows 2003 Server + SP1
    • Windows Vista
    以後的皆有支援,此處支援,乃指『可辨識、存取』,不包含開機(作為系統磁碟)

    2.開機支援(作為系統磁碟):
    主機板必須支援EFI

    三、GPT、NTFS轉換

    在Windows環境,磁碟系統GPT轉換回NTFS的指令:
    diskpart
    選項:
    • list disk 列出目前磁碟
    • select disk n 選擇目標,n為代號
    • clean all 清除所有分割資料,之後,即可重新分割

    如果是新的磁碟(超過2TB,包含RAID),自然會顯示出『GPT磁碟』選項,無須另外處理

    Reference:
    http://en.wikipedia.org/wiki/GUID_Partition_Table
    http://bigcandy.blog.ithome.com.tw/post/2158/72554

    2010年9月2日 星期四

    鎖定套件避免 apt 升級部份套件的方法

    Q: 如何避免 apt 雞婆的更新部份你想要裝 或 不想要更新的套件呢?
    A: 修改 /etc/apt/preferences 就好了,內容會像是:
    Package: PACKAGE_NAME
    Pin: PIN
    Pin-Priority: PIN_PRIORITY
    以 syslinux 為例
    Package: syslinux
    Pin: version 3.8*
    Pin-Priority: 100
    所以優先順序填成下面的值,會造成不同的結果:

    1001 # 永不更新,如果現存的版本比較新(優先順序比較低)還會作降級的動作
    1000 # 跟 1001 一樣,不過 apt 不會作降級的動作
    990 # 如果有比較高的版本用 "APT::Default-Release" 標示的會昇級
    500 # 比 0.8* 還高的版本就會昇級,不過 0.8* 還是較低版本裡面的第一選擇
    100 #syslinux 裡面有更高的版本就會不管 0.8* ,但如果沒有其它的版本先安裝了的話,就會先裝 0.8*
    -1 # 避免裝 0.8* 這個版本

    Reference:
    http://antontw.blogspot.com/2009/06/linux-apt.html

    Linux清除ARP 暫存

    一、這樣可以清除單一IP的ARP緩存
    arp -d IP
    二、清除192.168.0.0網段的所有暫存

    for((ip=2;ip<255;ip++));do \
        arp -d 192.168.0.$ip &>/dev/null; \
    done

    三、清除所有ARP

    arp -n|awk '/^[1-9]/ {print "arp -d "$1}' | sh


    Reference:
    http://www.linuxzh.org/Linux/arp-clean.html

    Ceasar's Photo

    www.flickr.com