Tag: .NET

A Knight’s Watch

Recently I came across this interesting problem through Toptal (on Codility) which kept me thinking hard for a few days. Finally, I now have a solution to this problem and would like to share it here. Problem: Basically, the problem deals with a knight piece on an infinite chess board. Assuming the knight is positioned […]

Read More

Image File as Response from .NET Web API

When developing a web API, it is often required to send response as a PDF or image file.Following lines of code will assist to create method that will override the default media type of the response determined by Content Negotiation. public HttpResponseMessage GetImage()        {            byte[] bytes = […]

Read More

Automating Development in ASP.NET MVC

Inspired by rapid development framework Artisan in Laravel for PHP, I am thinking maybe we (.NET developers) can do something similar in our environment as well. http://laravel.com/docs/5.0/artisan Basically I am thinking of automating the whole process of creating Repository classes (including required entries for properties and fields), Model classes,  Service layer (layer where you put […]

Read More

Implementing Unit of Work Repository Pattern and Entity Framework Database First Design

Without getting into the discussion of the advantages/disadvantages of this implementation, I would like to straight away get into the implementation pattern that I have learned from working in a company in Kathmandu. If you are interested in the discussion whether this is a better approach of implementation as compared to some other “XYZ” approach, […]

Read More

Flat File Splitter

At work the other day, I needed to write a program for splitting a text file (.txt) to smaller pieces. The file that we received from our client was a flat file of size of about 2.5 GB. I needed to import the contents of the file to our SQL Server database.  Since the file […]

Read More