C# – How to find overlap of datetime intervals

I needed to count the overlap of the datetime intervals. After some coding I’ve refactored the code to static class and uploaded¬†to Github, so that others can use it too. It might save you some time ūüôā There are currently two methods. One to get the interval overlap and the other to count the interval […]

How to speed-up generating PDFs via TMS Flexcel

In my¬†current project¬†we needed¬†to generate lot of PDFs from the same excel template. ¬†For this we use TMS Flexcel library. It is a simple library for generating Excel or PDF files in .NET. It loads a xls template from filesystem, populates it with data and that’s it. Quite easy. But generating tons of files¬†in a […]

Handle exceptions in ASP.NET + IIS

Handling exceptions in ASP.NET can be quite tricky. There is lot of ways how to handle them, some are described in the links below (see resources to study). Our solution looks like this Web.config <system.web> <!– MVC Settings –> <compilation debug=”true” targetFramework=”4.5.1″ /> <customErrors mode=”On” /> <!– TODO: Use RemoteOnly for production –> </system.web> <system.webServer> […]

How to call any function as a $filter in AngularJs

Recently I had this little trouble. I had a simple angular controller, which filtered some array of items. I did not want to define the filter in a “global space” because I knew it will be used only by this one controller. So this first thing was to define the custom filter function. Like this […]

Selenium WebDriver can’t start

After a few days of writing tests using Selenium, the WebDriver suddenly stopped working. It did not even start. I tried to restart my machine, check versions of Firefox and Selenium (both were up to date), restart Visual Studio, clean solution. Nothing worked. ¬†There was not even an exception description. All I got was a […]

How to optimize SQL generated by NHibernate

If we query objects with lot of dependencies NHibernate can (and I believe by default will) load all of them. In many situations this is not necessary. For example all we want is to count objects with some properties or show only 3 properties of some object. The object has lets say 20 properties, some […]

How to unit test Angular’s $resource and $http

Unit testing of Angular’s underlying $http can be very tricky. I’ve some spent considerable time to get the unit testing up and running. What was running OK in a live application, was not working at all in a unit test. I was getting error message “No pending request to flush !” all the time. My […]

Function string.format ported from .NET to AngularJS

Have your ever wondered if there something like string.format() method as known in .NET but available in Javascript? And waht about AngularJS? The answer is yes. Guys from Microsoft wrote library Ajax Control Toolkit, containing little this gem String.js¬†(I found it via Stackoverflow). I needed it as a filter in AngularJS, so I have ported […]