I was trying to learn about OpenESB following a tutorial. When I was running the test for the composite application in Part 3, the test often took tens of seconds before it could complete. It seemed that the test needed to wait due to the error below:
java.lang.RuntimeException: MBeanServerConnection is null. Make sure the App Server is running.
After some investigation, I found that the error could be fixed by entering a correct password to the GlassFish server, where the default password was "adminadmin". With this fix, the test could be completed in two seconds on my computer.
Monday, September 02, 2013
Monday, April 08, 2013
「守護中環」有樣學樣?
今天讀《明報》見到「守護中環」人士的論點,真的嚇了一跳!
話說昨天「真普選聯盟」舉行政制研討會,但因「『守護中環』插言叫囂」(《明報標題》),令研討會腰斬。「愛港之聲」成員陳文廣解釋,「踩場」是因為建制派沒有代表發言。
也許他們認為之前有民主派人士衝擊政府舉辦的咨詢會合理,所以他們便有樣學樣。不過他們也許沒明白一點,就是政府應代表全港人民,但「真普選聯盟」只需要代表某些理念相同的人。
見到這些所謂愛港人士的言論,真的令人不寒而凜。
話說昨天「真普選聯盟」舉行政制研討會,但因「『守護中環』插言叫囂」(《明報標題》),令研討會腰斬。「愛港之聲」成員陳文廣解釋,「踩場」是因為建制派沒有代表發言。
也許他們認為之前有民主派人士衝擊政府舉辦的咨詢會合理,所以他們便有樣學樣。不過他們也許沒明白一點,就是政府應代表全港人民,但「真普選聯盟」只需要代表某些理念相同的人。
見到這些所謂愛港人士的言論,真的令人不寒而凜。
Sunday, April 07, 2013
Mac OS X 上的中文字體
一直認為,Mac 機上的預設中文字體不太靚。以前亦嘗試過去改善這問題,但總覺仍有所缺。直至最近見過iPhone上的中文字,發覺原來這非必然。
在這裏略略指出解決的方法:
在這裏略略指出解決的方法:
- 在較新版本的Mac OS X, 附加了更多的中文字體。不過並非每一隻字體也適合做預設字體。尤其若果經常要處理正體和簡體的中文字,應該選一些字體能正常地同時顯示正簡字。我試過不同的字體,發現Heiti SC, Lantinghei SC和Hiragino Sans GB 效果較好。
- Heiti 和Lantinghei 有正體和簡體字的版本。兩者分別不大。但當顯示某些正簡字類似的字,例如「迎」字時,正簡字體便會顯示出相應的寫法。雖然我想用正體字版本,不過正體字體顯示簡體時會有較多間題,所以我選擇了簡體版。而我個人較喜歡Lantinghei SC,所以選了這個。而iPhone 上用的應該是Hiragino Sans GB.
- 選了想用的字體,便可用TCFall 去設定。不過該程式較耐冇更新,所以不能選用像Lantinghei SC等較新的字體。解決方法是下載source code, 自行加入新的字體。或直接更改:
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/DefaultFontFallbacks.plist - 在Lantinghei 字體中,我較喜歡Extralight. 所以設定字體時,可以選這個style. 不過縱使選了,有時系統仍會改用Demibold 版本。我相信原因是系統會自動選取較接近medium weight 的字體。
- 為了解決上一項間題,我用fontforge(可用brew去安裝)強將extralight 定為medium, 再將demibold定為bold。這樣,系統便會預定用本來Extralight 的版本去顯示中文,而需要顯示粗體時,便會使用Demibold版本。
經一輪修訂,終於轉了一隻自己接受到的中文字體(見下圖)!或者正如TCFall原作者所講,應該寫信到Apple 叫他們重視一下正體字用者的感受。
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:
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:
- Look for the plugin folder. It was /Applications/Adobe Reader.app/Contents/Built-in on my computer (Adobe Reader 11.0.02).
- 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.
- Restart Adobe Reader. You should see that the scrolling becomes fast.
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.
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而引起,而不能有其他起因。不過觀乎「國文」全文,沒有解釋為何學民思潮的初步勝利,只可以有學民思潮「言之有理」和「恐懼心理」兩個起因,為何不能是因為巿民自己對國民教育有合理的擔憂,也為何不能是某些論者所講的什麼勾結外國勢力等原因。至於為何恐懼心理和表面情緒可以是合理原因,「國文」亦沒有提出任何理據!
明報今天刊登的一篇評論,「國民教育科爭論中的邏輯錯誤」(簡稱「國文」),作者以提出一些「攻、防雙方都不曾察覺的邏輯錯誤」,提醒大家留意。該文引用學民思潮聲明,舉出兩個例子,作為六種邏輯錯誤的例證。
例一:「但近日由政府贊助的國民教育服務中心及浸會大學當代中國研究院編製的《中國模式——國情專題教學手冊》,當中內容偏頗,嚴重扭曲民主概念,大力歌頌中共所謂『民主集中制』,赤裸地進行政治灌輸!此證明民間對國民教育淪為『洗腦教育』及成為政治灌輸工具的指控並非無的放矢。」
「國文」作者以例一,解釋「稻草人錯誤」,「巧合錯誤」,「混淆相關和起因」,「以果證因」四種邏輯錯誤。不過有趣的是,例一的結論為「指控並非無的放矢」,「國文」的作者卻將例一與對「國教科課程指引」(簡稱指引)的批評拉埋黎講,以顯示頭三種的邏輯錯誤。舉例說,作者認為教材是稻草人,批評者不應因為稻草人(教材)有洗腦成份,於是推論「指引」有洗腦成份。很可惜,例一並非以指引有洗腦作結論,反而「國文」則以指引有洗腦成份作攻擊對象,作為作者論據中的稻草人!
再睇「國文」中舉的另一例子。
例二:「此外,現時政府資助國民教育機構的準則欠缺透明度,只怕將來市面上絕大部分國民教育教材都會以政治正確及避談敏感議題為依歸。」
「國文」作者以此例子解釋「滑坡錯誤邏輯」和「類比錯誤」。例如作者說:「其內在的邏輯推理是:現時政府資助國教機構的準則欠缺透明度,所以將來政府必然欠缺透明度,因此將來市面上必然只有政府欽點的機構提供教材,於是大部分教材必然都會政治正確。」於是作者認為例二犯上了滑坡錯誤,即以一連串的可能性當為必然。可惜的是,例二的用詞是「只怕」,即是表達某可能性去到值得關注的程度,但沒有斷定此可能性為必然。也許作者也意識到例二並非說必然,因此以「內在」邏輯作解說,以推論出滑坡錯誤。
今次輪到睇「國文」的結論:
「(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.
/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!
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 ------------------------------------
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
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.
/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.
Subscribe to:
Posts (Atom)
