Noah Blumenthal's Blog

May 25, 2009

Script# interesting namespace “feature”

Filed under: Uncategorized — noahblu @ 5:10 pm

Take a look at this code:

System.DHTML.Window.Event.ReturnValue = false;

Now take a look at this code:

using System.DHTML
Window.Event.ReturnValue = false;

Do they look the same to you?

Because they don’t look the same to Script#!

The former doesn’t compile “Check that your C# source compiles and that you are not using an unsupported feature.” and the latter does.  Interested little quirk, huh?


May 22, 2009

Debug is not defined (FireFox 3.0.10)

Filed under: Uncategorized — noahblu @ 6:15 pm

I spent a long time today trying to track down an issue whereby all my Javascript code worked in IE but none worked on Firefox (that’s a first!!!).

I found I kept getting the following error in the FF Javascript console:

Debug is not defined

of course always followed by lots of other errors. I found I had to add an empty Debug function in javascript above the rest of my code:

function Debug(){}

Quite a hack, huh?

I’m using Script# ( to build much of my JS framework (I highly recommend) and it relies on this Debug object.


May 8, 2009

Checking equalities of object properties in NUnit

Filed under: Uncategorized — noahblu @ 4:59 pm

I’m retrieving some information from a DB and I wanted to check not only that two objects are equal (which might mean that their persistance ID is the same) but that their properties are equal too.  I wrote the following code to do this.  It’s pretty simple and probably isn’t going to do everything I need down the line, but for the test case at hand it worked well.  Feel free to use it but if you improve it I’d love to hear about it.

public static void PropertiesAreEqual(object o1, object o2)
     Type o1Type = o1.GetType();
     Assert.IsInstanceOfType(o1.GetType(), o2);
     System.Reflection.PropertyInfo[] o1Properties = o1Type.GetProperties();
     Type o2Type = o2.GetType();
     foreach (System.Reflection.PropertyInfo prop in o1Properties)
         Console.WriteLine("Checking... " + prop.Name);
         object o1Value = prop.GetValue(o1, null);
         object o2Value = o2Type.GetProperty(prop.Name).GetValue(o2, null);
         Assert.AreEqual(o1Value, o2Value);

SqlCE Unable to load DLL “sqlceme35.dll” exception on Vista x64

Filed under: Uncategorized — noahblu @ 4:24 pm

I ran into a wall today when I tried testing my NHibernate repositories against a SQLCE Database.

1) Referencing System.Data.SqlCE and
2) Setting Copy Local on that DLL to True (this is required for NHibernate because it expects the DLL in the local directory)

I still was getting an excpetion:

Unable to load DLL “sqlceme35.dll

I found this post about it:

And realized it must be my 64-bid Vista. I downloaded the SP1 from here:

And everything worked fine.

Blog at