Sunday, September 10, 2017

張惠妹 - 快樂眼淚

張惠妹 - 快樂眼淚

作詞:林夕
作曲:楊陽
編曲:吳慶隆



看著你久違卻 熟悉的臉龐
kan zhuo ni jiu wei que shu xi de lian pang
那些煙遠往事 畫上了圓滿
na xie yan yuan wang shi hua shang liao yuan man
因為你快變成 別人的新郎
yin wei ni kuai bian cheng bie ren de xin lang

你終身的對象 一定很理想
ni zhong shen de dui xiang yi ding hen li xiang
否則你又何必 終止糾纏
fou ze ni you he bi zhong zhi jiu chan
只好微笑祝福 你們的浪漫
zhi hao wei xiao zhu fu ni men de lang man

Chorus:
我終於變得不多愁善感
wo shi zhong bian de bu duo chou shan gan
回憶還像心跳那麼難忘
hui yi huan xiang xin tiao na me nan wang
擁抱的熱 還留在我們的身上
yong bao de re huan liu zai wo men de shen shang
緣分卻不能反抗
yuan fen que bu neng fan kang
愛人不變朋友實在太難
ai ren bu bian peng you shi zai tai nan
希望離別 能讓以後
xi wang li bie neng rang yi hou
更快樂 更幸福 更美滿
geng kuai le geng xing fu geng mei man

漫長路上你幫我背的行囊
man chang lu shang ni bang wo bei de xing nang
因為有你的汗 變成珍藏
yin wei you ni de han bian cheng zhen cang
我給你的補償 是為你打扮
wo gei ni de bu chang shi wei ni da ban

Repeat Chorus

那次大雨中下班
na ci da yu zhong xia ban
你拿一把雨傘 來接我
ni na yi ba yu san lai jie wo
想起來 難免傷感
xiang qi lai nan mian shang gan

感謝你愛我一場
gan xie ni ai wo yi chang
難得敘舊笑談
nan de xu jiu xiao tan
依然溫暖
yi ran wen nuan
有浪漫 沒緣分
you lang man mei yuan fen
總不算遺憾
zong bu suan yi han

我終於變得不多愁善感
wo zhong yu bian de bu duo chou shan gan
回憶還像心跳那麼難忘
hui yi huan xin tiao na me nan wang
擁抱的熱 還留在我們的身上
yong bao de re huan liu zai wo men de shen shang
緣分卻不能反抗
yuan fen que bu neng fan kang
愛人不變朋友實在太難
ai ren bu bian peng you shi zai tai nan
希望離別 能讓以後
xi wang li bie neng rang yi hou
更快樂 更幸福 更美滿
geng kuai le geng xing fu geng mei man
我快樂 的眼淚 在流轉
wo kuai le de yan lei zai liu zhuan

Sunday, September 3, 2017

Downloading Segmented Vimeo Videos

Have blogged about this before. Downloading Vimeo videos used to be a matter of clicking the download button that appears below the video player. Download disabled? No problem. Just plug in the Vimeo video URL to the many online video downloaders that supposedly can do the job. youtube-dl might even do the job.

Lately, I've noticed that a lot of the premium Vimeo videos are chopped up and sent to the client browser as m4s segments. I've written a blog post before re: downloading Brightcove videos, but this one is totally different. As far as I can tell, there is no main mp4 link that can be obtained. You'll have to save all these m4s segments and somehow piece them all together to get the complete video.

Did a bit of research, and looks like someone already wrote a python script that should be able to do this. Installation is pretty simple:

  1. Install additional requirements using pip install.
  2. Install ffmpeg.
  3. Extract the master URL (http://...master.json?base64_init=1) and plug into the vimeo-download command.

vimeo-download.py script should probably work fine with a Windows python and ffmpeg installation, but I decided to go with Linux. See my blog post about Linux VM. As mentioned, python comes pre-installed in Linux Mint, but not pip.

sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install python-pip

Once pip in installed, it's time to install the additional required packages:

pip install -r requirements.txt

Got an error message saying: ImportError: No module named setuptools

sudo pip install -U setuptools

Next error message is about OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/asn1crypto'

sudo pip install -r requirements.txt

Which now works fine until we get to:

build/temp.linux-x86_64-2.7/_openssl.c:12:24: fatal error: pyconfig.h: No such file or directory compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

This requires additional packages to be installed.

sudo apt-get install python-dev

Then we get: build/temp.linux-x86_64-2.7/_openssl.c:434:30: fatal error: openssl/opensslv.h: No such file or directory

sudo apt-get install build-essential libssl-dev libffi-dev

All the packages from requirements.txt were installed after these additional commands.

Next up is the ffmpeg installation. As instructed in the installation notes, tried to set mc3man/trusty-media as a PPA repository. Got the below error message, which indicates xenial (Linux Mint 18) is too new and not supported by the PPA.

This PPA does not support xenial

Why not just get ffmpeg from the official repositories? Which is what I did.

sudo apt-get install ffmpeg

Next question: How do we extract the master URL of a segmented vimeo video?

  1. Enable Developer Tools (Ctrl + Shift + I)
  2. Go to the Network tab.
  3. Play the Vimeo video.
  4. Look for the entry which says master.json?base64_init=1
  5. Right-click and Copy link address

Usage syntax is:
python vimeo-download.py --url "http://...master.json?base64_init=1" --output <optional_name>

From that master.json URL, we get the base video and audio URLs, and all the segments are retrieved. The v.mp4 video file and the a.mp3 audio file are muxed using ffmpeg to come up with the final vimeo video in the output directory.

Linux Virtual Machine

Sometimes, it's easier to get something done in Linux, compared to Windows. Yet, it might be a one-time job that doesn't warrant a special partition on the hard disk, or even a live CD-ROM or USB stick. For those time, you just want to run Linux on a virtual machine. You can delete the VM once you're done, or just keep VM file the run it again the next time you need it.

For desktop virtualization, it's a tossup between VMWare and Oracle's VirtualBox. Decided to go with the latter, since it's open-source and I feel easier to install and configure. Lots of pre-built images to choose from, but I decided to build the VM from scratch. It's just a matter of creating the VM and specifying the memory and hard disk space. On first boot, specify which Linux ISO to boot from and do a clean install.

Started off with Ubuntu Server, since I have no need for a GUI. For some reason, I was not able to install the VirtualBox guest additions. Tried:

sudo mkdir --p /media/cdrom
sudo mount -t auto /dev/cdrom /media/cdrom/
cd /media/cdrom/
sudo sh VBoxLinuxAdditions.run

and:

sudo apt-get install virtualbox-guest-utils

Seemed to do something, yet not able to get full-screen window and cut-and-paste between host and guest, so I guess it didn't work.

Moved on to Lubuntu. Window resolution was so low that the installation screens are cropped out. Managed to get the OS installation going. Again, had a hard time getting the guest additions working, even though I got the Guest Additions CD image mounted.

Lastly, I tried Linux Mint 18. With this, everything just worked. No cropped installation screens. Full-screen window *before* I installed guest additions. And now I can open multiple terminals, do cut-and-paste between host and guest, and shared folders. Bonus points - python comes pre-installed (but not pip).

Tuesday, August 29, 2017

張惠妹 - 如果你也聽說

張惠妹 - 如果你也聽說

作詞:李焯雄
作曲:周杰倫
編曲:吳慶隆

伴奏版



突然發現站了好久 不知道要往哪走
tu ran fa xian zhan le hao jiu bu zhi dao yao wang na zou
還不想回家的我 再多人陪只會更寂寞
hai bu xiang hui jia de wo zai duo ren pei zhi hui geng ji mo
許多話題關於我 就連我也有聽過
xu duo hua ti guan yu wo jiu lian wo ye you ting guo
我的快樂要被認可 委屈卻沒有人訴說
wo de kuai le yao bei ren ke wei qu que mei you ren su shuo

夜把心洋蔥般剝落 拿掉防衛剩下什麼
ye ba xin yang cong ban bo luo na diao fang wei sheng shen me
為什麼脆弱時候想你更多
wei shen me cui ruo shi hou xiang ni geng duo

Chrous:
如果你也聽說 有沒有想過我
ru guo ni ye ting shuo you mei you xiang guo wo
像普通 舊朋友 還是你 依然會心疼我
xiang pu tong jiu peng you hai shi ni yi ran hui xin teng wo
好多好多的話想對你說 懸著一顆心沒著落
hao duo hao duo de hua xiang dui ni shuo xuan zhe yi ke xin mei zhao luo
要怎麼負荷 捨不得又無可奈何
yao zen me fu he she bu de you wu ke nai he

如果你也聽說 會不會相信我
ru guo ni ye ting shuo hui bu hui xiang xin wo
對流言 會附和 還是你 知道我還是我
dui liu yan fu he hai shi ni zhi dao wo hai shi wo
跌跌撞撞才明白了許多 懂我的人就你一個
die die zhuang zhuang le cai ming bai le xiu duo dong wo de ren jiu ni yi ge
想到你想起我 胸口依然溫熱
xiang dao ni xiang qi wo xiong kou yi ran wen re

許多話題關於我 就連我也有聽過
xu duo hua ti guan yu wo jiu lian wo ye you ting guo
我想我寧可都沉默 解釋反而顯得做作
wo xiang wo ning ke du chen mo jie shi fan er xian de zuo zuo

夜把心 洋蔥般剝落 拿掉防衛剩下什麼
ye ba xin yang cong ban bo luo na diao fang wei sheng xia shen me
為什麼脆弱時候想你更多
wei shen me cui ruo shi hou xiang ni geng duo

Repeat Chorus

如果你也聽說 有沒有想過我
ru guo ni ye ting shuo you mei you xiang guo wo
像普通 舊朋友 還是你 依然會心疼我
xiang pu tong peng you hai shi ni yi ran hui xin teng wo
跌跌撞撞才明白了許多 懂我的人就你一個
die die zhuang zhuang cai ming bai le xiu duo dong wo de ren jiu ni yi ge
想到你想起我 胸口依然溫熱
xiang dao ni xiang qi wo xiong kou yi ran wen re
如果你想起我 你會想到什麼
ru guo ni xiang qi wo ni hui xiang dao shen me

Friday, August 11, 2017

Lego Island on Windows 10

It's always tricky running old-school 90's PC games with modern operating systems like Windows 10. I got hold of an ISO of Lego Island. Mounted it via Windows Explorer and proceeded to install the game. Wanted to install DirectX 5. What?! Windows 10 offered to install DirectPlay. Installed but the game still won't run.

Lucky for me, someone else ran into the same problem, and figured out a workaround.

  1. Install the game as you normally would.
  2. Do NOT install DirectX when asked by the installer.
  3. Copy the contents of Lego/Scripts folder from the CD-ROM to the corresponding folder on the hard disk.
  4. From the redist/directx folder of the CD-ROM, copy d3drm.dll file to the main folder of the game.
  5. For best results, enable "Run as administrator" and "Compatibility mode (WindowsXP SP3)" for LEGOISLE.EXE and ISLE.EXE.
  6. Also, run CONFIG.EXE and select Ramp Emulation under Advanced settings.
  7. Enable "Draw 3D to Video Memory" and "Flip Video Pages Memory".


Or we can just do it the easy way. Load the CD-ROM (or ISO), then run the alternate installer created by le717 (Caleb Ely), which can be found here.

Saturday, July 29, 2017

SyncToy with Network Drives

Wanted to synchronize a local directory with one on the network drive. Fired up Microsoft's SyncToy to do the job. For some reason, SyncToy is not able to see the network folder mapped to a local drive letter.

Solution? Use the UNC path instead. Not sure what's the UNC path for your mapped drive? Run "net use" on the command prompt.