呢幾日諗緊一個難題,話說有個朋友,中學識嘅。我無同佢同過班,剩係同佢一齊讀過一個星期先有兩堂嘅 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
-
三十一年前,响英國利物蒲一間醫院,一個又瘦又黃嘅 BB 出世。想當年,嘅一位年輕嘅母親,到今時今日已經退休。出入醫院、牙齒脫落、白髮、皺紋,體力亦大不如前,但依然要為兩個仔粗心。 好想做 D 嘢...
-
同事結婚,部 cam 上次影完新年煙火唔記得 set 返 auto focus. 下午嘅婚禮 out fo. 夜晚婚宴,Ricoh 相機對焦稍差,再度 out fo. 婚宴趨勢: 1. 加入天才表演,俾新娘驚喜。彈結他、彈琴等,無論練得幾好,上到台都係會太緊張,影響表演。 2. ...
-
呢排興講港女港男,今次講吓醜女。 响香港,醜女被人叫豬扒,豬扒一詞係由黃子華把口講出嚟嘅,當年無線有套劇叫《男親女愛》。黃子華响一間律師樓做事務律師叫余樂天,under 鄭裕玲演嘅 Miss Mo. 有場戲,余樂天話 Miss Mo 係豬扒。Miss Mo 就當然會問乜嘢意思啦,...
-
噚日講過,每一套戲都有一個設定嘅世界觀。有說人生如戲,即係其實每個人都有一個世界觀,我哋叫做觀念,同你觀念接近嘅人,好可能已經係你嘅朋友。當然,每個人嘅觀念唔同,但係兩個人都可以做朋友、拍施、甚至結婚 (星期日檔案講嘅異族婚姻係其中一例)。因乜嘢而令到呢兩個觀念嘅人可以走埋一齊?...
-
好多香港人對文字都有邊讀邊,有時又知其音不知其寫法。 例如「海獺」咁,因「賴」呢一個偏旁,好多人讀咗「瀨」呢個音。但其實讀音為「刷」,咁好多人聽到,就寫出「海賊 (近音而非同音)」呢個詞語。可惜呢個世界只有烏賊,即係墨魚,海賊最多係指海盜,並唔係一種動物。 由可愛嘅海獺扯到去海盜...
-
响地鐵走出嚟,聽到一堆人响到講點行點行,點解唔搭的士云云。於是問一問佢哋想去邊,想去「富臨」喎... 聽落好熟,但係唔太記得响邊,跟住佢哋問上環街市响邊,指咗個方向之後,佢哋已經行開咗。過多幾秒,先記得原來富臨就係屋企對面間酒樓,即係話呢間酒樓,對於我呢個老街坊嚟講,似乎唔係...
-
話說新年就到,同各大客戶拜年就少不免,於是就要 Designer 去整張賀年咭,要求就只係一兩句: Could you please quickly design one? With again, our cloud favour? No need to be very RE...
-
呢排個髮型好似開始失控,噚日一朝早就去咗剪頭,順便去睇吓有無乜嘢好啱買,再去 Fitness First 完成最後一次 Workout. 跟住又係搬嘢嘅時間,其實都搬得七七八八,係剩返啲濕碎嘢。所以都只係搬咗一轉,再响新屋度執吓嘢咁。 可能知道要轉換環境,有少少忐忑,瞓...
-
之前食飯睇到有隻 64GB 嘅手指,9xx. 今晚放工去 298 睇,只係 869. 可惜嘅係略嫌大支,唔係我嘅 style. 唯一可以做嘅,又係等。