Archive for the ‘Programming Concepts’ Category

Many a times we come across a business case where we need to add multiple markers to Google Map. When markers added on map cross a thousand mark it slows down Google Map big time. In order to handle this scenario, I came up with my custom approach which I have tested with about 10000 points on the map.



Validation are utmost important part of a software product. It is important to validate the data that is going into the system at each and every layer. By each and every layer I mean it is important to have validation in place on client side, server-side and even database level.


In order to convert newlines (replace \r\n with \n) across all varchar and nvarchar fields in a database below is the simple query that will be helpful to generate queries to update the data in table.

select 'update ' + + '.' + + ' set ' + + ' = REPLACE(REPLACE(' + + ', CHAR(13), ''''), CHAR(10), '')'
from sys.columns c
inner join sys.systypes st
on c.system_type_id = st.xtype
and CHARINDEX('varchar', <> 0
inner join sys.tables t
on c.object_id = t.object_id
inner join sys.schemas sc
on t.schema_id = sc.schema_id



So in the fast pace world where daily a new invention is taking place, it is also challenging to keep up with the pace with the technology. There were days and when Web Services (created in .Net) were meant for being consumed by say a Client Web Application or desktop application. Now a days with more and more platform scaling up its important to have a service which can be used cross platform. Which I basically mean that a service once created can be consumed by Web Application, Android App, iOS App, Windows Mobile App, etc. In order to make this happen, I know you all are aware up till now that json is the apt to be used. So what’s new over here !!!

Well just creating service is not mere enough for having a good scalable Web API Service, one should have a good architecture in place which will make like easy to maintain our service in the long run.

Here are few must have components which are essentials for a Web API service.


Beautify XML String in JavaScript

Posted: September 28, 2015 by Sagar Wasule in JavaScript
Tags: ,

Ok so here is a scenario where for requirement I had to properly indent the string xml viz, beautify the xml string with proper indentation.

function formatXml(xml) {

var formatted = '';
var reg = /(>)\s*(<)(\/*)/g;
xml = xml.replace(/\r|\n/g, ''); //deleting already existing whitespaces
xml = xml.replace(reg, '$1\r\n$2$3');
var pad = 0;
jQuery.each(xml.split('\r\n'), function (index, node) {
var indent = 0;
if (node.match(/.+]*>$/)) {
indent = 0;
} else if (node.match(/^<\/\w/)) {
if (pad != 0) {
pad -= 1;
} else if (node.match(/^]*[^\/]>.*$/)) {
indent = 1;
} else {
indent = 0;

var padding = '';
for (var i = 0; i < pad; i++) {
padding += ' ';

formatted += padding + node + '\r\n';
pad += indent;

return formatted;

The below method fetches the path for all the files present in a Directory or Sub Directory under the parent Directory.
The file path are fetched in a list of string to be used for any implementation as and when required.

private List DirSearch(string sDir)
List files = new List();
foreach (string f in Directory.GetFiles(sDir))
foreach (string d in Directory.GetDirectories(sDir))
catch (System.Exception excpt)
//throw ex

return files;

Below is the simple method that can be used to fetch file names of all the file present under a File Directory.

private static string[] GetFileNames(string path, string filter)
string[] files = Directory.GetFiles(path, filter);
for (int i = 0; i < files.Length; i++)
files[i] = Path.GetFileName(files[i]);
return files;

This code is designed in such a way so that we can obtain filename according to filetype.
If I provide ‘*.*’ as an input to filter, all the file names will be obtained in string array, but if I obtain ‘*.jpg’ as an input the string array will contain file names for all ‘.jpg’ files.


string[] fileNames = GetFileNames(@"C:\Users\Public\Pictures\Sample Pictures", "*.jpg");

In this article I will provide you with a quick reference in order to create proxy file in ASP.Net.

Here we will be using svcutil.exe provided by .Net framework to create proxy file at the specified location.



1. Abbreviation: URL stands for Uniform Resource Locator
2. Meaning: URL is a subset of URI that specifies where an identified resource is available and the mechanism for retrieving it.Mechanism actually means one of the protocol schemes (e.g., http, ftp, file, mailto) provided by URI.
3. Examples:
• http:/
Here, http is the protocol, is the domain name, MyApp is the folder name, Index.aspx is the filename
Here http is the protocol, is the domain name, articles is the folder name and default.aspx is the file name


1. Abbreviation: URI stands for Uniform Resource Identifier
2. Meaning: A URI is a superset of URL that identifies a resource either by location (URL), or a name(URN), or both (URL and URN).
• /some/page.html

So you’ve heard about AngularJS, but you’re not exactly sure how to get started with it?
This tutorial is for you.



This tutorial is going to go through all of the key fundamentals you need to know about the AngularJS SPA (Single Page Application) framework.
My name is Sagar Wasule and I’ll be walking you through some of the key concept which I wish will clear your doubts regarding AngularJS.

Here in this series of articles we will be focusing 100% on AngularJS.

I will provide you with some demos with the help of that I will explain you key concepts of AngularJS.
I came across AngularJS while discussion with my friend about various JavaScript libraries that are available in the programming world. I was really excited to know about this library being developed by Google.