# Thursday, August 11, 2005
My sister Erica delivered my first nephew yesterday afternoon.  Connor James Mullen, 7 lb. 15 oz.  Woo hoo!  Everyone is doing beautifully.
Thursday, August 11, 2005 11:02:43 AM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, July 19, 2005
There is a grass roots initiative, begun in the UK, called the ICE (In Case of Emergency) initiative.  Both the goal and the implementation are very simple.  Take a moment and add some additional entries to your cell phone / PDA addressbook that start with ICE.  Examples are “ICE – wife”, or “ICE – Mom”.  That way, first responders who are coming to your aid can quickly determine from your phone (assuming it’s working of course, but it couldn’t hurt) who to call on your behalf.  It takes only a moment, and could save a lot of time and hassle in case of emergency.
Tuesday, July 19, 2005 10:51:47 AM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, July 18, 2005

For around 2 years now, I’ve been involved with my local CERT (Community Emergency Response Team) program.  I took the initial training a little over 2 years ago, and since they I’ve been to several refresher classes and exercises, and joined the Steering Committee as the newsletter editor.  For those not familiar with CERT, it’s a nation-wide program that teaches people how to prepare for disasters, and how they can help themselves, their families, and their neighborhoods in times of disaster or emergency.  Our local program in Hillsboro is open to anyone who lives or works in Western Washington County, and involves 24 hours of training (3 hours, one night a week for 8 weeks).  The training includes disaster medical training, light search & rescue, team organization, and other important preparedness skills.

This past weekend I got a chance to go to the Western Territorial Citizens Corps Conference in beautiful Bozeman, Montana.  It was a great conference, and I learned a lot about the overall organization that is the Citizens Corps, which was really worthwhile.  I also got a chance to see a bit of Bozeman, which I really enjoyed.  What a gorgeous town!  We also got a chance to hit the Museum of the Rockies, which has a truly amazing collection, including some of the best dinosaur exhibits I’ve seen.

Citizens Corps is the (relatively) new umbrella organization under which the national CERT program is housed, along with four other “partner” programs. 

All of these organizations provide opportunities for the average citizen to volunteer some of their time to better prepare themselves and their communities for disasters and emergencies, as well helping out and saving a lot of money for our frontline first responders.  For examples, volunteers for the Fire Corps can do things like help cook at fire stations, or do paperwork which frees up firefighters for the work they are best qualified to do. 

Check out the websites and find out how you can help.  It’s every American’s responsibility to be prepared.  And if anyone has questions about the CERT program, I’d be happy to answer them.

Monday, July 18, 2005 3:29:47 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, July 11, 2005

Cheb i Sabbah is an Algerian-born San Franciscan who makes some truly incredible music.  I’m a big fan of “Asian Underground”, which is a relatively recent genre that mixes modern electronica/dance music with traditional South Asian/Middle Eastern music.  I just finished listening to Cheb i Sabbah’s latest album, “La Kahena”, and it ROCKS!  It’s all centered around the traditional music of the Berbers of North Africa.  Fantastic.  It’s amazing how such ancient music blends seamlessly with modern electronica. 

Other great Asian Underground acts include State of Bengal, Billy Sagoo, Panjabi MC, Asian Dub Foundation, and Talvin Singh.  All worth a listen.

Monday, July 11, 2005 2:33:59 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [1]  | 
# Friday, July 08, 2005
I’ll be teaching Introduction to Web Services (CST 407) at OIT (Portland) this Fall.  Tell your friends!  We’ll be covering the basics of Web Services, including theory, history, best practices, and a firm grounding in underlying technologies like XML and SOAP.  Should be a good time.  If you are interested you should be prepared to write code in C#.
Friday, July 08, 2005 4:21:38 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 

Over the holiday weekend we lost our 11-year-old Husky/German Shephard, Saffy (short for Saffron).  She went quickly, and didn't suffer, which is all we could have hoped for.  We can only hope that wherever she is now that the sun is warm, and the squirrels are slow.  She'll be missed.

Saffy

Friday, July 08, 2005 8:07:38 AM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, June 30, 2005

I finally solved the namespace issue I was having, although I’ll probably burn for all eternity for the solution.  In short, because of the behavior of XmlTextWriter, the only solution that could be implemented in a reasonable amount of time was to post-process the XML and strip out the extra namespace declarations. 

So I started down the path of using XmlTextReader to spin through and collect up all the namespaces that I needed, then add those to the root node.  After that I could use a regular expression to strip out all the unneeded ones.  Turns out I had overlooked the fact that the input isn’t guaranteed to be well-formed XML.  :-(

The “XML” is actually a template that our system uses to do some tag replacement.  So the output of that process is well-formed, but the input can contain the “@” character inside element names.  A no-no according to the XML spec. 

So here it is, the all-regular-expression solution.  I wouldn’t suggest you try this at home, but it does actually work, and seems to be quite fast (sub 1/4 second for a 1.5Mb input, and the typical input is more like 10K). 

Note: this is made a little simpler because I know (since I just wrote out the “XML”) that all the namespace prefixes we care about start with ns, e.g. ns0, ns1, etc.

                    #region begin hairy namespace rectifying code here

                    //this is necessary because the XmlTextWriter puts in more namespace

                    //declarations than we want, which causes file bloat.

 

                    Regex strip = new Regex(@"xmlns\:ns\d=""[^""]*""");

                    ArrayList names = new ArrayList();

                    MatchCollection matches = strip.Matches(result);

                    foreach(Match match in matches)

                    {

                        string val = match.Value;

                        if(!val.StartsWith("xmlns:ns0"))

                            if(!names.Contains(match.Value))

                                names.Add(match.Value);

                    }

 

                    string fixedNamespaces = null;

                    StringBuilder sb = new StringBuilder();

                    foreach(string name in names)

                    {

                        sb.AppendFormat(" {0}",name);

                    }

 

                    fixedNamespaces = result;

 

                    int pos = fixedNamespaces.IndexOf(">",0);//should be the end of the xml declaration

                    pos = fixedNamespaces.IndexOf(">",pos+1);//should be end of root node.

 

                    fixedNamespaces = fixedNamespaces.Insert(pos,sb.ToString());

 

                    pos = fixedNamespaces.IndexOf(">",0);//should be the end of the xml declaration

                    pos = fixedNamespaces.IndexOf(">",pos+1);//should be end of root node.

                    result = strip.Replace(fixedNamespaces, "", -1, pos);

 

                    #endregion

XML
Thursday, June 30, 2005 12:53:56 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [1]  | 
# Friday, June 24, 2005

We’ve got some XML documents that are getting written out with way too many namespace declarations.  That probably wouldn’t be too much of a problem, except we then use those XML documents as templates to generate other documents, many with repetitive elements.  So we’re ending up with namespace bloat.  Scott and I found an example that was coming across the network at about 1.5Mb.  That’s a lot.  A large part of that turned out to be namespace declarations.  Because of the way XmlTextWriter does namespace scoping, it doesn’t write out a namespace declaration until it first sees it, which means for leaf nodes with a different namespace than their parent node, you end up with a namespace declaration on every element, like this…

<?xml version="1.0" encoding="UTF-8"?>

<ns0:RootNode xmlns:ns0="http://namespace/0">

            <ns1:FirstChild xmlns:ns1="http://namespace/1">

                        <ns2:SecondChild xmlns:ns2="http://namespace/2">Value</ns2:SecondChild>

                        <ns2:SecondChild xmlns:ns2="http://namespace/2">Value</ns2:SecondChild>

                        <ns2:SecondChild xmlns:ns2="http://namespace/2">Value</ns2:SecondChild>

                        <ns2:SecondChild xmlns:ns2="http://namespace/2">Value</ns2:SecondChild>

                        <ns2:SecondChild xmlns:ns2="http://namespace/2">Value</ns2:SecondChild>

                        <ns2:SecondChild xmlns:ns2="http://namespace/2">Value</ns2:SecondChild>

                        <ns2:SecondChild xmlns:ns2="http://namespace/2">Value</ns2:SecondChild>

                        <ns2:SecondChild xmlns:ns2="http://namespace/2">Value</ns2:SecondChild>

            </ns1:FirstChild>

</ns0:RootNode>

With our actual namespace strings, that’s like an additional 60 btyes per element that we don’t really need.  What we’d like to see is the namespaces declared once at the top of the file, then referenced elsewhere, like this…

<?xml version="1.0" encoding="UTF-8"?>

<ns0:RootNode xmlns:ns0="http://namespace/0" xmlns:ns1="http://namespace/1"  xmlns:ns2="http://namespace/2">

            <ns1:FirstChild>

                        <ns2:SecondChild>Value</ns2:SecondChild>

                        <ns2:SecondChild>Value</ns2:SecondChild>

                        <ns2:SecondChild>Value</ns2:SecondChild>

                        <ns2:SecondChild>Value</ns2:SecondChild>

                        <ns2:SecondChild>Value</ns2:SecondChild>

                        <ns2:SecondChild>Value</ns2:SecondChild>

                        <ns2:SecondChild>Value</ns2:SecondChild>

                        <ns2:SecondChild>Value</ns2:SecondChild>

            </ns1:FirstChild>

</ns0:RootNode>

When we edited the templates manually to achieve this effect, the 1.5Mb document went to like 660Kb.  Much better.

There doesn’t seem to be any way to get XmlTextWriter to do this, however.  Even if you explicitly write out the extra namespaces on the root element, you still get them everywhere, since the writer sees those as just attributes you chose to write, and not namespace declarations. 

Curses!  I’ve spent all day on this and have no ideas.  Anyone have any input?

Work | XML
Friday, June 24, 2005 2:53:54 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [10]  | 

Vikki and I went to see Batman Begins last weekend up in Seattle, and really enjoyed it.  I was pondering the phenomenon that is Batman during the movie, and started thinking that Batman has become such an iconic figure in our contemporary mythos that it really frees the director.  It’s like making a Robin Hood movie.  You don’t have to worry about telling the story, because everyone already knows the story.  So the directory can focus on the details. 

Christian Bale was fantastic as the brooding playboy-without-conscience who beats up bad guys in his spare time.  He really brought a lot of detail to the character, and you can really start to understand what kind of guy Bruce Wayne would have to be to become Batman. 

Great supporting cast too.  Liam Neeson makes a great villain.  Good, atmospheric physical culture.  They did a good job of bringing the brooding Gothic/Art Deco style of Gotham into the modern age.  Definitely worth seeing. 

Friday, June 24, 2005 2:25:36 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, June 15, 2005
The New York Times has a very positive review (reg. required) of Batman Begins.  So maybe there is hope.  It’s amazing what you can do with a directory who cares, and some actors who can really act.  I’ve been a fan of Christian Bale ever since he was “Falstaff’s Boy” in Henry V.  Maybe I’ll get a chance to see it this weekend…
Wednesday, June 15, 2005 3:03:35 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |