Microsoft Community Meetup in Islamabad

Last week, I had honor to interact with community at Microsoft Community Meetup Islamabad where I got the opportunity to share my thoughts on community contribution and its significance.
I talked about why community contribution matters to society and what are some of the common benefits of community meetup.

I was amazed to see the willingness of people to participate in community activities and enjoyed the same discussion with them on dinner. If you would like to get involved in community as volunteer or need to discuss with me, just don’t hesitate to contact me or tweet me.

Restoring NuGet Packages and gitignore

Some time earlier, I posted about “Restoring NuGet Packages for External Dependencies” to restore dependencies when building solution and this way you don’t have to commit “packages” folder.
Just a short note: If you are working with Git and have enabled restoring NuGet packages automatically then perhaps it would be helpful to add “packages/” to .gitignore file as you don’t want to commit the packages folder.
This is also been handled in latest VisualStudio.gitignore sample available at github/gitignore. By default the “packages/” is commented so don’t forget to uncomment the line (see line# 98).

 

Imagine Cup 2013 Evaluation Experience

Like last year, I was invited by Microsoft Pakistan to evaluate the software competition entries for Microsoft Imagine Cup 2013. It’s a great opportunity to see how our academia is doing in terms of the output they produce and see how new talent is doing.

In Islamabad, we evaluated around 20 projects from various Universities such as FAST-NUCES, University of Karachi, NEDUET, NUST etc. I think looking back to our academic life and comparing with the projects students are doing these days I think they are doing a remarkable work. Students today are utilizing technology much more than we used to do. The recent boom of small form factor devices and mobile apps ecosystem has also provided developers opportunity and exposure which was not available previously. Plus I appreciate Microsoft Pakistan in providing direct opportunities to students in the form of Hackathons, App competitions, student partners, hardware support etc.

However, the bar set for Imagine Cup software competition is much high as students from around the globe compete and ultimately only one entry will win from Pakistan. So each entry was evaluated considering following factors:

  • Concept
  • Market Opportunity
  • Team Communication Skills
  • Technology Usage
  • WOW Factor

 

I believe our students have great potential but they somehow lack completeness in projects and need good preparation to win. With my recent evaluation experience, I would like to share some tips to student competing in global competitions. This is on top of tips and suggestion I shared previously as I think they are really important to go through. If you haven’t read my earlier post and you are competing, I highly recommend you read it.

Prepare for Completeness

One of the key factor is that all participants must consider every evaluation criteria when presenting, submitting documents, recording video etc. You must be able to demonstrate your idea in few minutes, show some market opportunity and competitor analysis followed by technology usage. Answer some of the great questions like why would anyone use it? who needs it? Have you talked to any potential customer? Show how your solution would create a difference and leave the floor with excitement. Demonstrating only solution or technology or project output may raise some red flags. If your project is not complete show the judges what are you planning and HOW you are going to achieve future milestones.

Be a Product Manager

In addition to the point above, one of your team member have to be a Product Manager. Spend some time thinking how you are going to productize your work. You must have some plan how would you market it, how would you launch it, how much it would cost, what features other similar products offer, who is your customer, why would anyone buy it? if its a world citizenship category project, have you talked to any concern NGO?

Usability Matters

As your project evolves, set aside some time to think about usability and user experience. Especially if your target audience is physically challenged people, you need to think how they will actually end up using your product. For example, If you are targeting someone who is unable to see but can listen, then how he is going to launch your app, how he is going to provide input etc. Is your app really easy to use for your target audience?

Connect with Industry Experts

Take advantage of your alumni, connect with industry experts, request them favor to review your work, practice presenting (online and offline). Get their guidance.

Take it Serious

Competitions like Imagine Cup provides tons of opportunities to students. Not only you can get cash support to really convert your project into product but also you can have chance to interact with potential investors, researchers and international industry links. So if you are IN, take it real serious and participate only to WIN.
All the Best!

Session: Web Development using ASP.NET MVC

Yesterday, on 26th March, I was invited to talk on Web Development using ASP.NET MVC organized by Microsoft Pakistan in collaboration with Higher Education Commission (HEC).
I am really glad to see the video conference setup by HEC. The session was broadcasted LIVE to around 10 Universities across Pakistan connecting hundreds of students with live Q&A session.

Universities connected via Video Con facility
With folks who attended session in-person at HEC

I really enjoyed connecting with many students especially Universities in other than major cities.

You can find the slides below I used as reference:

Restoring NuGet Packages for External Dependencies

NuGet is an excellent visual studio extension and answer to dependency management in .NET. It makes super easy to manage third party libraries. If are working on .NET and have not noticed NuGet, you are missing something very useful, read about NuGet here.
If you have been working on Java platform then this is something similar to Maven dependency management 
In early days… developers used to commit third party libraries (.dlls) into source control, those who don’t tend to get part of GAC. So we have seen developers maintaining folders like Lib, External Libraries etc. as part of repositories or branches into source control. This approach is easy but have it’s own limitation such as version management and manual maintenance etc.
Then comes the NuGet Package Manager to resolve dependencies. It’s has benefit of integration with Visual Studio and manages packages over just libraries (dlls). It creates a “packages” folder to download all external libraries and their dependent libraries along with version management.

NuGet Package Manager
With that developers started committing “packages” folder into source control to share external dependencies across team or contributors and that is fine but over time this would make distributed versioning control systems like Git to grow significantly large due binaries.

Restoring Packages Automatically

With NuGet 2.0, now you don’t need to commit “packages” folder and let NuGet download and restore missing packages when you build solution
For NuGet to do this, you need to take few steps.
1) Check “Allow NuGet to download missing packages during build” in Tools -> Options -> Package Manager
2) Enable NuGet Package Restore
That will do the needful, it would create a nuget folder as part of your solution file and will now automatically restores the missing libraries. What happens is that at the time of build, NuGet reads the packages.config file, identify the missing ones and download the missing packages with mentioned version from NuGet gallery.
This way you don’t have to commit your “packages” file into source control and yet easily maintain dependencies.
Have you tried NuGet Package Manager, dear reader?

MVP Summit 2013 Summary and Take Away

Hello folks!
I am at the Seattle Airport (SEATEC) leaving for home via Dubai waiting for boarding to start. So I thought to utilize the time and share my summit experience.
As I mentioned in a blog post earlier, this was my third time attending the MVP Summit and yet it’s always good to attend the summit, interact with product teams at Microsoft and take something out of it.

Complimentary copies from Practices & Patterns teamTypeScript with Mads togerson
Scott Hanselman on Future of ASP.NETSummit attendee party
But I am not going to share about usual happenings occurred at Summit instead I would like to share some technology updates and good tools I came across at MVP Summit. While much of the content at MVP Summit was under NDA (Non-Disclosure Agreement) yet there are many things that I can share with you and are publicly available as of today. I am going to glimpse through them.

1) ASP.NET and Web Tools 2012.2 Released

One of the recent update announced this week from ASP.NET team is the tooling update for web development. This includes bunch of updates such as support of LESS framework (.less extension), enhancements in Web API, SignalR templates, new template for Facebook application and updated reference to libraries. Note that some of the feature I mentioned in my earlier blog post as part of Web Essential extension are now graduated to Visual Studio as part of this update. Check out detail update on ScottGu blog.

2) PerfView

PerfView is a performance-analysis tool that helps isolate CPU- and memory-related performance issues. It’s a very handy tool if you are into to investigating performance bottle necks so things like blocking time, memory allocation, GC collection time etc. can be identified from using this tool.

This tool is developed by CLR team. It doesn’t have very good UI, but I am impressed by its data and benefits. Also please note that with default options, it’s not very heavy and can be used in production environment as well. Summary: If you are facing performance challenges in your .NET server side apps, give it a try.

3) Visual Studio DevLabs Extensions

DevLabs extensions are experiments/trials of potential upcoming features in Visual Studio. But guess what? you can try them today. I can’t explain much about this, you can check it out on Visual Studio Gallery. Please note that this is in addition to Productivity Power Tools available for Visual Studio which I mentioned in an earlier blog post.
View DevLabs Extensions on Visual Studio Gallery

4) TypeScript

TypeScript is typed super-set of JavaScript and it helps you write JavaScript with static type checking and some sort of benefit of static typed language. For example, it let’s you define interfaces, object type, method type rather than everything as ‘var’. If you write a lot of JavaScript, consider evaluating it. However it’s still in preview version.

Tutorial | Playground

That is all for now, the boarding is about to start in next five minutes.

Keep Exploring!

Attending Microsoft MVP Summit 2013

Hi Folks,
Just excited to share that I will be attending Microsoft MVP Summit 2013 next week in Bellevue and Redmond. The summit is a multi-day event and comprises of technical deep dive sessions with product teams along with variety of networking opportunities. 
This would be my third time attending the MVP Summit, previously attended in 2010 and 2011.

Like always, I will get a chance to meet Visual C#, ASP.NET and Visual Studio team, so I would be happy to take your any respective product specific feedback or feature request that you would like me to discuss with product team. You can share details via contact form or twitter.
Besides, you can also give any feature request to product teams via user voice forums. (see Visual Studio and ASP.NET)

ASP.NET MVC 4 Redirects Incorrect Login URL /login.aspx

When working with ASP.NET MVC and WebMatrix.WebData.SimpleMembershipProvider, I faced an issue of ASP.NET redirecting to incorrect login page i.e. “/login.aspx” in case of unauthorized access. As a result, got server error something like below snapshot

Solution: 

The resolution is simple and somewhat intuitive. Somebody needs to tell ASP.NET my LoginUrl. There are two workaround for that which I have tried and worked for me.
  • Add a LoginUrl key in appSettings in web.config
<add key="LoginUrl" value="~/Account/Login"/>
  • OR Set the form loginUrl in   in web.config
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="3000" />
authentication>
Another way around I found on stackoverflow is to set FormAuthenticationSettings but I didn’t give it a shot.
Finally, if you faced issue of redirect to ~/Account/Logon instead of ~/Account/Login in MVC 4 then make sure to check the PreserveLoginUrl is added and set true in your appSettings as mentioned in ASP.NET MVC 4 release notes
Hope it helps.

 

Web Development Goodies in Visual Studio 2012

Visual Studio 2012 and it’s extensions ecosystem brings excited enhancements for web developers. I am glad to see that web platform team is giving attention to open source, adapting industry trend faster than ever and making developer life easy and standard-complaint.
In this post I am going to share some of web development goodies that ships with Visual Studio 2012 (including Visual Studio Update 1 along with ASP.NET and Web Tools 2012.2 RC update) as well as some popular and must have extensions.

 

HTML5/CSS3/JavaScript Editor Enhancement Support:

 

The Visual Studio 2012 IDE includes great tooling update for supporting HTML5/CSS3/JavaScript intellisense. This includes new HTML5 tags and CSS3 properties. This helps in writing code relatively faster.


 
And who said to work on color hex codes? CSS color picker is now supported directly in CSS editor in Visual Studio. Makes it super easy to select and customize colors.
Further, JavaScript editor has improved significantly supporting better intellisense including for jQuery library.

An important point for JavaScript intellisense is to add reference path to js files. If you have noticed in ASP.NET MVC 4 project templates there is a js file “_references.js”

This file add references of common scripts referred in project to support their intellisense. However the reference to “_references.js” is added as global references in Visual Studio -> Options -> Text Editor -> JavaScript -> Intellisense -> References

It’s not the case that you cannot develop HTML5/CSS3 application without it. It’s just a editor support. Part of the features were also made available for Visual Studio 2010 SP1.

Page Inspector:

Page Inspector is a new feature in Visual Studio 2012. If you have developed web layout using HTML/CSS, you must have came across situation to give hit and try web layout for example, setting the right position, padding, selecting the color and see what best suited. I previously used to do this using FireBug, a Firefox browser extension. Page Inspector one feature is to answer this scenario. Scott Hanselman has produced a great animation to show what page inspector does. So I have copied it below.

Paste JSON as Classes 

A new feature to convert JSON into classes. A copied JSON can be pasted using Edit -> Paste Special -> Paste JSON As Classes

{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}

is pasted as

 

NuGet

NuGet is a popular extension of Visual Studio that makes it easy to manage third party libraries and dependencies in Visual Studio. In fact it’s so good that it now ships with Visual Studio 2012.
You can open up NuGet Package Manager using user interface or Package Manager console window available in View -> Other Windows -> Package Manager Console.

The way it works is that if you develop third party libraries and want to share with other developers then you create a package in NuGet. Other developers can retrieve package from NuGet repository and download the library along with required configuration, such as entry in web.config. See an example blog post, where I demonstrated configuring ELMAH using NuGet.

Web Essentials

If you are currently working on web application front-end in VS and you don’t have web essential extension installed then you are simply missing something essential. Web Essential is an visual studio extension created by Mads Kristensen and its like playground for the web tools team. It has a bunch of great features which provide help in development, I am just going to highlight few of them. Complete feature set is explained at http://vswebessentials.com/
LESS Editor/Preview: LESS extends CSS with dynamic behavior such as variables, mixins, operations and functions. If you write CSS and don’t know about LESS, you are missing something really handy. Web essential extension supports .less extensions file in a way that it previews the output CSS and some refactoring as well.


Vendor Specifics Generation: Many of the CSS3 properties required vendor specifics properties to work across web browsers. These include -moz, -webkit, -ms and -o. Consider following example below:

would result in:
 
There are many other goodies for web developers, TypeScript, CoffeeScript, advance intellisense in HTML, JS and CSS editors, ZenCoding etc. Go get it. This extension is also available for Visual Studio 2010 as well.

Productivity Power Tools

Productivity Power Tools is another must have extension of Visual Studio developed by some engineers at Microsoft Visual Studio team but they are not yet part of the Visual Studio official shipment. Some of the feature has graduated to official shipment over the time yet there are many good to have feature in productivity power tools. Some of the features I like are:
  • Ctrl + Click for Go To Definition
  • Remove unused Using from code editor context menu
  • Power Commands
  • Quick Tasks. Quick Tasks is nothing revolutionary rather it brings out most commonly used settings in Visual Studio to your finger tips. (see snapshot below)

For details, check out the Productivity Power Tools page on Visual Studio Gallery. This extension is also available for Visual Studio 2010 having relatively different feature set.

Open Source Web Platform

Over the last two years, I am glad to see the interest and shift of Microsoft Web and Azure team towards open source. Since then they have started publishing some of their source code on codeplex and github. This really helps developer community in contributing towards frameworks and understanding code which is good to have in case you faced any issue and wanted to know internals.
That is all for now. I have tried to highlighted some of good stuff available in Visual Studio ecosystem, which are helpful for web developers. I recommend you to check out details of each item.
Happy Coding!
 

Beginning Web Development using ASP.NET MVC

Yesterday I had an opportunity to talk on web development using ASP.NET MVC for students at AIOU.
I wanted to make sure that students have good concept of “Web” and the HTTP transactions. Plus in the start, it takes a little time for beginners to understand the Model-View-Controller (MVC) pattern and the convention over configuration style in ASP.NET MVC. So I started the session with web fundamentals and moving to demonstrating ASP.NET MVC project.
For those asking for presentation slides, which I think are not very important here but may be helpful, are shared on slideshare.