10 Things to read (#4)




10 Things to read (#3)


10 Things to read (#2)



  • Microsoft Open Specifications Poster v2: Open Specifications Posters make it easy for interoperability developers to explore the Open Specifications overview documents for Office client, Lync, SharePoint, Office file formats, Exchange Server, SQL Server, and Windows.
  • Maiden Name Modeling: modeling a domain model, data model, or any other data structure representing information for the real world involves infinite number of possibilities. In this article, Jeffrey Palermo shows two ways to model the same data in a real scenario.
  • Converting AutoMapper to a Portable Class Library: in this article, Jimmy Bogard shows the process of converting AutoMapper to PCL and also highlights the benefits.


  • New Web Features in Visual Studio 2013 Update 2 CTP2: Visual Studio team announced a new update today for VS 2013 and they added couple of handy features the editor such as SAAS and JSON editing capabilities.
  • ASP.NET Project “Helios”: as frameworks like MVC, WebAPI, and SignalR don’t fit nicely into the LOB model which made ASP.NET famous. Helios pairs the granular control offered by self-hosted scenarios with the benefits offered by being hosted inside IIS.

10 Things to read (#1)


  • Compiling C# Code at Runtime: this codeproject article shows how to compile text at runtime and execute the same. It also shows speed comparison between compile-time-defined function, runtime compiled functions.
  • Creating Zip Archives in C# 5.0 (.NET 4.5): creating zip archives in .Net hasn’t been easy till now, unless a 3rd party library is used. C# 5.0 adds dedicated zip compressing library to BCL under System.IO.Compression namespace. This article on dotnetcurry shows how to create zip archives using C#.
  • New Roslyn-Powered .Net Framework Reference: .Net framework code had been outsourced for long time but was not getting frequent updates. The new framework reference which was released today provides a intuitive UI.
  • Azure Scheduler 101: Kevin Lam explains how the Azure Scheduler works on channel 9. and how you can use it in your applications. This 12 minute video is all you need to start using Scheduler on windows azure.
  • Explore the .Net Framework 4.5.1: Gaye Oncul Kok wrote a great overview of .Net Framework 4.5.1 on MSDN magazine. The article has info and code samples on new features of .Net 4.5.1
  • Using LINQ with collections that doesn’t support LINQ: Dustin Davis implemented a simple class called Linqqer to show how to LINQ enable collections that don’t support LINQ.
  • Zone.js: it lets you do open heart surgery on the browser, one of the rare thing implemented by AngularJS team. Here is a intro to zone.js and this video is all you need to get an idea of its capabilities.


Creating Impossible Scenes with Photographs

Photography has been a passion for many over decades and people try to bring in new techniques when they get bored with the regular photos they click. I was exploring around and came across a TED video “Impossible Photography” by Erik Johansson. He is an amazing photographer but he thought there could be more to a photo if he brings in some imagination and combines multiple photos in a way which makes it really amusing and thought-provoking.

Check this video on Impossible Photography and give a jolt to your imagination…:)


Great Free Pluralsight courses on Building HTML5 apps with KnockoutJS, jQuery and ASP.NET Web API

Pluralsight has worked hard to bring you video tutorials on cutting edge technologies from best trainers in the industry. Recently they started a new promo which allows you to watch John Papa‘s one of the “best tutorials to learn building Single Page  Apps with HTML5, KnockoutJS, jQuery and ASP.NET” on a 1 month free subscription.

With this promo, you will be able to watch following courses

1) Building HTML5 and JavaScript Apps with MVVM and Knockout

2) Single Page Apps with HTML5, Web API, Knockout and jQuery

Both of these courses are one of the best resources available today and if you are planning to learn the cutting edge stuff, you should get it *without fail*.

How do I get free 1-month subscription?

The  subscription is entirely free and doesn’t need you to share your credit card number or make a future purchase – in short, there is no hidden cost. Just follow the instructions on John’s blog post: Learn about Knockout, HTML5, SPA and ASP.NET Web API for Free!

Why should I care about Single Page Apps?

SPAs are around for some time and with the popularity of mobile devices and tablets SPAs are becoming more relevant. The goal of Single Page Application is to give a fluid user experience  with all the interactions being on a single page. There are some nice resources available online for you to get started with:

1) Sample SPA: If you want to see it to believe it, you should check this out.

2) Single Page application with MVC4: If you are starting with not much of knowledge in this area, start with this tutorial from Microsoft.

3) Steven Sanderson’s tutorials on SPA: Steve has put in substantial effort in this area with Microsoft Technologies stack and are a must visit if you don’t want to miss the best part.

Single Page Application packages and samples

- Channel 9 video on SPA

4) John Papa’s channel 9 video on MVVM: This video will give you a good insight on MVVM.

So you have all that you need to head start with SPA and the new breed of web apps. Happy coding..:)

Beyond Hidden fields with ASP.Net

ASP .Net

ASP .Net

As we all know hidden fields are used to store a temporary value that will be needed on the page at a later stage which is available only on the code behind. Even asp.net uses hidden field to store View State. It is a common practice among programmers to include one or more hidden fields on the page as and pass values to and fro on the page.

Problem with Hidden Field

While rendering hidden filed, asp.net changes the ID attribute of the control and it comes up with something similar to “ctl00_ContentPlaceholder1_ListView1_ctrl0_Label1″.

Since the server control HiddenField does not support a CssClass attribute, we can not assign a class to the control. While developing asp.net they might have though why wold someone want set and style to a control that is not visible on the page. Valid question; but we will end up with a problem while accessing the value from such a hidden field using jQuery. Here is a nice solution for that problem, which generates a friendly ID for the hidden control.

Problem with multiple Hidden Fields

We add a new hidden field as and when needed on the page. But what if there is a situation where in you will need to store mare than 5-6 temporary values on the page? Poor man’s solution would be to use a delimiter based string, split and use the string as and when needed. But the solution that I am proposing is much better and simpler and extensible.

Beyond Hidden Fields and welcome JSON

The solution uses a JSON object to store the temporary values.  All you do is define an anonymous class with appropriate properties and values, pass it on to an extension method of Page class. The page extension method returns a script block with the json object; call a register script method on the page and you are done. Here is the code:

public static void RegisterPageScript(this Page currentPage, object data, string variableName)
            var configString = JsonConvert.SerializeObject(data);
            if (!string.IsNullOrEmpty(configString))
                var pageScriptTag = string.Format("< script type=\"text/javascript\"> var {0} =  {1} ", variableName, configString);
                currentPage.ClientScript.RegisterClientScriptBlock(Type.GetType("System.String"), "pageSettings", pageScriptTag.ToString());

How to use this method? Here is the code:

var pageSettingsObject = new { Prop1 = "some text", Prop2 = 1 };
this.Page.RegisterPageScript(pageSettingsObject, "PageSettings");

Run the page and take a look at the rendered page source. You will notice that PageSettings is a javascript variable which can be directly accessed using javascript and more over it is a javascript object and hence a set of such values are stored in an object. You can easily access the values needed. For example, open up FireBug, go to console, and try something like this


The value is available for javascript/jQuery… :)

What if you would like to send some more temporary values to server side code and want to change couple of values in the PageSettings object? Very much possible, as JSON object is a dynamic object, you can add a new property as and when needed. Just say

PageSettings.Prop3 = "blah blah...!"

Now the JSON object stores that too. You can again verify the same on firebug console. If you would like to send the whole JSON object to server side, convert the JSON object in to string, set it to a hidden field (a server control) . Here is the code:



This new approach allows you to structure your code better and is easy to maintain rather than adding a bunch of silly looking hidden fields and accessing them.



Facebook introduces HTML 5 Resource Center for Developers

Some time back Facebook announced a new HTML5 Resource Center for developers. The main reason behind this is it give ample of resources to developers for building great experiences across multiple platforms. It features information about developing web apps, games, testing web apps on mobile and PC and so on. In a way it acts as a great source of information for developers who are diving in to HTML 5. The company has also created a group HTML5 where you can join to share and get more information about facebook and HTML5.

Build the Future With HTML5

Build the Future With HTML5

Why was it created?

Most of the applications today are becoming available on the internet and the devices which access such applications vary from smart-phone, tablets, computers, TVs and more. Each such devices come with their own resolution, browser capabilities and limitations. It becomes very hard for developer to maintain different versions code for different browsers and different devices. HTML5 enables developers to work with a single code base which runs on all devices.

Facebook has more than 350 millions users on mobile. Applications can reach all such users by supporting mobile devices. Utilizing HTML5 and related technologies becomes crucial for surging in to such a market. Facebook’s endeavor helps developers across the world to accelerate innovation and build better user experience of cross-platform web apps.

 What is in it for me..?

Facebook follows Build, Test, Distribute method for HTML5 web apps.

Build section has ample of tutorials and guidance for creating the applications, Games and more. You can check the Showcase to see what other developers are building with HTML5.

Testing the application on different environments is a crucial part of the development activity. Many a times testing takes more time than the real development. Testing section covers all such aspects in detail including different automated frameworks such as Selenium.

Distribution is the last part which is quite easy if the first two levels are completed properly. Information on distributing apps on different channels such as Chrome Web Store, Facebook on mobile, native app stores and more can be found in this section.

If you are planning to make applications in HTML5 or migrating existing web apps to support HTML5 then visit the HTML5 Resource Center to get a good starting point.

How To manage your emails with Outlook Web Access Rules

Most of use MS Outlook at work for exchanging emails. MS Outlook as we know is only a tool which connects to the mail server such as MS Exchange Server and helps us send and receive mails. All the Rules we define on Outlook are only client specific; if you close Outlook or if you shut down your computer, those rules stop working immediately.

Microsoft also provides a web interface for Exchange server which is used by most of the companies to give mail access to employees outside the company network. You can manage your inbox by creating filtering rules on the outlook web app.

Creating Rules with Outlook Web App

Creating a Rule on Outlook Web App will filter the mails as soon as it reaches the Exchange Server, before Outlook on your desktop gets the mail.

To set-up a Rule login to Outlook Web App, Choose Options on the right top and select “Create an Inbox Rule”.

Outlook Web App Options

Outlook Web App Options

You will land in a new page which allows to manage all Outlook Rules.

Outlook Web App Manage Rules

Outlook Web App Manage Rules

You can choose from many available options to create a new Rule.  Let us click on “Create a new rule for arriving messages…” which will give a new window to decide what to do with the arriving mail.

Outlook Web App Inbox Rule Creation

Outlook Web App Inbox Rule Creation

The list is quite exhaustive as you see above. You can choose any item in the “when message arrives” drop-down based on your need  and for each such item outlook asks for supporting input. For example if you choose “It was received from”, then outlook allows you to select an email address from your address book; if the email address  in not available on the address book, there is a text box to manually enter the same.

After deciding what to choose from the first drop-down, we have multiple options for “Do the following:” starting from moving it to a different folder to deleting the message before it reaches inbox. Once done, save the new Rule; from now on the new rule will be in action checking all the emails that flow to your inbox. Any existing Rule can be modified by choosing the “Details” button.

For advanced users, there is a “More Options…” link while creating or modifying a rule. It allows adding multiple actions for a Rule and to add exceptions for the rule. There is a check box at the bottom which says “Stop processing more rules”. Choosing the check-box will disable processing the email with any other matching rules.

Outlook Web App Inbox Rule Advanced Options

Outlook Web App Inbox Rule Advanced Options

 Shortcut way to Create a Rule

Creating a rule by choosing Options is one way; but there is  a faster way to create a rule. Just right click on the mail for which you would like to create a rule.

Create Outlook Inbox Rule Faster

Create Outlook Inbox Rule Faster

This will automatically choose the email address for the new Rule. Just select the action part and and save the Rule.

How to stop Google Analytics from tracking my own visits to my site?

One of the problem with Google Analytics is it tracks all visits to your website, which includes your visits to the website also. You would visit your website many times to check whether it is working as expected. But each such visit are tracked in GA which causes inaccurate tracking.

How do I stop tracking My visits?

There are a couple of ways in which you can disable GA from tracking your visits. But unfortunately none of them are strait-forward. We will see possible ways to disable GA tracking and you can choose the one which is most suitable for you.

Disabling GA tracking by making a Host Entry

Hosts file has IP address to Domain mappings.  The IP address “″ points to localhost or the local machine. The idea her is to map  www.google-analytics.com to localhost. By doing this, all requests to GA server will end up pointing to the same system. That means you have disabled GA tracking on that machine permanently. Digital Inspiration has a good post on making host entry to disable GA tracking.

This approach has some down sides such as you are disabling the tracking for all websites visited on the machine. If you use multiple computers then host entry change has to be done on all the computers.

Those who are curious to know more about hosts file go through this article “What is the hosts file?

Excluding My visits in the tracking report

Another approach is to exclude my visits to the site from tracking report. This is done by including a filter for your IP address or a range of IP addresses.  Google has published a document “How do I exclude my internal traffic from reports?” which guides you through the process.

Using “Google Analytics Opt-out Browser Add-on”

After hearing all developer woes about disabling GA tracking for their own visits, google has finally come up with an add-on which does the job. You can download and install Google Analytics Opt-out Browser Add-on which tells the ga.js not to collect tracking data for the visits made from that browser.

Analytics Opt-out Browser Add-on

Analytics Opt-out Browser Add-on

The add-on supports Internet Explorer, Google Chrome, Mozilla Firefox, Apple Safari and Opera, so you can install the plugin on any of the browser and visit your website using the specific browser. If you wish to have it for all browsers, then there is an option to enable/disable to same.