# Friday, 02 December 2005

I haven’t tried doing any WCF (formerly and still known as Indigo) development in probably 6 months or so, and some things have changed since then.  Also, this is the first time I’ve tried implementing a duplex contract.  I made some mistakes along the way, due in part to the fact that the sample code in the November CTP doesn’t match the docs (no surprise there).  Over all, though, it was way easier than I thought it might be.  Certainly easier then .NET Remoting, and the fact that there’s a built-in notion of a duplex contract solves tons of problems.

Anyway, I was trying to get my client to work, and for the life of me couldn’t figure out the errors I was getting, until it finally dawned on me.  Here’s what I had:

        static void Main(string[] args)

        {

            InstanceContext site = new InstanceContext(new CallbackHandler());

 

            // Create a proxy with the given client endpoint configuration.

            using (MyDuplexProxy proxy = new MyDuplexProxy(site))

            {

                proxy.Send("Joe");   

            }

            Console.ReadLine();

        }

    }

It’s probably obvious to everyone who isn’t me why this won’t work.  You can’t dispose of the proxy and still expect a callback.  Now that I say that it makes sense, but it didn’t occur to me for a while, since the callback itself isn’t on the proxy class. So, I changed one line to this:

        static void Main(string[] args)

        {

            InstanceContext site = new InstanceContext(new CallbackHandler());

 

            // Create a proxy with the given client endpoint configuration.

            using (MyDuplexProxy proxy = new MyDuplexProxy(site))

            {

                proxy.Send("Joe");   

                Console.ReadLine();

            }

        }

and everything worked out swimmingly.  I continue to be impressed with how well thought out Indigo is.  While many people like to point out how many mistakes MS has made over the years, you certainly can’t fault them for not learning from them. 

Friday, 02 December 2005 14:31:53 (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, 29 November 2005

Geocaching is the bomb!  I’m totally hooked.  Even in the crummy weather we’re having today, Vikki and I managed to find two caches at lunch.  We’ve been geocaching in Sisters, out to Cannon Beach, and up on the Columbia outside of Vancouver.  There are a couple we haven’t been able to find, but for the most part it’s been pretty successful.  Even if we don’t find it, it’s a great excuse to get outside and go hiking with the kids and the dog.  And the thrill of the hunt really keeps me going.  I’m hoping when the weather improves (April? July?) I can plan some longer hikes to caches in the backcountry.  We’re also planning to hide a few of our own come Spring. 

It’s also been an excuse to finally learn map & compass navigation.  I’ve been wanting to try orienteering for a long time now, and now that I’m getting practice navigating it’ll be that much easier.  I’ve found some really good books on navigation and geocaching, and I’ll try to get around to posting a list some time. 

 

Profile for SafetyGeek
Tuesday, 29 November 2005 13:47:08 (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 

Over the weekend I finally got a chance to go down to the Evergreen Aviation Museum in McMinnville.  The Spruce Goose is one big plane!  When I’d read that it was the biggest plane ever built, that still didn’t prepare me for the actual scale of the thing.  The whole museum is essentially in one big room, and the goose makes the other planes (like the “little” B-17) look like kid’s toys in comparison.  Not too surprising that it couldn’t actually fly.

The museum is very well done, with good, informative graphics, and a very nice building.  A clean, well lighted place for planes. One of the coolest parts of the visit was that we got to go inside the B-17 (for $10 extra for a family) and talk with some of the volunteers about the plane.  My grandfather flew B-17s and B-25s in WWII, so it was pretty cool to get a look inside and get a sense of what it would have been like to ride in one.  It would have been crowded, cold (30° below) and pretty scary, considering there’s not that much aluminum between you and the bullets. 

On the way down I managed to hunt up a couple of geocaches in Newburg, which made the trip that much more fun.  We also got a chance to check out the Hotel Oregon, McMennemin’s hotel in McMinnville.  Typical McMennemin’s food, nice atmosphere.  It’d be a nice place to stay.

Tuesday, 29 November 2005 13:38:06 (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [1]  | 
# Monday, 07 November 2005

I got in some more geocaching this weekend.  I had a bunch of free time on Saturday, but unfortunately it started to rain really hard just as I found the first cache of the day, so I decided to call it quits.  So instead I went home and started reading up on navigation, which inspired me to get a snazzy new compass and start boning up on my wilderness navigation and mapreading skills.  I’ve wanted to try orienteering for ever, so this might get me towards that goal too. 

I had better luck yesterday since the weather was way better, although caching with both kids and the dog is an additional challenge.  They all hung in like troopers though, and we found 3 caches in Lacamas Park, up in Camas, WA.  It’s a lovely park, even this time of year.  It’s even better in the early spring when the camas lillies are in bloom. 

Monday, 07 November 2005 09:53:25 (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, 01 November 2005

I found 4 geocaches around Sisters this weekend, and had a blast doing it.  I’m totally down with this sport!  Of course, I need another hobby like the proverbial whole in the head, but at least it’s an outdoor activity. 

The part that was the most fun was looking for caches that were in places I otherwise never would have visited.  We saw the remains of the first ski area in Central Oregon, the view from 4–Mile Butte, and some other great sights in the high desert.  I’m hoping the rain lets up a bit this weekend so I can go after some of the local caches in Hillsboro.

Tuesday, 01 November 2005 16:36:14 (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 

I’ve been working on a project that required me to turn some CLR types into a set of XML Schema element definitions so that they can be included in another file.  It stumped me for a while, and I envisioned having to reflect over all my types and build schema myself, which would be a total drag. 

Then I remembered that this is exactly what xsd.exe does.  Thank the heavens for Reflector!  It turns out to be really simple, just undocumented…

            XmlReflectionImporter importer1 = new XmlReflectionImporter();

            XmlSchemas schemas = new XmlSchemas();

            XmlSchemaExporter exporter1 = new XmlSchemaExporter(schemas);

            Type type = typeof(MyTypeToConvert);

            XmlTypeMapping map = importer1.ImportTypeMapping(type);

            exporter1.ExportTypeMapping(map);

It’s that easy!  The XmlSchemaExporter will do all the right things, and you can do this with a bunch of types in a loop, then check your XmlSchemas collection.  It will contain one XmlSchema per namespace, with all the right types, just as if you’d run xsd.exe over your assembly.

Even better, if there’s stuff in your CLR types that isn’t quite right, you can use XmlAttributeOverrides just like you can with the XmlSerializer.  So if you want to exclude a property called “IgnoreMe” from your MyTypeToConvert type…

            // Create the XmlAttributeOverrides and XmlAttributes objects.

            XmlAttributeOverrides xOver = new XmlAttributeOverrides();

            XmlAttributes attrs = new XmlAttributes();

 

            /* Use the XmlIgnore to instruct the XmlSerializer to ignore

               the IgnoreMe prop  */

            attrs = new XmlAttributes();

            attrs.XmlIgnore = true;

            xOver.Add(typeof(MyTypeToConvert), "IgnoreMe", attrs);

 

            XmlReflectionImporter importer1 = new XmlReflectionImporter(xOver);

            XmlSchemas schemas = new XmlSchemas();

            XmlSchemaExporter exporter1 = new XmlSchemaExporter(schemas);

            Type type = typeof(MyTypeToConvert);

            XmlTypeMapping map = importer1.ImportTypeMapping(type);

            exporter1.ExportTypeMapping(map);

That’ll get rid of the IgnoreMe element in the final schema.  It took a bit of Reflectoring, but this saves me a ton of time.

Work | XML
Tuesday, 01 November 2005 16:32:41 (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [2]  | 
# Friday, 28 October 2005
I found my first geocache at lunch yesterday.  Vikki and Carter (my wife, and our dog) came over to help.  Pretty fun stuff.  It was actually a “multi-cache” meaning that the initial coordinates get you a piece in a puzzle, which leads to the next set of coordinates, etc.  Bascially it’s a treasure hunt for technologically enabled grown ups.  I can see it getting to be a habit forming kind of hobby.  From looking at the maps, there are plenty more caches near both work and my house to keep my busy for a good while.
Friday, 28 October 2005 09:48:03 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, 26 October 2005

I did a little geocaching with some friends this summer, and really want to do some more.  To that end, I just got my first GPS, a Garmin GPSMAP 60C.  So far I’m totally digging it.  It gets great reception, even in the car, and the color screen is super easy to read.  It’s even got some nice built-in geocaching features, like the ability to mark a cache as found, and recording when you found it. 

The USB interface is super easy, and I was able to upload/download waypoints in no time.  I have yet to try downloading a route, but that will be next.  I haven’t shelled out for the mapping software yet, so I have to content myself with the basemap, which isn’t much to go on, but should be enough for highways at least.

I’m hoping to get in some ‘caching this weekend, so we’ll see how well it works in the field.

Wednesday, 26 October 2005 10:07:12 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 

While I’d consider this more of a “survival kit” than a “72–hour kit”, it’s still a neat idea.  I really like the way the saw blade is mounted on the tin.  Plus it’s always fun to see what people make out of Altoids tins…

Wednesday, 26 October 2005 09:59:55 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, 18 October 2005

As I mentioned last week, we had our first city-wide emergency comm drill in Hillsboro this past Saturday.  Overall, it went pretty well, but I definitely came away with some key learnings:

  • Get your Amateur license.  If you want to be able to reasonably expect to contact an Emergency Operations Center, or something similar in your area, ham radio is the way to go.  In case you haven’t heard, you don’t have to learn Morse code any more to get your technician’s license, and the test isn’t hard.  Check out Gordon West’s test prep materials.
  • If you don’t have an Amateur license, and you only have an FRS radio, you’d better get up someplace high.  While talking on your radio from a tree may be inconvenient, it’s about the only way you stand any chance or reaching someone more than a few blocks away.  I was stationed on top of a parking garage, and I only heard people on FRS radios if they were up someplace high, like a roof or a hill.  On the other hand, I had no problem hearing hams from all over town.
  • Check your equipment.  Several people found that their equipment didn’t work the way they thought when they went to use it.  Particularly a problem with fixed installations, where things tend to work loose eventually, get out of whack, etc.

Hopefully this won’t be our last drill, and we’ll learn more then next time.  Again, though, the one big takeaway from this and from everything post-Katrina is that when all else fails, ham radio works.

CERT | Radio
Tuesday, 18 October 2005 12:54:30 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |