Tuesday, January 09, 2007

I have had occasion recently to play with the latest (December 2006) CTP of WPF/e.  It's a really cool technology that I think is poised to change the way people write rich web apps.  It's cross-platform (Windows and MacOS at the moment) and cross-browser (IE5-7, Firefox, and Safari at the moment).

The CTP has some limitations at the moment that are keeping it from really being a replacement for HTML-based web apps (It's missing the WPF layout manager for one), but it certainly doesn't keep you from doing some really cool stuff with it.

Rather than just point you to the existing samples (scroll down to see them), I thought I'd put together one of my own.  I created a proof of concept replacement for my blog's header that shows my photos from Flickr as if they were hundreds of polaroids strewn about and panning by.  You'll need to go to the WPF/e site and download the plugin that's appropriate for your OS (look under Top Downloads on the right). After you've done that, click the image below to see the demo.

Click to see demo

It consists of:

  • A xaml file with the "background" (some of which is in the foreground) and some general declarative animation instructions.
  • An html file with some script infrastructure for pulling JSON data from the Flickr APIs and turning them into visual elements.
  • The provided WPF/e scripts for instantiating the control
  • the MicrosoftAjax.js file from the AJAX library.
  • A little .ashx proxy for routing the async calls to Flickr (to avoid cross-domain scripting issues)

If you watch long enough, it should scroll through all 7,140 of my pictures (with some gaps in between while loading new images), and then start over.

All in all, it was really easy to do.  There are some problems I need to address before it could realistically take over as the header for my blog, but I think it shows some real promise.  I can't wait for the actual WPF/e release.

posted on Tuesday, January 09, 2007 2:52:10 PM (Pacific Standard Time, UTC-08:00)  #    Comments [1]
 Thursday, January 04, 2007

The couch that we ordered over 2 months ago was finally delivered yesterday.  When we moved into our house here, we picked out a couple of couches...  a less-expensive, fold-out sleeper for the upstairs living room, and a really nice, non-sleeper for the big downstairs room where we spend most of the time.  The sleeper arrived shortly after we ordered it, but the nice one was delayed multiple times.

We spent our first 7 years of marriage with really old couches that my parents had when I was growing up.  They were so old and broken down that we decided not to bother bringing them with us to Washington.  It's very nice to have a sweet couch (it's nice to have a couch at all).  We made sure to get one long enough that I can lay on it without my head or feet having to be on an armrest (something I rarely experience at 6' 2").  It also sits up nice and high so you don't have to feel like you're climbing out of a hole when you get up.  Becky's feet don't even touch the floor when she's sitting on it.

posted on Thursday, January 04, 2007 2:33:13 PM (Pacific Standard Time, UTC-08:00)  #    Comments [1]
 Wednesday, January 03, 2007

Someone asked me the other day if you could reflect on other people's assemblies using the CLR.  My answer was, "ABSOLUTELY!!!!!"

As it turns out, they were having some problems achieving this, and they were wondering if there was some kind of security mechanism in place that was preventing reflection on 3rd party assemblies.  Here's the basic scenario.  They had a 3rd party library with a type that defined several "constants" using fields.  They needed to be able to specify a named constant via a string and return the value for the constant.  Security and performance arguments aside (they had already been considered), they simply wanted to lookup the field by name via reflection and get its value.  This can be accomplished via just a few fairly reasonable lines of code using one of the GetField family of methods on System.Type and then getting the value.  I'll leave this as an exercise for the reader so they can have the fun of wresting with the silly BindingFlags enum.

After some discussion, I learned that the trouble actually revolved around getting the Type object in the first place.  They were using Type.GetType to load the type with a namespace-qualified name as the string argument.  It was returning null (Nothing in VB).  They were validating that the string was correct using Intellisense, and concluding that since Intellisense could see the type, that Type.GetType should also "see" it (which seems like a perfectly reasonable assumption).

Type.GetType() takes a string argument specifying the type to retrieve.  When specifying types in strings, you can usually use a namespace qualified name ("[namespace.]type"), or an assembly-qualified name ("[namespace.]type, assemblyName").  If you don't provide the assembly name, the API looks through the assemblies already loaded in the AppDomain for a type that matches the name.  If an assembly name is specified, a bind occurs to the assembly and it is loaded if necessary.

In this case, there was a reference to the assembly containing the type, so Intellisense was picking it up and providing completion. The trouble was that, at runtime, the assembly had not yet been loaded into the AppDomain, so the type was unavailable.

So, the options were (in order of appropriateness in my opinion):

  • Use an early-bound type - Since the type was known at compile-time, use typeof() (GetType() in VB).  This will create a compile-time, assembly-qualified type reference in the IL rather than a runtime parsing/bind/load of the type string.
  • Use an assembly-qualified type string - Adding the assembly name to the type string will let the CLR know what assembly to look in (and load if necessary).  There are some subtle versioning issues with this approach, especially for strongly-named assemblies.
  • Make sure the assembly is loaded prior to calling Type.GetType() - Making an early-bound call to something else in the assembly first will get it loaded into the AppDomain.  This seems like a fragile solution and I would not recommend it, although it will technically work.

The real issue here is the number of samples (especially in VB) provided by MS that use Type.GetType() with a non-qualified name (ex. "System.String").

posted on Wednesday, January 03, 2007 9:09:25 AM (Pacific Standard Time, UTC-08:00)  #    Comments [1]
 Tuesday, January 02, 2007

This year, we gave the gift that keeps on giving... the stomach flu. But, before I get to that, let me back up a bit...

If you recall, we got our power restored after over a week of outage with just a little more than 12 hours to prepare for our holiday travels.  However, we managed to get everything together and arrive at the airport the suggested 2 hours before the flight.  Out trip went through Phoenix instead of Denver, so I figured we'd be in the clear weather-wise since nothing ever happens in Phoenix.

Wouldn't you know it, we got to the airport to discover our flight had been delayed due to fog in Phoenix.  After a bout with a touchy airline representative (which I may eventually devote an entire entry to), we decided to go ahead to Phoenix since everything was delayed coming and going in hopes that our connecting flight would be delayed as well.

4.5 hours after our flight was to leave originally, we boarded the plane with still a slight chance of catching our connection.  After we landed in Phoenix, we discovered we'd missed the connection by a mere 19 minutes.  With no flights available to El Paso until Christmas, we really had only one acceptable option... rent a car and drive.  So, at about 9pm, we hopped in a car and drove the 6.5 hours from Phoenix to El Paso to Becky's parents house.  All in all, I felt a great sense of accomplishment in having executed such an old-school road trip with a 1-year-old.

Christmas with the Pattersons was great.  I got something I have wanted most of my life... a radio-controlled helicopter.  Thanks everyone.  The only issue was that things in our room were much colder than we were used to, which resulted in Jenna waking up every 30 minutes after midnight due to being cold, and she got all sniffly and such.

We went to Cattleman's (a world-famous steakhouse) for dinner Christmas eve, and I had a huge t-bone.  It was delicious.  Becky had been feeling ill earlier in the day, but we attributed it to lack of sleep.  After dinner, she took a turn for the worse.  I started feeling bad, but attributed it to eating too much.  Becky went to the doctor while I put Jenna to sleep.  By the time Becky got back, I was full on sick, but it was too late to see the doctor.  It was probably the worst night of my life.  Becky's dad helped us tremendously by tending to Jenna, who had also caught the bug.

The next morning, after an unpleasant episode in which I thought I was literally dying, I went to the doctor too.  We were scheduled to fly to Austin and drive to Belton this day, and were contemplating delaying the trip.  We ultimately decided that the pros of keeping our original schedule outweighed the benefits of staying longer.  So, somehow, we got on a plane to Austin and then drove the hour from Austin to Belton.  Unfortunately, the wake of our illness still spread to virtually all of Becky's family.  Some of them got sick on their flights home.

In order to avoid getting sick when we arrived in Belton, my parents just waved to us as we went to the apartment behind the house where they work.  They had gone to alot of trouble to quarantine us away, which was great because we had alot of room for Jenna and we had complete control over the temperature.  For the next few days, we followed a protocol of constant hand washing and such to prevent the spread of the plague.  We even avoided seeing my brother's family completely to avoid any complications for their new son who was less than a few weeks old.  This seemed to be working until my Dad got sick, followed by my mother that night.  My aunt also got sick on her flight home.  We ended up canceling several rendezvous we had planned with friends in the area.  In the end, we finally had a very short visit with my brother's family on his back porch.

Even though we had to be up at the crack of dawn on the 1st to get to the airport, we thankfully had an uneventful and undelayed flight home, and we just sat on our couch in disbelief of the events that had transpired during the previous few weeks.  Now, we just have to shift Jenna 2 hours back to Pacific time.

So, to everyone we had hoped to visit while we were in Texas, we're sorry things had to go down like that.

posted on Tuesday, January 02, 2007 4:26:53 PM (Pacific Standard Time, UTC-08:00)  #    Comments [1]
 Friday, December 22, 2006

So, 1 week +12 hours give or take, and power has returned.  Unfortunately, cable is still out, so no XBox for me tonight.  We leave for Texas tomorrow morning.  Let the fun begin!

posted on Friday, December 22, 2006 1:14:18 PM (Pacific Standard Time, UTC-08:00)  #    Comments [0]
 Thursday, December 21, 2006

In all the craziness brought about by the lack of power (still none, by the way), I have neglected to relay an important announcement. My brother and his wife had their baby! Landon Ross Miller was born Friday the 15th of December at 11:09 PM.  Everyone is doing well, and we can't wait to meet him next week.

Congratulations, Bro!

posted on Thursday, December 21, 2006 2:33:24 PM (Pacific Standard Time, UTC-08:00)  #    Comments [1]
 Wednesday, December 20, 2006

So, we still don't have power, but things are looking up.  Let me give you the rough timetable so far.

  • Thursday, Dec 14th ~8pm: Wind starts picking up. Lights begin to dip occasionally.
  • ~10:30: Power goes out.  Ticked because I was in the middle of a Halo match.
  • ~11:30: By this time, the wind is really blowing.  The sound of branches breaking off can be heard occasionally throughout the surrounding woods.
  • Friday, Dec 15th ~12:30am: The wind is blowing like crazy.  The gusts are bending the trees to an alarming degree.  We decide we should move downstairs in case one decides to fall.  This wakes Jenna up and she decides we are playing some kind of game.  She spends the next several hours honking our noses.
  • ~2:00am:  I am VERY concerned about falling trees.  With each gust, the sounds of breaking trees can be heard.
  • ~4:00am:  Jenna is finally asleep.  The wind seems to have subsided.  We go back upstairs to be comfortable.
  • ~morning: Damage is surveryed.  Nothing major.  Check around the neighborhood.  Nothing terrible.  Patiently wait for power to be restored.
  • ~noon: It's getting cold.  I look for some firewood.  All I find is soaked through.
  • ~3pm: still no warmth.  We decide to bail.  We call the Flints and head to Bellingham.
  • ~7pm: We arrive in Bellingham, warm up, and stay the night.
  • Saturday, Dec 16th: Head back to our house to check on the cats.  The daylight reveals the devestation of the infrastructure.  Trees are down everywhere.  Powerlines are a tangled mess.  The power's going to take a while.  We make sure the cats are OK, and head back to Bellingham.
  • Sunday, Dec 17th: Attend Jeff's church and locate a generator that meets our criteria.  Big enough to run the furnace, small enough to fit in the trunk.  Head back to the house and fire it up.  Becky took Jenna to a friend's house while the house warmed up.
  • 8pm: the house reaches 60 degrees, our criteria for staying the night, so Becky brings Jenna back and we put her to bed.
  • 10pm: the house reaches normal temperature.
  • Monday, Dec 18th 12:30am: The furnace stops working and the house begins cooling fast (the structure itself has not yet heated up to normal)
  • 1:00am: We head to Becky's friends house and spend the rest of the night.
  • Daytime: Jenna and Becky hang out at her friends house, and I go into work to see about arranging furnace repairs and do other errands in addition to keeping work from falling too far behind.
  • Evening: return to Becky's friends house, and have a nice evening playing with Jenna and xbox. Becky and friend go check on cats, which are freaking out, but otherwise doing fine.
  • Tuesday, Dec 19th: Some work.  The furnace guys show up and confirm my diagnosis of a faulty flame sensor.  Furnace working again.
  • Evening: Head to another one of Becky's friends for some nice dinner.
  • 8:00pm: I get a call from my realtor, who just got power and offers his huge generator.
  • ~9:30pm: Big generator hooked up and running.  Now we can run some lights and other stuff. Additionally, it runs all night on a tank of gas, rather than having to fill every 5 hours.  Also discover cable service is out.  No xbox.
  • Wednesday, Dec 20th morning: wake up from a very pleasant and successful night. Fill tank on the generator and go out to get more gas.  Then head into work.
  • 1pm: Becky and Jenna join me at work for some lunch.

In somewhat unrelated news, I saw what I believe to be a couple of river otters swimming in the creek yesterday evening.  The reason I think they were otters was they looked like otters, and the tracks I found in the snow look like otter tracks. I'll have to keep my eyes open for them and maybe get some pictures.

posted on Wednesday, December 20, 2006 2:46:57 PM (Pacific Standard Time, UTC-08:00)  #    Comments [5]
 Monday, December 18, 2006

I've gotten lots of inquiries lately where, for now, the answer is simply, "we're alive".  If you weren't aware, the Seattle area was pounded last Thursday by an incredibly fierce windstorm.  Over two thirds of the houses in the area lost power, which equates to over a million customers (houses/businesses). We live in one of the areas hardest hit by the storm.

Luckily, we, our cats, our home, our cars, and everything else all escaped unharmed.  However, we have been without electricity since Thursday night.  We decided the best course of action with a one-year-old was to get the heck out of there.  We stayed with the Flints Friday and Saturday night.  After a brief period of warmth on Sunday brought by a generator, we are now staying at a friends house in nearby Kirkland who regained power on Sunday.

I'll update more when I have more time.  For now, I'm working on getting the furnace fixed.  Either running it continuously for about 8 hours damaged part of the ignition system, or running it from a generator screwed something up.

Hopefully, everything will be cleared up in time for us to make a Saturday flight to Texas for the holidays, but they're saying it may be Friday or Saturday before our power gets turned back on.

posted on Monday, December 18, 2006 3:39:53 PM (Pacific Standard Time, UTC-08:00)  #    Comments [0]
 Monday, December 11, 2006

Today is Jason Owens's birthday.  Jason is a buddy of mine from way back.  I believe we met before preschool sometime, but I honestly can't remember.  We shared all the years of school together, even through college.  I remember turning on the water hose in his backyard so we could try to turn it into Degoba (sp?) so we could play Star Wars properly.

Since college, we haven't been able to get together much.  We're supposed to get together over Christmas though, which I'm looking forward to.

Every year, it was a tradition for some of our closest friends to get together at Jason's house for his birthday.  We'd spend the night playing slaughter-ball, football 500, and topping it off with a viewing of "¡Three Amigos!".

Happy Birthday, man.  I was going to scan an old picture for this entry, but I haven't found the box with the old pictures in it yet, since moving.

posted on Monday, December 11, 2006 8:24:34 AM (Pacific Standard Time, UTC-08:00)  #    Comments [0]