Teemablogi sissekanded


Recognizing printed text on images using Azure Computer Vision API

Microsoft Azure Cognitive Services offer us computer vision services to describe images and to detect printed or handwritten text. Text recognition provides interesting scenarios like cloud based OCR or providing automated translations for texts on images. This blog post focuses on recognizing printed text using Azure Computer Vision API. Source alert! Sample solution built on ASP. 11:30 08.11.2017 kanalilt DT blogi 2


Running ASP. NET Core applications on Windows Subsystem for Linux.

Windows 10 has something called Windows Subsystem for Linux and this something enables us to run Linux applications on Windows 10 using Linux without need for Hyper-V or other virtual machines. When building multi-platform applications like my open-source TemperatureStation solution then having Linux right there for testing comes very handy. This blog post shows how to get Linux running on Windows, how to install. 10:01 03.11.2017 kanalilt DT blogi 2


Server-side charts with ASP. NET Core, Node services and D3.

ASP. NET Core introduces Node services that allow applications to run Node scripts on server. We can send data from controller action to Node script and get back some output we can use in view. This blog post shows how to use Node services to render d3. js charts on server-side to PNG files. Why Node services Node has tons of modules available and ready for use. Before Node services there were no good way in ASP. 08:49 25.10.2017 kanalilt DT blogi 2


NotSupportedException: No data is available for encoding 1252

Another day, another surprise on . NET Core. Tried to load a file with Windows-1252 encoding and got the following exception: NotSupportedException: No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding. RegisterProvider method. Here’s how to solve the problem. 07:22 05.10.2017 kanalilt DT blogi 2


ASP. NET Core and IIS: 502. 5 Process Failure 0x80004005 : 80008083.

When running ASP. NET Core on IIS one may get weird error Application ‘<IIS PATH>’ with physical root ‘<PATH TO APPLICATION>’ failed to start process with commandline ‘”dotnet” . \MyApp. dll’, ErrorCode = ‘0x80004005 : 80008083. Here is one and most probable solution for this issue. It usually comes down to fact that runtime needed for web application is not available on server. 08:24 29.09.2017 kanalilt DT blogi 2


Defensive database context for multi-tenant ASP. NET Core applications.

In multi-tenant applications where tenants share same data store cross-tenant operations must be avoided. There are many ways how bugs like this can happen. Be it hard to debug threading issue or some other complex situation, it is better when application components are ready for this kind of situations and better fail instead of going to glory end with illegal operations. 08:40 04.09.2017 kanalilt DT blogi 2


Unit testing multi-tenant database provider

My saga on supporting multiple tenants in ASP. NET Core web applications has come to point where tenants can use separate databases. It’s time now to write some tests for data context to make sure it behaves correct in unexpected situations. This post covers unit tests for data context and multi-tenancy. My previous work on multi-tenancy To get better understanding of my previous work on multi-tenancy in ASP. 09:36 29.08.2017 kanalilt DT blogi 2


Handling missing tenants in ASP.NET Core

My last post about multi-tenants applications with ASP. NET Core Implementing database per tenant strategy on ASP. NET Core I proposed some ideas about tenant providers but I didn’t focused on issues related to missing tenants. This post proposes missing tenant middleware that redirects faulty requests to some public page of company web site. To get better understanding of my previous work on multi-tenancy in ASP. 08:00 24.08.2017 kanalilt DT blogi 2


Implementing database per tenant strategy on ASP.

Let’s continue with multi-tenancy in ASP. NET Core web applications and focus on solutions where every tenant has its own database. It’s not only about database – there can be more services where every tenant has its own instance. It makes solution provided here easily extendable to also other services besides SQL Server or any other relational database. 08:22 23.08.2017 kanalilt DT blogi 2


Implementing tenant providers on ASP.NET Core

In my previous post about global query filters in Entity Framework 2. 0 I proposed an idea how to automatically apply query filters to all domain entities when model is built so enitites are always coming from the same tenant. This post digs deeper to possible solutions for detecting current tenant in ASP. NET Core we applications and proposes some tenant providers to use as starting point for multi-tenancy support in real-life applications. 08:29 22.08.2017 kanalilt DT blogi 2


Using bearer tokens in ASP.NET Core

There are not much examples available about ASP. NET Core and acquiring access token. I found good and pretty big sample by Microsoft Patterns & Practices called multitenant-saas-guidance, Based on this I wrote my simple “boiler plate” ASP. NET Core solution that authenticates against Azure Active Directory and asks current user data using Microsoft Graph. 08:34 21.08.2017 kanalilt DT blogi 2


Hiding search suggestion in Search Results Web Part

I have page in SharePoint where users can search for specific type of items and see different results in Search Results Web Parts. The page I have has eight results web parts and when nothing is found I want to keep results web parts laconic and minimal so they don’t waste space on screen. What I want is shown on following two screenshot fragments. 07:38 18.08.2017 kanalilt DT blogi 2


ASP. NET Core: Building enum provider to convert C# enums to JavaScript.

My previous post about ASP. NET Core and getting C# enums to JavaScript was primitive and used simple attribute on enums to detect ones we need in JavaScript. This blog post extends the idea and makes some generalizations to support also those enums that are located in the libraries we don’t control or on what we don’t want to apply attribute. 07:30 17.08.2017 kanalilt DT blogi 2


Global query filters in Entity Framework Core 2.0

Entity Framework Core 2. 0 introduces global query filters that can be applied to entities when model is created. It makes it easier to build multi-tenant applications and support soft deleting of entities. This blog post gives deeper overview about how to use global query filters in real-life applications and how to apply global query filters to domain entities automatically. Sample solution. 07:00 16.08.2017 kanalilt DT blogi 2


Like-operator in Entity Framework Core 2.0

Entity Framework Core 2. 0 was announces yesterday and it brings some new and cool features. One of them is SQL Like-operator we can use now using directly in our code. Here is the simple web application that demonstrates using of new Like-operator. Let’s start with simple Songs table in SQL Server database. Here are the model for table and database context. 09:11 15.08.2017 kanalilt DT blogi 2


.NET Core, ASP.NET Core, EF Core and .NET Standard 2.0 announced

Today Microsoft announced versions 2. 0 of . NET Standard, . NET Core, ASP. NET Core and Entity Framework Core. Also new updated to Visual Studio 2017 are available (both stable and preview version). This blog post is summary of most important features announced today. . NET Standard 2. 0 . NET Standard is for sharing code Much bigger API Surface (32k API-s in . NET Standard 2. 0). 09:02 14.08.2017 kanalilt DT blogi 2

ASP.NET Core: Converting C# enums to JavaScript

In my previous posts about enums I covered how to convert C# enums to JavaScript on classic ASP. NET MVC. This blog post introduces how to do it on ASP. NET Core using simple view component. To get better understanding about my previous work on getting C# enums to JavaScript on classic ASP. 08:33 14.08.2017 kanalilt DT blogi 2


Converting System.Drawing.Color to hex

One quick code note to make during building my Azure Cognitive Services demo application. I needed a way how to convert colors of System. Drawing to hex strings that I can use in views. Here is my simple and elegant solution. To convert Color to hexadecimal string we can use ColorTranslator class from System. Drawing namespace. As I don’t want views to have direct dependencies to System. 07:40 11.08.2017 kanalilt DT blogi 2


Controlling LifeCam Cinema on Raspberry Pi

After some Windows 10 IoT Core updates I discovered that it detected LifeCam Cinema camera connected to it. I tried it also few months ago but then Windows 10 IoT Core was not able to detect it. To find out if and how it works I wrote a primitive UWP application that shows picture from camera and saves photos made using webcam. Here is the nice evidence of support for LifeCam Cinema. I found it from Windows 10 IoT Core Device Portal. 08:00 10.08.2017 kanalilt DT blogi 2


Converting multiple C# enums to JavaScript

My last solution to turn C# enums to JavaScript was simple but needed some additional work to support multiple enums better. After some playing with different approaches I found simple one that works okay for me. This blog post describes my simple solution that turns multiple C# enums to JavaScript with one shot. NB! This post is like chapter two to my previous enums post Converting C# enums to JavaScript. 08:00 09.08.2017 kanalilt DT blogi 2