... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)

2008-06-30

SQL Server 2000 vs Recursive Functions

In SQL Server 2000, if you attempt to alter an existing recursive function so as to change the number of parameters, you will receive an error message complaining that you are passing the wrong number of arguments to the function.  This appears to be because SQL Server is checking against the old definition of the function being defined.

2008-06-20

Fiddler

Fiddler is a TCPMON-like web debugging proxy for the .NET ecosystem.  If you want to perform port-forwarding like TCPMON, you can either add a registry entry like this:

HKCU\SOFTWARE\Microsoft\Fiddler\ReverseProxyForPort=target port (DWORD)

or enable Tools/Fiddler Options/Allow remote clients to connect and then add an OnBeforeRequest handler in Rules/Customize Rules:

if (oSession.host.toLowerCase() == "webserver:8888") oSession.host = "webserver:80";

2008-06-19

Data Storm

Data Storm is a lightweight database browser intended to be invoked in-line in a Java unit test.  It is useful for debugging database unit tests that perform a rollback after the test.

2008-06-13

Java Bean Introspector vs Boolean

The Java bean introspector returns null for the read method for a property whose type Boolean (boxed) and whose getter follows the is... pattern.  JAXB names such properties following that pattern.

2008-06-11

Visual Studio XSD Tool vs XML Schema

The Visual Studio XSD tool cannot handle an XML Schema that uses a repeating element with the same name at two distinct places.  For example, it cannot handle this schema (in XQuery notation for brevity):

root {
  elementA {
    problemElement {
      name
    }
  },
  elementB {
    problemElement {
      name
    }
  }
}

The element named problemElement causes the problem.  If you attempt to generate C# code for this schema using the XSD tool, it all works.  But if you try to generate a dataset, you an error like:

Error: There was an error processing 'myproblematic.xsd'.
  - The same table (ProblemElement) cannot be the child table in two nested relations.

The solution is to rename one of the problematic elements to reflect the context (sigh).

I have a minimal xsd that demonstrates the issue:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    targetNamespace="urn:tns"
    xmlns:tns="urn:tns"
    >

  <xs:element name="Root" type="tns:Root"/>

  <xs:complexType name="Root">
    <xs:sequence>
      <xs:element name="ElementA">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="ProblemElement">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="Name" type="xs:string"/>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="ElementB">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="ProblemElement">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="Name" type="xs:string"/>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

</xs:schema>

And here is the command to process it:

C:\VS.NET2003\Common7\Tools\vsvars32.bat
xsd /d dotnet-xsd-bug.xsd

Blog Archive