Skip to main content

Posts

Showing posts from 2013

Visual Studio Project Template for AngularJS SPA + ASP.Net MVC \ Webapi

I am very exited to announce that our team at Technovert has release a Visual Studio project template for AngularJS. More details on how to install and use this template are available on the Technovert Blog

Knockout.js has been a standard library that .Net devs have been using for creating rich interactive business apps. But AngularJS from Google provides a more complete framework and is gaining a lot of dev community support. This project template can help you get up and running with AngularJS in no time and evaluate it for your future needs.

AngularJS Model - ViewModel

Recently Robin Ward did a comparison between AngularJS and Ember (both the post and the comments are interesting read). One of the complaint that Robin had that AngularJS does not provide any specialized model class. As described in the blog

There is no standard Model base class, nor is there a component or interface in AngularJS that defines what a model is supposed to be.
What that means is that anything defined on $scope can acts as model, as this sample on the blog describes




For some (like me) this is the flexibility where as for others who want a more structural approach this is a nuisance.AngularJS does not even provide any definite guidelines around how the model should be actually designed to be effective with AngularJS

This leads to what we call as $scope pollution. We define multitude of properties on the $scope object and managing it becomes difficult.  Looking at the code one cannot tell what is the actual model and what properties are just to support UI logic.

Model Desig…

IIS Url Rewrite and HTTP POST data

If you play around with IIS Url Rewriting rules and try to do redirects on an HTTP POST you loose your POST data.

To make sure you get the post data you have to set the `redirectType` to `Temporary` within your rules. So the action configuration looks like this

<action redirectType="Temporary" type="Redirect" url="http://{HTTP_HOST}{REQUEST_URI}"> </action>
You may think what scenario warrant a POST request redirect. We faced one such scenario while doing SSO with a federated Identity Provider (IP)  such as Google, Azure AD. In federated authentication scenario once the user is authenticated by the IP, it redirects back to your site with claim tokens in a POST request over secure channel (https). In our case we wanted to redirect to user back http after receiving the request. But any redirects were causing loss of token. By doing a 307 (Temporary) redirect we were able to preserve the post data.

Remote login on Azure Roles

In case you do not follow this guy :), there has been one significant change to Azure which would make developers life much easier while debugging and testing an azure deployment.

You can now enable remote login into azure deployment without requiring you to enable it during the package creation. This means even if the deployment happened with Remote login not enable, you can still enable remote login from azure management portal directly. More details are available here 

So no more forgetting remote login option. Just do a deployment and if required enable remote login from azure management portal.

Logging .Net Exception Details with Complete Stack

I learned today that in .Net doing a ex.ToString() would log the complete exception details including any inner exception details. The important thing here is that it would do this recursively so if there is an InnerException it would call ToString() on it, which in turn can call ToString() on the next level hence forming a recursive chain.

So we can do away with such format string

System.Diagnostics.Trace.TraceError("The error was {0}. Stack Trace {1}. InnerException Details {2}",ex.Message, ex.StackTrace,ex.InnerException.Message);

Google Driven Development GDD

In this era of TDD, BDD, DDD and all other  *DDs, we have a breed of developers doing Google Driven Development (GDD). Sounds interesting, indeed it is :).

Here is how to identify a GDD guy
This person does not believe in writing anything on his own, copy/paste from blogs, articles, source code is a way of life. And since I have not written it I don't care how it works as long as I see something working. His best friends are Ctrl-C, Ctrl-V and Google. Cannot write 5 lines of code or code for 5 minutes without doing a Google search.His productivity is directly related to performance of corporate network, and how fast Google searches. If the network is down, it's better to go for a coffee. Search hours on Google for "Object reference not set to an instance of an object" and then believes that the whole world is facing the same issue. Who cares what the context of problem is.To solve the errorHe then tries each and every solution that Google GOD provides.If by fluke he …

Azure and Package Deployment for Specific Roles

When a single Azure Subscription Service has multiple roles (Web and Worker) in it, updates to the role cannot be selective. Time and again I have had scenarios where I wanted to update the one role but did not want to touch the other. But as Azure deployment works, there is a single package and it updates all roles in the subscription.  While doing an update today I was pleasantly surprise that now while updating the site I do have an option to select which specific role to update. Here is what the dialog looks like now

So now we can update specific roles without touching other ones. Great!!!
Things to keep in mind here would be, once deployment is complete you cannot tell which role was updated and which is still running on a older version. But the deployment name does change. So i think this is a good feature for some quick fixes, else we should stick to simultaneous updates only.