Friday, August 28, 2020

Mac OS的Automator

 昨天和老同學討論Mac vs Windows, 當然火花十足,事實上我也算不上蘋果忠粉,用的日子也不長,所以至今天才發現Automator這個「新」功能,今天要和各位網友分享。

話說我製作蘇子曰YouTube頻道的錄像時,在資料搜集期間,用Google Slides最為方便,不過錄影時如果要同時控制Presentation的話難免分心,所以會在錄影完畢後,在iMovies的Main track逐張Slide的圖像加上去,再在Main Track之上加上有「 人頭」的部份作Picture-in-picture.

問題來了:在Google Slides入面只能逐個Slide「手動」Export為圖像檔!如果多Slides的話頗費時。其他可Export的格式包括PowerPoint及PDF等,而這些格式又能否「一次過」轉為多張圖像呢?答案是可以的!特別鳴謝兩位網友(Link1, Link2)

我在此簡單描述一下步驟:

  1. (在Spotlight)打開Automator
  2. File->New->Choose "Application"
  3. 在左邊Library選PDFs,把Render PDF Pages as images拖到右邊。
  4. 再在左邊Library選Files & Folders,把Move Finder Items拖到右邊。(不然會找不到之前一步的檔案)
  5. Save(為此Automator Application改個易記的名字)
  6. 在Finder把PDF拖到這個新Application即可把它轉為多張圖像
不知Windows有沒有對應的內置功能?


Monday, August 17, 2020

Free web hosting and free SSL cert

Back in the days most of us (with some tech backgrounds) have played with creating a personal website by writing our own HTML that has our bio and some pictures embedded. And most of us used free web hosting (why pay for it anyway? :P) Then FB got popular and the rest is history. Fast forward 2 decades and the most popular free "site builders" like Wix and Google don't serve raw HTML page you write anymore, which is understandable because it's harder to secure things they don't control. Long story short, I needed to serve a page, and using the HTTPS protocol. And InfinityFree came to rescue!

I created a new (free) account and provided it a domain name I purchased from GoDaddy years ago (for fun and good luck mainly :P) By doing so I needed to change the namesever records to point to the ones used by InfinityFree/Epizy. Then I clicked on the "Free SSL certificates tab" which listed 4 steps:

1. Add CNAME records (which is done on the InfinityFree/Epizy side because of the nameserver change) This took a few hours to become effective. 

2. Request a new (free) SSL cert. Not sure how long it took between request and issue.

3. Install the new cert. This is done via copy-and-paste the key and the cert under the SSL/TLS in cPanel. 

4. Check for validity of your cert. You can use SSLShopper.com and simply type in your www.<domain name>

Any html you want it to serve can be uploaded via FTP or File Manager under the htdocs dir. For those who used Apache back in the days of course knows about htdocs. Nginx use the same dir too. The good thing is InfinityFree/Epizy created a new user for such purpose that is separated from your InfinityFree logon.  

The only downside of free SSL cert is that it usually expires soon. I setup reminder on the InfinityFree side for renewal. Let's see if that works. Anyway, I think it has done a good job already for such free services.

Thursday, August 06, 2020

My Clojure experience

 As I mentioned in this post, I found that Cursive IDE is the recommended way to go and that's what I tried. To be honest, the whole process is not exactly what I would call intuitive. I think the guides I mentioned in my previous post did a pretty good job. Let me summarize a few key features:

1) CursiveIDE is based on IntelliJ so the latter is the one you start. The type of project to add is Clojure->Leiningen (FYI, Leiningen is a build automation tool. I think the name comes from the short story "Leiningen Versus the Ants" Of course, ant refers to the "other" famous tool)


The project name must be all lowercase.

The IDE automatically creates a bunch of files for you. The most important one is probably project.clj. If your code requires importing external modules, you specify the dependency in this file. I found that the REPL that is already running would not "take in" the new dependency so the safest thing to do is to kill the existing REPL and start a new one.

2) The Right-click menu of project.clj has a choice to start your REPL. By default the namespace is <your project name>.core. In fact, Cursive also automatically creates a core.clj file for you.


3) If you want to have code in another <file name>.clj file, you add New Clojure Namespace with <file name>, the namespace would be <project name>.<file name>

4) You can load your current .clj file into the REPL using the right-click menu and then REPL.


5) However, Cursive does not switch namespace automatically. Use the same menu to switch. 

6) You can send a statement in your .clj file to the REPL for execution. Alternatively you can type the statement in the lower REPL window and hit ENTER after the closing ')' (or hit CTRL-ENTER)

BTW, this is the fun project I worked on: calculation of hours of sunlight based on the coordinates of the city and the date. 

Tuesday, July 14, 2020

停雲、陶淵明、辛棄疾

最近在玩師兄介紹的Elementary OS,他亦推薦其中一張寫著中文書法「停雲館」的Wallpaper,引發了一場關於「停雲」的討論。



首先找到的是辛棄疾詞《賀新郎·甚矣吾衰矣》,其中有一句:

一尊搔首東窗里。想淵明《停雲》詩就,此時風味。

詞中更出名那一句是:

我見青山多嫵媚,料青山見我應如是。

照字面解作詞人顯得相當有自信,其實根據上文下理自嘲成份較重。全詞充滿抗金壯志未能酬,志同道合之士日少的感慨。根據詞序,辛棄疾作詞時正獨坐於一個叫「停雲」的堂館,而停雲也是陶淵明一首詩的名稱,以下摘自網上文章:

《停雲》是晉宋之際詩人陶淵明的作品。此詩分四章,其主旨正如序中所言,“思親友也。”詩中運用比興的手法和覆沓的章法,通過對自然環境的烘托描寫,和不能與好友飲酒暢談的感慨,充分抒发了詩人對好友的深切思念之情。同時,詩中“八表同昏”“平路伊阻”“平陸成江”等詩句也暗含了作者對時世的擔憂。

可見情感和辛棄疾想表達的相當類似。之後辛棄疾亦諷刺當時想在酒中求名的文人(蘇東坡乎?)辛認為酒的真正「功能」是解愁罷了。

想對這兩首作品有更深入認識的朋友,建議參考文1,2,3

Wednesday, June 24, 2020

Elementary OS Cangjie input

作為電腦玩家,最興奮的事莫過於有新電腦用;不過換腦是數年一度的「盛事」,退而求其次就是拿舊電腦翻新。幾天前電腦界師兄推薦Elementary OS, 我的實驗用Linux box又剛好boot不起,正是裝新OS的好機會了。

玩了一會才有需要打中文,記得使用Ubuntu的話,這只是在System settings(-> Language -> Input Method加倉頡**)就可以攪定的簡單動作,不過在Elementary OS就試了大半小時也無功而還!結果找到這篇教裝FCITX的帖文 。不同的是我要裝倉頡Version 3:
sudo apt install fcitx-table-cangjie3 im-config

Reboot後還有一步(參考此帖文):
fcitx-configtool 
在此工具內加入Cangjie3,之後Ctrl-Space即可toggle英文和倉頡。(用慣Mac OS X的CapsLock作toggle會很不慣,但也沒辦法了,留意CapsLock時即使已選倉頡也打不到中文的)

註**:
以上方法是使用FCITX,另一個「老字號」系統是IBus,其實只改System settings的話,只差這一步就能用IBus的倉頡:
im-config
由default改為IBus



Tuesday, June 16, 2020

自古紅顏多薄命

標題這一句相信大家都聽過,但出處到底是那裏?首先提供一個錯的答案:蘇東坡有一首名為「薄命佳人」的詩:
雙頰凝酥發抹漆,眼光入簾珠的皪。 
故將白練作仙衣,不許紅膏汙天質。 
吳音嬌軟帶兒癡,無限閑愁總未知。 
自古佳人多命薄,閉門春盡楊花落。

根據這本《蘇東坡新傳》,此詩是描寫風塵界的美女,好景總是短暫。(至於我第一次見到此詩,是來自一本《蘇東坡》小說,當中虛構情節有東坡為其已出家為尼之情人寫下此詩)其實即使良家婦女,美貌又何嘗能長久保持呢?

標題那一句其實出自吳承恩名著,無人不識的小說《西遊記》,正正是孫悟空見到朱紫國皇后金聖娘娘後的感想:
自古紅顏多薄命,懨懨無語對東風

意思是自古以來美女的命運總是充滿不幸,令人唏噓感概。

Monday, June 08, 2020

Video editing and Animation

You don't have to try too hard if what you want to do all day long is watching videos on the web. Yes, we just take it for granted but it does take some skills to put together a presentable video! Editing home video is one of my hobbies started before the days of YouTube. I bought a copy of Adobe Creative Suite with my student discount when I was taking Graphic design classes. Adobe Premiere Pro is still one of the top choice for this task. Of course, 17 years have gone by one would think there must be lots of free/open source alternatives to Adobe Premiere. For those using Mac, PCWorld recommends iMovie 10. And there are many choices for Open Source cross-platform (i.e. Linux too!) software, for example, the UI of OpenShot would look familiar if you have used iMovie before.

Similar to video, animation is everywhere. You would remember Adobe Flash if you did animation "back in the days" In fact, some scammers still try to trick people to download malware disguised as Flash installer now that Adobe doesn't even call their animation tool Flash anymore. The company has adapted to the current HTML5-based standard (instead of needing a proprietary browser plug-in) and calling their tool simply Adobe Animation. If you cannot afford a license or just want to use other freeware, check out this video:



Tuesday, June 02, 2020

潮汕說唱

早前看網上直播有潮汕女主播在rap潮州話,方知有潮汕說唱的文化,除了女主播當日翻唱的Tizzy T,重要人物還有AFinger壹指團體(那是潮州版大懶堂了),以下是一條介紹潮汕hiphop的紀錄片:
葉子說到潮汕人祖先去馬來西亞謀生那段特別有feel, 我也從中認識了汕頭這個感覺上很親切但從未去過的地方。

Thursday, May 28, 2020

祇·祗·衹·袛

近幾年一直學習草書,有幾個字是比較欠缺標準,亦對名家寫法難以理解,其中一個是孫過庭書的:


在我收藏的集于右任字書唐詩有這個「底」字:



讀了劉東芹《草書字法解析》才明白以上兩字的寫法:
寫法明白之後,才再考究一下字義:p

孫過庭寫那個應該是「祇」,而草書的「衹」也是同樣寫法(要看上文下理), 知道「只是」有人有時會寫成「祇是」(示部那個),亦有「神祇」這個詞語。我以前見過有底下一畫的「祗」,原來也有「袛」這個字!

到底這四個字各有甚麼意思?請看咬文嚼字的博客的祇·祗·衹·袛一文。

Tuesday, May 19, 2020

The coolest museums in USA

This website has been sending junk mails to me for a few weeks but I finally found one articles I read there that is worthy of sharing. It introduces one cool museum per state in US. For a country with people who in general supports museums in their community (at least that is my impression), I can imagine there is gotta be one cool museum in each state. Still, it is a big task to know all of them! I haven't been to all 50 states myself. And for the states I visited, there are still lots of interesting museums that I am unaware of. For example, who would know there is a musical instrument museum in Phoenix? Speaking of musical instrument, I did have fond memories playing with some at the EMP museums in Seattle (of course not the Kurt Cobain guitars on display there) Now it has been renamed to the Museum of Pop Culture. Another music related museum on the list that I have been to is the Rock and Roll Hall of Fame in Cleveland, Ohio. 

Monday, May 11, 2020

When your cleat came loose from your bike shoe

... and it is clipped to the pedal, it would be a challenge to get it out. And it happened to me last week! Thanks to the video in this link, I was able to take it out, though not as easy as the dude in the video. Lesson learned: even after tightening your screws on the cleats multiple time and it still comes loose, it’s time to get a new cleat (and maybe shoes) In fact, I do have a pair of bike shoe with cleats that I have worn only a few times that I bought for my Big Island trip years ago. I was just too lazy to take them out of the box :p

Monday, May 04, 2020

爨寶子碑

作為書法愛好者,見到爨寶子碑如此奇特的字,當然會有興趣認識此碑,這位網友指出該碑有三大奇處:首先,文中提及大亨四年,其實晉安帝這個年號只用了三年!作者認為原因是爨將軍居於雲南離京城太遠,消息不靈通。其次,由曹魏至當時東晉,朝廷一直禁止立碑,爨家可能山高皇帝遠,所以無視禁令。最後,字體反映隸書「過渡到」楷書的演化,既非如隸書般扁形,卻又保留隸書的磔筆,實在罕見。有趣的是,此碑被發現後,學者才驚覺書聖王羲之的年代原來隸書才是主流,甚至開始懷疑古往今來第一行書蘭亭序是假的!

Monday, April 27, 2020

Nat King Cole的South of the Border

《國境之南,太陽之西》算是村上春樹最不奇幻的小說之一,當愛情小說讀也可以,書名前半是指South of the Border這首美國歌曲,很多著名歌手都唱過,不過書中提到的Nat King Cole版卻從未有過錄音,雖然Google有一個搜尋結果是YouTube 片,不過那是「造」出來的,那就不連結了, 另一位爵士歌手Fats Domino倒真是有錄音傳世,而純器樂版本我推薦Benny Goodman Big Band的。其實我一直誤會書名是指East of the Sun (and west of the moon) 這首我更喜歡的Jazz standard!

Monday, April 20, 2020

集專名元曲

閱讀《慢讀元曲》一書時,讀到作家王仲元的介紹,說有兩首運用「集專名」技巧創作的曲,不過就沒有解釋技巧的細節,Google一下「王仲元 集專名」頭十幾條結果都是一模一樣不具細節的網頁!後來才見隋樹森先生《元人散曲概論》之六是分析元人散曲的藝術性,文中提到「集專名」是甚麼一回事:
元人散曲中,還有集各種專名者。如孫季昌的《端正好》套集雜劇名詠情,王仲元的《粉蝶兒》套集曲調名題秋怨,孫叔順的《粉蝶兒》套集藥名等即是。這其中,有時也頗有巧思,應當算是一種藝術,有時候在文藝之外,也還能起到一些意外想不到的作用。如日本青木正兒的《元人雜劇序說》,就曾利用孫季昌那首集雜劇名的散套,考證某些雜劇的時代。日本人寫的《宋元科技史》,也曾引用到孫叔順的集藥名散曲。
以《粉蝶兒》之五《石榴花》為例:
常記得《賞花時》節《看花回》,《上京馬》《醉扶歸》。《歸來》窗半《月兒低》,真個《醉矣》。《柳青娘》《虞美人》扶只,困騰騰《上馬嬌》無力,《步步嬌》弄影兒行遲。似《鳳鸞》交配答《雙鴛鴦》對,人都道《端正好》夫妻。

在雙引號內的都是曲調名,真的相當有趣;令我想起小時候也會用不同流行曲詞串起來寫一些遊戲文章,難度當然小巫見大巫了。

Thursday, April 16, 2020

Canon MX880 Scanner ADF 黑線問題已解決

這部Printer/Scanner已用了很多年,今天有一疊樂譜要掃描備份,從document feeder放進,發覺掃描出來的文件有一條黑色直線,但用Flatbed去掃描則無此問題!原來兩者分別用兩塊不同的「玻璃」。後者是大那塊,前者則是左方那狹窄長條;我用抹眼鏡布(輕微弄濕)了狂抹那長條及四邊接著膠片的位置,第一次清潔後發現黑線變幼,再清潔一次就解決了問題,希望此帖對其他用家有所幫助。

Monday, April 13, 2020

珍貴的唐詩

早一陣子香港命理學大師李居明對抗疫提出一些建議,包括抄寫經文讓心境平靜,而無宗教一士則可抄唐詩三百首云云,成為一時「佳話」。很多人都聽過俗語有云:「熟讀《唐詩三百首》,不會吟詩也會吟。」(其實我一直覺得吟字出現兩次是敗筆,有說第一個吟字是作字,也有說第二個吟字是偷字,總之意思不難理解)感覺上有《唐詩三百首》一書是理所當然的事,讀了此文方知唐代詩人作品失傳了很多,流傳下來是因為後世文人的努力,包括明代胡震亨、降清的錢謙益及為錢氏接力的季振宜,胡的《唐音統簽》和錢季兩位的《唐詩》就成為康熙下詔修的《全唐詩》的原材料,後者收錄了接近五萬首作品。

Monday, April 06, 2020

Tribute to Harold Mabern

I was listening to this album the other day, performed by a quartet featuring the late great jazz pianist at PizzaExpress in SOHO London. I vaguely recalled I considered going there or Ronnie Scott's for jazz during my 1998 visit. Not 100% sure which one I went as I didn't write about this in my old post. I suspect I chose the latter since I would have found it too weird for a pizza place to be a jazz club as well. And I just realized this is the brand that our family (oh well, one of the member) like in Hong Kong. In fact, my buddy ordered to-go from it earlier in the year for the party at his place. Of course, the PizzaExpress restaurants in Hong Kong do not feature live jazz.

Monday, March 30, 2020

靉靆

今天讀到兩個不識的中文字,當然上網查查,找到一篇講靉靆是中國古代對眼鏡的稱呼,明末張自烈於《正字通》載:「靉靆即眼鏡。」不過我讀到的靉靆是指昏暗多雲的天色,出自一首日本能因法師詩歌的中文翻譯本:
猶憶出京日
靉靆霞相隨
今過白河關
蕭蕭秋風吹

原文是:
都をば 霞とともに 立ちしかど 秋風ぞ吹く白河の関

Monday, March 23, 2020

地球上最大的生物

見到標題相信不少人第一時間想到鯨魚吧,那的確是動物界中第一巨無霸,不過生物不只包括動物,又或者植物,地球上最大這個名銜屬於非動非植的蘑菇!那是一隻在美國俄勒岡州「居住」的蜜糖菌,全長2.4英里,年齡估計介乎1900至8650歲,當然也是地球上最老的生物!

講起地球上最大,讀到這篇文章介紹最大的兩棲類動物原來在南中國,正式名稱是中國大鯢,俗稱娃娃魚,相信就是金庸小說射鵰入面瑛姑要捉那條。

Monday, March 16, 2020

孟德爾頌與德詩


本地的圖書館有個二手CD架,賣得相當便宜,去年我發現了這張孟德爾頌藝術歌曲的唱片只售$2,決定搏一搏,原來孟德爾頌的藝術歌曲水準和其他此道高手比起來未算突出,本碟可算是靠歌唱家的功力搭救,我也因此碟而接觸了一些德文詩,詩人當中名氣最大的當然是歌德,但我想介紹一首出自Emanuel von Geibel的,我翻譯如下:

我的心有如暗黑的夜
當樹頂沙沙作響
月亮平靜地從雲中升起大放光芒,看看!
樹林靜了下來聆聽 
你是月亮,閃閃生光的月亮
你用滿滿愛意
向我拋個媚眼
當中滿載天堂般的平安感,看看!
我如暴風雨的心已被安撫