February 10, 2009
@ 12:00 PM

Digging through the Castle source code look what I found in the "HowToBuild" file (note the last line):

Possible problem with 3.5
=========================
if you get the following error:
"The SDK for the 'net-3.5' framework is not available or not configured."
then you probably need to fix the sdkInstallRoot in your nant.exe.config file to point to the correct location in the registry
See the following article for more info:
http://www.timbarcz.com/blog/NantSetupForVisualStudio2008AndNet35.aspx

Looking through the file's history I can see that Ken Egozi is a pretty smart man. *wink* *wink*


 
Categories: Caslte | Open Source Software

February 10, 2009
@ 08:22 AM

1 Thessalonians 5:21

  • "Test everything. Hold on to the good." (NIV)
  • "Prove all things; hold fast that which is good." (King James Version)

 
Categories: Humor | Testing

February 3, 2009
@ 09:57 AM

image I felt compelled to write after seeing this very same issue come up twice in the last week or so, once for a fellow developer and today for me.

The Problem

We use a DataSet for assistance with testing our data layer (think NDBUnit).  The problem we have is that when you generate the DataSet the XSD created contains all these table adapters that bloat the file, in our app the file bloats to about five times the regular size.  We've found that deleting the table adapters on the file makes the file open up so much faster.  However, every time we make a change to the database schema we have to regenerate the DataSet so that it matches the schema.  As the table count has grown deleting these table adapters by hand has grown wearisome.  All this is merely set up for me over-fixing the problem.

My First (Wrong) Thought

I thought to myself, "hey this is XML I'll just load up and XML document and query out the nodes (TableAdapters) I don't need and remove them from the document and save it back."  While writing a quick bit of code I found writing more code than I needed (at this point I was only at 6 lines).  Despite the file being XML, I don't need to treat it as XML.  Understand that nothing about getting rid of the TableAdapters relies on the "XML-ness" of the file, it's all just text. Reminding myself of that...here's what I came up with...

The Second (Correct) Solution

Simply treat the file as text and remove the piece you need, the only caveat is that I'm dealing with XML and so if I remove a "piece" I have to remove the whole "piece" (where "piece" means XmlNode).  The solution below simply matches TableAdapter nodes and replaces them with empty text.  Simple.

   1: var path = @"C:\dev\sandbox\Website\src\IntegrationTests\TestData\Database.xsd";
   2: var text = File.ReadAllText(path);
   3: File.WriteAllText(path, Regex.Replace(text, "<TableAdapter.*?>.*?</TableAdapter>", "", RegexOptions.Singleline));

The Point

The point is the first solution, while correct, was more complex than it needed to be.  Using a little bit of RegEx to wipe clean certain nodes, I get exactly what I want in three lines of code.  Moral of the story?  Don't overcomplicate what doesn't need to be.


 
Categories: Common Sense | Musings | Tips & Tricks