呢幾日諗緊一個難題,話說有個朋友,中學識嘅。我無同佢同過班,剩係同佢一齊讀過一個星期先有兩堂嘅 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
-
去做 gym 時見到蔚藍色嘅天空,即刻走去差相機電池,之後去數碼港,睇吓可唔可以影到日落。早到咗少少,太陽太光猛,影吓雲境,都唔錯。差唔多時間,六點八 set 好腳架,起動! 影咗成個鐘,差唔多八點,想收工之際,竟然見到北斗七星! 都有年幾無見囉,唯有留耐少少,影多半個鐘。想...
-
趁放假去金鐘拎車牌,人唔算多,用咗份舊 form 申請,要再填過。填完 form, 撳完 EPS, 睇住將咭過膠,換返嚟嘅係一張連相都無嘅車牌... 我問女職員:「係咪完成㗎喇?」佢答:「去駕車啦!」「哦! 唔該晒...」
-
今日公司聚餐,食到一碟雞,問起有乜意頭。我就 up 咗以前年尾「無情雞」嘅習俗。為免知其然而不知其所以然,今晚再上網查吓。 只係大致上經濟唔好嘅年尾做尾牙 (或者年尾最後嗰餐),老闆會特別加一碟雞做餸 (以前嘅工係包食包住,今時今日大部份大陸廠都係)。開飯時候,老闆會挾件雞頭過你...
-
睇咗幾年,咁多年來都無進步,TVB 尤其嚴重。有時候好唔明,D 導播係都要 Zoom 埋去一個大大棵嘅煙火度,個效果通常都係咁: 其實,拉遠境咪得囉,你又已經有唔同角度嘅攝影機,驚悶咪 fade 去第二部機。Zoom 近少少影兩艘船再慢慢 pan 去另一艘船又得。煙花,係要睇佢嘅...
-
香港人永遠敵不過時間,時間一長,個個都嗌退場,退唔到場,又坐定定等清場。 勿忘初衷,究竟係指和理非非定係要求普選? 說著 We will be back 到最後會唔會變成 We will be back to normal life? 大家可能對某些人嘅負出無言感激,但對...
-
呢個世界無如果,但如果我上個月無清倉,我股票嘅投資組合會唔見咗差唔多 13%!!! 宏利跌得尤其犀利,無咗 22%, 究竟發生乜事? 計落都肉痛,蝕咗真係唔知點算... 都夠我去幾次澳洲...
-
今日博士開 Talk, 講 Big Data + Data Mining. 我諗呢堂係咁多年嚟第一次上堂,溫故而知新,一樂也。
-
話說搵到工搬咗屋之後,就諗起去登記做選民,今日,就係大選嘅日子。英國嘅政治,真係識條鐵,不如講吓週邊嘅事。 話說工黨好勤力咁宣傳,今朝落樓嗰陣,重有新嘅傳單派入嚟。 本來都想投咗票先返工,但今日遲咗少少出門,都係放工先去投票。 响地鐵站嘅免費報紙,當然亦會有講大選入...
-
曾任權話國家廿年嚟嘅繁榮倡盛同改變,造福今日嘅香港。即係話香港人係靠六四先有今日,亦即係話香港人無用要靠北京政府接濟。
-
聽到有牧師話有六成愛滋病人係同性戀,所以同性戀係高危云云。搵咗篇 原文 出嚟為証,可以睇吓呢一粒數可以點玩。 4. 最後,我和你們分享我自己個人的經歷,我在三藩市牧會十多廿年,也牧養過一些同性戀的弟兄姊妹,也曾陪伴過一些因AIDS而死的同志,走他人生最後一程,我內心直至現在也不...