... 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 :)


NUnit Gotcha

If you neglect to make the constructor on a test fixture public, the NUnit test runner will complain that the fixture is invalid with the misleading reason 'the fixture contains no tests'.


Internet Explorer DOM

Using IE 6, when you create an INPUT node, you must set the type property prior to adding the node as a child of another element.  If you try to add it afterwards, IE complains that the type property cannot be read.


SQL Server

Here is an MS SQL statement that creates an SQL script containing INSERT statements for all of the data in all of the tables in the current schema:

    case when c.ordinal_position = 1
        then 'SELECT ''INSERT INTO "' + t.table_name + '" VALUES ('''
        else ''
    ' + coalesce('
        + case when patindex('%char%', c.data_type) <> 0
               or patindex('%text%', c.data_type) <> 0
               or patindex('%date%', c.data_type) <> 0
               or patindex('%time%', c.data_type) <> 0
            then ''''''''' + replace(' + c.column_name + ', '''''''', '''''''''''') + '''''''''
            else 'convert(varchar, ' + c.column_name + ')' end
        + ', ''NULL'')',
    case when c.ordinal_position <> all(select max(ordinal_position)
                                       from information_schema.columns
                                       where table_name = t.table_name )
        then ' + '','''
        else ' + '');'' FROM "' + t.table_name
            + case when t.table_name = all(select max(table_name)
                                           from information_schema.tables
                                           where table_type = 'BASE TABLE'
                                           and table_name <> 'dtproperties'
                  then '";' else '" UNION' end
from information_schema.tables as t
join information_schema.columns as c on (t.table_name = c.table_name)
where t.table_type = 'BASE TABLE'
and t.table_name <> 'dtproperties'
order by t.table_name, c.ordinal_position

It doesn't handle all the data types, but works well for small databases.  The statement could be adapted to other dialects of SQL.



In anticipation of demonstrating QJ to Schlumberger, I went looking for some open source E&P software, especially simulators, that I could try to hook into QJ.  I found Sim42, an open source chemical process simulator.  I also dragged SysQuake out of distant memory as a general purpose simulation package.


Visual Studio

The way Visual Studio 2003 handles web projects still sucks.  As I noted before, there is a way to work around most of the problems discussed at:

ASP.NET Applications without Web Projects

In the end, however, these were the steps I followed to get things to work in my project:

  1. Create a deploy directory to hold your assembled web application.  Add this directory to your web server instead of the default build outputs directory.
  2. Create a post-build script to copy the build outputs to the deploy directory, as well as other critical files like the *.aspx, Global.asax, Web.config, etc.  Note that the DLLs for the application must be contained in a directory tree rooted in a directory called bin.  A sample post-build script might look like:
    del/s/q $(ProjectDir)deploy
    xcopy/y/f $(ProjectDir)Web.config $(ProjectDir)deploy
    xcopy/y/f $(ProjectDir)Global.asax $(ProjectDir)deploy
    xcopy/y/f $(ProjectDir)*.aspx $(ProjectDir)deploy
    xcopy/y/f $(TargetDir)*.dll $(ProjectDir)deploy\bin
  3. Make sure you have a Web.config file and that the attribute /configuration/compilation/@debug is true.
  4. Edit the project's configuration properties so that:
    1. Debugging\Enable ASP.NET Debugging is true
    2. Debugging\Debug Mode is URL
    3. Debugging\Start URL is the URL of your page

Also, as a one-time operation on any given Visual Studio installation, I followed the steps on the web site referenced above to get make all of the web items available on the "new item" palette.  Specifically, I added the following lines to the of the file VC#\CSharpProjectItems\LocalProjectItems\localprojectitems.vsdir in the VS installation directory:




Stylus Studio uses a nice XML Schema documentation generator called xs3p.

Stylus Studio


 The expression context for the XPath query functionality does not define the default namespace.  Therefore, there is no way to search for elements in most documents, i.e. documents that have a non-empty default namespace.  How did they miss that one?

The query v.1 button keeps getting reselected when I type text into the query box even after I have explicitly chosen v.2.  I have to type first, then select v.2.

XPath2 querying is sketchy.  There is no mention of it in the documentation.  The expression "for $x in (1, 2, 3) return $x" generates a warning dialog box with no text in it.  "(1, 2, 3)" works.

Visual Studio

The way Visual Studio 2003 handles web projects sucks.  You must create a virtual directory on IIS that contains not only your binaries, but also your source.  Weird.  Also, VS2003 cannot handle filenames that start with a dot -- such as Subversion .SVN files.  I found an article that shows how to work with ASP.NET with a standard local project:

ASP.NET Applications without Web Projects

Blog Archive