呢幾日諗緊一個難題,話說有個朋友,中學識嘅。我無同佢同過班,剩係同佢一齊讀過一個星期先有兩堂嘅 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
-
今年立法會選舉臨近,其實心已有所屬,但係想用一 D 另類嘅方法,睇吓可唔可以好客觀咁分析選舉 初探港島區: 縱觀大部份選舉,人氣、形象似乎比政綱、政績重要,自問小弟無能力去做一個選舉調查,但以 Google 作為一個工具,未嘗不可。 *先以人名作為關鍵字,若有太多不相關結果,加入...
-
好鐘意睇費達拿對羅迪克,節奏夠快,唔會悶。唯一不足係費達拿屈機式嘅 Ace 波,一球、兩球、三球、四球、Game Federer, 都幾無癮。可能係鋤強扶弱嘅心態,每一次都係支持羅迪克,每一次都係屈居亞軍。依家 break point, 唔知結果會點?
-
Communiation - 溝通 Community - 社區 Communism - 共產主義 三個唔同嘅字但字根都係嚟至於拉丁文 communis. Communis 可以再拆成 com- 同埋 unus. Com- 解「一齊」而 unus 解 「一」。 Communica...
-
呢排喺社交媒體上見到好多人分享啲所謂好好用嘅 prompt,話係可以幫到手提升效率或者創新嘅秘訣。不過,你以為真係咁簡單?我諗真係有用嘅秘訣,行家唔會咁輕易就分享出嚟! 所謂「知識就係力量」,有啲嘢,特別係真正有價值嘅,分享出嚟就等於係將自己嘅競爭優勢交出去。就好似啲大師級嘅人物...
-
有說,早起的鳥兒有蟲吃,呢日係成個旅程最早起嘅一日,習慣咗每朝起身都望出個窗,睇下天氣如何,再決定行程。呢日係去布拉格嘅日子,行程就定死咗,不過望出窗口之後,靚到不能形容。空中嘅雲海,反射日出嘅晨光,拎相機、開窗、Zoom, 㩒快門,如果再開揚啲,你話幾好。 食過早餐,按照...
-
話說網台有 節目 講太平山嘅故事,雖然之前都做過少少 Study , 但都想睇吓有無乜嘢新發現,於是又再週圍咁搵吓。發現 政府網頁 依家有講太平山名字嘅起源,而網頁入面嘅文字,亦都有好多唔同嘅網頁引用。 搵搵吓,搵到另一個 網頁 ,話可以睇吓1898年嘅維多利亞城地圖喎,就...
-
呢個世界無如果,但如果我上個月無清倉,我股票嘅投資組合會唔見咗差唔多 13%!!! 宏利跌得尤其犀利,無咗 22%, 究竟發生乜事? 計落都肉痛,蝕咗真係唔知點算... 都夠我去幾次澳洲...
-
今日博士開 Talk, 講 Big Data + Data Mining. 我諗呢堂係咁多年嚟第一次上堂,溫故而知新,一樂也。
-
今日第一堂,遲咗少少走,跟手又無的士,成個上環嘅馬路又塞晒,搭地鐡又要行餐死,反正都係行,一於行少少過中環搭電車。去到 APA, 個排舞室點解無人,唔通老點? 唔理,買支水先。買完水,再去排舞室,有幾個學生响入面,但唔係上堂... 左問又問之下,原來轉咗房... 足足遲咗3個字,...