Showing posts with label .Net Core. Show all posts
Showing posts with label .Net Core. Show all posts

Friday, September 21, 2018

Setting up a Dockerfile to publish a .net or .netcore application in a Windows container

Docker has been gaining significant traction lately, most of it can be credited to it's ability to create portable lightweight containers very quickly for continuous deployments and sprawling testing and staging environments. These environments would require a Dockerfile to carry a set of steps and instructions that would be needed to successfully restore, build and publish a .net or .netcore application.

Let's begin right away with the 1st step; selecting a build SDK image. For .net applications it would be microsoft/dotnet-framework:4.7.1-sdk and for .netcore applications we'll use microsoft/dotnet:2.1-sdk. Both of these are Windows images. The following would be the first step of our Dockerfile:

# Build SDK image
FROM microsoft/dotnet-framework:4.7.1-sdk AS build-env   # .net

FROM microsoft/dotnet:2.1-sdk AS build-env               # .netcore

Sunday, June 10, 2018

Using System.Drawing to create an image thumbnail cropped at 1:1

Creating a thumbnail for an image is very easy if you are developing for .Net Framework or .Net Core, since both platforms offer the System.Drawing packages. The tricky solution is cropping the image in perfect square format without distorting or stretching the image.

The following code shows how to exactly do a center crop while generating a thumbnail, the original image needs to be scaled down to match size of the thumbnail while maintaining the aspect ratio first, then moved to an offset calculated previously such that the final drawing removes the pixels that were supposed to be cut off during the cropping. The offset represents the number of pixels of that side that require to be cropped off.

It should be kept in mind that on .Net Core the package must cover all platforms. For that case there are three nuget packages available for .Net Core for Windows, Linux, and OSX each.

Monday, February 16, 2015

Kendo UI Grid - Server Side Paging, Filtering and Sorting

There are a number of ways a DataSource can be handled with a Kendo UI Grid. In this article we are going to talk about binding data from a remote location on to a Kendo UI Grid with server side paging, filtering and sorting to ensure server response is smallest and light as possible for quick loading and to be able to handle if the data has thousands of records (that can lead to oversized response objects or time outs). I will give example code snippets to form an understanding of the solution.

The Grid


Below is a Kendo UI Grid declaration for which we will implement the server side manipulation.