2004-12-30

兩個修女

有兩個修女,一個是叫做數學修女,另一個則是叫邏輯修女,現在已經快天黑了。

但她們離修道院還有很遠的路程。

數學:妳有沒有注意到,後面有個男人已經跟蹤我們有三十八分鐘三十秒,不知道他想要做什麼?
邏輯:這很合理的,他想侵犯我們。

數學:天哪!在這樣的速度下,他會在十五分鐘之內抓到我們的,我們該怎麼辦?

邏輯:唯一合理的方法當然是走快一點。

數學:好像沒用呀!
邏輯:當然沒用,那個男人也很合理的越走越快。

數學:那我們該怎麼辦?在這樣的速度下,他還有一分鐘就能抓到我們了。
邏輯:唯一合理的方法就是我們分開逃,妳走那邊,我走這邊,他不可能兩個都抓。

那個男人繼續跟蹤邏輯修女。
數學修女平安地到達修道院,但很擔心邏輯修女會不會出事,然後就看到邏輯修女進了門口。

數學:邏輯修女妳終於回來啦!感謝主!快告訴我發生什麼事?
邏輯:發生了唯一合理的事情,那個男人不能兩個都跟蹤,所以他就來追我。

數學:對對,但後來發生什麼事?
邏輯:發生了唯一合理的事情,我用盡全力地跑,他也用盡全力地在後面追。

數學:然後呢?
邏輯:發生了唯一合理的事情,他抓到我了。

數學:天哪!那妳怎麼辦?
邏輯:我做了唯一合理的事,把裙子拉起來。

數學:天哪,邏輯修女!那個男人呢?
邏輯:他做了唯一合理的事,他把褲子拉了下去。

數學:我的天哪!那後來呢?
邏輯:不是很合理嗎,數學修女‥‥‥‥‥‥‥‥‥(往下看)









一個把裙子拉起來的修女,一定跑得比一個把褲子拉下去的男人快得多!!!


剛才在亂想的你,趕快說兩聲:阿們!

2004-06-01

Compressed Filesystems under Linux (ziosfs/squashfs)

isofs
$ isosize -x /dev/cdrom
sector count: 146112, sector size: 2048
$ isosize -d block_count /dev/cdrom
299,237,376
$ dd if=/dev/cdrom of=image.iso bs=2k count=146112 conv=notrunc,noerror
146112+0 records in
146112+0 records out

real    1m25.266s
user    0m0.098s
sys     0m4.379s
$ ls -l image.iso
299,237,376 image.iso
$ tar cvjpf image.tbz2 image.iso && ls -l image.tbz2
284,117,981 image.tbz2
ziofs
$ mkzftree -p 4 /mnt/cdrom ziso
real    1m27.215s
user    0m30.316s
sys     0m3.644s
$ mkisofs -z -R -J -o image.ziso ziso
Warning: using transparent compression. This is a nonstandard Rock Ridge
         extension. The resulting filesystem can only be transparently
         read on Linux. On other operating systems you need to call
         mkzftree by hand to decompress the files.

Total translation table size: 0
Total rockridge attributes bytes: 36308
Total directory bytes: 71680
Path table size(bytes): 228
Max brk space used 63000
139603 extents written (272 MB)

real    0m24.501s
user    0m0.463s
sys     0m1.647s
$ ls -l image.ziso
285,906,944
squashfs
$ mksquashfs /mnt/cdrom image.sqsh
Creating little endian filesystem on image.sqsh, block size 32768.

Little endian filesystem, data block size 32768, compressed data, compressed 
metadata
Filesystem size 277719.14 Kbytes (271.21 Mbytes)
        95.19% of uncompressed filesystem size (291761.77 Kbytes)
Inode table size 8704 bytes (8.50 Kbytes)
        36.38% of uncompressed inode table size (23925 bytes)
Directory table size 2517 bytes (2.46 Kbytes)
        53.70% of uncompressed directory table size (4687 bytes)
Number of duplicate files found 14
Number of inodes 353
Number of files 337
Number of symbolic links  0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 16
Number of uids 1
        root (0)
Number of gids 0

real    1m35.402s
user    0m31.254s
sys     0m2.945s
$ ls -l image.sqsh
284,385,280

2004-05-07

VCD to DVD-VCD under Linux

Encode VCD audio to 48000Hz
$ mpgsplit movie.mpg [0-50M] -o vcd.mpg

$ du -hs vcd.mpg
489M    vcd.mpg
$ mpginfo vcd.mpg48k
vcd.mpg
  Mpeg 1 System File [Video/Audio]
  Muxrate : 1.41 Mbps
  Estimated Duration: 48:57.47s
  Size [352 x 240]     29.97 fps    1.15 Mbps
  Audio : Mpeg 1 layer 2
  224 kbps  44100 Hz
  Stereo,  No emphasis
(A) Approach 1: Reencode -> demux -> mplex
$ mencoder \
-ovc copy \
-oac lavc lavcopts acodec=mp2:abitrate=224 -srate 48000 -idx -noskip -sws 2 \
-of mpeg vcd.mpg -o outfile.mpg48k > /dev/null
real    4m25.739s
user    2m34.639s
sys     0m18.953s
$ mpginfo outfile.mpg48k
outfile.mpg48k
  Mpeg 1 System File [Video/Audio]
  Muxrate : 2.11 Mbps
  Estimated Duration: 48:57.08s
  Size [352 x 240]     29.97 fps    1.15 Mbps
  Audio : Mpeg 1 layer 2
  224 kbps  48000 Hz
  Stereo,  No emphasis
$ mpgdemux outfile.mpg48k
real    1m23.077s
user    0m2.966s
sys     0m4.411s
$ mplex -f 8 -o outfile.vobmpg chunk-0.m1v chunk-0.mp2
real    2m2.510s
user    0m43.697s
sys     0m7.602s
(B) Approach 2: Demux -> toolame Audio -> mplex
Verify the vobmpg
$ dvdauthor -o dvd_test outfile.vobmpg
$ rm -rf dvd_test
DVD Authoring
$ dvdauthor -x dvdvcd.xml
DVDAuthor::dvdauthor, version 0.6.9.
Build options: gnugetopt magick iconv freetype
Send bugs to 

INFO: Locale=LC_CTYPE=zh_TW.Big5;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY
INFO: Converting filenames to BIG5
INFO: dvdauthor creating VTS
STAT: Picking VTS 01

STAT: Processing Part1.vobmpg...
STAT: VOBU 4848 at 499MB, 1 PGCS
INFO: Video pts = 0.178 .. 2937.579
INFO: Audio[8] pts = 0.178 .. 2937.658

STAT: Processing Part2.vobmpg...
STAT: VOBU 9866 at 1011MB, 1 PGCS
INFO: Video pts = 0.178 .. 3011.452
INFO: Audio[8] pts = 0.178 .. 3011.530
STAT: VOBU 9876 at 1013MB, 1 PGCS
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg1
INFO: TV standard: ntsc
INFO: Aspect ratio: 4:3
INFO: Resolution: 352x240
INFO: Audio ch 0 format: mp2/2ch, 20bps

WARN: Audio channel 1 gap is negative (-7098) on VOB Silver1.vobmpg cell 1
STAT: fixed 9876 VOBUS                        
INFO: dvdauthor creating VTS
STAT: Picking VTS 02

STAT: Processing Part3.vobmpg...
STAT: VOBU 6496 at 656MB, 1 PGCS
INFO: Video pts = 0.178 .. 3866.073
INFO: Audio[8] pts = 0.178 .. 3866.146

STAT: Processing Part4.vobmpg...
STAT: VOBU 12254 at 1238MB, 1 PGCS
INFO: Video pts = 0.178 .. 3419.193
INFO: Audio[8] pts = 0.178 .. 3419.290
STAT: VOBU 12264 at 1240MB, 1 PGCS
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg1
INFO: TV standard: ntsc
INFO: Aspect ratio: 4:3
INFO: Resolution: 352x240
INFO: Audio ch 0 format: mp2/2ch, 20bps

WARN: Audio channel 1 gap is negative (-6537) on VOB KooYin1.vobmpg cell 1
WARN: Audio channel 1 gap is negative (-6537) on VOB KooYin2.vobmpg cell 1
STAT: fixed 12264 VOBUS                        
INFO: dvdauthor creating VTS
STAT: Picking VTS 03

STAT: Processing Part5.vobmpg...
STAT: VOBU 6880 at 629MB, 1 PGCS
INFO: Video pts = 0.178 .. 3685.526
INFO: Audio[8] pts = 0.178 .. 3685.594

STAT: Processing Part6.vobmpg...
STAT: VOBU 12765 at 1168MB, 1 PGCS
INFO: Video pts = 0.178 .. 3145.586
INFO: Audio[8] pts = 0.178 .. 3145.618
STAT: VOBU 12778 at 1169MB, 1 PGCS
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg1
INFO: TV standard: ntsc
INFO: Aspect ratio: 4:3
INFO: Resolution: 352x240
INFO: Audio ch 0 format: mp2/2ch, 20bps

WARN: Audio channel 1 gap is negative (-6090) on VOB paycheck1.vobmpg cell 1
WARN: Audio channel 1 gap is negative (-6090) on VOB paycheck2.vobmpg cell 1
STAT: fixed 12778 VOBUS                        
INFO: dvdauthor creating VTS
STAT: Picking VTS 04

STAT: Processing Part7.vobmpg...
STAT: VOBU 7456 at 572MB, 1 PGCS
INFO: Video pts = 0.184 .. 3354.864
INFO: Audio[8] pts = 0.264 .. 3355.032

STAT: Processing Part8.vobmpg...
STAT: VOBU 12109 at 928MB, 1 PGCS
INFO: Video pts = 0.184 .. 2076.504
INFO: Audio[8] pts = 0.264 .. 2076.672
STAT: VOBU 12110 at 928MB, 1 PGCS
WARN: GOP is not closed on cell 1 of source Itchy1.vobmpg of pgc 1
WARN: GOP is not closed on cell 1 of source Itchy2.vobmpg of pgc 1
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg1
INFO: TV standard: pal
INFO: Aspect ratio: 4:3
INFO: Resolution: 352x288
INFO: Audio ch 0 format: mp2/2ch, 20bps

WARN: Audio channel 1 gap is negative (-7920) on VOB Itchy1.vobmpg cell 1
WARN: Audio channel 1 gap is negative (-7920) on VOB Itchy2.vobmpg cell 1
STAT: fixed 12110 VOBUS                        
INFO: dvdauthor creating table of contents
INFO: Scanning DVD123/VIDEO_TS/VTS_01_0.IFO
INFO: Scanning DVD123/VIDEO_TS/VTS_02_0.IFO
INFO: Scanning DVD123/VIDEO_TS/VTS_03_0.IFO
INFO: Scanning DVD123/VIDEO_TS/VTS_04_0.IFO
INFO: Creating menu for TOC

STAT: Processing menu.mpg...

INFO: Video pts = 0.184 .. 2.184
INFO: Audio[8] pts = 0.184 .. 60.160
INFO: Audio[32] pts = 0.184 .. 0.184
STAT: VOBU 2 at 2MB, 1 PGCS
INFO: Generating VMGM with the following video attributes:
INFO: MPEG version: mpeg2
INFO: TV standard: pal
INFO: Aspect ratio: 4:3
INFO: Resolution: 720x576
INFO: Audio ch 0 format: mp2/2ch, 20bps

STAT: fixed 2 VOBUS
Play the DVD
$ xine dvd:/path/to/VIDEO_TS/
This is xine (X11 gui) - a free video player v0.9.23.
(c) 2000-2003 The xine Team.
libdvdnav: Using dvdnav version 1-rc4 from http://xine.sf.net
libdvdread: Using libdvdcss version 1.2.8 for DVD access
libdvdread: Couldn't find device name.
libdvdnav: Can't read name block. Probably not a DVD-ROM device.
libdvdnav: Unable to find map file '/home/brother/.dvdnav/.map'
libdvdnav: DVD disk reports itself with Region mask 0x00000000. Regions: 1 2 3 4 5 6 7 8
Burn the DVD
$ growisofs -dvd-compat -speed=4 -Z /dev/hdc -dvd-video -VR /path/above/VIDEO_TS
Executing 'mkisofs -vRJ . | builtin_dd of=/dev/hdc obs=32k seek=0'
mkisofs 2.01a27 (i686-pc-linux-gnu)
Scanning .
Scanning ./VIDEO_TS
Scanning ./AUDIO_TS
Writing:   Initial Padbock                         Start Block 0
Done with: Initial Padbock                         Block(s)    16
Writing:   Primary Volume Descriptor               Start Block 16
Done with: Primary Volume Descriptor               Block(s)    1
Writing:   Joliet Volume Descriptor                Start Block 17
Done with: Joliet Volume Descriptor                Block(s)    1
Writing:   End Volume Descriptor                   Start Block 18
Done with: End Volume Descriptor                   Block(s)    1
Writing:   Version block                           Start Block 19
Done with: Version block                           Block(s)    1
Writing:   Path table                              Start Block 20
Done with: Path table                              Block(s)    4
Writing:   Joliet path table                       Start Block 24
Done with: Joliet path table                       Block(s)    4
Writing:   Directory tree                          Start Block 28
Done with: Directory tree                          Block(s)    4
Writing:   Joliet directory tree                   Start Block 32
Done with: Joliet directory tree                   Block(s)    3
Writing:   Directory tree cleanup                  Start Block 35
Done with: Directory tree cleanup                  Block(s)    0
Writing:   Extension record                        Start Block 35
Done with: Extension record                        Block(s)    1
Writing:   The File(s)                             Start Block 36
/dev/hdc: "Current Write Speed" is 4.1x1385KBps.
  0.22% done, estimate finish Tue May  4 14:49:50 2004
 ...
 ...
 ...
  99.78% done, estimate finish Tue May  4 13:29:28 2004
Total translation table size: 0
Total rockridge attributes bytes: 2025
Total directory bytes: 6144
Path table size(bytes): 42
Done with: The File(s)                             Block(s)    2229675
Writing:   Ending Padblock                         Start Block 2229711
Done with: Ending Padblock                         Block(s)    150
Max brk space used 21000
2229861 extents written (4355 MB)
builtin_dd: 2229872*2KB out
/dev/hdc: flushing cache
/dev/hdc: closing track
/dev/hdc: closing disc

CD Recording

$ du -h
614M
$ cdrecord speed=40 -v dev=/dev/hdc file.iso
cdrecord: No write mode specified.
cdrecord: Asuming -tao mode.
cdrecord: Future versions of cdrecord may have different drive dependent defaults.
cdrecord: Continuing in 5 seconds...
Cdrecord-Clone 2.01a27 (i686-pc-linux-gnu) Copyright (C) 1995-2004 J顤g Schilling
TOC Type: 1 = CD-ROM
scsidev: '/dev/hdc'
devname: '/dev/hdc'
scsibus: -2 target: -2 lun: -2
Warning: Open by 'devname' is unintentional and not supported.
Linux sg driver version: 3.5.27
Using libscg version 'schily-0.8'.
SCSI buffer size: 64512
atapi: 1
Device type    : Removable CD-ROM
Version        : 0
Response Format: 2
Capabilities   :
Vendor_info    : 'LITE-ON '
Identifikation : 'DVDRW LDW-451S  '
Revision       : 'GSB6'
Device seems to be: Generic mmc2 DVD-ROM.
Current: 0x0009
Profile: 0x001B
Profile: 0x001A
Profile: 0x0014
Profile: 0x0013
Profile: 0x0011
Profile: 0x0010
Profile: 0x000A
Profile: 0x0009 (current)
Profile: 0x0008
Using generic SCSI-3/mmc   CD-R/CD-RW driver (mmc_cdr).
Driver flags   : MMC-3 SWABAUDIO BURNFREE FORCESPEED
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Drive buf size : 1895168 = 1850 KB
FIFO size      : 4194304 = 4096 KB
Track 01: data   613 MB       
Total size:      704 MB (69:45.69) = 313927 sectors
Lout start:      704 MB (69:47/52) = 313927 sectors
Current Secsize: 2048
ATIP info from disk:
  Indicated writing power: 6
  Is not unrestricted
  Is not erasable
  Disk sub type: Medium Type B, high Beta category (B+) (5)
  ATIP start of lead in:  -11730 (97:25/45)
  ATIP start of lead out: 336350 (74:46/50)
Disk type:    Short strategy type (Phthalocyanine or similar)
Manuf. index: 62
Manufacturer: VIVASTAR AG
Blocks total: 336350 Blocks current: 336350 Blocks remaining: 22423
Forcespeed is OFF.
Starting to write CD/DVD at speed 40 in real TAO mode for single session.
Last chance to quit, starting real write    0 seconds. Operation starts.
Waiting for reader process to fill input buffer ... input buffer ready.
BURN-Free is ON.
Turning BURN-Free off
Performing OPC...
Starting new track at sector: 0
Track 01:  613 of  613 MB written (fifo 100%) [buf 100%]  39.8x.
Track 01: Total bytes read/written: 642918400/642918400 (313925 sectors).
Writing  time:  163.437s
Average write speed  28.0x.
Min drive buffer fill was 45%
Fixating...
Fixating time:   13.840s
cdrecord: fifo had 10127 puts and 10127 gets.
cdrecord: fifo was 21 times empty and 3221 times full, min fill was 0%.

real    3m11.734s
user    0m0.298s
sys     0m1.684s

2004-03-27

CJK under Gentoo Linux



Traditional Chinese (Big5):-
(http://www.info.gov.hk/gia/general/200403/27/0327212.htm)
政制事務局局長:我們已會見了七十多個團體及個別人士,而他們都有就政制發展 的原則問題和法律程序問題向我們講解了他們的看法。我們在過去兩個多月所收集 到的書面意見,我們已在各區民政處存放了他們的意見書,大家都可以參閱。我們 在下星期的第一份報告書會講及法律程序的問題,我們總結在社會上收集到的意 見,以及會講專責小組就這五個法律程序的看法。
Simplied Chinese (GB):-
(http://sc.info.gov.hk/gb/www.info.gov.hk/gia/general/200403/27/0327212.htm)
政制事务局局长:我们已会见了七十多个团体及个别人士,而他们都有就政制发展 的原则问题和法律程序问题向我们讲解了他们的看法。我们在过去两个多月所收集 到的书面意见,我们已在各区民政处存放了他们的意见书,大家都可以参阅。我们 在下星期的第一份报告书会讲及法律程序的问题,我们总结在社会上收集到的意 见,以及会讲专责小组就这五个法律程序的看法。
Japanses (Shift-JIS):-
(http://www.kantei.go.jp/new/kousikiyotei.html)
*小泉総理の当日の公務を紹介しております。なお、公式に発表されたもののみ 掲載しており、予告なく変更になることがありますので、あらかじめご了承くだ さい。* (http://www.kantei.go.jp/jp/koizumispeech/2003/12/09danwa.html)
四半世紀にわたる圧政の下で、国土や国民生活が荒廃したイラクにおいては、 今、喫緊の課題はイラク人による自由で民主的な政権を早急に樹立することで す。新生イラクを立ち上げるためには、既に40ヵ国近い各国の部隊が種々の支 援を行っています。10月16日には、国際社会がイラクの復興と安定の確保に 一致団結して取り組むことを確認する国連安全保障理事会決議1511が全会一 致で採択されました。来年6月に予定されている統治権移譲までの間は、復興と 安定の道筋を作る上で極めて重要な期間となります。我が国としても、国連や国 際社会がより積極的な役割を果たすべきと考えており、今後ともかかる議論に積 極的に参加し、主張すべきことを主張していきます。