Debugging with Visual Studio over HTTPS

Quick hint: to enable IIS Express in VS to work with HTTPS, change “SSL Enabled” to true in project properties, and change project URL in Web tab to something like “https://localhost:44300”. The port MUST be 44300 or higher. No more “This site can’t be reached The connection was reset. Try: Checking the connection Checking the […]

Read More…

Controller communication in AngularJS

Quite often there is a need to pass data from one controller to another. This is relatively easy if we need to pass data from child to parent controller, but not so straight forward when controllers are not in that relationship. Still, there’s quite a few ways of achieving that, differing in ease of implementation […]

Read More…

Data mocking in angular E2E testing

We needed to create a suite of e2e tests for our web app, preferably without having to hit the database for obvious reasons. So basically I wanted to have a solution that satisfies these requirements: Allows easy switch between real and test data, for example by specifying a url parameter. Allow to specify a mock […]

Read More…

JavaScript testing quick start

How to quickly setup a JS testing with Karma runner and Jasmine: Install node (http://nodejs.org/download/) Open command prompt, and run npm install -g karma //Packages are installed to c:Usersyour-user-nameAppDataRoaming pm Generate karma config file. In command prompt: cd to your development folder, and karma init If you get a warning WARN [init]: No binary for Chrome. Create […]

Read More…

F#: RPN Calculator

I thought it would be cool to learn another language, for a brain exercise, something different from C#, yet actually usable. So here comes the F#. Trying to learn the syntax as I go along, and translating some C# code into F#. It may not be really idiomatic to F#, but its a start. This […]

Read More…

Late binding in SignalR

Once in a while there’s a need to add a callback to signalR after the hubs/connections have been started. Out of the box – you can’t, though its pretty easy to add. Here’s a solution we’re using for one of internal projects, which basically wraps the hub, and allows to (optionally) add the callbacks at […]

Read More…

JavaScript gotchas

Sort of part 2 to JavaScript notes.   JavaScript has a minimum time resolution of 4ms. If you do a setInterval with 1ms delay – it will be bumped to 4 ms. var x = { val: 0 }; var id = setInterval(() => { x.val++; }, 1); setTimeout(() => { clearInterval(id); console.log(“X: “, x); }, 10000); This code will print same value of x.val whether the delay is 1 or 4 ms.

Read More…

Registering custom NLog target in code

Created a custom target, and wanted to add it in code, instead of adding it in nlog.config file, at least for now. Documentation says all you need is this ConfigurationItemFactory.Default.Targets.RegisterDefinition(“myTarget”, typeof(SignalRTarget));  which is 1/3 of the story. After some some googling and thinking I realized I probably need to specify a rule for the new target. […]

Read More…

WebAPI and custom model formatters

Just had this little gotcha: I needed to do some operations on input parameter to a POST method, so wrote a custom formatter, and added it to a list: config.Formatters.Add(new MyCustomFormatter()); I’m sure those who have done it already see the problem:) Basically web api has a catch-all formatters, so if you do it like […]

Read More…