Friday Links 0.0.9 - MISC: unclosed tags, bin packing, nfluent

This is based on an email I send my .NET team at work

Happy FridayMonday,

A few random links today.

Unclosed Tag Finder

http://jona.ca/blog/unclosed-tag-finder

This has saved me a few times when trying to find an unclosed HTML tag buried somewhere among a half dozen templates. You just paste in the markup and it will try to tell you what tag is broken.

Binary Tree Bin Packing Algorithm

http://codeincomplete.com/posts/bin-packing/

I stumbled across this when I was looking into how some front-end build tools do automatic spriting. CSS spriting is a way of taking multiple source images and cramming them into one large image, then using CSS to adjust what part of that large image is actually visible. This can increase performance of a website by reducing HTTP requests for multiple images.

The naive approach is to just throw them all together linearly, but if the images are a bunch of different sizes, you wind up with a lot of wasted whitespace.

This article walks through how to use a binary tree to sort the source images in a way that makes it easier to fit snugly into a square output image with way less wasted space.

It also comes with a nice [demo page](http://codeincomplete.com/posts /bin-packing/demo/).

N-Fluent

http://n-fluent.net/

I really like N-Fluent for writing unit test assertions in C#.

It plays really well with Intellisense, so that it has customized matchers based on the type of the object you are testing. For example, if its a string, Intellisense will prompt you with EqualsIgnoringCase or if its an IEnumerable it has enumerable testing methods

I also like that it’s impossible to get the expected and actual backwards. In Nunit, Xunit, and MSTest, the assertions are always Assert.Equal(expected, actual). I frequently forget the right order. If you get it wrong, the test still passes/fails, but the error message becomes confusing.

It also has really nice error messages that quickly point you to the problem.