呢幾日諗緊一個難題,話說有個朋友,中學識嘅。我無同佢同過班,剩係同佢一齊讀過一個星期先有兩堂嘅 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
-
十月影咗唔少相,但啲相唔係太配合到個氣氛,唔打算 Post 上 fb. 响呢度記底佢算。 10月1號,唔使多講發生乜事 10月2號,話說隻牙旅行前碎咗,做咗個牙模,牙冠呢日鑲咗入口 同一日返到公司後嘅黃昏 10月3號,呢日公司攪義賣,有好多糕點,買咗件 ...
-
中學嗰陣上宗教堂,神父話天主有信、望、愛三德,當中嘅望係希望,人無咗希望就乜都無。 望住啲數字,同埋 fb 朋友們嘅反應,好明顯香港人由希望開始變為絶望,醒咗嘅人疲態盡露,開始想瞓返。 攪咗咁大場龍鳳,連斗零都爭取唔到,以後個社會會變成點,我唔敢想像。 的確,希望唔可...
-
有說,早起的鳥兒有蟲吃,呢日係成個旅程最早起嘅一日,習慣咗每朝起身都望出個窗,睇下天氣如何,再決定行程。呢日係去布拉格嘅日子,行程就定死咗,不過望出窗口之後,靚到不能形容。空中嘅雲海,反射日出嘅晨光,拎相機、開窗、Zoom, 㩒快門,如果再開揚啲,你話幾好。 食過早餐,按照...
-
Yesterday, something draw my attention. Some people were claiming that REST would become the standard way to execute web service. Some even ...
-
2020年1月23日,武漢封城,香港確診第一宗武漢肺炎,第一波就係經高鐵直送,好彩都係零星個案,第一波都未算係乜嘢,當777响度叫官員戴咗口罩都要除低嘅時候,全香港人都四圍咁撲口罩。 與此同時,正值農曆新年,大家都出門旅行,留學生回流,第二波就殺到埋身,由打邊爐家族同佛堂群組打响...
-
精神緊張之下,只係瞓咗6個鐘,要去拎錢同 Passport Application Form, 行去 Gloucester Road 站,去郵局攞好 Form. 間郵局係响一間鋪頭入面,而間鋪頭咁啱有 Western Union 嘅 Agent, 問題只係無 Passport, ...
-
落咗幾日雪,今日終於出太陽,決定去 City Park 補完,於是就帶晒相機同全景鏡,全副武裝去影相 有太陽、有藍天,比起噚日嘅較果好好多 個湖景亦都唔錯 部份結咗冰,湖面好幾硬,見到有人踩上去影相,不過我就唔夠膽咁做 竟然搵得返噚寫嘅字 去...
-
要預防疾病傳播,就要早發現、早隔離、早治理。Given 有無限資源,就可以每個星期做一次全民測試,有結果之前唔俾出街,屬於高成本制作,低效率。做全民測試,但又唔禁足,就會好似香港咁,測試完個個都以為自己無事就出街玩,攪到頭第三波到呢一刻都未斷到尾。 想有效率,當然係集中測試高危群...
-
中學嗰陣,一向都係 Microsoft 嘅支持者,我好多身邊嘅人亦都知我有幾想入去做嘢。但係知道佢 monopoly 嘅手段之後,就夢想有一日可以開間公司同佢爭一日之長短。雖然係咁講,但暗地裏依然係 Microsoft 嘅支持者,幾年前,佢 Software factories ...
-
地鐵出事,個個上地面搵接駁巴士,迫得就迫,無人識得排隊。究竟,係香港人染上咗大陸人嘅陋習,定係其實香港唔係我哋想像之中咁文明? 下次話大陸人唔文明之前,我諗好多香港人都要諗清楚自己係乜嘢人先。 香港政府以鐵路為主要交通工具嘅政策,係又咪要檢討吓? 一係無事,揩親都係大鑊嘢。