Friday, December 19, 2014

Use Hangfire to schedule jobs in ASP.NET

Hangfire is a great library to schedule and execute asynchronous work in a web application. One of the things I like about this library is that you can start with a simple background process inside the Application Pool and when your jobs get larger(and take more time) you can move them to a separate process.

Here are the steps to move your Hangfire jobs outside your web application:

  • Step 1 – Change the Hangfire configuration inside your web app to disable the Hangfire server functionality(note that the job information is stored inside a database):
  • Step 2 –Schedule your jobs(like you did before):
  • Step 3 – Inside another project, a console application in this case, you can host the Hangfire server:

Thursday, December 18, 2014

Team based vs Project based

As a certified Scrum Master, I do most of my projects using Scrum (or Scrum but…). I really like the transparency and continuous feedback that Scrum brings to the table. But I also notice that Scrum isn’t the perfect fit for all kinds of projects. It’s suited well for Green-Field/Brown-Field projects but I struggle applying Scrum to a Maintenance project or where one team is working on multiple projects at the same time(which is not done in Scrum).

After reading the following article – No projects, Beyond projects – I stopped trying to use Scrum as the hammer that works for every nail(and screw). In this article, the author promotes an alternative model to think about work. He calls this the Beyond Projects model or more descriptive Continuous Work, or Steady State Work Model, or Work Streams.

The author doesn’t mention it, but it sounds familiar to Kanban

Wednesday, December 17, 2014

Angular.js 1.3: bindToController

I keep finding new stuff inside Angular 1.3. One of the things I found is the bindToController attribute. I’m an advocate of using the controllerAs syntax to get rid of the $scope variable. The only problem before is that in a directive you still had to use $scope…until now.

Let’s first have a look at what the AngularJS documentation has to say about the bindToController attribute:

When an isolate scope is used for a component (see above), and controllerAs is used, bindToController: true will allow a component to have its properties bound to the controller, rather than to scope. When the controller is instantiated, the initial values of the isolate scope bindings are already available

Before scope variables were not included in the controller scope when controllerAs was used. This means that the directive's scope variables were not bound to the object created by controllerAs.  The bindToController attribute fixes this.

Enough talk, show me the code:

Tuesday, December 16, 2014

Woops! Angular suddenly stopped working… and it was Batarangs fault

Last week I encountered a strange problem. Without changing anything to my code, my Angular application started failing. I had no clue why… until I noticed that Batarang, a Chrome Extension for Angular.Js had been updated. It looked completely different and injected some custom JavaScript into my application. As far as I could remember, it did not do that before.

Could it be? I disabled the extension in Chrome and yes, my Angular.js application started to work again. Verwarde emoticon Anyone who had the same problem with the latest AngularJS Batarang extension?

Note: I’m using Angular 1.3 but a colleague had the same issue with Angular 1.2

image

Monday, December 15, 2014

WPF Performance Tips

With the recent announcements about new WPF features, it’s time to re-introduce some WPF related blog posts.

When browsing through the CodeProject articles, I noticed this great post about WPF performance: http://www.codeproject.com/Articles/784529/Solutions-for-WPF-Performance-Issue

This is one of the most complete performance guides I’ve ever seen and certainly useful for every WPF (and even XAML) developer.

Here is the list of topics covered:

  • Basic knowledges of WPF rendering.
    • Pixel Snapping in WPF Application
    • WPF Visual Rendering
  • Detect issues with WPF performance suite - Performance Profiling Tools for WPF
    • Detect Software Render
    • Detect Undesired Rendering
  • Make a trade-off between graphique's quality and performance.
    • Disable Pixel Snapping and Anti-Aliased option
    • RenderOption
    • UIElement.CacheMode and BitmapCache
  • Make a trade-off between architecture and performance
    • IValueConverter and IMultiValueConverter
  • Improving scrolling performance in WPF (Virtualization)
  • WPF in remote desktop
  • Third party libarary
  • The Roadmap for WPF (published at 12 Nov 2014 by Microsoft Project Manager)
  • Brief and Conclusion
  • References

Go bookmark this link!

Friday, December 12, 2014

Microsoft Azure–A/B testing

A/B testing is a technique whereby different users get a different version of an application of website. This allows you test new features ‘in the wild’ and allows to check which experience or functionality is preferred. Facebook uses this technique a lot, but it’s also a useful technique for the ‘non-facebooks’ of the world.

Doing A/B testing in Azure Websites is really easy. It is supported out-of-the-box by using multiple deployment slots. Let’s walk through the steps:

  • Open the Azure Management Portal. Use the new portal available at https://portal.azure.com/. The A/B testing functionality can only be configured there.
  • Create a new Website. Choose a URL, Web Hosting Plan(Deployment slots are only available when you use a Standard plan), Resource Group, Subscription and Location(or just use the defaults Glimlach). Click on Create.
  • Once the website is created, open the blade of the site and look for the Deployment slots section.

image

  • Click on Deployment Slots to load the Deployment Slots blade. Click on Add Slot to create a new deployment slot.

image

  • Specify the name of the slot(this will become part of the URL) and click OK.

image

image

  • Click on the Testing in production configuration. The configuration blade is loaded. For every slot, you can specify how much of the traffic is going to one of the slots or the production site. Click Save to apply the changes.

image

Thursday, December 11, 2014

TypeScript build server error: "tsc.exe" exited with code 1.

typescriptAfter configuring a Continuous Integration build for a TypeScript enabled web application, the build turned red with the following error message:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\TypeScript\Microsoft.TypeScript.targets (118): "tsc.exe" exited with code 1.

On the build server I had installed the TypeScript components for Visual Studio 2013, but for this particular project we were still using Visual Studio 2012. I was able to fix the problem by installing the TypeScript 1.0 Tools for Visual Studio 2012 on the build server.