Injecting resource files as plain JavaScript objects in ASP.NET Core

Localization and internationalization are much-discussed topics and many terrific solutions have been developed to easily create multilingual applications. I would like to introduce a different way of localizing web-based applications. As the title suggests, I will show you how to inject resource files as plain JavaScript objects to the web client. The result is a simple JavaScript object which is globally available to the client. I found this so useful that I did a similar thing for translated content and even the application’s settings (which are stored in a database).

How to fix SQL Server Data Tools error ‘Unexpected exception caught during population of source model’ in Visual Studio 2017

For the last few days I’ve been getting an error when comparing database schemas in Visual Studio using the SQL Server Data Tools:

“Unexpected exception caught during population of source model: Object reference not set to an instance of an object”

Preparation materials for Exam 70-487: Developing Microsoft Azure and Web Services

Months behind schedule, I have begun preparations for my next exam: 70-487 Developing Microsoft Azure and Web Services. If I pass this one, I’ll be MCSD in Web Applications.

A repository of useful PowerShell scripts

I have had to generate a lot of new files lately, and because I am allergic to repetitive work, I looked for a way to dynamically generate and process files. And for my case, PowerShell scripting comes pretty close to what I needed. Just like a few of my other posts (the best of StackOverflow and Things I always have to Google, I decided it would be a good idea to centralize these scripts and share them with you. Most of these scripts were made for one specific case so they’re not generic – but upon request I’ll try to make these as generic as possible. This is going to be a post that I’ll hope to update on regular occasions, so make sure to pay a visit every now and then if you’re working with PowerShell too.

Best of Stack Overflow

Just as in my other post about topics I have to “re-Google” often, this post serves as a catalog of interesting Stack Overflow articles. Because the concept of browser favorites doesn’t work quite well in my world, this blog post does the job of keeping a simple and convenient list very well. To keep things as simple as possible, I have divided the post in categories, comparable to the tags in Stack Overflow.

Create lambda expressions on the fly in C#

For the last couple of weeks I have been working with client-side frameworks such as Kendo UI and Sencha ExtJS a lot. One of the requirements of my clients was server-side filtering, grouping and ordering of several grids and other components. The challenge here is that you don’t know exactly what information might be coming in: which field do you have to filter or sort, which direction, what operator do you have to use, etc. There is only one proper way to do this in C#: Expressions.

ASP.NET MVC fixing error ‘Multiple types were found that match the controller named’ when routing is not the problem

I just came across following error message while I was converting one of my ASP.NET MVC applications:

Multiple types were found that match the controller named 'Home'. 

Replacing file extensions from uppercase to lowercase

Here’s a very simple utility that recursively finds uppercase file extensions and makes those who are lowercase. For once, it’s not written in C# but in good old DOS. If you paste this code in a CMD file, you’ll have a working program. If you execute this cmd, it will take the current folder as the root and it will process all files and subfolders.

Nowadays you would use PowerShell but this is a way to provide a quick fix to your users.

C# and the Spotify Web Api: part I (authorization)

Curious about the possibility of displaying Spotify playlists on my website, I investigated the Spotify Web API. Initially, I thought everything seemed quite easy, but then I got to the authentication and authorization section. As it turned out, it is not that simple but after trial and error, I got what I wanted. Here’s what I did.