呢幾日諗緊一個難題,話說有個朋友,中學識嘅。我無同佢同過班,剩係同佢一齊讀過一個星期先有兩堂嘅 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
-
憎,一個可圈可點嘅字,每人嘅定義都唔同。唔鐘意可以叫憎,討厭亦都可以叫憎。但係乜嘢定義都好,都係負面嘅。但係,我哋又需唔需要去憎一個人呢? 如果一個乞你憎嘅人,係朝見口晚見面,你憎佢,就好似罰自己咁。一個你唔識嘅人得罪咗你,你憎佢,你又唔會記住,憎嚟都無謂。 與其去憎一個人,不如...
-
卓小姐離開電台了,祈待她在其他媒體發光發熱,或向她所喜愛的藝術進軍。
-
WhatsApp 出咗 Web 版,對於一啲唔鐘意用手機打字嘅人係一件大好嘅消息。流程大概就係响 https://web.whatsapp.com 度有個 QR Code 俾手機嘅 WhatsApp Scan, 之後手機同網頁就會接通。好奇之下做咗幾個實驗,發現幾件有趣嘅事。 ...
-
Xmas eve - Had a party with colleague, then friends. Day after boxing day - BBQ with other friends, dinner with yet some other friends. It...
-
I've attended an ePayment course that my friend is taking. The lecturer came from America. I felt like I was in US in during the class. ...
-
Wednesday is the first day of Chinese New Year. I enjoyed the day with my family. We first went to restaurant to "drink tea". T...
-
乜嘢係 香港居民 ? 基本法第三章 第二十四條 香港特別行政區居民,簡稱 香港居民 ,包括永久性居民和非永久性居民。 香港特別行政區永久性居民為: ( 一 ) 在香港特別行政區成立以前或以後在香港出生的中國公民; ( 二 ) 在香港特別行政區成立以前或以後在香港...
-
羊 【羊 辛苦得財】 辛苦得財... 我上司話我下年交稅會交得好金 發財第12位 今年吉星全無,自閉孤獨,事業財運頗弱,只對藝術工作者有利。 出生年份 1943、1955、1967、1979、1991、2003 性格 老闆人才 羊羊天性溫馴、注重感情、重信用、老實。做事踏實、內斂...
-
最後一日,主要係執嘢,執咗啲之前無帶嘅嘢,例如中型腳架、剔撻舞鞋、電飯煲、同埋全境鏡。加埋托運嘅零食,原來咁又滿咗一喼嘢。 等 A11 嘅時間,落雨了,唔通連個天都唔鐘意我? 好彩雨並唔係太大,而且落車嘅地方係有蓋,唔會淋濕。响車上,見到迪士尼嘅煙火,過咗青馬橋,小睡咗片刻,...
-
三至四人嘅 China Team 做嘢,香港雖要多一個 Programmer 包底,一個 QA 做 Testing, 半個 PM 去睇實個 Project. 响香港,一個 PM 可以同時睇 4 個 Project, 即係個 PM 睇少咗兩個 Project。一人個 QA, 可以同...