Sunday, April 07, 2013

Adobe Reader Scrolling Slowly on Mac

I found that Adobe Reader scrolls slowly when reading a PDF file, compared to Preview.  After reading some search result, I found that this was caused by some unknown built-in plugins.

To see what plugins have been installed, from the menu click "Adobe Reader"->"About Adobe Plugins".

If you want to check whether the slow scrolling problem is caused by the plugins, you can disable all plugins temporarily by press the shift key when you start the Adobe Reader.

To fix the problem by disabling plugins:

  1. Look for the plugin folder.  It was /Applications/Adobe Reader.app/Contents/Built-in on my computer (Adobe Reader 11.0.02).
  2. Move those culprit plugins out of the folder.  In case, I removed "Checkers.acroplugin" and "PDDom.acroplugin" from the folder.  This may need more experiments to see which plugin really caused the problem.
  3. Restart Adobe Reader.  You should see that the scrolling becomes fast.  
Even disabling the plugins, I still felt that Preview performed faster than Adobe Reader in my case.  However, the latest version of Adobe Reader seems to support more features for commenting.  That's why I still needed to use Adobe Reader sometimes.

Thursday, October 25, 2012

Using USB thumb drive on Windows XP Guest with VirtualBox on Mac OS X Host

According to this post, to use a USB thumb drive on Windows XP guest in a VirtualBox machine on a Mac OS X host, one needs to use only one processor in the VirtualBox setting.  What a surprising setting!

Tuesday, October 09, 2012

NullPointerException When Creating New LibreOffice Database File

When I tried to create a new database file in LibreOffice (version 3.6.2 on Mac), I encountered the following error:

SQL State: S1000
Error code: -27

file input/output error java.lang.NullPointerException.properties

The reason was that I had added a newer version of hsqldb file in the classpath.  The one I added was hsqldb-2.2.6.  It seemed that LibreOffice expected a version of 1.8.0.

After removing those hsqldb files from the classpath, I could create a new database file again.

Saturday, September 15, 2012

國民教育爭議中的「邏輯錯誤」

國民教育爭議不斷,今天讀報仍可見到有趣觀點!

明報今天刊登的一篇評論,「國民教育科爭論中的邏輯錯誤」(簡稱「國文」),作者以提出一些「攻、防雙方都不曾察覺的邏輯錯誤」,提醒大家留意。該文引用學民思潮聲明,舉出兩個例子,作為六種邏輯錯誤的例證。

例一:「但近日由政府贊助的國民教育服務中心及浸會大學當代中國研究院編製的《中國模式——國情專題教學手冊》,當中內容偏頗,嚴重扭曲民主概念,大力歌頌中共所謂『民主集中制』,赤裸地進行政治灌輸!此證明民間對國民教育淪為『洗腦教育』及成為政治灌輸工具的指控並非無的放矢。」

「國文」作者以例一,解釋「稻草人錯誤」,「巧合錯誤」,「混淆相關和起因」,「以果證因」四種邏輯錯誤。不過有趣的是,例一的結論為「指控並非無的放矢」,「國文」的作者卻將例一與對「國教科課程指引」(簡稱指引)的批評拉埋黎講,以顯示頭三種的邏輯錯誤。舉例說,作者認為教材是稻草人,批評者不應因為稻草人(教材)有洗腦成份,於是推論「指引」有洗腦成份。很可惜,例一並非以指引有洗腦作結論,反而「國文」則以指引有洗腦成份作攻擊對象,作為作者論據中的稻草人!

再睇「國文」中舉的另一例子。

例二:「此外,現時政府資助國民教育機構的準則欠缺透明度,只怕將來市面上絕大部分國民教育教材都會以政治正確及避談敏感議題為依歸。」

「國文」作者以此例子解釋「滑坡錯誤邏輯」和「類比錯誤」。例如作者說:「其內在的邏輯推理是:現時政府資助國教機構的準則欠缺透明度,所以將來政府必然欠缺透明度,因此將來市面上必然只有政府欽點的機構提供教材,於是大部分教材必然都會政治正確。」於是作者認為例二犯上了滑坡錯誤,即以一連串的可能性當為必然。可惜的是,例二的用詞是「只怕」,即是表達某可能性去到值得關注的程度,但沒有斷定此可能性為必然。也許作者也意識到例二並非說必然,因此以「內在」邏輯作解說,以推論出滑坡錯誤。

今次輪到睇「國文」的結論:

「(1) 雖然學民思潮已取得初步勝利,但並不代表他們言之有理和思維正確。(2) 他們只是成功利用了社會大眾的深層恐懼心理和表面情緒反應而取得了成功,是「盲拳打死老師傅」的典型案例,值得學界反思。」

第一句我沒異議,只是照計有興趣去睇「國文」中的邏輯錯誤的讀者,都應該會有此理解,不用作者提點。

不過第二句就有點問題。該句中的「只是」,即是指恐懼心理和情緒反應是學民思潮取得初步勝利的唯一原因,亦即否定了學民思潮其他批評的理據。本文基於例一例二,已舉例指出「國文」作者所講的邏輯錯誤是有問題。不過就算例一例二真的有邏輯問題,也不等於學民思潮所有的批評(或者大部份)的批評是有問題(例如作者似乎沒有考慮過學民思潮對指引的直接批評)。

而就算言之有理和思維正確不是學民思潮初步勝利的原因,但這不等於他們的勝利只可以是因為恐懼和表面情緒!若果要推論某事不能因為A而引起,因而只可以因B而引起,需要先提出某事只可以因為A或B而引起,而不能有其他起因。不過觀乎「國文」全文,沒有解釋為何學民思潮的初步勝利,只可以有學民思潮「言之有理」和「恐懼心理」兩個起因,為何不能是因為巿民自己對國民教育有合理的擔憂,也為何不能是某些論者所講的什麼勾結外國勢力等原因。至於為何恐懼心理和表面情緒可以是合理原因,「國文」亦沒有提出任何理據!

收緊按揭成數 => 更多人買細價樓?!

昨天金管局宣佈,因應「QE3」而收緊按揭成數。據電視台轉述的評論,認為這措施會令更多人不能買貴價樓,因而轉買細價樓。不知他們是否想說,因為多了人買細價樓,會令細價樓的樓價上升呢?

到底此措施對樓巿有什麼影響,恕我不能斷定。不過以上的論據,就十分有趣。按此推論,若果巿民收入下跌,亦都會因買不起貴價樓,因而令更多人轉買細價樓。但另一方面,一般人會認為,若果巿民收入上升,能促使樓價上升。若果將使兩者夾埋黎睇,即係話,無論巿民收入上升或下跌,細價數都會受到正面影響。換句話說,即係無論巿民收入如何,細價樓樓價係侷住升!

到底是否更多人會轉買細價樓?也許這是對的。當樓價下跌時,自然多了細價樓,因此可說成是多人買細價樓。若然細價樓樓價升了,也可說成是更多人買了細價樓的證據。

Thursday, July 12, 2012

Reader Page Customization in Safari

The style of the Reader page can be customized by modifying this file:

/System/Library/PrivateFrameworks/Safari.framework/Resources/Reader.html

To change the font size for the .page, the "important" keyword has to be added.

More information can be found on this page.

Wednesday, June 20, 2012

Calibre Recipes for 每日日課 & 每日聖言

I have written two Calibre recipes for downloading daily Mass readings and breviary from the HK Catholic Diocesan Liturgy Commission webpage.  They can be useful for reading offline on a e-reader like Kindle.  To use them, copy each recipe to a text file, and then "load recipe from file" in Calibre.

They download content for 60 days starting from today.  So one may ask Calibre to download these sources every 30 or 60 days.

Writing recipes are relatively easy tasks.  The difficult task is to read them daily!

每日聖言

------------------------------------- recipe starts below ------------------------------------
from datetime import date, timedelta


class MeiRiShengYan(AutomaticNewsRecipe):
    title          = u'\u6bcf\u65e5\u8056\u8a00'
    oldest_article = 35
    max_articles_per_feed = 100
    auto_cleanup = True


    no_stylesheets = True
    encoding = 'big5-hkscs'


    cover_url = 'http://liturgy.catholic.org.hk/dlcgif.gif'


    def parse_index(self):
        today = date.today()
        current = today
        feeds = []
        articles = []
        while (current - today < timedelta(60)):
            url = 'http://catholic-dlc.org.hk/mk' + current.strftime('%y%m%d') + '.htm'
            title = current.isoformat()
            articles.append({'title':title, 'url':url,
                             'description':None, 'date':current})
            current += timedelta(1)


        feeds.append((u'\u6bcf\u65e5\u8056\u8a00', articles))
        return feeds


    def populate_article_metadata(self, article, soup, first):
        title = soup.find('p', attrs={'class':['MsoNormal','MsoPlainText'], 'align':'center'})
        if title:
            article.summary = self.tag_to_string(title)
            article.text_summary = article.summary
------------------------------------- recipe ends above ------------------------------------



每日日課

------------------------------------- recipe starts below ------------------------------------
from datetime import date, timedelta


class MeiRiRiKe(AutomaticNewsRecipe):
    title          = '每日日課'
    oldest_article = 35
    max_articles_per_feed = 300
    auto_cleanup = True


    feeds          = []


    no_stylesheets = True
    encoding = 'big5-hkscs'


    cover_url = 'http://liturgy.catholic.org.hk/dlcgif.gif'
    map = {'LH1': '晨', 'LH2': '日', 'LH3': '晚', 'LH4': '誦', 'LH5': '夜'}
    pages = list(map.keys())
    pages.sort()
        
    def parse_index(self):


        today = date.today()
        current = today
        feeds = []
        articles = []
        while (current - today < timedelta(60)):
        for page in self.pages:
        url = "http://catholic-dlc.org.hk/%s_%s.htm" % (page,  current.strftime('%Y%m%d')) 
        title = current.isoformat() + self.map[page]
        articles.append({'title':title, 'url':url, 'description':None, 'date':current})
        current += timedelta(1)
        feeds.append(('每日日課', articles))
        return feeds


    def populate_article_metadata(self, article, soup, first):
        title = soup.find('p', attrs={'class':['MsoNormal','MsoPlainText'], 'align':'center'})
        if title:
            article.summary = self.tag_to_string(title)
            article.text_summary = article.summary
------------------------------------- recipe ends above ------------------------------------

Friday, May 25, 2012

Aquamacs + Emacs (HomeBrew) + site-lisp

The site-lisp directory for Emacs is:
/usr/local/share/emacs/site-lisp

So to share this site-lisp directory with Aquamacs:
sudo mkdir /Library/Application\ Support/Emacs
cd /Library/Application\ Support/Emacs
sudo ln -s /usr/local/share/emacs/site-lisp


I used this so that I can use the same version of ESS for Emacs (installed by HomeBrew) and Aquamacs.

Monday, July 25, 2011

Local Backup on Lion (Mac OS X 10.7)

Local backup is a new feature in Lion. Once the time machine is setup, the local backup will be enabled. When a laptop is disconnected to the time machine drive, the local backup starts to take snapshots on the computer periodically (I still haven't figured out how often it will take).

This poses one problem. If the local drive runs low on storage, the local snapshots will take up much of the scarce space. Deleting files doesn't help -- not until the local snapshots have been pruned. One way to remove the snapshots immediately is by disabling the local snapshots. This can be done by typing the following command on the Terminal:

sudo tmutil disablelocal

Once this command has been issued, the system will start to prune the local snapshots. It may take some time (maybe a few minutes) before the disk space occupied previously by those snapshots can be recovered.

Saturday, November 13, 2010

乜都發水

早幾個月,發現我部MacBook 舊電發左水,脹大到頂住trackpad 個制,搞到無啦啦會當我禁左個制咁。

除左舊電會發水,層樓都可以發水。實用率越黎越低不在話下,原來唔同單位唔可以亂比較,因為大家實用率不同,建築面積高原來唔代表單位內籠一定高。發展商人話,大家買樓的時候都預左單位會發水,買地成本都會因應提高,所以唔可以話發水會令到發展商多賺到錢。

聽落有點道理,不過信報林行止專欄早排指出一點,又更有道理咁。因為起樓有得發水,一個發展商如果識得挖空心思,左度右度搵盡各種方法黎發水,咁樣佢的投地成本就可以越低。當然每個發展商的發水功力各有不同,發水能力低的,自然唔夠發水能力高的發展商比。結果就係,發水力強的就可以低價買地,發水力低的就要比多D錢。咁搞法,發展商之間的競爭,唔單止係鬥起樓質素,更加係鬥邊一間可以更取巧,可以發更多水,起埋更多唔等洗的野出黎博發水。

以上的評論,搞到我好似仇商咁,查實就未必,我只係想指出起樓發水有咩唔好。而另一方面,唔單只商家可以發水,而家連工人返工都可以發水。食飯照計唔應該做野,可以休息下,明明唔係做野但又可以當返緊工。起樓發水比人鬧,但返工用發水方法黎計最低工資就當成理所當然?人工低故然值得幫助,不過希望唔好學埋D發展商咁,一齊鬥取巧黎諗住篤高工時黎掙多D錢。

無論起樓,或者返工,甚至我舊電,希望都唔好玩發水,搞到大家頭都大埋,一味真亦假時假亦真。

Monday, September 06, 2010

Blocking Flash

I have recently found an extension to Safari, which allows me to block the Flash content of a webpage. The Flash content, which is often annoying and consumes quite much CPU, can be enabled only after I click on it, so that I can load only those I want.

The extension is called ClickToFlash. Have a try.

Thursday, August 12, 2010

Changing Default Fonts on Mac OS X

To change the default (Traditional Chinese) fonts on Mac OS X, one may edit the following file directly:

/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/DefaultFontFallbacks.plist

Also note that to be able to modify this file, you need superuser right. So one can "sudo vi" to edit this file. I used STSong for monospace and san-serif, while STFangsong for serif. These fonts look better to me than those Hei type fonts.

A simpler way to do this is to use TCFail. Indeed, I noticed the path to the above file by reading the source code of TCFail.

Update 2010-11-16: To make this works, the order of the languages has to be changed, so that Chinese has to be put in front of other languages (e.g. Japanese). This can be done in the Language pane of the Language & Text panel under System Preferences.