Tuesday, 27 December 2016

Observer Pattern in javascript

   In daily life we always need to do a add,edit,delete,update operation in our development life.    to better go with it and to adopt a nice way of coding it is important to identify how structured our code is. So today i am going to do this with nice page operation in JavaScript through Observer design patterns. Var Page = function(){     this.Pages =[];  ...

Monday, 26 December 2016

Strategy Pattern In MVC4

08:57 Posted by Nikesh No comments
 Creating a form which on post do calculation based on different shipping types.We will learn how these calculations occurs in Strategy Pattern We are creating very simple form in which we can enter price and based on shipping service we can do calculation. <form action="/home/myform"...

Sunday, 25 December 2016

C# Dictionary

03:39 Posted by Nikesh , No comments
Dictionary class is a data structure which represents a collection of keys and values pair of data this resides in name space using System.Collections.Generic; Dictionary work faster than list collections because it indexes with key and value pair.  key -- Value through which you want to use as a pointer   Value -- This is which will give you result of that pointer.                     ...

Normal text field Sanitizing Using C# (Regex Part 2)

02:28 Posted by Nikesh No comments
                1. In our daily programming as we play with form we always need a validator which can validate our text like "Names" , "School", "Organization".  So we need to sanitize this type of input, so that it...

Saturday, 24 December 2016

Find all href link value in HTML string posted in c# (Regex Part1)

08:08 Posted by Nikesh No comments
Let assume you have passed full html on form post to your action and you come with a need where you have to find all href link in that html string.Assume you have got an string which contin links like   <html>       <p>           <a href="http://www.codesgonecrazy.com\">Crazy Codes </a>      ...

Wednesday, 21 December 2016

Factory Pattern In C#

Uses:- They have flexibility that can create documents flexible. Create a console application name it anything paste all code given below; Class MyApplication { Static void Main(String []args) { ////////Constructor that calls factory method////////////////////////// Document[] documents  = new Documents[2]; documents[0] = new Resume(); documents[1] = new Report();  ...

Tuesday, 20 December 2016

Seo - (Mobile Tel Link) click to call for phone numbers on website in javascript

While working with seo optimization, many times we need to include phone dialer on all valid phone on website for its better work. Here I have created an script which can automatically add dialer to href with refrence of same number that phone is written in anchor tag.  With help of this we can reduce multiple hour of reentering or adding phone inside anchor dialer...

Seo Optimization - Fixing Trailing /// From Various Section In Asp.Net

Trailing slash commonly asked to manage while optimization, as this can treat content duplicate or can make url and seo friendly.  we can obtain it by multiple ways, we can manage url in Action which will called on url browsing or we can use them Global.asax, or we can manage them by customizing inside custom error management classes. Here i have given some examples which can show some...

Manage File Path In Sql

Extracting file name from full file path Suppose we have saved our images with their path name in sql as /root/subroot/image/image.jpg And we need to extract only image name without their path. For this we are going to use two to three inbuilt functions as SUBSTRING(),CHARINDEX(),REVERSE()  SUBSTRING(string, start postion, End positions )  --  For Splitting Strings  CHARINDEX("Expression",...

Monday, 19 December 2016

MVC C# Error Handling

1. Object Can't be cast from Db null to other types. Soln.--  Mostly comes when working with database, when we execute our query but after execution we didn't return anything and we are trying to achieve query result through functions. Suppose we have a procedure which is inserting our data to database and simultaneously getting return in some variables or parsing as parameter and our procedure...

Visual Studio Short Cuts

Visual Studio Shortcuts Ctrl + C ---> Copy Ctrl + X  --->  Cut Ctrl + F  --->  Finding Words Ctrl + H  --->  Find And Replace Words Ctrl + Shift + i  --> Ctrl + C --> Copying lines on which cursor present  Ctrl + M  ---> Collapse Selected Functions Ctrl + [  --->  Reach to start braces of functions Ctrl + ]...