Thursday, October 2


I am reading "A Software Engineer Learns HTML5, JavaScript, and JQuery". The examples for using JQuery in Chrome under the Tools->Javascript Console did not work at first. It was a simple fix: Include a script at the top of the HTML file with


or something similar. This particular line reads the library from Google. It can also be downloaded from:

Thursday, September 4


The DOCTYPE is an important signal to browsers and allows them to interpret the content of a document in the context of the rules associated with the doucment type. If this is omitted the browser will revert to its tradition rule set and the may produce very different results from one browser to another or even one version to another.

There is typically no version number attached to HTML in the DOCTYPE. There is also no Document Type Definition (DTD) defining the rules of the markup language. The reason for this is that HTML5 is not based on SGML like earlier version of HTML.

Although HTML5 is not based on any other standard, it is possible to write HTML5 in XML serialisation mode. The following would be the skeletion for a HTML5 page inat serializes to XML:


HTML documents that utilize XML mode should have a document type of application/xhtml+xml

Thursday, May 15

ExpectedException on an inner exception

How do I do this? I have a test with an expected exception, but the act is going through reflection. The code throws the exception, but reflection is changing the exception. Can I use ExpectedException on an inner exception?
public void TestTransformationNegative()
   // Arrange 
   int[] numbers = { 10 };
   var target = new LinqProjectionAccessor(new LinqProjection());

   // Act
   string[] numbersAsText = target.Transformation(numbers);
Test Name: TestTransformationNegative Test FullName: UnitTestLinq.TestLinqProjection.TestTransformationNegative Test Source: c:\Users\tjmadden\Source\Workspaces\Linq\UnitTestLinq\TestLinqProjection.cs : line 128 Test Outcome: Failed Test Duration: 0:00:00.0264312 Result Message: Test method UnitTestLinq.TestLinqProjection.TestTransformationNegative threw exception System.Reflection.TargetInvocationException, but exception System.IndexOutOfRangeException was expected. Exception message: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array. Result StackTrace: at Linq.LinqProjection.<>c__DisplayClass5.b__4(Int32 n) in c:\Users\tjmadden\Source\Workspaces\Linq\Linq\LinqProjection.cs:line 147 at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Linq.LinqProjection.Transformation(Int32[] numbers) in c:\Users\tjmadden\Source\Workspaces\Linq\Linq\LinqProjection.cs:line 149 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at UnitTestLinq.Accessors.AccessorReflection.RunMethod(Type objectType, String methodName, Object objectInstance, Object[] objectParameters) in c:\Users\tjmadden\Source\Workspaces\Linq\UnitTestLinq\Accessors\AccessorReflection.cs:line 51 at UnitTestLinq.Accessors.AccessorBase`1.RunMethod(String methodName, Object[] parameters) in c:\Users\tjmadden\Source\Workspaces\Linq\UnitTestLinq\Accessors\AccessorBase.cs:line 35 at UnitTestLinq.Accessors.LinqProjectionAccessor.Transformation(Int32[] numbers) in c:\Users\tjmadden\Source\Workspaces\Linq\UnitTestLinq\Accessors\LinqProjectionAccessors.cs:line 54 at UnitTestLinq.TestLinqProjection.TestTransformationNegative() in c:\Users\tjmadden\Source\Workspaces\Linq\UnitTestLinq\TestLinqProjection.cs:line 134

Wednesday, May 7

Getting StyleCop to ignore temporary files.

I use StyleCop. I like it. With Visual Studio 2013, though, I found a few problems. Number 1 is that Express does not have extensions, so you must add the StyleCop extension to the project manually.

<import project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
<import project="$(ProgramFiles)\MSBuild\StyleCop\v4.7\StyleCop.targets"/>

StyleCop also complains the temporary files that Visual Studio generates do not have headers. There are a few ways to have it ignore these, but I found adding this to the project file works well in the Express version of Visual Studio.
  <excludefromstylecop include="$(IntermediateOutputPath)\**\*.cs">