Wednesday, December 30, 2015

TSQL: count specific children in hierarchy

We have a project with hierarchical data: there are products nested in different categories and categories in its turn nested in segments. The goal was to count products and display this count on parent nodes. So basically we needed something like this:

As you can see there is amount of products displayed next to every node. Lets take a look on how to count those products using TSQL and CTE tables.

Tuesday, December 29, 2015

.NET: Custom minified script bundles with sourcemaps

I stumbled upon a situation where I had to create minified javascript bundle with a sourcemap for this bundle. There is no default implementation at the moment, however there are classes in Microsoft.Ajax.Utilities namespace which can be used to do it.