呢幾日諗緊一個難題,話說有個朋友,中學識嘅。我無同佢同過班,剩係同佢一齊讀過一個星期先有兩堂嘅 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
-
IT 係男仔為主嘅行業,十個有九個都係仔嚟。不過呢排返駕駛學院學車,係十個有十個係佬... D 女去晒邊? 咪响晒門市同 call center 度囉!
-
種族歧視條例通過,呀差、鬼佬、賓妹就會絕跡? 不如整個行為歧視條例,咁講粗口、吸煙、打尖就唔會俾人咀藐藐。 點解我地嘅政府唔係先從教育著手? 為人父母嘅點解對仔女無家教? 未有做好配套就立法或者推出嘅政策,作廢嘅多。例如: 機舖唔俾食煙、母語教學。 呀差、鬼佬、賓妹變成...
-
曾任權話國家廿年嚟嘅繁榮倡盛同改變,造福今日嘅香港。即係話香港人係靠六四先有今日,亦即係話香港人無用要靠北京政府接濟。
-
早起嘅一日,要坐直通巴上深圳去貴陽。要早起之餘,早到買唔到麵包做早餐,搭的士重要隧道費貴過車費,加上第一次去深圳坐飛機嘅不安,心情極唔老嚟。 去到深圳機場,聽聞響鐵梯等,點之有幾條嘅鐵梯,加上重要人物無手機 roaming, 老點指數上升。響機場兜咗個圈,想去麥記食個早晨全餐...
-
屋企換咗 LED 電視,好似好多嘢睇,都係時候為部電腦加入數碼電視嘅大家庭。要求我似為好簡單,一張硬解硬壓嘅 TV Tuner. 但係行咗幾日,似乎硬解無乜可能,大部份都係要用張 Display Card 做解壓,似我張舊嘅 Display Card 嚟睇,睇嚟要報銷。硬壓嚟...
-
响公司做嘢,真要成條人命賣俾佢,前一兩年已經有一兩個同事捱到個胃同腸有事,呢排有一個同事話有高血壓。大佬,全公司大部份人都未夠三十歲,做乜攪到個個都殘晒呀... 自求多福...
-
今日早少少返咗屋企,等睇辯論。一開場,梁生讀穚講完政綱,唐生就話佢唔個「猿人」,要同大家道歉云云,聽到我一頭霧水。Public Speech, 唐生真係一個好好嘅反面教材。之後講講吓普選,又話如果2017年一人一票選特首唔成功,2020年都唔會有一人一票選立法會,要脅全香港市民乎...
-
行頭入鬼屋嘅一定唔會驚,因為工作人員嘅出現到你嘅經過有 reaction time, 反而你係一個 signal 俾工作人員去嚇你後面嘅人。 今晚去到最後鐘馗捉鬼都幾 ok, 唔係行第一個,氣氛亦好夠。