呢幾日諗緊一個難題,話說有個朋友,中學識嘅。我無同佢同過班,剩係同佢一齊讀過一個星期先有兩堂嘅 Computer Studies, 但係就偏偏係依家最老死嘅朋友。
我今日都問過佢,但係佢都解唔到究竟我哋點樣熟絡。我諗唯一解釋到嘅,就係緣。緣呢樣嘢好奇妙,只要時辰一到,擋都擋唔住。無嘅話,真係住响隔籬,甚至做埋同房,都唔會識到。
我呢,人緣就幾好喇,但姻緣就嘛嘛。
Search This Blog
Monday, January 31, 2005
Self-disposing Resource Pattern
A few mon, I have encountered a quite disturbing problem (see below). Until recently, I found that this problem can be solved by a interesting class, SoftReference, in Java. So, I formulated the following pattern. It's still a rough draft, but I would like to publish it first.
Name: Self-disposing Resource Pattern (Java)
Context: A is some expensive resource that may or may not be pooled. A is used to create another kind of resource, B. If A is disposed, it cannot create B anymore. However, if A is not disposed, the system may run out of memory.
Problem: Determine when to dispose A.
Solution: Java comes with SoftReference class for memory management. “An object is softly reachable if it is not strongly reachable but can be reached by traversing a soft reference.” An A instance can be registered to a resource manager to be a soft reference when it is no longer reachable by any thread. On the other hand, the resource manager can start off a thread to dequeue the SoftReference instances from a reference queue and clean up the resource properly.
Name: Self-disposing Resource Pattern (Java)
Context: A is some expensive resource that may or may not be pooled. A is used to create another kind of resource, B. If A is disposed, it cannot create B anymore. However, if A is not disposed, the system may run out of memory.
Problem: Determine when to dispose A.
Solution: Java comes with SoftReference class for memory management. “An object is softly reachable if it is not strongly reachable but can be reached by traversing a soft reference.” An A instance can be registered to a resource manager to be a soft reference when it is no longer reachable by any thread. On the other hand, the resource manager can start off a thread to dequeue the SoftReference instances from a reference queue and clean up the resource properly.
Friday, January 28, 2005
First Week of the Semester
The school has been started this Tuesday. I attended to the classes for three consecutive nights. It's so tired. Tomorrow, I need to take another one in the afternoon. I'll need to decide whether I should drop the Tuesday class. That class was very boring.
Monday, January 24, 2005
Days of Part-time Working
I haven't blogged for a long time. I am currently working as a part time. In theory, I should have more time than before and I should have more time to blog. Obviously, it's not.
I found that there are many personal stuff have to take care in the first. Like have the MP3 player fixed, applying for CEF, etc.
The second week, I got cold again. I had to take rest at home and didn't go to work out. My body get a bit slimmer. It's not good though. After I got better, I go hiking with friends and upgrading the CPU. Actually, these few weeks I was trying to get an AMD's Althon XP CPU which was out of stock. I gave up in this week and got a Sampron. Another thing I wanted to get was a Palm T3 which was again out of stock. I am considering if I should by T5 instead.
This week, I finally started trying to swim. Rocky now is my "couch" preventing me from drowning. Even just one day, I thought I had the key to swim.
Today, we went to Leo's home to play video games and having dinner together. It's a tired but enjoyable day. Rocky and I almost missed a bus when going there. However, we still miss the stop to get off the bus. Luckily, Michael and Sammi were still enjoying their lunch.
Interesting enough, we missed the bus of the back trip. We then take the MTR to get back home. When getting the last trip of the train, we missed the train again.
I found that there are many personal stuff have to take care in the first. Like have the MP3 player fixed, applying for CEF, etc.
The second week, I got cold again. I had to take rest at home and didn't go to work out. My body get a bit slimmer. It's not good though. After I got better, I go hiking with friends and upgrading the CPU. Actually, these few weeks I was trying to get an AMD's Althon XP CPU which was out of stock. I gave up in this week and got a Sampron. Another thing I wanted to get was a Palm T3 which was again out of stock. I am considering if I should by T5 instead.
This week, I finally started trying to swim. Rocky now is my "couch" preventing me from drowning. Even just one day, I thought I had the key to swim.
Today, we went to Leo's home to play video games and having dinner together. It's a tired but enjoyable day. Rocky and I almost missed a bus when going there. However, we still miss the stop to get off the bus. Luckily, Michael and Sammi were still enjoying their lunch.
Interesting enough, we missed the bus of the back trip. We then take the MTR to get back home. When getting the last trip of the train, we missed the train again.
Sunday, January 2, 2005
Summary of These Two Weeks
Xmas eve - Had a party with colleague, then friends.
Day after boxing day - BBQ with other friends, dinner with yet some other friends. It's a great day.
New year eve - tried to buy T3. However, it seems that it was totally out of stock.
Plan on 2005 - Study. Start profiling my financial status, again.
Day after boxing day - BBQ with other friends, dinner with yet some other friends. It's a great day.
New year eve - tried to buy T3. However, it seems that it was totally out of stock.
Plan on 2005 - Study. Start profiling my financial status, again.
Subscribe to:
Posts (Atom)
Popular Posts
-
通常一個人做唔同事有唔同嘅態度,不過,呢種行為就完全應驗咗响 decision making 呢科心理學,教授响第一堂入面所講 "human is retarded" 呢句。呢句係指人因為行為唔夠 consistent, 所以經常做出愚蠢嘅決定。 自呢堂起,唔...
-
記憶太少,就大概係幼稚園定小學嗰陣上過廣州探過佢。嗰陣時嫲嫲有一間士多仔,有汽水可以飲。前店後居,屋企有一隻貓仔,但啊媽唔俾掂,話污糟喎。 到咗中學,嫲嫲落咗嚟香港一個禮拜,但都無同佢出過一次街,好似無傾幾句計添。 讀完書返咗嚟香港之後,前幾年一直都想再去廣州探佢,但因為...
-
一個要好嘅朋友睇到我之前篇 資產與負債 後寫咗 篇文 為 in-house programmer 申寃,雖然我之前篇文重點唔係要講 in-house vs. software house. 但既然有反應,我又當然回應吓,本來想寫個 comment, 但越寫越長,不如就嚟一個交換日...
-
Butterfly Effect 總恬嚟講就係因為一個輕微嘅變化,而引致一個重大嘅改變。今次個重點,唔係個效應本身,而係想講一講超時工作 (即係 OT) 點樣改變香港人生活模式。 物價篇: 有說,超級市場賣貴貨,甚麼平通街、保證至抵,都係扼人嘅。但係,工時長咗,放工時間夜咗...
-
我剩係相信數字,經過一個 project, 發現到 software outsource 都好大機會慳到錢。 呢個 project 見到嘅,係用 111 個香港 man-hours, 就有 2035 個大陸 man-hours 嘅回報。如果當大陸嘅 productivity 大...
-
電動車環保,但點解普及唔到? 車價係主因,續航能力亦係一個疑問。咁貴買部行無耐就要叉幾個鐘嘅車,略嫌欠經濟效益。 乜原來到咗2013年,叉電仲係問題? 我哋手中嘅電話、平板、相機等等,通通都要叉電。買呢啲 Gadget, 通常會買/送乜嘢附件? Screen Protecto...
-
友人問: 真心問一句, 特首可否有富商朋友? 是否不可以有朋友款待, 又該怎樣申報? 富商朋友可以有,但款待就咪啦! 咁咪申報都慳返囉! 搭遊艇兩個人先俾嗰五舊水,TurboJet 貴賓廂一位都差唔多二千蚊啦! 係,你係做左四十幾年事,係識得好多朋友,但好多賭客都係做咗幾十年...
-
响陳水扁做台灣領導人嘅年代,呂秀蓮因為成日講錯嘢,俾人話係 IBM (International Big Mouth) 同 BMW (Big Mouth Woman). 呢兩日,香港都出咗個 BMW, 叫做譚香文。 話說前亞視女主播王麗珠曾經係譚香文嘅議員助理,譚香文選唔到議員,...
-
金鐘、銅鑼灣、旺角响佔領運動其實缺一不可。我唔識乜嘢孫子兵法,但係以現有嘅資訊,加少少邏輯,可以推斷到每區所扮顯緊嘅角色。 响網絡世界度,資訊保安公司有時會架設一啲 Honeypot 嘅 Server, 專門俾人 Hack 入去。呢啲 Server, 因為太易 Hack, 往...
-
原來要去澳洲做嘢唔係太難,係時候考慮吓係咪要轉換環境。