Entities and Models in large ASP.NET MVC application

ASP.NET MVC is a presentation framework. To build a large application, a few more architectural components are required. In the post, a greeting is retrieved from the database and displayed in the UX. Data Access Layer Data access layer is distributed into three assemblies: HelloWorldApp.Entities HelloWorldApp.Repositories HelloWorldApp.Repositories.Contracts Greeting class

IGreetingRepository interface

GreetingRepository class

Business Logic Layer The business[…]

Read more

Random Select using Fisher Yates algorithm

Today, I had a chance to use Fisher Yates algorithm. Here is the problem statement: Out of an array of N items, randomly pick K items where 0 < K < N. My first version of the algorithm was as follows:

The code above has two problems: When n == k, the loop takes a long time to complete.[…]

Read more

The basics of Search and TF-IDF vector

Search is a complex subject matter. Using search engines simplifies the solution. Using a search engine shields an engineer from understanding how search works. The objective of this article is to provide a simplified understanding of how search works. What is search? Query is a set of words or tokens which is used to retrieve relevant information. Information is retrieved[…]

Read more

Responsive list of items shown in tabular format

At the bottom of every content site, there are several links. The links are unordered lists in HTML, but they appear in tabular format. For example, the bottom of a site is shown below. The HTML markup for the above grid is quite trivial.

The unordered list has the bootstrap style – list-unstyled. This will remove the bullet point for[…]

Read more

Async functions with AngularJS

The best feature that I have encountered with AngularJS is programming async functions. The best example of using async functions is the $http service. To make a web request, the following javascript code can be used:

The $http function returns a promise object. The promise object has a then function which has two arguments: onSuccess callback, onFailure callback. If[…]

Read more

Configure many-to-many relations in Entity Framework for a MySQL database

The Entity Framework tutorials site has a nice article on configuringmany-to-many relations. In this post, the same case study is implemented on a MySQL database. In addition, the association table has additional useful fields. Example There are two tables: Students and Courses which have many-to-many relation. They are associated by a Student Course table. The Student Course table has one[…]

Read more

Introduction to Google Maps Javascript API

Google Maps Javascript API is very easy to use. In this article, I will show you how you can mark locations in a map. The first step is to get an API Key for Google Maps. Use the API Key which can be used on a web page.

The code for showing the location on the map is very[…]

Read more

Guide to implement cross cutting concerns

Cross cutting concerns (wiki) are classes which interact with most classes in the application that you are developing. Logging, Instrumentation, Caching, Transactions are common examples. Case 1: Class does not know about the concern If the class should not know about the concern, use decorator pattern or AOP. Decorator pattern Decorator pattern is an elegant solution, if properly implemented, to implement[…]

Read more