Thursday, January 1, 2015


CQRS stands for Command Query Responsibility Segregation

Basic concept of this pattern is to keep separate models to read(Query) and write/update(Command) information. Which lead to Command Query Separation.The main aim of CQRS is to assist in building high performance, scalable systems with large amounts of data.


Complex CRUD(Create, Read, Update, Delete) model

chris :

Wednesday, August 6, 2014

Basic Html page with Angular js in 2mins

We only need one html file for this. We can also use three files for this purpose.

1. Angular.js file – this is the main javascript file we need to make page support for Angular js. We can include it in our folder or we can directly take it from CDN.

2. Basic Html file – this file should contain ng-app in any HTML tag. ng-controller,ng-repeat and {{variable}} are code syntaxes.

3. CardController.js file -  this file contains controller class and with $scope variable it defines its parameters.

<html ng-app xmlns="">
<!--<script src="scripts/angular.min.js"></script>-->
<script src="//"></script>
<script language="javascript">
//we can also use CardController.js for this
var CardController = function ($scope) {
= [{ Id: 1 }, { Id: 4 }];
<body ng-controller="CardController">
<div ng-repeat="card in cards" class="CardItem">
Id: {{card.Id}}

Output will be
Id: 1
Id: 4

Hope you wanted to learn more simple beginners lessons on AngularJS covering most parts with examples. -

Tuesday, August 5, 2014

Remove Carriage Return, Line Feed, Tab in TSQL

Following code shows way to remove all spaces from selected column values. We generally use RTRIM and LTRIM build in string functions but sometimes it doesn’t remove some spaces due to string contains carriage return life feed and tab like control characters. We can’t see these characters with grid result view but we can see in text result view in MSS Management Studio.

REPLACE(REPLACE(REPLACE(RTRIM(LTRIM(ColumnName)), CHAR(10), ''),CHAR(13), ''),CHAR(9), '')
CHAR(9) - 'Tab'
CHAR(10) - 'Line Feed'
CHAR(13) - 'Carriage Return'

Wednesday, June 4, 2014

Started to deep learn Software Design


Clean Code: A Handbook of Agile Software Craftsmanship [Robert C. Martin]

Tuesday, April 1, 2014

Create a user for SQL Server authentication

First log into sql server using sql management studio or other relevant tool as an administrator.
Then use following command to create testuser in testdb database. You can ignore DEFAULT_DATABASE part as well if it is not working.

-- Create user for SQL Authentication
USE master
    WITH PASSWORD = 'test#123',DEFAULT_DATABASE = testdb

-- Creates a database user for the login created above.
USE testdb
CREATE USER testuser FOR LOGIN testuser

Saturday, December 15, 2012


I got following error when running Test project with visual studio 2010.

SetUp : System.BadImageFormatException : Could not load file or assembly 'TP, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.


When I checked there were difference in Solution platforms of two project.One set to x86 while other project set to AnyCPU.So I changed it from AnyCPU to x86.It works.

Wednesday, July 18, 2012

C# Password encrypting and decrypting

public static string HashPassword(string password)
    var provider = new SHA1CryptoServiceProvider();
    var encoding = new UnicodeEncoding();
    var hash= provider.ComputeHash(encoding.GetBytes(password));
    return Convert.ToBase64String(hash);

var pwdstr=HashPassword(password);
var user=(from u in context.Users
          where u.UserName.Equals(username) && u.pwd.Equals(pwdstr)  
          select u);

This is simple way to set and check password stored in database.Hope it will helpful.To store in a database use first method and to compare use second method.Until next post cheers!!!