Set the controls to lightly toasted muffins... RSS 2.0
 Monday, March 13, 2006

I don't know what the Attorney General is so upset about, isn't this what the Home Office wants for all our good citizens anyway? They just happen to be starting from the top.

Monday, March 13, 2006 12:34:20 PM UTC  #    Comments [0] -
Other

Wow...this guy had some imagination. One of my favourites is 'Earth Orbital Bombs As Nuclear Deterrents'.

Via: The Register

Monday, March 13, 2006 12:29:24 PM UTC  #    Comments [0] -
Other

You may know this already but if you're running ASP.NET 1.1 and ASP.NET 2.0 on the same box then make sure you create a separate application pool for ASP.NET 2.0. You can just clone the Default Application pool if you want, but that can have security implications if you're box is a shared hosting environment because re-using NETWORK SERVICE as the process identity will leave your 2.0 sites open to file harvesting by Full Trust 1.1 apps (that said you are encrypting your connection strings, aren't you? :-) ).

Once you've created the app domain, goto the site or vdir that needs to run ASP.NET 2.0, open the property pages, choose ASP.NET 2.0 from the ASP.NET tab then choose the new ASP.NET 2.0 Application Pool in Home Directory Tab -> Application Settings: Application Pool drop down.

Failure to run ASP.NET 2.0 in it's own app pool will result in the evil 'Server Application Unavailable' message because the ASP.NET 1.1 and 2.0 runtimes can't co-reside in the same worker process.

Monday, March 13, 2006 12:55:59 AM UTC  #    Comments [1] -
.NET
 Sunday, March 12, 2006

This is old hat and more of a bookmark for me when I bump into this each time I'm working with XML documents that have default namespace declared. But I thought I'd share anyway.

Take the following simple XML document:

<?xml version="1.0" encoding="utf-8" ?>
<
products xmlns="urn:backoffice:products"
>
   <
product id="100-1100"
>
      <
description>JVC CD Player</description
>
      <
price>120.99</price
>
      <
category>100</category
>
   </
product
>
   <
product id="100-1101"
>
      <
description>Sony CD Player</description
>
      <
price>122.99</price
>
      <
category>100</category
>
   </
product
>
   <
product id="100-1102"
>
      <
description>LG DVD Player</description
>
      <
price>109.99</price
>
      <
category>110</category
>
   </
product
>
   <
product id="100-1103"
>
      <
description>Technics DVD Player</description
>
      <
price>199.99</price
>
      <
category>110</category
>
   </
product
>
</
products>

You might expect that the code to select all the product nodes would look like:

XmlNamespaceManager nsm = new XmlNamespaceManager(new NameTable());
nsm.AddNamespace("", "urn:backoffice:products");
XmlNodeList productList = products.SelectNodes("/products/*", nsm);

The above seems the logical thing to do because the default namespace doesn't have a prefix so you naturally go ahead and specify String.Empty (or "", whichever) when adding it to the namespace manager. Additionally if you execute the code and breakpoint after setting adding the namespace and inspect the DefaultNamespace property of 'nsm' you'll see that it's even set to "urn:backoffice:products". However, the XmlNodeList returned from products.SelectNodes has no nodes.

This confused the hell out of me when I first encountered it way back when and I tripped up on it again last week. What's going on?

Basically XPath expressions select nodes that are either in a namespace or in the empty namespace. The XPath expression '/products/*' is selecting nodes from the empty namespace (xmlns="") but the document above is defining a default namespace of 'urn:backoffice:products' which is not the empty namespace. We have to tell XPath to select nodes from the namespace 'urn:backoffice:products' otherwise no nodes will be returned.

So how do we do this?

XmlNamespaceManager nsm = new XmlNamespaceManager(new NameTable());
nsm.AddNamespace(
"p", "urn:backoffice:products");
XmlNodeList productList = products.SelectNodes("/p:products/*", nsm);

We add the namespace with an arbitrary prefix and the XmlNamespaceManager is used to expand 'p' to the default namespace name which then brings the nodes we're interested in into scope.

One thing still puzzles me though is the purpose of the DefaultNamespace property in the XmlNamespaceManager and I guess some digging around will uncover it's intentions because the MS docs are pretty vague.

 

Sunday, March 12, 2006 4:49:49 AM UTC  #    Comments [3] -
.NET

I haven't done the show for a couple of weeks, mostly because I fancied a couple of Fridays off just to finish work and kick back in front of the telly and catch up on some reading. Also I've been feeling a bit burned out and there's no point sitting in the studio with a lacklustre and last minute choice of tunes and no research and just playing tunes like a robot.

That said, it hasn't kept me from adding a few new items to my music library over the past few weeks -

Mogwai - Mr Beast their newest release and Come on Die Young and Young Team just to complete the set. I'm also seeing them in Edinburgh in April at the Queens Hall. Looking forward to it immensely.

The Dandy Warhols - Come Down, Dandy's Rule Ok, Odditorium Or Warlords of Mars, Thirteen Tales... and Welcome to the Monkey House. I was really put off the Dandy's because of that infernal Vodafone(?) advert which ruined a perfectly good tune. I'm glad I revisited them as they're bloody marvelous.

65 Days of Static - Fall of Math, One For All Time. These guys are just amazing and I'd say they're one of the standard bearers of the 'post rock' movement. If you like Mogwai then your gonna love these guys.

Sparklehorse - I already had 'It's a Wonderful Life' and figured it was time to flesh out with Good Morning Spider, Vivadixiesubmarinetransmissionplot.

Roxy Music - Roxy Music, For Your Pleasure, Stranded, Country Life and Siren. I had these one tape years ago and they were ridiculously cheap on Amazon's marketplace.

The Wedding Present - George Best, Seamonsters, Bizarro and Take Fountain.

The Delays - Faded Seaside Glamour and You See Colours

So as you can see I've got a lot of listening to catch up on and I now need a bigger shelf for my CD's. Anyway I'll be back on the radio next week and if you're in the Perth or Pitlochry area next Friday then tune into 97.5FM between 10pm and midnight.

 

Sunday, March 12, 2006 2:23:11 AM UTC  #    Comments [0] -
Other
Now Playing
Top Artists This Week
Fluff

Powered by FeedBurner
Categories
Archive
<March 2006>
SunMonTueWedThuFriSat
2627281234
567891011
12131415161718
19202122232425
2627282930311
2345678
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008
Kevin Kenny
Sign In
Statistics
Total Posts: 194
This Year: 41
This Month: 0
This Week: 0
Comments: 101
All Content © 2008, Kevin Kenny
DasBlog theme 'Business' created by Christoph De Baene (delarou)