Skip to main content


Showing posts from September, 2014

I survived the first Ordina Hackaton… (and started counting down to the second edition)

Yesterday I didn’t succeed in creating my daily blog post. Why? Because I was recovering from a 24 hours of coding marathon this weekend. Ordina , the company I work for, organized their first Hackaton. 24 hours of coding, lots of food and even more fun. Going from Unity3D, Quadcopters, Powershell, Xamarin, Windows Store Apps, Angular, and even Sharepoint, there was a technology niche for everyone. Together with some colleagues, we started ‘Team Awesome’ ready to build the coolest game ever(and this in 24 hours)! Our goal was to build a Frogger clone with the following features: · Full 3D game running on Windows, Android and Facebook · Single- AND multiplayer · Stunning graphics and sound effects never seen in a computer game before · Oculus Rift integration( ) · And many more… Without any previous experience, we were able to build a Unity 3D game using the language we all love, C#… It was maybe a little bit too ambitious but we got quite fa

SQL Server Error: The proposed new database owner is already a user or aliased in the database.

On a project I’m working on, I had to set the database owner. So I opened up SQL Server Management Studio, opened the Properties for the database and tried to set the owner. But it failed with the following error: The proposed new database owner is already a user or aliased in the database. It looks like you cannot set the owner of the database to a user that is already used for this database. To fix it, you first have to remove the user from the list of logins.

Using the HTML 5 progress control in Angular.js–IE 11 troubles

A colleague is building his own file upload control using Angular.js. He already got quite far thanks to the power of HTML 5 and Angular.js. As he wanted to show some feedback to the user during the upload process, he integrated the HTML5 progress control. This control works perfect together with Angular.js… unless you are using IE 11. Here is the original code(does'nt work in IE 11): And here is how we got it working using ‘ ng-attr-value ’:

ORMs - You're doing it wrong

ORMs(Object-Relational-Mappers), can’t live with them, can’t live without them. I always had a love/hate relationship with ORMs. No matter if it’s NHibernate, Entity Framework or a micro-ORM solution, it always feels like too much work just to get some data in and out a database… Therefore it’s really important to use ORMs in the correct way. Jimmy Bogard has his own opinions about ORM usage and in his presentation ‘ORMs – You’re doing it wrong’ , he shares his opinions with the world. Nothing gets DBAs more riled up than a developer infatuated with an Object-Relational Mapper. ORMs work great at mapping from relational to objects, but can be a crutch. If you want to make your DBA (and your users happy), you’ll want to use your ORM intelligently. In this session, we’ll look at application patterns, ORM features and more to discover the right way of using your ORM. We’ll also look at when to ditch your heavyweight ORM and reach for a lighter one. Finally, we’ll cover why abstract

Use Windows Live Writer with Blogger and 2-factor authentication

After enabling 2-factor authentication for my Google account, I noticed that I couldn’t upload a blog post anymore. Whoops! If you’re reading this blog post, this means that I fixed it… Here are the steps to get it working again: Log in on Gmail using your Google account. Click on the arrow button next to your email address in the right corner and click on Account . The Account settings site is loaded. Click on the Security tab. Click on Settings next to App passwords . Add a new application for Windows Live Writer and click on Generate to generate a password. Copy the generated password and use it as the password in Windows Live Writer. That’s it! You are now living in a safer world…

ASP.NET Web API Samples

Last month, Filip W released his ASP.NET Web API 2 Recipes book.(A must read by they way…) The book contains over 100 recipes covering various Web API scenarios. Each of the recipes has got an accompanying Visual Studio solution, which illustrates the given problem and presents a solution in a simple, isolated manner. Go buy the book, but in the meanwhile you can already check all the source code for free at Github . Thanks Filip!

ASP.NET Web API issue: This method or property is not supported after HttpRequest.Form, Files, InputStream, or BinaryRead has been invoked.

When calling an ASP.NET Web API it failed with the following error message: "An error has occurred." ExceptionMessage "This method or property is not supported after HttpRequest.Form, Files, InputStream, or BinaryRead has been invoked." ExceptionType "System.Web.HttpException" StackTrace at System.Web.HttpRequest.GetInputStream(Boolean persistEntityBody, Boolean disableMaxRequestLength) at System.Web.HttpRequestWrapper.GetBufferedInputStream() at System.Web.Http.WebHost.SeekableBufferedRequestStream..ctor(HttpRequestBase request) at System.Web.Http.WebHost.HttpControllerHandler.c__DisplayClass11.b__b() at System.Web.Http.WebHost.HttpControllerHandler.LazyStreamContent.get_StreamContent() at System.Web.Http.WebHost.HttpControllerHandler.LazyStreamContent.CreateContentReadStreamAsync() at System.Net.Http.HttpContent.ReadAsStreamAsync() at System.Net.Http.HttpContentExtensions.d__0`1.MoveNext() --- End of stack trace from previous location where exce

Angular.js and KendoUI: be careful when specifying widget options

Although combining Angular.js and Kendo UI is really easy, there is one thing that bit me in the food when I first started combining the two. Let’s have a look at some code I wrote: And then have a look at this code: Do you see the difference? If you look carefully you should notice that the string ‘c2’ (to format the number as a currency) is quoted inside the attribute values. Without the single inside they will be interpreted as variable names and Angular-Kendo will look for $scope.c2. Luckily Angular-Kendo will emit a warning in the JS console when such variables are not found.

Combining Angular.js and KendoUI

Thanks to the built-in support, using Kendo UI together with Angular.js is really easy. For all widgets you have an Angular directive available. Here are the steps you need to take to get it up and running: Include the necessary script references: Either include the kendo.angular.min.js script file or use the kendo.all.min.js (which contains all widgets including the angular.js integration) Add a dependency to Kendo UI inside your Angular app: var productsApp = angular.module('productsApp', ['ngRoute', 'kendo.directives' ]); Use the Kendo UI directive inside your views. A specific naming pattern is used. You even have 2 options(let’s use for example the NumericTextBox widget): Option 1:  kendo-numeric-text-box Option 2: kendo-numerictextbox Widget options also follow a specific naming pattern. The option name is converted from camelCase to dash-separated-words, and prefixing it with k- . For example:

Angular.js debugging tip

Here is a quick debugging tip when you want to debug the scope for a specific element: Open up your Angular.js application in Chrome Use the selection tool(magnifying glass) to select the element you want to inspect When the element is selected Chrome will store this element inside a ‘$0’ property Now that we have an element reference, we can open up the console and write some code to get to the scope:

Angular.js: controller as and routing

I talked about the new ‘controller as’ syntax before . It allows you to create an alias for your controller on your scope and use that inside your views: If you don’t want to specify your controller inside your view and still want to use the ‘controller as’ syntax, this is also possible. On the $routeProvider an extra property is available which allows you to specify the alias there:

Using font-face and .woff files in IIS

After pushing an ASP.NET MVC Web app into acceptance, some users complained that the fonts looked ugly. When investigating the issue we noticed that on Chrome and Firefox a 404 error was thrown when loading a .woff font file in the browser. This prevented the @fontcase specification in our CSS to load the correct font and style our text. We discovered that the MIME type is missing for .woff files in IIS. Luckily, this is an easy one to fix. Open up your web.config and add the following section:

TF400917: The current configuration is not valid for this feature. This feature cannot be used until you correct the configuration

While upgrading a Team Foundation Server instance to the latest bits, I ended up with the following error ( again ): TF400917 : The current configuration is not valid for this feature. This feature cannot be used until you correct the configuration. This time the issue was not related to some missing work item states, but to an invalid configuration of one of the Add panels. The Add panel allows you to quickly add new work items in the web access: In our case the Add Panel was customized to show some extra fields and these fields were no longer available after the TFS upgrade. To fix it, I exported the process configuration file using witadmin exportprocessconfig and removed the invalid field from the AddPanel configuration: Afterwards I imported the process configuration again using witadmin importprocessconfig. This article brought me to the solution: .

Web Framework Benchmarks

If you don’t have any clue which web platform and framework to use, and performance is essential, have a look at TechEmpower Web Framework Benchmarks . Introduction from the site: This is a performance comparison of many web application frameworks executing fundamental tasks such as JSON serialization, database access, and server-side template composition. Each framework is operating in a realistic production configuration. Results are captured on Amazon EC2 and on physical hardware. The project is still evolving, and as it does so, the GitHub repository for the project is turning into a showcase of sorts for each framework's best-practices.   And some info about the motivation : Choosing a web application framework involves evaluation of many factors. While comparatively easy to measure, performance is frequently given little consideration. We hope to help change that. Application performance can be directly mapped to hosting dollars, and for companies both large

Introducing ‘devops’ into your organisation - Stack Exchange's Opserver

I’m currently helping a customer move their IT organisation into a ‘devops’ mindset. One of the tools I’m investigating to improve the transparency of their operational environment is OpServer. Opserver is a monitoring system by the team at Stack Exchange , home of Stack Overflow . It is a tool for monitoring: servers SQL clusters/instances redis elastic search exception logs haproxy ... What works for Stack Overflow should also work for us I guess… Once I’m done looking at all the possibilities I’ll do a follow up post. Until then here are some screenshots:

Error when loading html template using Angular.js: err_content_decoding_failed

After creating an application using Angular.js, we noticed that sometimes the HTML templates were not loaded. If we looked inside the browser console, we saw the following error code: ERR_CONTENT_DECODING_FAILED Turns out that this issue was related to the GZIP compression we were using for our static and dynamic content. It’s not exactly clear why this is causing the issue but switching it of in IIS solved the problem for us. Open up your web.config and disable the compression:

jQuery UI costed a day of my life

Last week I lost a whole day together with a colleague investigating why our jQuery UI Tooltip widget didn’t want to work. Here is the original code: After a long search and a lot of head scratching we finally discovered the cause; the jQuery UI tooltip only works when you specify a title on the tooltip you want to use(even when you want to specify your own content.

Readable code–Techniques to improve code readability

As a lead developer and architect I spend most of my day reading code, a lot more than I am writing code. This should explain why I find readable code very important. (And no documentation is not a good alternative to readable code). On CodeProject I found a great article by Thorsten Bruning explaining a bunch of techniques to improve code readability. If you think readable code is important, a must read…

WCF Data Services: Expression of type 'System.Data.Entity.Core.Objects.ObjectContext' cannot be used for return type 'System.Data.Objects.ObjectContext'

If you try to create a WCF Data Service using the Visual Studio Template(see image below) with an Entity Model created using Entity Framework 6, you’ll end with an exception like the following: Expression of type 'System.Data.Entity.Core.Objects.ObjectContext' cannot be used for return type 'System.Data.Objects.ObjectContext' The problem is that the WCF Data Services template does not offer support for the new Entity Framework 6 classes. In EF6 the ObjectContext is completely decoupled from the .NET framework. As a result the class no longer lives in the same namespace explaining the exception above. WCF Data Services Entity Framework Provider This does not mean you cannot use WCF Data Services with Entity Framework 6. There is a new NuGet package called WCF Data Services Entity Framework Provider . This NuGet package bridges the gap between WCF Data Services 5.6.0 and Entity Framework 6+. Here are the things you need to do to get this working: In

MIT Open Courseware

If you are looking for some more ‘Academic’ training content, go check out the MIT Open Courseware site . It offers a great set of courses on a wide range of topics. So if you are bored studying Angular.js directives and you want to relax your mind, have a look at Quantum Physics for Undergrads or one of the other courses…

JIT Compiler encountered an internal limitation

While debugging an application in Visual Studio, I encountered the following exception message: “JIT Compiler encountered an internal limitation” Woops, what’s that strange beast? I’ve never seen such an error before! A search on the Internet brought me to the following bug on the Microsoft Connect site: . But no solution yet… However there is a workaround that ‘solved’ the problem for me; disable IntelliTrace. Although not a real solution in the long run, I was able to continue working… If you have a better solution, please let me know!