Saturday, November 06, 2010

Sports highlights: Golden Gate Park to Golden Gate Bridge Ride

Normally I don't talk about my own sports activities here. For one thing, I don't do that much. The only things I like are golfing and biking. I still haven't played my annual 18-holes (not even 9-holes) this time of the year. Doesn't seem like it's gonna happen. I used to do a few hours of bike ride about once a month and I've tried almost all flat trails in the Bay Area but my biking has been reduced to mostly 15 minute trips between Caltrain and office. Nothing really interesting to share, until today. Well, everything changed in August when I thought my folding bike was broken (and thus gave me a perfect excuse to buy a long-wanted road bike as a replacement) I started with some easy routes (like this) and then some harder ones. Finally I have the most fun bike ride in years. I took me 4 hours to hit all these landmarks: Conservatory of Flowers, Palace of Fine Art, Golden Gate Bridge, Sausalito, Legion of Honor, Cliff House and back to Golden Gate Park (photo).

Friday, November 05, 2010

Music of the day: Telemann Viola Concerto in G

On Aug 30th 2010, 103 violists played this piece together in Berkeley (this ViolaMania was probably a record breaking event)


Too bad I hadn't started on viola at that time yet. The event allowed everyone who could play the piece to bring his/her viola and play!

Thursday, November 04, 2010

Sports highlight: 由1993等到2002,等到星期一

講的當然就是新科棒球World Series冠軍三藩市巨人隊。我由92年左右開始追Baseball,看得最多的是Rangers, Astros, Braves, White Sox, Cubs。(前四隊都在近十五年打入決賽。)不過92年球季最令我印象深刻的是當時在Pirates的年輕巨星Barry Bonds,在季後賽對Braves失利無緣打入決賽!此後Bonds加盟巨人隊,由於經常到SF/Oakland遊玩,也漸漸對巨人隊及A's產生好感。該球季初至中段,巨人隊勢不可擋,暑假我在香港,最期待姐姐寄來巨人隊及A's新聞的剪報(Thanks!),誰知季尾竟然又被Bonds的死敵Braves追過,連季後賽也無法打入!2002年WS Game6功虧一簣,又再次失望。今季不被看好,竟然就是成功的一季。要分析,十萬字也寫不完,還是看專家Peter Gammons吧(我覺得很有見地

Tuesday, November 02, 2010

Topic of the day: the digital music business

As a long time Rhapsody subscriber/listener, I didn't even know the company was spinned off. Doesn't sound like good news. I guess it's really hard to make money there. A former player in this business, Imeem's founder Dalton Caldwell, explained why. Of course, current players like startup MOG's founder David Hyman sings a different tune. I recommend reading
this. It's an interesting read because what the author said about MOG was rather negative.

Monday, November 01, 2010

Tech of the day: java.util.HashMap

I used to think of HashMap as a easy-to-use class. You put a key-value pair in. Get a value out using the key. How complicated could it be? Oh well, apparently it's more complicated that I gave it credit for. I learned 2 things in the past few days. I tried using objects that I defined as keys. I knew for sure I need to override the boolean equals(Object obj) method so that two keys that are different objects but representing the same data will be treated as the same key. What I didn't know was that I also needed to override the int hashcode() method! Without overriding it, keys that are different objects but representing the same data will have different hash code and thus treated as different keys. One simple way (not always distributes the objects well in the Hash, depending on your data, but it will work) is to keep a running total starting with 0. Multiply by a prime number and add the hashcode of a data field to the running total. Repeat for all data fields you use for representing the same data. Another mistake I made was that I needed to iterate through all the keys and remove some of them depending on its value, I got a java.util.ConcurrentModificationException. The fix? Instead of removing keys from the HashMap, simply call remove() on the iterator to remove the element last seen. (Yes, the underlying HashMap will reflect this removal)