Monthly Archives: October 2013

Security is mostly a superstition. It does not exist in nature, nor do the children of men as a whole experience it. Avoiding danger is no safer in the long run than outright exposure. Life is either a daring adventure, or nothing. – Helen Keller

This is a very interesting quote I ran across recently.  It applies to a large extent to financial matters.  Some people think that by putting all their money in a FDIC insured bank account, they would have security.  This is completely false.  Inflation will almost certainly erode the purchasing power of the money and hyperinflation can completely wipe it out.  With stocks, the danger is much more obvious but in my view the danger is less.

Security is mos…

Modeling Object Oriented Data in a Relational Database

Often in business programming, we find ourselves storing data that lends itself to the concept of inheritance that we find in object oriented programming.  The attached document outlines some ways we can store our data and what the pros and cons of each choice are.

OO In A Relational Database (PDF)

OO In A Relational Database (HTML)

Tagged , ,

Looping over XML in .NET

Let’s say you need to loop over an XML document:

Image

The obvious way to do this is this:

NaiveXMLloop

There are two problems with this code.

  1. What if there are no records?  SelectNodes may return null and cause the loop to give an exception under some circumstances.  (though I experienced this in real life, I was not able to duplicate the issue for this article)
  2. Though the the inner foreach loop will not reference only sub-nodes of the current node in the outer loop.

The following resolves both issues.  Note the empty IEnumerable default and the dot in the inner loop’s XPath.

BetterXMLloop