A new year and new resolutions, goals to achieve

A new year and new resolutions, goals to achieve. None the less 2013 has been awesome year and has been great honor to work with awesome people in our team and 2014 will be best years once again. Wish you all best wherever you are… Looking forward for it

 Good Luck everybody …

2013 in review

The WordPress.com stats helper monkeys prepared a 2013 annual report for this blog.

Here’s an excerpt:

A New York City subway train holds 1,200 people. This blog was viewed about 7,700 times in 2013. If it were a NYC subway train, it would take about 6 trips to carry that many people.

Click here to see the complete report.

KendoUI – Validation Gotcha(s) …

While making Initial layout and architecture for the front end for our product @ Vanguard Software Group, i was trying to do POC and trying to hit all points where we going to use KendoUI.

I had came up pretty road blocker during this exercise – it was related to Loading a partial view into the application through Kendo’s Window widget.


The Validation doesn’t Simply work. No matter what i did, it just didn’t Budge. 

In researching the whole thing i came across multiple posts and ideas to make it work but all of them were not totally looking it deeply enough for me.

I found following:

  1. http://demos.kendoui.com/web/validator/index.html
  2. http://blog.janjonas.net/2011-07-24/asp_net-mvc_3-ajax-form-jquery-validate-supporting-unobtrusive-client-side-validation-and-server-side-validation
  3. http://www.telerik.com/community/forums/aspnet-mvc/window/client-validation-not-working-with-window-loaded-from-form.aspx
  4. http://www.kendoui.com/forums/kendo-ui-complete-for-asp-net-mvc/window/validation-problems-with-form-inside-window.aspx

Out of all those above Point # 4 had some proper half information… So took from there and fixed the issue by using the Window’s refresh method form kendo to bind it properly.

Hello Eric,

If you are using the jQuery validation then you should use the jQuery.validator.unobtrusive.parse method in the Window refresh event after the content has been loaded:

function refresh(e) {

If you are using the Kendo Validator then you should initialize it on the form.

So by reading “If you are using the Kendo Validator then you should initialize it on the form.” I achieved it by doing following

LoginModule = function () {
var validator = null;
function Show() {
$(“#LayoutMain”).append(“<div id=’window’></div>”);
var window = $(“#window”);
if (!window.data(“kendoWindow”)) {
width: “600px”,
title: “Login”,
content: “Home/Login”, //partial View
modal: true,
resizable: false,
refresh: function () {
validator = $(“#LoginForm”).kendoValidator().data(“kendoValidator”); //do this IMPORTANT
function Submit() {
return {
validator: validator

See the BOLD lines above and follow the code.


AND Lastly don’t FORGET to set HTML Element’s NAME attribute! If you don’t set it the Validation will also not work. Normally as coming from asp.net background i was only setting Id of the HTML element. and it was causing the validations messages to not appear.

 <input id=”Email” name=”Email” required validationMessage=”Email is required.” />

I hope this helps somebody out there 🙂


Kendo UI – Drop down list Setting Value autoBind = false setting

I am evaluating kendo ui right now to use in our big application. We have a situation where we have much values in dropdowns (like 200+) and there are more than 1 drop down with that size. So if we have a complex form. The Page Load takes time to render the form. (Due to that each box needs to be loaded from service and filled up).

We avoided this by writing our own asp.net web control with on demand support (like autoBind property) in the drop down list in kendo ui.

Now, DropDownList from KendoUI serves the purpose with autobind = false, BUT when setting value it fetches data from remote binding first and then selects appropriate value. (this is cool and really good for small lists) but Potentially this will mean that when we load the page and set the value it will issue remote binding calls for each of the drop downs.


Can we set value/ text to appear without issuing the remote binding. We want remote binding to be done ONLY when the user clicks on the drop down itself. (not when we are filling form). This will save extra calls to system and help quickly render the form to user.

Here is JS Bin


If somebody from kendo ui would like me to help out – let me know, but this idea will allow us to use kendo ui drop downs with good use.

Read full post thread here ….



Handy Script for Checking Breakages in SQL Server Objects (Views, Stored Procedures etc …)


Today i was working with some column removal and there were lot of stored procedures that i had to verify if they are fine or not.

So, wrote the following script to check each and every stored procedure for any breakages.

Copy and Execute on your database and enjoy!!!


DECLARE @spName nvarchar(1000)

DECLARE product_cursor CURSOR FOR

SELECT CONVERT(nvarchar(20), sch.name) + ‘.’ +  CONVERT(nvarchar(500), obj.Name)

FROM sys.sql_modules modu

INNER JOIN sys.objects obj

INNER JOIN sys.schemas sch ON obj.schema_id = sch.schema_id

ON modu.object_id = obj.object_id

WHERE obj.type = ‘P’ — for stored prcedures… 

OPEN product_cursor

FETCH NEXT FROM product_cursor INTO @spName



PRINT @spName

exec sp_refreshsqlmodule @spName

FETCH NEXT FROM product_cursor INTO @spName


CLOSE product_cursor

DEALLOCATE product_cursor

JQuery Mobile and Asp.net WebForms 4.5


I was searching for some examples on the responsive web design and frameworks and i was impressed by JQuery mobile and it’s roadmap towards the future and it’s broad capabilities. You can view JQuery Mobile at http://view.jquerymobile.com/1.3.0/

So, in further searches – it was obvious that lesser people have tried it with web forms. I didn’t find any examples (may be there are.. but nothing good appeared on google search).

So here is a another to the point simple example:


  1. Create Empty Web Forms Project (VS 2012)
  2. From NuGet – Add Jquery
  3. Add Jquery UI (For normal site)
  4. Add JQuery Mobile (For Mobile Site)
  5. Add “Site.Master” Master page
  6. Add “Site.Mobile.Master” Page (To used as master page for mobile site)
  7. Add Default.aspx
  8. Add Default.mobi.aspx
  9. Add Global.asax

Main Idea

“Every .aspx page in normal page has its respective .mobi.aspx” It’s hybrid project and we will simple use asp.net url routing to map if the request comes from mobile site (only in case of .aspx) – All other things remain same.


Here are questions:

  1. How to do URL Rewrite?
  2. How to setup jQuery Mobile?

1- How to do URL Rewrite?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Routing;
namespace Test.WebWithMobile
public class Global : System.Web.HttpApplication
        protected void Application_BeginRequest(object sender, EventArgs e)
            if (Request.Browser.IsMobileDevice)
                //Request.Url.MakeRelativeUri(new Uri(Request.Url.AbsoluteUri)).ToString() + Request.Url.AbsoluteUri.Replace(“.aspx”, “.mobi.aspx”)
                if ((!Request.Url.OriginalString.ToLower().Contains(“mobile”)
                    && Request.Url.OriginalString.ToLower().EndsWith(“.aspx”))
                    || Request.Url.OriginalString.IndexOf(“.aspx”) == -1)
                    var url = Request.Url.OriginalString;
                    if (url.ToLower().IndexOf(“.aspx”) == -1)
                        url += “Default.aspx”;
                    url = url.Replace(“.aspx”, “.mobi.aspx”);                    
                    var path = Request.Url.MakeRelativeUri(new Uri(url));
                    HttpContext.Current.RewritePath(“~/” + path);

2- How to setup jQuery Mobile?

<head runat=”server”>
<meta name=”viewport” content=”width=device-width, initial-scale=1, maximum-scale=1″ />
<link href=”Content/jquery.mobile-1.3.0.min.css” rel=”stylesheet” />
    <script src=”Scripts/jquery-1.9.1.min.js”></script>
    <script src=”Scripts/jquery.mobile-1.3.0.min.js”></script>
<asp:ContentPlaceHolder ID=”head” runat=”server”>

<form id=”form1″ runat=”server”>
<div data-role=”page”>
            <div data-role=”header”>Mobile Header</div>
            <div data-role=”content”>
<asp:ContentPlaceHolder ID=”ContentPlaceHolder1″ runat=”server”>

That’s It !!!

Surprised … but that’s it… This will get your going with query mobile and setting up web solution.

  1. Intro to JQuery Mobile
  2. Responsive Web Design
  3. PluralSight Training
  4. Download Source Code


SignalR – Simple Implementation

Hi Guys,

Back with an interesting post here. I was recently trying to find a simple and to the point example of SignalR with no big code snippets to work with. It was somewhat complex to understand the whole picture. Anyways, here is the “to the point” with no extra details small application.

It consists of

  1. Web Application (Our Host for SignalR)
  2. Windows Client Application (Demonstrating how you can invoke SignalR and Interact with)
  3. Source Code attached at end of this article
Web Application – The Host
Follow these steps
* Create Empty VS 2012 – Web Application Project
* Install SignalR Package from NuGet (Microsoft ASP.Net SignalR)
* Add Global.asax
* Put in following Code

       protected void Application_Start(object sender, EventArgs e)        {



*  Add Default.aspx

* Paste following HTML

<%@ Page Language=”C#” AutoEventWireup=”true” CodeBehind=”Default.aspx.cs” Inherits=”WebCommunicator.Default” %>

<!DOCTYPE html>

<html xmlns=”http://www.w3.org/1999/xhtml”&gt;

<head runat=”server”>


    <script src=”Scripts/jquery-1.6.4.min.js”></script>

    <script src=”Scripts/jquery.signalR-1.0.1.js”></script>

    <script src=”signalr/hubs”></script>

    <script src=”Scripts/app.js”></script>



    <form id=”form1″ runat=”server”>


        <input id=”txt” style=”width: 200px;” /><input type=”button” id=”btnSend” value=”Send”/>

        <div id=”messages”>






 *  Add Hub code in App_Code folder for the project


using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using Microsoft.AspNet.SignalR;

using Microsoft.AspNet.SignalR.Hubs;


namespace WebCommunicator.App_Code



    public class CommunicationHub : Hub


        public void send(string message)


            Clients.All.addMessage(message);//this should be in js

            Clients.Caller.sendAcknlowedge(message + ” received …”);




*  Add app.js in Scripts folder in web project

$(document).ready(function () {

    $(function () {

        var commHub = $.connection.commHub;

        commHub.client.addMessage = function (message) {

            $(“#messages”).append(“<li>” + message + “</li>”);


        commHub.client.sendAcknlowedge = function (message) {

            $(“#messages”).append(“<li><b><i>Server Responded: ” + message + “</i></b></li>”);


        $(“#btnSend”).click(function () {






AND THAT’s IT FOR Server Side Code …

Easy Right? 🙂

Now, Let’s make Windows Client for it…

Windows Client

* Create a New Windows Form Project (You can make WPF/ Windows Phone Etc …)

* Install Client Package for SignalR from NuGet

Full Code Snippet for the Window Form (Paste this code and add a text box and two buttons in designer)

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using Microsoft.AspNet.SignalR;

using Microsoft.AspNet.SignalR.Client;

using Microsoft.AspNet.SignalR.Client.Hubs;


namespace WebCommunicator.WinClient


    public partial class Form1 : Form


        IHubProxy proxy;

        HubConnection connection;

        public Form1()



            this.FormClosing += Form1_FormClosing;



        void Form1_FormClosing(object sender, FormClosingEventArgs e)


            if (connection != null)


            connection = null;



        private void button1_Click(object sender, EventArgs e)


//Put your url here.. i published to iis before using it from client.

             connection = new HubConnection(@”“);

            proxy = connection.CreateHubProxy(“commHub”); //name from the hubName attribute

           //to receive the callback from server. You can do anything on this!


                msg => 

                this.Invoke(() => listBox1.Items.Add(msg)));

            connection.Error += connection_Error;



        void connection_Error(Exception obj)




//send message to server

        private void button2_Click(object sender, EventArgs e)


            proxy.Invoke<string>(“send”, textBox1.Text); //this “send” is defined on hub



    public static class ControlExtensions


        public static void Invoke(this Control Control, Action Action)






That’s IT for client…

Now, as you have already deployed the web application… You can open multiple browsers from a machine or from multiple machine and see the magic.

I had two machines (Mac and Windows) – Used safari from mac and  windows for forms app and IE test… It worked all great.

Signlar in Action


This is really to the point working solution. I will describe each item in next article soon. Also you can find details for each of them everywhere on the internet. I had to share this as i had problem gathering information. So, hopefully that will some of people.


  1. Leave aside what you know about applications. Just start with it. If you will think too much, you will never get it working.
  2. Remember HubName
  3. Make sure order of js files inclusion is correct, just like mentioned above
  4. if you get $.connection as undefined means that you don’t have javascript files loaded correctly.

You can download source code from here… WebCommunicator.zip (Source Code)

Submitted First Ever IPHONE app to Apple :)


Today, after 16 hours of learning and objective-c coding. I was able to submit a one screen application to apple’s app store. It’s under review now and let’s what happens next.

Overall it was pretty intense and researching experience – enjoyed it all the way. I am going to share some of the screenshots.

Motivation: For this was that i went to my doctor and he asked me to loose weight and do some exercise. which triggered me to do some research on reasons, and i found that BMI needs to be down and i need to loose around about 30 pounds  (:

Now, anyways – i haven’t done any exercise yet but did got motivated to write this small calculator for it. (Although i was also able to open my windows in office to get more sun, as it comes out that i have very low vitamin D – ugh…)

So, don’t bash me around – it’s my first one 🙂





sp_who2 with sort and other things



TABLE #sp_who2(SPID INT,StatusVARCHAR(255),


Login  VARCHAR(255),HostName VARCHAR(255),


VARCHAR(255),DBName  VARCHAR(255),




INT,LastBatch VARCHAR(255),







INTO #sp_who2 EXECsp_who2







— Add any filtering of the results here :



       DBName <>‘master’and HostName <>‘server’and HostName <>‘data1’

— Add any sorting of the results here :



BY  LastBatch DESC



TABLE #sp_who2