I've been writing some socket-based code for an upcoming column, and it worked really
nice when I used localhost for the client and server on another machine, but broke
when I tried to use the machine name.
Just something else I didn't know about networks. localhost is not the same thing
as the local ip address, but is rather a totally separate address.
If you want to create a TcpListener, you should use IPAddress.Any as your parameter
for the IP address. That will do what you want.
Le Tour de France 2003 started
last weekend. The tour, if you don't know, is a 2000ish-mile, three-week race
up and down the mountains in France. It's widely regarded as one of the toughest physical
The best coverage in the US is on OLN.
The offbeat and often insanely funny Brunching
Shuttlecocks website has closed. Well, it hasn't actually closed, but they've
stopped updating it. The site is still there, with archived content.
From their wonderful movie
reviews, to their offbeat
ratings, they've written the kind of comedy I sometimes aspire to write.
I highly recommend the "The
Book of Ratings", which is an assembly of ratings from the site, in portable dead
The Online Slang Dictionary is
a reference everybody needs sometime, especially those of us who find it increasingly
hard to appear cool to our 9-year-old daughters.
I've finished a new version of my Regular
Expression Workdbench, and it's now available on gotdotnet.
If you use regular expressions on .NET, or you've heard about them but haven't really
tried them, this tool can help you a lot. If I do say so myself.
As an old Perl guy (in both senses of the word "old"), I've spent a fair amount of
time writing regular expressions. It's easy to try out a regex in Perl, but not so
easy in a compiled language like C#. I wrote the first version of this utility a couple
of years ago, and in the first version, all it did was let you type in a regex, a
string to run it against, and execute it.
Over time, it grew. The next version supported some fairly cool features:
This version adds a few more features:
Comments & suggestions are always welcome.
If you take a lot of digital pictures (I have 7000 images on my laptop right now,
and lots more archived), you spend lots of time copying files across to your computer.
Most cameras come with USB cables, which aren't really that useful.
My preferred solution is a CompactFlash
PCCard adapter. You take the compact flash out, plug it into the adapter, and
slide the adapter into your laptop. At that point, it looks just like a disk drive,
as compactflash cards look like IDE drives. Easily copy the files across and delete
the existing ones, without having to use camera power. It's also a bit faster.
You can also get these for other storage formats.
These two contraints - what you want to do with the aperture or shutter speed, and
what the camera needs to do to give you a good exposure - sometimes come into
conflict. If you take a picture of moving water, you often want a slow shutter speed
(1/30th to 1 second, depending on the effect), but if it's a sunny day, you'll overexpose
at that shutter speed.
Enter the neutral-density filter. With the the filter, you get a 3-stop (3 factors
of 2, or 1/8th) decrease in the amount of light that comes in. That means that
instead of an exposure of F16.0 at 1/125th of a second, you can either open the lens
up to F2.0, or lengthen the exposure to 1/15th of a second.
I used this last night on some fireworks, just so the CCD sensor doesn't get overloaded.
The cool part is that it's just a setting in the recording menu, and everything else
works the way you'd expect.
Our trip to Maui involved lots of camera issues. We're a Canon family, with a G1 for
me, an A20 (the aforementioned waterlogged A20) for my wife, and a low-end Canon for
my 9-year-old daughter (bought after she shot 15 rolls of APS film in Europe last
My G1 has been a great camera. It's not quite as flexible as an SLR - you don't get
interchangable lenses, and it doesn't zoom enough to do kid's sports, but overall
I take a lot more pictures. My plan was to take the G1 to Maui with me, but 3 hours
before the flight I realized that I had left it at our ski cabin, so it was time for
an unscheduled upgrade. I chose the 4
The G1 is a "prosumer" model. It has 2048x1500 resolution, decent glass, a 3x zoom,
aperture and shutter priority, manual focus, a really-nice flip and tilt-LCD, and
a bunch of other features I've probably forgotten. The two features that had the most
effect on my shooting are the tilt-LCD (take high and low angles easily), and the
multiple-exposure panorama (aka stitching) support. Both let you get shots that you
just couldn't get before.
It's amazing how much better the G3 is than the G1.
The faster processor is great, as is the high spead multiple exposure. When I take
candid pictures (of kids or adults), I like to take 5 or 6 exposures in every situation,
and this gets them muh faster. The better zoom is great. There are two features especially
worthy of mention.
The first is the intervalometer. I used this to take sunset pictures one night, and
just set it up to take pictures while we barbecued and drank Mai-Tais. Every 55 seconds
or so, the camera would turn on, take a picture, and turn off. Neat
The second big new feature is the neutral density filter. It reduces the light by
3 stops. So, why would you want to do that?
The two big variables in photography are aperture (how much the lens is open), and
shutter speed (how long it's open). To get the right exposure, these two variables
have an inverse relationship - the more the lens is open, the shorter the exposure
needs to be. The aperture also controls the depth of field, so if you want everything
in focus you need a small aperture (big number), or if you want the foreground and
background out of focus, you need a large aperture (small number). Similarly, if you
want to stop action, you need a short exposure time, and if you want to blur action,
you need a long exposure time.
of Secrets - Anatomy of the ultra-secret National Security Agency (James Bamford,
With the exception of the stillborn "Clipper Chip", the NSA has done their best to
stay out of the public light. This book discusses how the NSA was formed, what it
does, and how it does it. It also exposes some interesting information - that the
Joint Chiefs had plans to attack Americans and blame it on Cuba, and that perhaps
the same thing happened in the Gulf of Tonkin.
After reading this book, I'm somewhat conflicted over the NSA. Sometimes, I think
they're an incredible national asset, and that the intelligence they gather makes
the world a safer place. Sometimes, I think they're the biggest threat to personal
liberty around. And other times, I think they're an agency that has become increasingly
irrelevant with the spread of the internet and strong encryption.
Spent the last 10 days in Maui (Pictures),
with no internet connection. This a a computer-free post.
6/25 Blue Water Rafting
This morning, we went on a charter boat operated by Blue Water Rafting. This was a
trip in a small, 7-person Zodiac-like craft. The boat left from Kihei Boat Ramp (definitely
an advantage if you're staying in Kihei), and we journeyed south to the most recent
lava flows (circa 1790). We spent a lot of time very close to the lava or inside some
caves at the side.
The trip included 5 stops for snorkling, including 4 sites on the west shore and the
obligatory trip to Molokini. Molokini is the
top of a cinder cone with a reef on the inside, and part of the cinder cone under
water. It is the #1 snorkling destination on Maui. This mostly because it's fairly
big and can support a lot of boats, but there are better places to journey to. It
does have the advantage of being fairly sheltered, and the reef is pretty.
1) You rent the boat, you choose where it goes.
2) Spend time where you want.
3) Nobody else goes close to the lava flow.
4) Snorkel with Dolphins (if you're lucky), or off the backside of Molokini.
5) Captains know where the fish and the turtles are.
1) Ride is very rough (the rafting moniker is deserved)
2) Breakfast and lunch are limited (muffins/fruit, sandwiches)
3) Expen$ive. For the 6 person boat for 5 1/2 hours, you will pay $800. That's helicopter
Waterproof Camera Housing
I got my wife a waterproof housing housing for her Canon A20 camera (about $150).
You put the camera in it, seal it up, and it has controls on the outside. The display
might as well be off, and it's hard to look through the viewfinder, so I had my best
luck pointing and shooting. It helps immensely if you can surface dive, as the fish
are often 15 or 20 feet down. A nice option, especially since waterproof housings
for my G3 cost around $800.
6/26 Snorkling at the Fishbowl. Or, perhaps the aquarium. We're not sure.
On the advice of our captain, Kim and I and my sister and brother in law decide to
snorkel at the "fishbowl". It's near Ahihi
marine preserve (also a great place to snorkel), but to get there you have to
a) find the trailhead and b) hike for 30 minutes across the lava field. Not as bad
as it sounds.
Once we get there, we find out that this is now a destination for sea kayak tours.
3 boats when we get in there, which isn't bad, but another 20 arrive when we're snorkling,
which means avoiding them and the 40 people who don't really know how to snorkel.
The four of us go outside the bay, and Kim and I see a turtle, but that's about it.
We come back in, dry off, and hike back another 30 minutes to the car. Not really
better than Ahahi.
6/26 Canon Waterproof Camera Housing (redux)
Used the waterproof housing again today. My wife and I conspired together, which is
never a good thing. If I had prepared the camera, it would have been fine, and if
she had done it the way she wanted, it would have been fine, but unfortunately, she
did what I had said, and left the carry strap on, but didn't get it tucked in sufficiently.
The housing worked fine for about 10 minutes, but then I got it down about 3 feet,
and it quickly filled with water. I did all the the right things (kept it wet,
soaked in in fresh water for a long time to get all the salt out), but the camera
is DOA right now. I may try cleaning it more once I get home, but it's probably a
goner. Sigh. Off to EBay...
6/26 Kinston Technology 128MB Compact Flash Card
Despite the warning on the back that says, "do not bend this card or expose it to
strong physical or electrical shocks, water, solvents", the compact flash card from
the camera survived immersion in salt water fine, and I was able to pull 12 pictures
off of it. It's a bit like looking at the images of the Challenger before it exploded
and knowing that something bad is going to happen, as you can see a bit of fog on
some pictures, and then the last picture has droplets inside the lens.
6/29 Maui Thoughts
Maui is certainly a wonderful place. The weather in Kihei (and presumably, also in
Kanapali) is perfect - not too hot, not too cool.
Unfortunately, it appears that everybody in the Western Hemisphere feels the same
way. Despite the lack of Japanese money for the past few years, prices in Maui make
San Francisco prices look cheap. We're in a 900 sq. ft. one bedroom condo a block
from the beach, with what is technically known in real estate circles as a water view
(ie the water can be seen if you lean out over the railing). A similar unit in this
building with no view is going for $200K. The place where we stayed last time (Hale
Hui Kai), a condo on the water, one of the units is selling for $750K. Or, you can
buy a large house 3 blocks from the beach for $800K. Oh, and if you have a condo,
you also have a maintenance fee of $300 a month.
I've been working on some code to do peer-to-peer communication between .NET applications.
I won't give away all the details in it right now, since my next column will be on
it, but I spent a fair amount of time trying to figure out the answer to this question.
If you look for examples in the doc, you'll find that they do something like:
This code enables somebody connecting to our program and getting a remote instance
of MyRemoteClass. It's not terribly useful, however, since it's a stateless model
- there's no way to get anything back other than a new instance of MyRemoteClass.
What you typically would want is to hook up to an already-existing instance.
So, I started search the RemotingConfiguration class, to see what I could find. The logical thing
to do would be to have something like RegisterInstance, but there's nothing like that
to be found. After about twenty minutes in Google Groups, and I find the answer.
I note this not to show how to do this - though I think this is useful - but to highlight
the problem of letting your developers name the methods in your class. While
"Marshall" may make perfect sense to the class designers, it makes very
little sense to me.
I ran into Chad Meyers from ActiveWin when
I was at TechEd a week ago, and he hit me up for an interview.
Aside: Being in a convention in Dallas is like having a fever. You're either hot and
sweaty, or cold and shivering.
I bought a Roomba this week.
It's a $200 robotic vacuum cleaner made by a company named iRobot (wonder if Asimov's
estate gets any fee from that). Works pretty well at finding its way around the room,
though the first time we ran it, it bumped into a picture leaned up against the wall.
The second time it bumped against the wall, the picture fell, and landed on Roomba.
Roomba got stuck, and shut off.
After that, Roomba got scared and went and hid under out bed at the other end of the
Review: Well, two sessions does not a good product make, but if you're willing to
sweep the pizza boxes and cans to the side, it does a pretty good job, and it's fairly
amusing to watch. You do have to hook it up to a charger (somewhat a bummer), but
since you have to empty the container fairly often anyway, making that purely automatic
wouldn't help much. A pretty sophisticated device.
If I'm going to keep anthropomorphizing the thing, it really needs a better name.
If you have suggestions, let me know.
So, who is this Eric Gunnerson? And what will he cover here?
I'm a program manager in the Visual C# team, and I own the C# project system and our
community efforts. But I must explain what "own" means in this context. "Program Manager"
in many companies means "guy who's in charge of everything", but at Microsoft, Program
Manager means something different. Basically, PMs are the glue that holds the
I also write an MSDN C# column named "Working
with C#" (no, I didn't name it) , and I'm the author of "A
Programmer's Introduction to C#" from Apress.