Showing posts with label Fun of the day. Show all posts
Showing posts with label Fun of the day. Show all posts

Monday, August 16, 2010

Interesting Question

Maybe not so interesting to most people. But it is good to have a chance to dig a hole and jump into it by myself. I am implementing this and hopefully get it resolved elegantly.


Target:


Design a data structure + algorithm to be able to respond to query requests in a timely manner.


1. Assume you have a set of string, say N strings.
2. The lengths of the N strings vary from 1 byte to X bytes.
3. Design a data structure + algorithm to provide a fast query based on:
4. If a string S is provided, we want to be able to find out all strings containing S as their substring in O (log (N)) time.

Conditions:

A. Pre-processing time to make the data structure ready for query need not be considered. We can improve it later on. This is to simply the answer at beginning. I started with rigid requirement of this part and had trouble to have an answer quickly at beginning.

B. Assuming we to run the query many times, and hence first priority is to optimize complexity of the query.

C. You can use hash table in design at beginning. But it is really a memory hogger, so eventually you need to change it to something else.

Monday, May 17, 2010

Adding Logging Support to MaxiCom 0.2

I wanted a neat serial console tool. I hate pressing combination keys so minicom's full capability and key combos are not what I want. I am not used to the separated command line of CuteCom, either.

I found MaxiCom's simple and intuitive GUI fits my needs perfectly when I have access to desktop GUI interface. But my job routinely requires capturing console logs. So its lacking of this feature made me add this feature.


When you click on the "LOG" button, it generates a file under $HOME with filename containing the date and time the log file is started. When you finished the capture, click log again. The file is then completed. When the file is created, the date and time will be written to the log file and when it ends, the date and time are also written.

Thursday, August 13, 2009

A Special Crash Report

I've never seen something like this, but this one is really cute. (At least to me...)


'import site' failed; use -v for traceback
Sorry, command-not-found has crashed! Please file a bug report at:
https://bugs.launchpad.net/ubuntu/+source/command-not-found
Please include the following information with the report:
No module named CommandNotFound
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 10, in
from CommandNotFound import CommandNotFound
ImportError: No module named CommandNotFound
Python version: 2.5.2 final 0

Sunday, May 03, 2009

Golden Week

Golden Week is a national holiday in Japan that lasts for one week. It sounds great, most of us will envy it a lot, but I never knew it actually has great impact to us.

I took a HSR train today to southern part of Taiwan today. When I was on the shuttle bus to the metro, I found there are three Japanese girls sitting nearby. After ten minutes, I realized that some one in Japan notified me they are having Golden Week since yesterday and he will not be able to reply emails.

Also, on the 2008-2009 calendar I brought back from MIT, Golden Week is listed on it, too!

I think Japan has successfully marketted its national holiday. And the best thing is, because it takes only 4 hours flight to reach Taiwan (roughly two movies), many Japanese visit here for sightseeing.

That helps our economy.

Maybe, I should learn Japanese, too.

Wednesday, March 04, 2009

A Nice Poem

I got this from Mrbig a few minutes ago. It makes perfect sense to me. Hope it does to you, too.

五言詠麻雀 曹興誠          

東南西北風 玩過人人瘋 方城無歲月 喧笑不知冬
峰迴出意表 拙能勝智巧 名利追逐苦 何如吃碰胡 
貪求把把贏 必然頻放銃 心快手要慢 盯張不可鬆
聽熟不聽生 聽邊不聽中 牌背要能守 牌順要敢衝 
贏時莫輕狂 輸時忌燥動 出牌要果敢 慢磨惹人煩
不可禁如廁 牌規應寬容 輸若贏友誼 似敗實成功 
有云玩喪志 我問志何用 人生如牌局 無欲更從容
世道多炎涼 幸有牌熱烘 局散何妨去 笑看月當空

Friday, December 19, 2008

Snow Storm?

Below is the weather forecast I just copy-n-pasted from weather website. CSAIL has warmed snow storm for tomorrow. So, it is likely no one will be here tomorrow!

Eventually, it looks up we will have enough snow for a snowman!


Friday

Partly cloudy with a chance of snow in the morning... then snow in the afternoon. Snow may be heavy at times in the afternoon. Snow accumulation of 4 to 6 inches. Highs in the lower 30s. North winds 5 to 10 mph...becoming northeast 10 to 15 mph with gusts up to 30 mph in the afternoon. Chance of snow near 100 percent.

Friday Night

Snow. Snow may be heavy at times in the evening. Additional snow accumulation of 3 to 5 inches. Cooler with lows around 14. Northeast winds 15 to 20 mph with gusts up to 35 mph. Chance of snow near 100 percent.

Thursday, December 18, 2008

New Way of Cost Down

For those that know my company, they typically recognize it as a seriously cost-cutting firm. We cost-cut virtually anything. However, here comes the new way to do the cost cutting:

Use a New Font Face on Printers

A Dutch company has added holes to Font Face so it would save up to 20% of printer inks.

This is a good news to every one. Also those that waste ink and paper: they can use 25% more ink than they used before without increasing cost. The catch is they still have to pay 25% more for papers they used.

Wednesday, December 10, 2008

Writing a Trojan Horse Email?


I get some scam mails daily. But this one is interesting for me because it is so content independent but non-real. I guess there might be some viruses or Trojans in it. But the content of this mail is funny:

Good morning

We have already made ready the contract and we also joined some points you’d asked to add to it.
The lawyers change some points on the last page. Read the contract, please, and if there are no objections from your part we can pay for the first batch on Friday.
You can find the contract in the attached ZIP Archive.

We also ready to send it by fax if you need
Kind regards

Wednesday, November 26, 2008

FUBAR

I read it on an article on ZDNet but didn't know its meaning.

Found it on Wikipedia: "Fucked Up Beyond All Repair" (used to describe the state of some equipment) or "Fucked Up Beyond All Recognition" (used to describe a situation or scenario).

Another acronym which means the same is: SNAFU, "Situation Normal: All Fucked Up" or "Systems Neatly All Fucked Up" in computer world.

Last time we were talk about there are so many acronyms in computer world. Adrien mentioned once his school wanted to have a name. They decided to have the ACRONYM of the full name first. Then try to find words that can literally create this ACRONYM.

Now I believe there are many smart people in computer science world because smart people tend to do stupid things, often.

Thursday, November 20, 2008

Minus 4 degrees!


This morning I went out for school. It's the first time I go out at a temp under ZERO.
Oh, what fun! (What cold!)

Sunday, November 16, 2008

不凡的人生 真實的故事

今天趁著星期六放假,跑去參加了一個活動: 紐英崙中華專業人員協會第三十一屆年會。
付了 $25 的入場費。真的是完全值回票價 + 物超所值。

接連的演講都非常精彩。我自知筆拙沒辦法將它們全部忠實的紀錄並分享出來。但其中有兩則是不能不拿出來獻曝一下的。兩個故事分別是:

1. Sharing My Life Experience - 李昌鈺博士

2. 我在金三角2920天之見證心得 - 鍾儱徽執行長

李博士大家都聽過,他已經是一個家喻戶曉的刑事鑑定專家 (曾在全球四十幾個國家進行過鑑定),也曾替 319 槍擊案進行過鑑定工作。他在UNH (University of New Haven) 成立了 Henry C. Lee Institute of Forensic Science。四年前他曾主演電視劇。由於他的電視劇及CSI系列影集,他的學院近年湧進許多學生想要投入此類工作。

事實上,李博士的演講完全是從頭笑到尾。李博士的幽默感令大家都折了腰,笑到一整個不行。除此之外,我也對李博士的智慧五體投地,有空的話可以參考 youtube 上的影片:











可以看出李博士對主持人們的無俚頭可說是處理的非常之好。這兩位常會問讓來賓難以回答的無俚頭問題的主持人,他都 handle 的非常好。您可以看看上面的影片,看看是不是讚同我對於他的反應速度很快,常會反將一軍,或是回答的很漂亮,將有引導性的問題岔開 (但不是迴避問題喔)。

你可能覺得他很不錯,但你可能不知道,李博士的slogon就是把 "不可能變成可能"。

怎麼說呢?李博士跟著媽媽從大陸逃難到台灣,爸爸在逃難過程中不幸罹難,所以從小就沒有父親,媽媽一個人扶養十三個兄弟姐妹長大,他因為家窮所以考上大學時,因為要學費決定去唸警察大學。還因此被媽媽罵了一頓,認為是不行的人才去當警察。但他大學畢業後三年就當上警察局長,是至今的最年輕紀錄保持人。

在畢業後十二年赴美求學。由於很窮,李博士當時還得去端盤子打工,晚上半夜再去做實驗。由於美國的畢業典禮也是要交錢的,所以畢業典禮是自己在家裡舉行的。

他說他在這世界上最怕他媽媽,也最尊敬他媽媽。結果有些求助於他的人很聰明,找上他媽媽,結果他媽媽就會跟他講說你就去幫幫人家嘛。每次到最後他都會聽媽媽的話,真是超可愛的。(李媽媽三年前於106歲辭世。)

老實說,我已經開始在博客來跟金石堂找李博士的書跟DVD了!哈哈!

--------------------------------------------------------------------------------

至於鍾執行長的故事更是令人動容。

他陰錯陽差的步上了在金三角禁毒的路。很猛吧!在全世界海洛因供給量超過一半的地方搞禁毒。他的合作夥伴竟然是毒梟!

他跟老婆離婚,拋家棄子,把台北的三棟房子都賣了。連爸媽的棺材本也都拿了投入。最後媽媽連火葬費也都給了他。因為媽媽曾經對他說過:我生了你不是要你有什麼成就,只是希望你這輩子做一件有意義的事就夠了。

結果他決定幫忙禁毒,用禁毒改變這個世界。他的媽媽認為這事非常有意義,所以決定不惜一切幫助他,在今天的演講中,他提到他父母年事已高,現在兩人都住在加護病房中。其實演講中許多片段讓現場許多人都流淚了。一大群在美國的傑出華人 (現場應該有過半是博士學歷),都被他感動了。

第一次見毒梟時,對方居然說,看你一個人很有骨氣自己闖進來,這樣吧,算你半價。事實上,在那之前他還被游擊隊抓過 (毒梟的手下),對方認為他可能是間諜,不過後來不斷澄清,到最後對方也說,其實他看起來不像間諜,最後就放了他。他提到當他回了台灣時曾經有CIA與他接觸,要兩個毒販的項上人頭,共計五百萬美金的懸賞。只因為他是唯一一個可以在金三角活動的外國人 (非毒品交易者)。

當他回金三角時,他把這件事告訴了毒販頭頭,你知道對方的反應是什麼嗎?頭頭說,項上人頭可以給你,只是希望你能夠自己只留一萬美金,其它的可以用來幫助這裡的人民。事實上,就算殺了他也沒有意義,因為還是會有別的人出來接替的。

現在,他在努力的協助金三角建設以及進行教育。今天有在賣郵票,一份十美元,我買了。我沒有他這樣的勇氣、毅力、與骨氣,但是口袋裡還有十六塊美金。

今夏緬甸風災,全世界嘗試幫助緬甸的救援中,台灣能夠第一個進入幫忙他功不可沒。從四十歲起,至今十八年他把時間幾乎全部投入緬甸的有意義的事中。

和我庸庸碌碌的人生比起來,他真的是活的非常的有意義。我想他應該會一輩子在這事上努力,也許他到最後會死於為了緬甸而努力吧。但是無論如何,我相信他的毫不保留,將讓他在闔上眼的那一刻覺得自己活的有意義。

Tuesday, October 21, 2008

Steve Ballmer Got Kicked

Mr. Ballmer stated that Google Doc has no threat to Microsoft. He pointed out a very simple feature that G-Doc is missing: "you can’t even put a footnote in a document”.

He was right. Note: "was".

Two days after he said that, G Doc has the footnote feature added.

http://blogs.zdnet.com/Google/?p=1160&tag=nl.e539

Friday, August 22, 2008

海角7號

幾週前去大江看電影,在等待的空檔中看到海角7號的預告片,當時跟小潘兩個人覺得這是部很令我們期待的電影。不過因為我們看電影的頻率很高,所以也沒特別注意上映日期,心想總會發現吧。

由於後天要啟程去 Boston 出長時間的差,今天特別請了假陪陪家人,當然不能免俗的是去看場電影嘍!在電影院時我們發現電影的時間都不理想,但最後在Wall-E與海角7號之間要做一個選擇。小潘決定了看海角7號 (我猜想原因是受到之前Linkin Park的洗禮,現在對於有搖滾樂內涵的東西都特別有興趣吧。)

我們看的是中午12:25,應該是新竹華納威秀的第一場。

這場觀眾不多,我們也沒照劃定的位置坐,在差不多正片開始時我們右邊來了一位小姐,就這樣三個人一排一起看電影。

沒想到我們三個一樣被電影逗得笑的超大聲,看完電影還真給它有點累,因為笑點實在太多了。有好幾幕我還差點要哭了,眼睛已經濕了一半。

推推推推推推推推推推推推推推推推推推推推推推推推推推推推推推推推推推推推!

上面這一行就是我對這部電影的推薦程度。

這部電影當然不是什麼藝術大作。但它是非常細膩的一部電影。在看電影時,許多我們生活中的細節都不停的觸動神經讓我會心一笑,有時是大笑。看好萊鎢用大錢堆砌的電影所做不出的感動,在這裡才能看到!

電影中的愛情部份,是一段六十年前的一個懦弱的日本教師,與一個勇敢的台灣女人之間,最終由於男人的懦弱而沒有結果的愛情;映射到現代看似陽剛,卻其實也一樣膽小的台灣男人,對一個勇敢的日本女人的愛情所做出的回應。

在海灘上,他對她說的簡單的一句話 "留下來,不然我跟你走" 讓我看了好想掉眼淚,寫這篇post時眼睛也不忍不住濕了。

國寶的話常常令人捧腹。

至於從多年前就一直看著的夾子電動大樂隊小應跟糯米團主唱,完全就是一整個有喜感,跟平常表演時的他們一樣令我覺得自在。

非常喜歡千繪在這部電影裡的表演,其實在看電影前並不知道千繪的存在,回來後google了一下居然發現她有自己的部落格,中文也會通喔,千繪住在台灣,非常認真的在學中文呢!

千繪的blog: http://chieworld.pixnet.net/blog/

范逸臣這名字說實話很熟,但不知道是誰,高矮胖瘦幹什麼的通通都不知道,也是今天才認得。他在裡面的角色是個在台北混不出名堂的樂手回到家鄉,雖然做了個工作但其實始終自認懷才不遇,對世界充滿不滿,也不對自己的人生抱有熱情。最後是千繪這個角色的觸發,不放棄他的繼父讓他再次找到熱情,迎向未知的人生。

等我從 Boston 出差回來,我想再去一次墾丁.......... (夏都上次蜜月時去住過了, 怎麼覺得他們拍得讓我覺得比我去住還美呀?)

Wednesday, July 02, 2008

Coolest Domain Name Ever Seen

http://err.no/personal/blog/

Monday, June 30, 2008

最新的十字路口 DM

前幾天跟老婆兩個人一起去看電影, 車從高速公路開上新安路往寶山路上時, 鼓起了勇氣
告訴老婆我打算要去看赤壁在新竹遠百的首映這件事, 老婆果然是老婆, 不用三秒鐘就猜
出我其實是衝著林志玲的面子去看的。於是沿路就針對是不是為了林志玲而去看, 以及其
正當性展開密集的討論....

從竹科開出來後, 在新竹市寶山路到底, 過了 "制服女孩" 之後的路口停了下來, 按照慣例
有人在路中間發海報, 但是有位先生發的東西好像不是海報...那是什麼呢?

一個紙盒子?
在那位先生越走越近時, 有種不祥的預感, 我在想會不會是推銷東西的, 一開車窗就要你買東西...
不過到最後還是敵不過好奇心而把它接了過來, 好險那位先生沒叫我買什麼東東。

上面這三張是開箱照的連續動作圖......... 看出來是什麼了嗎?

這個東西的設計者非常用心, 還為了大家的安全, 加上了請勿食用的字樣

噹噹! 如果前面還沒猜出來是什麼的朋友, 不用再猜了, 這樣應該很明顯了吧......


請皮膚黝黑的 Model 拿著實品展示大家看: "老師在說, 你有沒有在聽阿? ㄚㄚㄚ..."

ps. 感謝小0小朋友不收費的幫忙拍攝廣告喔~~
ps 2. 到現在我們還是沒研究出來這個DM到底可以用來幹嘛

Friday, June 13, 2008

老婆的開車技術

老婆的開車技術是很好的, 很多女生領了照不敢上路, 或是上了路就當活動路障, 我老婆完全沒有這類的問題, 尤有甚者, 老婆曾經在我坐在副駕假眠時, 開到一百三, 可是一點都不含糊。

有一天我下班回家時, 老婆一看到我就笑的非常璨爛, 像盛開的一株非洲堇。

場景: 客廳
我: 老婆, 什麼事這麼開心呀?
老婆: 呵呵呵
我: 老婆, 發生了什麼事, 怎麼這麼高興?
老婆: 呵呵呵
我: (檢查一下臉上是不是被畫了多拉ㄟ夢) 咦, 我沒問題呀...
老婆: 呵呵 呵呵 呵呵 呵呵
老婆: ....... 跟你說一件事 不可以生氣喔
我: 什麼事? (疑惑)
老婆: 你要先答應我不可以生氣
我: 你被開罰單了嗎? 你去百貨公司花了很多錢?
老婆: 不是啦 也不是啦
我: 那到底是什麼事呀? (心中有股不祥感升起 + 國旗歌)
老婆: 就是那個.......車子去撞傷了啦
我: 喔 (看看老婆跟小0, 都沒事), 那還好吧?
老婆: 還好啦 就是刮傷了
小0: 車車受傷了 車車痛痛 擦藥藥
------- 這是分隔線 ---------------------
場景: 停車場
我: 哇靠, 見骨了啦
老婆: 呵呵 呵呵 呵呵 呵呵
我: ............

Monday, November 19, 2007

A Note for Myself - Linkin Park tour, Taiwan, 2007/11/16

It's a pity I couldn't join this concert. But we got too many things to pity for in our short life. So, I can still enjoy the fun part. That is, buy their album and enjoy.

The playlist:

1.No more sorrow
2.Lying from you
3.Somewhere I belong
4.Wake+Given up
5.From the inside
6.Don't stay
7.Papercut
8.Petrified
9.Point of authority
10.Shadow of the day
11.What i've done
12.Numb
13.Push me away 《抒情版》
14.Hands held high
15.breaking the habit
16.In the end
17.Crawling
18.One step closer
19.The little things give you away
20.Cure for the itch(Mr.Hann超屌刮碟秀)
21.Bleed it out(rob 神之鼓技+chaz與大家互動 hey ho~ oh ho ~)
22.Faint+加長版ending

Wednesday, September 12, 2007

莒光日

莒光日 is a brainwash lesson we have to take during the military service. Obligatory or non-, you have to join it.

Some says the company I am working for (its name can not be told) has military-like administration. I don't quite agree with that.

1.a. 莒光日 take place on Thursday morning. Which is a waste of military service time.
1.b. The company whose name can not be told takes 莒光日 on Saturday morning. It effectively remove the burden of 莒光日 from our daily job.
2.a. 莒光日 starts at 8:00am, we usually need to leave the dorm at 7:45 so we will not be late.
2.b. The company whose name can not be told takes 莒光日 at 8:00am, too. But, as a difference, I am healthier because I always wake up before 6:30 and catch the bus at 7:00am so I won't miss any piece of lesson.

That's the advantages I can found so far. Will update if found anything new.

Thursday, May 17, 2007

Here is a presentation file, please download and try to figure out what it is talking about:

http://www.cs.washington.edu/orgs/student-affairs/gsc/offices/old/433/PoCSi43302/papers/dougz.ppt

I guess you might not able understand, and confused like me, here is the author's presentation:

http://www.youtube.com/watch?v=yL_-1d9OSdk

Enjoy ;->