2011-03-28

Apply quota on Online registration by Form at Google Docs

I often used the Online Form from Google Docs, which I find very useful to solicit user inputs for event registration.

However, so far, the logic exposed in the form editor is none. Therefore the form content is quite static.

Recently I have a need to enforce a quota on the event registration. After searching on internet (even at the Google Help), there is no straight answer. However, inspired by some pages realizing the extra logic at the Google Spreadsheet, I finally come out with the following approach:

(1) Design the Form and the spreadsheet sheet as usual. Please note that I still set the spreadsheet to "private" lest the user input data are improperly exposed.



(2) Add a new sheet (called stat, shaded shaded in yellow below).


In the sheet, I do some calculation logic:
B1: count the number of registration at Sheet1
B2: calculate the number of remaining seats (I set the total number of sheet to 5 for the sake of example)
B3: use the hyperlink function to set a link. The URL is actually the form link as marked in red below:



B4: contain the rejection message when the event is full
B5: use the if function to give a conditional output

(3) Then I publish the content of B5. Please remember to click the "Automatic republish when changes are made"


Please note that although my spreadsheet is set to private, there is no contradiction to the data publishing, as explained in the following Google Help.


(4) Finally, I write a html page with IFRAME to refer to the published data:



The final result is:



The link will be automatically changed when the number of registration reaches 5

2011-01-31

素食陷阱

見2011-1-28的 am730,恐怖!

2011-01-18

職場生存上位之道



迎來職場小說大熱,第169期iMoney就從多本暢銷小說中,選出了10條職場法則,分享如下:

  1. 銷售不是戰爭,商場也不是戰場。在戰場上,不是你死就是我活,而商場,是需要雙生雙贏。

  2. 不在其位,不謀其政。作為下屬,做好本份工作是首要的,莫要隨便去打聽上司的工作進展。

  3. 不管成與敗,要和老闆站在同一陣錢,共生共榮,這樣他才會為你分擔責任,分散職場的風險。

  4. 有些事心知肚明即可,說出來味道就變了,要學會在適當的時候保持沉默。

  5. 聯合次要競爭對手,打擊主要競爭對手,之後才集中火力,打擊次要競爭對手。

  6. 比起聰明,老闆更喜歡有執行力的員工。做好上司交代給你的事,不是你操心的就不要多想。

  7. 職場天條:慎用公司內部Email。

  8. 提高觀察力和記憶力,只要見過一面的人,盡可能記住他的姓名和見面時的林林總總,再見面時說出來,可得到對方的好感。

  9. 不要把勝負看得太重要,事成固然大吉,不成,最多換一份工作,重要的是,你學到了經驗,積累了知識,造些束西才是真正屬於你的,是比錢更重要的吃飯的本錢。

  10. 不要經常埋怨,埋怨別人只說明自己無能,做事情要有廣大心胸。

2010-11-19

有趣的詭辯例子

節錄自 於惠棠 之 《故事裡的詭辯術》

好讀網站 見到這本書(連結),例子很有趣,和大家分享分享。



麵條我沒有吃

某公擅長詭辯,又喜歡佔小便宜。有一次他去飯館吃飯,先要的是麵條,服務員端來的是辣麵,他不想吃 ,就讓服務員換了一盤包子,吃過之後不付款就走。

服務員對他說:「您吃的包子還沒有交錢呢!」

此人 說:「我吃的包子是用麵條換的。」

服務員說:「麵條你也沒有交錢。」

此人又說:「麵條我沒有吃呀! 」氣得服務員一時說不出話來。


一個人有三個頭

某甲對某乙說:「我能證明『一個人有三個頭』。」

乙說:「願聞高見。」

甲說:「每個人有一個頭,沒有人有兩個頭,一個人比沒有人多一個頭,所以,一個人有三個頭。」

乙雖然知道甲的論證是錯誤的,但不能指出錯在何處。



大膽刁民,本官何曾虧了你

從前有一個縣官要買金錠,店家遵命送來兩隻金錠。縣官問:「這兩隻金錠要多少錢?」店家答:「太爺 要買,小人只按半價出售。」縣官收下一隻,還給店家一隻。

過了許多日子,他不還帳,店家便說:「請太爺賞給小人金錠價款。」縣官裝作不解的樣子說:「不是早 已給了你嗎?」店家說:「小人從沒有拿到啊!」縣官拍案大怒道:「大膽刁民,本官要你兩隻金錠,你說只收半價,我已把一隻還給了你,就折合那一半的價錢,本官何曾虧了你!」

店家聽罷,苦不堪言。


你現在不是也在講話嗎

一個電影院裡正在放電影,觀眾席上有幾個人高聲說話,旁邊的一位觀眾勸他們說:「請你們不要講話,好嗎?」其中一個小伙子倒打一耙說:「嘿嘿,你現在不是也在講話嗎?」



快把飯錢算給巴依

在《阿凡提的故事》一書中,講了一個《飯錢》的故事:

有一個窮人找到阿凡提說:「咱們窮人真是難啊!昨天我在巴依(即財主)開的一家飯館門口站了一站,巴依說我聞了他飯館裡的飯菜的香味,叫我付錢,我當然不給。他就到喀孜(即宗教法官)跟前告了我。喀孜決定今天判決。你能幫我說幾句公道話嗎?」

「行,行!」阿凡提一口答應下來,就陪著窮人去見喀孜。

巴依早就到了,正和喀孜談得高興。

喀孜一看見窮人,不由分說就罵道:「真不要臉!你聞了巴依飯菜的香氣,怎麼敢不付錢!快把飯錢算給巴依!」

「慢著,喀孜!」阿凡提走上前來,行了個禮,說道,「這人是我的兄長,他沒有錢,飯錢由我付給巴依好了。」

阿凡提一邊說一邊從腰裡掏出一個裝銅錢的小口袋,舉到巴依耳朵旁邊搖了幾搖,一問巴依道:「巴依,你聽見口袋裡響亮的聲音嗎?」

「什麼?哦,聽到了!聽到了!」巴依說。

「好,他聞了你飯萊的香氣,你聽到了我的錢的聲音,咱們的帳算清了。」

阿凡提說完,拉著窮人的手,大搖大擺地走了。


空酒瓶等於裝滿酒的瓶

小趙、小錢、小孫、小李四人是同學,他們常聚在一起討論問題。有一天四人同桌吃飯,為桌上的半瓶酒爭論起來。

小趙說:這瓶子一半是空的。

小錢說:這瓶子一半是滿的。

小孫說:這有什麼好爭的,半空的酒瓶就等於半滿的酒瓶。

小李說:不對。如果「半空的酒瓶等於半滿的酒瓶」這個等式能夠成立,那麼我們把等式兩邊都乘以二:

半空的瓶乘以二,等於兩個半空的瓶,而兩個半空的瓶就是一個空瓶;半滿的瓶乘以二,等於兩個半滿的瓶,而兩個半滿的瓶就是一個裝滿酒的瓶。這樣,豈不是一個空酒瓶等於一個裝滿酒的酒瓶嗎?


父在母先亡

一個有迷信思想的人,請算命先生算一下自己的父母的享壽情況。

算命先生照例先問了一遍來人及其父母的出生年月日,然後裝模作樣地屈指掐算了一會兒,於是回答說:

「父在母先亡。」

這個人聽了以後沉思片刻,付錢而去。

為什麼求卜者對算命先生的話不懷疑,付錢而去呢?這是因為「父在母先亡」這句話有歧義,人們對它可以有不同的理解,或者說它可以表達不同的判斷:

父親尚在,母親已經去世;
父親先於母親而亡,即母親尚在,父親已經去世。

而且這兩種解釋不僅適用於現在,也適用於過去和將來。

我吸煙時從不工作

某工廠的一位車間主任看見工人小王上班對在車間裡吸煙,就批評他說:「廠裡有規定,工作時禁止吸煙!」

小王漫不經心地回答說:「當然,我吸煙時從不工作。」

誓聯

清人黃圖珌編過一則《誓聯》的笑話。說的是有個縣官上任伊始,便在堂上高懸一副對聯:

得一文,天誅地滅;
徇一情,男盜女娼。

但是,實際上他卻貪贓枉法。有人指責他言行不一,忘記了誓聯。

縣官辯解道:「我沒有違背誓言啊,因為我得到的不是一文錢,受賄徇情也不是一次啊!」

「靠得住」嗎

魯迅先生在一篇雜文中講了這樣一件事:

A: B,我們當你是一個可靠的人,所以幾種關於革命的事情,都沒有瞞著你。你怎麼竟向敵人告密去了?

B: 豈有此理!怎麼是告密!我說出來,是因為他們問了我呀。

A: 你不能推說不知道嗎?

B: 什麼話!我一生沒有說過謊。我不是這種靠不住的人!(《且介亭雜文末編》:「半夏小集」(五),第一零七頁)

這場官司要不要打

古希臘著名哲學家、詭辯家普羅塔哥拉曾公開設館教人辯論之術。他收了一個想當律師的學生,名叫愛瓦梯勒士。師生簽訂合同:學生先交一半學費,另一半學費待學生畢業後第一次出庭為人打官司勝訴後交付 ;如果官司敗訴就毋須再交這一半學費。

愛瓦梯勒士畢業後並未從事律師職業,也不交那一半學費。老師等得不耐煩,就向學生索取,學生執意不給,師生要訴諸法庭解決。老師對學生說,這官司打起來對你沒有好處。因為:如果我打贏了,根據法庭判決,你必須給我學費;如果我打輸了也就是你打贏了,根據當初簽訂的合同,你也必須給我學費(合同規定,愛瓦梯勒士第一次打贏官司應交學費);或者我打贏了,或者我打輸了;所以,你都必須給我學費。

愛瓦梯勒士聽後不甘示弱,他對老師說,我看這官司打起來實際上對你不利。因為:如果我打贏了,根據法庭判決,我當然不給你學費;如果我打輸了,根據當切簽訂的合同,我無須再交學費(合同規定,愛瓦梯勒士第一次打輸了官司,就不要交另一半學費);或者我打贏了,或者我打輸了;所以,我都不應付給你學費。

這就是邏輯史上著名的「半費之訟」。

2010-11-02

再看伍棟英

最近偶然從書櫃再翻起n年前買的《思考‧人生的路向》,是伍棟英寫的(小傳)
再讀起來亦有一番滋味。我喜歡的原因是作者沒有艱深的詞語,來表達一個深奧的問題 - 人生的意義!

到現在,我仍非常同意作者「盡生」的說法。

做點googling,發現書本原文已可在網上看到,有興趣的朋友可到以下網址:

《思考‧人生的路向》http://www.npc.edu.hk/staff/~ngtungying/wayoflife/wayoflife.htm

同時,伍棟英仍有繼續發表文章,網址如下:

雲水網誌:http://www.xanga.com/cloudwater_NTY

雲水網站:http://www.npc.edu.hk/staff/~ngtungying/index.htm

後記:
2010年買了一部Kindle電子書閱讀器,將《思考‧人生的路向》轉成Kindle格式

http://pominghk.web.fc2.com/e0164289.prc

2010-10-29

電腦上的計算尺

在2008年曾經拍下自己收藏已久的「古董」計算尺 (link)。

在網上,居然看到有人寫電腦程式來



有興趣的朋友不防到 Softpedia (link) 下載。(不過resolution比較差,希望遲些自己可寫一個好D嘅!)

2010-10-12

How I Trade and Invest In Stocks and Bonds (Richard D. Wyckoff)



Wyckoff 是某天在聽香港電台《投資新世代》時經濟日報的石鏡泉介紹的,看看維基百科(link),才知Wyckoff是20世紀初的財經名人!

在網上尋找他的文章,好好彩,仍找到很多,加上迎來買了部Kindle 3,所以閱讀電子書更加方便。

首先看的是”How I Trade and Invest In Stocks and Bonds”(Internet Archive有免費copy,1924年版,見link),雖然是scanned pdf,不過有OCR,所以可以search,很方便。

雖然沒有技術分析,Richard在書中詳細講他1的投資(或投機)心法,最重要是這些論據沒有因時間而變成失效,以下是我在本書的一些jottings,希望同大家分享:

頁17
All he asks is to be told "something good." That is not speculation, it is gambling...

頁34
I found that most of (the people) wanted to lean - not to learn. They just drifted along, guided by hope of profit and pursued by fear of loss.

頁45
Before I go any further, let me say that not every man is adapted to trading in stocks. In fact, very few are fitted for the work if it is undertaken as an art, a business, a profession, or whatever else you wish to call it.

頁75
Never get married to a security.

頁88
It is poor policy, I find, to wait for Opportunity to knock at your door.

頁143
These points are about equally divided between investment and speculation, but it is so difficult to determine which one begins and the other ends that in many cases I shall be obliged to treat them in combination.

頁144
IF ONE IS NOT ADAPTED TO TRADING HE SHOULD PROVE IT TO HIS OWN SATISFACTION AND THEN ABANDON THE BUSINESS. - He should then attempt to become an intelligent and successful investor. Failing of this, he should turn to savings banks and mortgages or other non-fluctuating mediums for the investment of his funds.

2010-10-11

Kindle 2011 Hong Kong Calendar

I have brought the Kindle 3. The advantages of Kindle 3 over previous version is:
  • it is much cheaper (the Wifi version is only US$139!)
  • it natively supports Simplified and Traditional Chinese without any additional hacking
After reading many "free" e-books found on internet, I must say I am very satisfied with my new toy so far, thanks to its appropriate footprint and long battery life.

I then start to explore whether I can create a Kindle ebook myself.

I am not a writer and therefore have no content to share. But why not make a Kindle app? Franking speaking I am not using KDK (Kindle Development Kit). But using the built-in annotation and indexing mechanism of the Kindle mobi format, I find I can make a calendar.


If you have interest, please install a copy yourself:

(1) save the attached prc file (link) using "Save Link As"
(2) transfer the prc file to your Kindle document folder via USB or your Kindle email account

Since I have added the Lunar Calendar, it has Traditional Chinese characters. But I have not tested the compatibility on older Kindle models.

You can create your Appointments as follows:
  • press the 5-way as usual to your target date (similar to creating notes)
  • enter your appointment details


Afterward, your schedule will be shown on the date with a superscript note-mark as follows:



(the yellow-highlight is added by me to draw your attention - Kindle does not support color display yet!)

Hope you like it.

2010-06-08

Composing a HTML table in Gmail

In Hotmail, I can directly edit the html codes during composing an email. However, in Gmail, I cannot have this feature.

Moreover, Gmail does not have the built-in function to compose a table.

Recently, I accidentally find that the copy-and-paste feature in the Gmail preserves the formatting. So following the track, I find I can actually create a table simply by copy-and-paste an empty table from another editor (like Word)!

Though I cannot do further formatting (like column width adjustment), I find I already overcome one of the greatest deficiencies.

2010-06-07

羅家聰用經濟學談「跳樓」

見6月5月iMoney

雖然有點黑色幽默,不過當中的經濟理論如:
  • Expected Utility
  • Discount Factor
  • Utility Function sensitivity
又真是很to-the-point