Monthly Archives: February 2014

Apparent Theft at Mt. Gox Shakes Bitcoin World

Economists have for a while been asking whether Bitcoin is a good store of value, for reasons ranging from demand to ease of entry. Now a bigger problem emerged: security. The Mt. Gox closedown is the biggest incident so far, but it is far from the first (see https://bitcointalk.org/index.php?topic=83794.0#post_toc_17).

Even without the transaction malleability issue, I see one of the biggest attractiveness of Bitcoin—access to your money unfettered by government control—instinctively as a two-edged sword. If you want no one to monitor your actual identity, then no one is monitoring whoever-took-your-money’s either. As such, I really do not see why people would trust their private keys with service providers, but storing them privately is just as safe as putting your money under your mattress either.

 

太多電線要走,開多個窿先夠。
A 10.8v drill has barely enough power to drill a 7cm hole through 1-inch particleboard tabletop, but now I can finally run cables any way I want.

2014-02-25 16.07.55

進修新趨勢 一個博士頂萬個碩士

信「升學專家」一成,小心前途去向不明。讀博士不能抱著香港人讀碩士的心態,光想拿多個學歷以利晉升。事實上除非在最頂尖的研究院畢業,否則博士學位只是個找工作的負累—學術單位看不上你,私人機構又嫌你學歷過高。為名銜而讀博士就更要不得,只適合已名成利就的社會達賢。

Do not ever consider getting a PhD for better career prospect. It will for sure not work out that way.

 

Preserving Constants in a Stata Collapse Operation

Let’s say you have a variable that you know is constant within each group, what is the best way to preserve it during a collapse operation in Stata? You might think taking the first value (firstnm) must be the fastest, since it theoretically only requires 1 step per group. If that is the case, you are in for a surprise—Stata is actually better in calculating the mean.

Here are the simulation results for 100 groups of 1000 randomly generated observations, averaged over 30 runs:

collapse mean 0.0443
collapse median 0.1062
collapse min 0.0844
collapse max 0.0657
collapse count 0.0456
collapse firstnm 0.0473
collapse lastnm 0.0464

The measurements are reported in seconds. The relative speed is quite stable to variations in number of groups and observations. Base on my analysis of the underlying algorthims collapse uses, the reason why firstnm is so slow is that an order-preserving sort has to be performed on the data, and order-preserving sorts are slow relative to non-preserving ones. To confirm this is true, I ran the test with just one group of 100k observations:

collapse mean 0.0614
collapse firstnm 0.0508

And as expected, firstnm is now faster. The calculation of mean also slows down more than that of firstnm as the number of groups decrease.

Base on my simulations, calculation of mean is faster when there are as little as 3 groups, so mean is the way to go in most cases.

反對自由行與自私

認真,如果有個本地富人和大家說:「自由行令你地買嘢貴咗,坐車迫咗,但我公司生意好咗,我啲舖收租多咗,我日日坐自己車又唔覺迫。如果我支持自由行係自私,你地反對其實咪又一樣?」大家會點答?

例:
a. 受害人數遠超得益人數
b. 富人太短視,看不見自由行有損自己長遠利益
c. 富人有本錢犧牲自由行的好處,一般市民卻承受不了其害處
d. 我就係仇富,因為富人無個好

歡迎提供其他答案。

百佬匯賣藥

Broadway_drugs
因為怕人多,平日甚少行經西洋菜街行人用區。昨日經過,偶爾發現百佬匯原來有藥賣。

你無睇錯,係藥—正露丸呀活絡油呀一應俱全。

同胞有需要,我明白的。但最有趣的是在全店中,只有藥物的價牌是沒有百佬匯的商標和名字。這些藥品並非處方藥物,便利店都可以賣,那價牌無商標是因為百佬匯並非藥廠認可代理?還是因為因為百佬匯不想有人在同一幅相中拍到商標和藥物?

麥當勞改價 2014


2014-02-05 13.06.41

昨日的香港頭條不少都是有關麥當勞改價。且不說麥記價錢上頭條是如何的世界罕見,改價背後的邏輯也實在耐人尋味。

先看看改價的內容:

– 巨無霸餐和魚柳包餐重上30多元;
– 雙層芝堡餐和脆辣雞腿包餐減價至21元;
– 魚柳包減價至9元,取代雙牛芝堡。

第一點可以看出的是雙牛芝堡加價是主打。近年美國牛肉價格上升了三成,廉價的$9兩牛芝堡自然首當其衝。現時很多人兩個雙牛芝堡當一餐,改價後應不復見。至於套餐,巨無霸和雙層芝堡基本上打個和,換陣只是回復到較合理的餐品高低定位。

第二,魚柳包主要是單點減價多於套餐加價。單點一個包、細薯條加細汽水其實和套餐沒多大分別,唯一例外是魚柳包 + 粟米杯這「健康組合」貴了。考慮到兩者客路不同—很多人只買$9包,一些女仕就一定不吃薯條—而美國原材料的價格又無顯著升幅,這一加一減對麥記的盈利應該有幫助。