May 31, 2006
Posted by geoffreyzheng under Programming
Leave a Comment
DDJ has an article about a nice and simple C++ message processing technique.
template void dynamicDispatch(MessageHandlerBase* handler,MessageType* self)
dynamic_cast*>(handler)->process(self); // should test against NULL from dynamic_cast
class Message1 : public MessageBase
void dispatch(MessageHandlerBase* handler)
template class MessageHandler : public virtual MessageHandlerBase
virtual void process(MessageType*)=0;
class SpecificMessageHandler : public MessageHandler, public MessageHandler
Only the handler of specific message types needs to include message declaration.
Double dispatching refers to calling handler.process from message.dispatch. Dynamic refers to the dynamic_cast. message.dispatch can be a macro to save copy-n-paste.
May 24, 2006
Posted by geoffreyzheng under China
Watched a great program tonight. Well the whole night is great! Had pot sticker with left over stuffing from last Saturday, and dumpling wraps I got from Chinatown at lunch. Watched another program on China’s environmental issues before BoB, not great, but still excellently produced with balanced and multi-angle perspectives, just what you expect from PBS (when can China has a TV channel like that?). After BoB, got a glimpse of the last 1.5 innings of Yankees-Red Sox in HD on INHD, during which Mariano gave up two base hits but still managed to get the job done. And I’m writing this blog now. Life is good.
Back to the program. The schedule says it’s about “six Chinese Americans share their experiences of what living in Beijing has been like during the past 20 years.” Now what experiences they are! The only somewhat famous person among the six is Kaiser Kuo, one of 唐朝’s founding members. The two other men presented both work in IT (one entrepreneur, one programmer). The three ladies all work with arts to some degree, one in movie business (she overdubbed for 关之琳 in 大腕 for both Mandarin and English, since apparently 关大美人 is good at neither), another a media artist, another a photographer/journalist.
The one natural thing that they all talk about is their identity issue. Are they/do they think of themselves as/do people perceive them as American or Chinese? Kaiser was crystal clear that he’s American even though he’s the most content with his life in China with wife and kid and work and doesn’t want to change anything (I wouldn’t either, if I had a loving family and like my well-paid job and play rock’n’roll for fun!). The other guys/gals aren’t so sure. A couple of them say they feel they’re somewhere inbetween, or sometimes here and sometimes there. This is the thing that strikes me the most, about which I’ll talk more later.
The programmer is quiet and calm but actually very funny, somewhat like Initech’s Michael Bolton. He went to work in Beijing for Levono from Silicon Valley after losing his job in the dot com bust. He said the first weird thing is 广播体操 twice a day (which I think is a good think for computer workers). Then one time there’s a company-wide broadcast about some “anti-corruption meeting”, and no one is supposed to do anything but sit in his/her cubical and listen to the radio broadcast, of which a “little people” was going through the whole office to make sure, who first told him to stop working to listen to the “very important broadcast”, and stopped him again when he was “just munching on some cookies”, where he “almost lost it”.
They didn’t mention 6-4, but they did talk about the anti-American movements due to the bombing of Chinese embassy in Belgrade and mid air collision, and the celebration after the 2008 Olympics was granted to Beijing. One girl said that her Chinese boyfriend said “I want to go protest at the US embassy, but then I realize I can just stay home and protest you” (I kind of remember seeing this somewhere before). Irrationally exuberant nationalism has led to the most horrific atrocities in human history. Do Chinese have any memory? (Well they really can’t when the “great, glorious, and correct” CCP doesn’t allow any one to say anything about the 40th anniversary of the Cultural Revolution!) It reminded me of the heated discussion in my college class’ email list after 9-11. I never claim to be always impartial and rational and logic. I had my moments of crazy nationalism in college after the Chinese men’s ping pong team won the world championship, when I set a broom on fire and paraded around the courtyard outside our dorm, oblivious to my hair and back catching some flame. But cheering for the death of thousands of innocent people with many Chinese among them? That’s some serious water damage in the brain.
Back to the identity issue. Some of them say it’d be nice to be half time here and half time there, and some do. To me, they’re truly Americans. Just the way they talk with freedom and confidence. Of course they’re good Americans, not the stereotypical fat stupid self-centered kind, like whom else but the president. I can never talk like that. And if they’re struggling with their identities, what am I supposed to be? Sure I’m a hell lot more Chinese than they are, spending only the last 1/4 of my life in America. But just like some of them, I have no idea what future is like, where I’ll be, or where I want to be. I can swear (at least for now) that I’ll never get US citizenship, because that officially means you’re no longer Chinese, and you’ll never really be American no matter how bad you want to and how hard you try. Maybe your kids can get close, like those people in the program.
One definitely positive thing I got from the program, though, is that life in China is moving forward, no matter how painfully for some people and for the environment. The previous program poses the dilemma for Chinese government to keep economic growth strong to ease/hide social unrest and yet deal with environmental and all other issues that come with industrial development. I think I read somewhere (maybe in my head) that China is dealing with almost all problems all societies have faced in the last 500 years combined. Human survive, and learn, albeit at huge costs some times. The CCP isn’t strong enough to stop the wheel of fortune–no one ever is; and it’s not stupid enough to think it can.
And again it boils down to the tiny me: what am I supposed to do?
May 16, 2006
Posted by geoffreyzheng under China
Leave a Comment
I got this idea this morning when thinking about how to write the blog about yesterday.
Now this is something I’d love to do if I were in Beijing:
One day every weekend, I would gather 4-8 people, mostly young college students I suppose, at a meaningful site in Beijing. I would research any cultural/historical materials related to the site, but I won’t try to be comprehensive (I can’t) and I’d encourage the participants to do some research ahead. We would go around and talk, using headsets in order not to be intrusive and obnoxious like a tour group (I will NOT hold a red flag herding the group here and there).
May 15, 2006
Posted by geoffreyzheng under Eat&Drink
Leave a Comment
After 4 trips to espresso-gulping Europe, the $20 machine from Walmart seems, well, too cheap. Encouraged by the fantastic deal and result on the Chef’s Choice 667 slicer, we went to Marshall’s and happily found this cool red Koala Espresso machine.
Now only if making a Starbucks-quality (no I’m not asking for Parisian cafe quality) espresso is half as easy as making perfect lamb slices. I’m overwhelmed by just browsing through the manual. Spent almost an hour running water through the machine to prime it and get a sense for its operation. Then this morning about 45 minutes got me a sour cup of coffee and a late commute.
Hopefully knowing and practicing the following won’t take longer than the machine’s warranty. Most info is from Koala’s website:
- Coffee bean: let’s not deal with different kinds of beans for now. There’re generally 3 kinds of roast: light, medium, and dark. Light isn’t good for espresso. Dark roast has a oily (high gloss) surface and tends to stick together.
- Coffee ground: grinded as close to brewing as possible. Dark roast should be grinded coarser than medium roast. The grain should feel slightly finer than granulate sugar. Burr grinder is better than blade. Given that we’re using Illy and Masim’s for now, I only have the next two steps to worry about.
- Tamping: about 30lbs of pressure. This is probably why I failed this morning.
- Brewing: Double shot = 2 to 2.5 fluid ounces in 20 to 25 seconds
2nd time is much better. There’s definitely crema (golden foam). It tastes a little bit sour at first, but then some nice coffee flavor lingers in my mouth for hours. Tamping is probably still not enough (I can hardly press down to 20lbs, according to a weight), and I don’t like the tamper as it’s hard to hold and press down. Also I probably let too much water through. Will go to Starbucks today to taste theirs, and watch how they do it.
UPDATE 2006-08-18: I asked a guy in the restaurant downstairs in my office building, and he showed me that they use a tamper attached to the grinder so it’s very strong.
Also the Koala is the immediate reason for our kitchen renovation, since we don’t have any room for this beautiful machine…
May 12, 2006
Posted by geoffreyzheng under Travel
Leave a Comment
It seems a bit too late to write about our 2003 trip. My best friends are going there soon, so I’m writing this for their reference.
We still find it the best among our 4 European trips so far: weather, food, Gaudi, Alhambra, flamenco, bull fight, flower, … What a first impression!
Roughly in descending order of interest.
||Prado and Sofia Museums|
Ermita de San Antonio
Plaza de España
Plaza de Toros de Las Ventas (for bull fight)
|Parque del Retiro
Did I say Gaudi?
Palau Musica Catalana
Palau Reial Major
Pobel Espanyol on Montjuic
||El Patio Sevillano (too toursy)|
Tablao Cardenal (flamenco)
|Alcázar de los Reyes Cristianos
Mirador de San Nicolas (to see Alhambra at sunset)
We knew nothing about Spanish cuisine except maybe paella, but what a treat we got! The consistently tasty paella, the endless variety of tapas, and the refreshingly intoxicating sangria…
- Casa Mingo: Paseo de la Florida 2, right on the way from metro Príncipe Pio to Ermita de San Antonio. Have roast chicken with their self-made cider so that you won’t get dizzy later staring up at Goya’s masterpiece.
- Cervecería Alemanic: Plaza de Santa Ana 6. On a very relaxing plaza, famous for fried sardine and Spanish omelette. The waitor is super cool: he took our order without writing down anything, then when we asked for check he wrote down everything on a napkin. Now that’s professional!
- Cervecería Santa Bárbara: Plaza de Santa Bárbara 8. Nice brewery. We had oystery with beer, yummy!
- La Plateria: Calle Moratin 49. Across the street from Prado, we had our first sangria there without knowing how strong it is. We got dizzily happy and took a nap in Jardin Botanico before going to Prado. Food, wine, great arts–life is beautiful!
- BaBaReeBa: Passeig de Gracia 28, between Plaza Catalunya and Illa de la Discordia. Cool decor, excellent food, way better than those toursy places on Las Ramblas.
- Pastisseria Escriba: Ramblas 83. Close to the colorful market La Boqueria, this is known as the most spectacular pastry shop in Barcelona.
- Sevilla: Cerveceria Giralda at Mateos Gago 1, very close to Giralda. Very nice tapas, we even saw the waiter in the tourbook photo and got his signature.
- Cordoba: Taberna La Lechuga at Tomas Conde 12, very close to Mezquita. Definitely the best tapas bar we went to.
May 8, 2006
Posted by geoffreyzheng under Travel
Leave a Comment
Exhausted, but how rewarding it is, as always.
Didn’t get wi-fi in Brussels, and couldn’t connect in Paris though there’re tons of APs (most are protected). When I checked out the hotel I saw a Linksys AP at the concierge, but wouldn’t have time to blog anyway.
Just record some fleeting thoughts here, to be expanded in our never-finishing travel site:
- The Dutch houses usually have their living room at street side, with a large window WITHOUT curtain. This is the same in all 3 Dutch towns we went to: Sassenheim, Haarlem, and Amsterdam. I wonder if it’s because they don’t care about their own privacy, or they don’t care about other people’s lives so nobody peeks. It’s wonderful for us, though, to peek into many tastefully decorated living rooms to get the ultimate reason (for me) for travelling: witness different lives as they happen.
- If I have to pick my favorite country/place in this trip, it’d be Belgium/Brussels. Big factors: Tintin, beer, and Art Nouveau. I absolutely love the comic walls in Brussels. Turn a street corner and you see a piece of art, intimate and accessible. The ‘t Brugs Beertje in Bruges is a beer lover’s paradise. Brussels’ Art Nouveau buildings aren’t as striking as Gaudi’s, but they’re still fine living monuments.
- Paris is too big and sophisticated to take in 8 days. It didn’t help to have 3 days of bad weather, May Day when everything is closed, and my aching ankle. Some quick notes of do’s and donnot’s:
- Best panoramic view is from Notre Dame, because it’s in the middle of the city and close to most sites. Arc de Triomphe is also good. Sacre-Coeur and La Defense is too far, and Eiffel is too high, and Paris at night is way too dim to be called the City of Light!
- Do NOT go up La Defense. It’s not covered by museum pass, and the tall buildings around it block most views of the city.
- Best underrated museum: Plans-Relief. Have some stunning city and landscape models. The one for Mount St. Michel is incredible. Later I found out from a book we bought that we only saw one wing of it due to construction, whereas the whole museum should take one full floor of the Invalides.
- Most relaxing museum: Rodin. The garden is perfect for afternoon nap: there’re several lounge chairs.
- Best moments: riding bike in Versailles garden. My ankle was hurting badly those days, so I felt like flying on a bike. We went to all borders of the garden, seeing only a few locals jogging in the vast woods. At the end of the Grand Canal, the chateau can hardly be seen, along with hordes and herds of tourists.
- Do NOT go to Delacroix Museum (though it’s covered by museum pass). It’s a tiny house, and the courtyard is just so. Delacroix’s works are pretty impressive, and he must be seething in his coffin when the Rodin and Picasso museums are so much better compared.
- Best cafe that we went to: Flore en Ile (something like that) on St. Louis island. We had stunning hot chocolate (I think it’s better than what we had at the so-called Paris’ best Angelina, which is pretty good, and different), and very nice Tarte Tartin.
- Best for our stomach: this is a shame to admit, but it’s a Chinese restaurant (万里香 at the corner of 温州街). There’s just nothing like a hot noodle soup at the end of a day. The taste is very authentic, and the restaurant always crowded.
- Biggest disappointement: Amélie’s Café des deux Moulins. I didn’t read the direction carefully enough, and thought it’s on the north side of Rue des Abesses along Rue Lepic. We walked up the curved street all the way to Rue Norvins, passing one of the only two remaining windmills in Montmartre (Moulin de la Galette) on the way. We cut back to Rue Lepic and still couldn’t find it. I was very stressed out and rain was pouring. Luckily, as we walked back toward the metro J noticed the cafe. The interior is dark and messy, hardly recognizable from the movie. The screen on which Amélie wrote the menu backward is gone. There’re only a couple of movie posters on the wall. There’re two ugly unhappy waitors. I guess the French just don’t care about one of the most popular French movies of all time.
- There’s no coincidence that most great modern cities have at least one great urban planner/architect associated with them. Paris was created by Baron Haussmann, New York by Robert Moses, Vienna has Otto Wagner, Berlin has Karl Friedrich Schinkel, Brussels has Victor Horta, Barcelona has Gaudi. Now think of what’s been happening at Chinese cities…