Skip to main content

Posts

SOLID Principle

SOLID is a design principle used in software industry. The objective of this principle is to make software Scalable, Maintainable, Loosely coupled, Encapsulated etc. The major flaws in design to fail the software are as below: Assigning more and more responsibility to a single class. Depending one class on another class. Spreading/Introducing duplicate code in the system. SOLID principle provide great help to overcome these design flaws. SOLID Principle Details S: Single Responsibility Principle (SRP) O: Open Closed Principle (OCP) L: Liskov Substitution Principle (LSP) I: Interface Segregation Principle (ISP) D: Dependency Inversion Principle (DIP) S: Single Responsibility Principle (SRP) A Class or Module or Function should have only one job to do. In another words, our Class or Module or Function should have only one reason to change. It should not be like Swiss knife wherein if one of them need to change then entire tool need to be
Recent posts

Design Patterns

Design patterns are basically the best practices used by expert in software development to achieve high scalability, high maintainability, high solutionability, high flexibility and so on. Design Patterns can be classified into three categories Creational, Structural and Behavioral patterns. Creational Design Patterns It provide a way to create an object while hiding the creation logic instead of instantiating objects directly using new key word. It provide more flexibility to the program to decide which objects need to be created for a given use case. Example Factory Pattern, Factory Method Pattern, Abstract Factory Pattern, Singleton Pattern, Builder Pattern, Prototype patterns are the example of creational design pattern. Structural Design Patterns Assembling classes and objects into larger structure while keeping the structures flexible and efficient. Inheritance is an example of this pattern. Example Adapter Pattern, Bridge

Frequent Terms used in Cloud world

In cloud world, number of terms or terminology used. We listen and use those terms on our daily life and also implement it in the project. But sometimes if someone suddenly ask about those words, we get confused and feel guilty because of unable to answer properly. That is the reason I am summerising some of the important terms together on this page so that we can memorize it quickly. Before going to the cloud world, lets first understand the Environment . Environment: Combination of Infrastructure/Hardwares, Softwares and Networking is collectively called as environment. Environment can be setup in two way On-Premises environment and Cloud environment. 1. On-Premises Environment: When all the required resources (Hardwares, Softwares, Tools, Applications etc.) are deployed in-house and within an enterprise’s IT infrastructure then it is called on-premises environment. An enterprise is responsible for maintaining the solution and all its related proce

Infrastructure Automation OR Infrastructure as Code (IaC)

Infrastructure as a code means create your required infrastructure through the code written using PowerShell or Azure CLI or Terraform.  The purpose of infrastructure as code is to enable developers or operations teams to automatically manage, monitor and provision resources, rather than manually configure discrete hardware devices and operating systems. Here I am not going to much focus on what is Infrastructure as a code rather I will prefer to focus more on 1. How to learn it?, 2. How to write the code for it?, 3. How to execute the code? and 4. How to automate whole process? There are various way to write code to create infrastructure but I will mainly focus on using Terraform script to create infrastructure. You can see the whole steps at this Github link For the simplicity, I have created two folders in this repository one is learning and another is practical. I will suggest to first refer the learning part and then come to practical part.

Frequent Terms used in Container World

In the container world, number of terms or terminology used. We listen and use those terms on our daily life and also implement it in the project. But sometimes if someone suddenly ask about those words, we get confused and feel guilty because of unable to answer properly. That is the reason I am summerising some of the important terms together on this page so that we can memorize it quickly. Some of the important terms are as below: Virtual Machine (VM), Container, Docker, Kubernete, Cluster, Nodes, Master Node, Worker Nodes, POD, Kubernete Service, Replication Controller or ReplicaSet and Auto Scaling I am trying to arrange those terms as per their uses and sequence. Virtual Machine (VM): VM is a kind of a virtual server that you can connect remotely. VM contains whole Operating Systems with all its libraries like any other physical machine that make it heavy in GB in size. To run an application web/window, you need a machine either (virtual or physical). Let sa

How to parse JSON data in SQL Server

To parse JSON data in SQL Server, there is a function called OPENJSON can be used in SQL Script. Syntax:   OPENJSON( [jsondata] , [path] ) [ with Clause  ] . Parameter jsondata is your json data and parameter path is the node of your jsondata. '$' is used to hold the root node. But before using OPENJSON function in your SQL Server, you must set compatibility level as 130 at least in your database to support OPENJSON function. Example: ALTER DATABASE MyDatabase SET COMPATIBILITY_LEVEL = 130 Parse JSON Data Example 1: DECLARE @Json NVARCHAR(MAX) SELECT @Json = ' { "StudentList": [  {  "Id":1, "FirstName":"Amalay", "LastName":"Verma", "Class":10, "Marks":61.5 }, {  "Id":2, "FirstName":"Saurabh", "LastName":"Sharma", "Class":11, &qu

Automation of Coding Standards for .Net using StyleCop

While writing c# code, it is very difficult to ensure that every developer is following coding standards guideline. Forget the advanced level of coding standards even we have experienced that basic level of coding standards are not followed properly in the project. And the major reason behind this is the manual process of forcing team members to follow the coding standards some time developer minds it and taking negatively. It is better idea to force developer by machine rather than human to follow coding standards in their code. For this there are couple of tools which are used to automate the coding standards process such as   StyleCop   FxCop   Code Analysis etc.  All these tools have some good and bad thing with own. Here this document is going to contain all about StyleCop.  StyleCop is a tool from Microsoft (an open Source Tool btw.) to analyse the Source Code. It works on C# source files directly rather than .DLLs. Sty

Azure Service Fabric Mesh

Service Fabric Mesh Azure Service Fabric Mesh  is an extension of the Azure Service Fabric. In another words, we can also say that it is a kind of Serverless version of Azure Service Fabric. Azure Service Fabric Mesh is a fully managed service which works on “ code and deploy ” fashion. It enables developers to develop & deploy Microservices applications without managing virtual machines, storage, networking, or infrastructure. It works by analyzing the resource requirements of each application and the available infrastructure, then automatically scales, rolls out upgrades and self-heals whenever it’s required. The platform supports both Linux and Windows containers, Microsoft said. With Azure Service Fabric Mesh, developers can deploy container-based Microservices directly from the Azure Portal or Command Line Interface, or from within Microsoft’s integrated development environment Visual Studio.              Azure Service Fabric Mesh tools that al

Page Directives in ASP.NET

Page directives configure the runtime environment that will execute the page. The complete list of directives is as follows: @ Page - Defines page-specific attributes used by the ASP.NET page parser and compiler and can be included only in .aspx files. @ Register - Associates aliases with namespaces and classes, which allow user controls and custom server controls to be rendered when included in a requested page or user control. @ Assembly - Links an assembly to the current page or user control declaratively.  @ Control - Defines control-specific attributes used by the ASP.NET page parser and compiler and can be included only in .ascx files (user controls). @ Implements - Indicates that a page or user control implements a specified .NET Framework interface declaratively.  @ Import - Imports a namespace into a page or user control explicitly. @ Master - Identifies a page as a master page and defines attributes used by the ASP.NET page parser and compiler and can be included onl

Page Life Cycle in ASP.NET

Page_PreInit Page_Init Page_InitComplete Page_PreLoad Page_Load Page_LoadComplete Page_PreRender Render

Generalization & Specialization in OOPS

Generalization: The concept of generalization in OOP means that an object encapsulates common state and behavior for a category of objects. Example : The geometric shape is an object and most geometric shapes have area, perimeter, and color. Specialization: The concept of specialization in OOP means that an object can inherit the common state and behavior of a generic object. However, each object needs to define its own special and particular state and behavior. Example: Each geometric shape has its own color and particular formulas to calculate its area and perimeter.

Various .Net Tools

What is Ilasm.exe used for? Ilasm.exe is a tool that generates PE files from MSIL code. You can run the resulting executable to determine whether the MSIL code performs as expected. What is Ildasm.exe used for? Ildasm.exe is a tool that takes a PE file containing the MSIL code as a parameter and creates a text file that contains managed code. What is the ResGen.exe tool used for? ResGen.exe is a tool that is used to convert resource files in the form of .txt or .resx files to common language runtime binary .resources files that can be compiled into satellite assemblies. Strong Name Tool (Sn.exe) used for? Sn.exe is a tool that is used to generate strong name. eg: sn -k mykey.snk What is the caspol.exe tool used for? The caspol tool grants and modifies permissions to code groups at the user policy, machine policy, and enterprise policy levels. Some more tool will be added shortly ! Please wait.... 

A short description about .Net Assembly

What is an assembly? An assembly is a collection of one or more .exe or dll’s. An assembly is the fundamental unit for application development and deployment in the .NET Framework. An assembly contains a collection of types and resources that are built to work together and form a logical unit of functionality. What are the contents of assembly? A static assembly can consist of four elements: 1. Assembly manifest - An assembly manifest contains the information about the identity and version of the assembly. It also contains the information required to resolve references to types and resources. 2. Type metadata - Binary information that describes a program. 3. Microsoft intermediate language (MSIL) code. 4. A set of resources. What are the different types of assembly? 1. Private assembly: A private assembly is installed in the installation directory of an application and is accessible to that application only. 2. Shared assembly: Shared assembly is shared by multiple

Increasing request limit quota in WCF/REST Service

Customizing  webHttpBinding  in web.config and referencing with  bindingConfiguration  in endpoint element <system.serviceModel>     <behaviors>       <endpointBehaviors>         <behavior name="AmmuEndPointServiceBehavior">           <webHttp />         </behavior>       </endpointBehaviors>       <serviceBehaviors>         <behavior name="AmmuServiceBehavior">           <serviceMetadata httpGetEnabled="true" />           <serviceDebug includeExceptionDetailInFaults="true" />         </behavior>       </serviceBehaviors>     </behaviors>     <bindings>       <!-- Customizations for REST service -->       <webHttpBinding>         <!-- Limits set to 10 MB (specified value in bytes) -->         <binding name="AmmuBinding" maxReceivedMessageSize="10485760" maxBufferPoolSize="10485760" maxBufferSize="10

HTTP status codes

1xx – Informational:  These status codes indicate a provisional response. The client should be prepared to receive one or more 1xx responses before receiving a regular response. 100 - Continue. 101 - Switching protocols. 2xx – Success:  This class of status codes indicates that the server successfully accepted the client request. 200 - OK. The client request has succeeded. 201 - Created. 202 - Accepted. 203 - Non-authoritative information. 204 - No content. 205 - Reset content. 206 - Partial content. 3xx – Redirection:  The client browser must take more action to complete the request. For example, the browser may have to request a different page on the server or repeat the request by using a proxy server. 301 - Moved Permanently 302 - Object moved Temporarily 303 - See Other 304 - Not modified. 307 - Temporary redirect. 4xx - Client Error:  An error occurs, and the client appears to be at fault. For example, the client may request a page that

Removing HTML tags from Input String in Sql Server

CREATE FUNCTION [dbo].[FN_AMMU_REMOVE_HTML_TAGS] ( @INPUT_STRING NVARCHAR(MAX) )     RETURNS NVARCHAR(MAX) AS BEGIN     DECLARE @Start INT, @End INT, @Length INT;         WHILE CHARINDEX('<', @INPUT_STRING) > 0 AND CHARINDEX('>', @INPUT_STRING, CHARINDEX('<', @INPUT_STRING)) > 0     BEGIN         SET @Start  = CHARINDEX('<', @INPUT_STRING);         SET @End    = CHARINDEX('>', @INPUT_STRING, CHARINDEX('<', @INPUT_STRING));         SET @Length = (@End - @Start) + 1;                 IF @Length > 0         BEGIN             SET @INPUT_STRING = STUFF(@INPUT_STRING, @Start, @Length, '')         END      END         RETURN RTRIM(@INPUT_STRING); END 

New features in C# 4.0

Introduction The major theme for C# 4.0 is dynamic programming. Increasingly, objects are “dynamic” in the sense that their structure and behavior is not captured by a static type, or at least not one that the compiler knows about when compiling your program. Some examples include • Objects from dynamic programming languages, such as Python or Ruby • COM objects accessed through IDispatch • Ordinary .NET types accessed through reflection • Objects with changing structure, such as HTML DOM script objects • Data readers and other user defined dynamic objects While C# remains a statically typed language, we aim to vastly improve the interaction with such objects. A secondary theme is co-evolution with Visual Basic. Going forward we will aim to maintain the individual character of each language, but at the same time important new features should be introduced in both languages at the same time. They should be differentiated more by style and feel than by feature s