Microsoft TechEd India 2011 – An event to remember

Tech Ed India 2011 was a great experience. Tech Ed events are always awesome. The level of energy you experience in Tech Ed is amazing – You’ll meet lot of great people, exchange a number of ideas, share your concerns, find solutions, seek ways to improve, learn together, share the passion, and much more. For me, Tech Ed is always a source of inspiration.

Note: I’ve Created An Archive of #TechEdIn tweets here : http://archivist.visitmix.com/amazedsaint/12 

Meeting Experts via The Roundtables and Providing direct feedback

As I’m part of the MVP community, one great opportunity in Tech Ed is to meet the experts via the Roundtable conferences. I was part of some high energy conversations with Jason Zanders , Yousef Khalidi, Rajiv Kumar (MS IDC Hyderabad) etc. Some of the information you get via these conversations are under NDA ;), but one serious concern I shared with Jason is the strategy of Microsoft when it comes to Tablets and IPTVs. I also suggested Yousef that it’ll be great if Microsoft can evolve the Azure storage to match NoSQL use cases.

Also, during the conversations with Jason and Yusuf, I realized how seriously Microsoft takes the input from the community.

202177_10150433972950504_500895503_17730765_7918838_o

 

192151_10150433968145504_500895503_17730718_5546549_o (1)

Conversations & Idea Networking

In Tech Ed, you’ll network with a lot of people. The MVP community in India is very open and vibrant - so that you can network with experts and MVPs in various Microsoft related technology areas, and can have intense idea exchanges, debates and discussions. I met a number of great guys, and had a handful of very interesting conversations - with guys like Abhijit, Abhishek, Lohit, Suprotim, Vijay, Ravikanth, Dhananjay, Hima, Krishna, Harish, Ram, Shravan, Alpesh etc – Just to name a few. I had detailed conversations on plug in support for IE9, leveraging the web sockets and HTML5 for something very interesting (secret), Code contracts in C#, BDD etc to name a few – with various guys.

image

 

image

 

image

 

image

 

Keynotes and Presentations

One visible part of Tech Ed event is the Keynotes and presentations on various areas – I mentioned it last because I thought I should highlight the less known aspects of Tech Ed first. This Tech Ed had a lot of great sessions, from distinguished speakers and community rock stars. Especially, I liked the Keynote from Jason on Day 3, and also sessions from (the ones I attended) Vinod Kumar, Yousef etc.

Overall, it was great fun, learning and networking - I enjoyed every bit of it. Thanks to all of you for making the event that much interesting!!

Read more >>

The Case of Switch-Case in C#

A quick rant on using switch-cases in C#. In Javascript, most developers prefer creating a lean object that can be re-used, instead of a stubborn switch case. For example, instead of this Switch Case implementation,

switch (foo) {
	case 'case1':
		alert('case1 code');
		break;
	case 'case2':
		alert('case2 code');
		break;
	default:
		alert('hm, default code');
		break;
}
a number of developers may consider this one as more elegant - because it is re-usable and more testable.
var mySwitch= {
'case1' : function() {
	alert('case1 code');
},
'case2' : function() {
	alert('case2 code');
},
'default' : function() {
	alert('default code');
}
};


if (mySwitch[foo]) {
	mySwitch[foo]();
} else {
	mySwitch['default']();
}
I was thinking about implementing something along similiar lines in C#, to re-factor few fat switch cases using a Dictionary. Obviously, this is context specific - one approach won't fit all the scenarios. Here is a quick example to clarify the point.

    public class SwitchCase : Dictionary<string,Action>
    {
        public void Eval(string key)
        {
            if (this.ContainsKey(key))
              this[key]();
            else
             this["default"](); 
        }
    }


    //Now, somewhere else

            var mySwitch = new SwitchCase
            {
                { "case1",  ()=>Console.WriteLine("Case1 is executed") },
                { "case2",  ()=>Console.WriteLine("Case2 is executed") },
                { "case3",  ()=>Console.WriteLine("Case3 is executed") },
                { "case4",  ()=>Console.WriteLine("Case4 is executed") },
                { "default",()=>Console.WriteLine("Default is executed") },
            };

            mySwitch.Eval(c);
This provides loose coupling, and you can even modify the logic for each case easily using a setter or so. Happy Coding!!
Read more >>

MVVM And Linq In Javascript for .NET Programmers

image If you are not using a well structured javascript library like JQuery, and still manage to do web development, you are .. hm.. probably interested in contributing too much to the garbage that is already there in the web (I am being nice here :)).

Anyway, this post is about few more cool Javascript libraries other than JQuery, that may generate a lot of interest for .NET Programmers (I am talking with Vin lately a lot about this). In this post, I’ll cover two nice little JavaScript libraries, that’ll bring Model View View Model and LINQ to JavaScript.

1 – Knockcout.js

Knockcout is a cool Javascript library that’ll bring the MVVM concepts to the Javascript. If you are already familiar with MVVM, you are good to use Knockout once you learn the little syntax differences. Here is a quick example that shows how to bind a text variable and a command.

<div>
    You've clicked <span data-bind="text: numberOfClicks"></span> times
    <button data-bind="click: clickCommand">Click me</button>
</div>
 
<script type="text/javascript">
    var viewModel = {
        numberOfClicks : ko.observable(0), 
        clickCommand : function() {
            var previousCount = this.numberOfClicks();
            this.numberOfClicks(previousCount + 1);
        }
    };
</script>

In the viewModel, we’ve a numberOfClicks variable, and also a clickCommand. You’ll see that we are binding the clickCommand to the button. When ever the button is clicked, the numberOfClicks variable is incremented. If you are wondering why we are using ko.observable to assign value to our numberOfClicks property, it is because

you need to declare your model properties as observables, because these are special JavaScript objects that can notify subscribers about changes, and can automatically detect dependencies.

Also, note that to get/set values to our numberOfClicks property, we are relying on methods (), to ensure cross browser compatibility. For this reason, all observable objects are functions. Also, note the data-bind attribute we use for binding the view model variables to the UI elements. Apart from these little differences, it is pretty easy to sail through knockout, and you can easily master MVVM in Javascript

Knockout is a JavaScript library that helps you to create rich, responsive display and editor user interfaces with a clean underlying data model. Any time you have sections of UI that update dynamically (e.g., changing depending on the user’s actions or when an external data source changes), KO can help you implement it more simply and maintainably.

Have a look at http://knockoutjs.com/

2 – Linq.js

If you love Linq, you’ll love Linq.js – it is an almost complete implementation of Linq for Javascript. You can use Enumerable.From(…) to convert an Array to an enumerable, to query them. Here is a quick example.

var array = [100, 200, 30, 40, 500, 40, 200];
var ex1 = Enumerable.From(array).Distinct().ToArray(); // [100, 200, 30, 40, 500]

Linq.js also has a JQuery extension, which is very handy.

Features include

  • implementation of all .NET 4.0 methods and many extra methods (inspiration from Rx, Achiral, Haskell, Ruby, etc...)
  • complete lazy evaluation
  • full IntelliSense support for VisualStudio
  • two versions - linq.js and jquery.linq.js (jQuery plugin)
  • support Windows Script Host
  • binding for Reactive Extensions for JavaScript(RxJS) and IntelliSense Generator -> see documentation
  • NuGet install support(linq.js, linq.js-jQuery, linq.js-Bindings)

Get it from http://linqjs.codeplex.com/

 

Happy coding, Enjoy.

Read more >>

top