Reading Notes #200

2015-09-06_2133Suggestion of the week


Cloud


Databases


Books

  • Microsoft Azure Essentials Fundamentals of AzureMicrosoft Azure Essentials_ Fundamentals of Azure (Michael S. Collier & Robin E. Shahan) - This week a felt like returning to the sources, and read the essentials. Difficult to summarize a summary, but all principal family of features are approached and the “must have” tools are over… Even some scenarios. A really good book, evenmore it’s for all.

Reading Notes #199

ElasticDBSuggestion of the week

  • First look at Application Insights (Andrei Dzimchuk) - Excellent post. Perfect to make your idea about why and how we should use Application Insights. Nice touch to the config.

Cloud


Programming

Databases

Miscellaneous



Reading Notes #198

P1020009Cloud


Podcast

  • .NET Rocks! - Great episode very interesting discussion about the new Azure Service Fabric.

Programming


Databases



Get more from Azure application Insights

Application Insights is an incredible tool that will brings to you a gigantic quantity of information about your application. In a previous post: Tons statistics and metrics for Microsoft Azure websites (not only in Asp.Net), I was explaining how to get started with App Insights. In this post, I want to explain how you can create your own customs events or metrics.

The setup


I will use an Asp.Net MVC named SimpleWebApp that will consume an Azure Api App named FrankApiApp. For the demo purposes I will have both projects in the same solution, but let's pretend that the ApiApp is not us, and that we don't control what inside.

To create an Azure Api App you will need Visual Studio 2015 or Visual Studio 2013 with minimum Azure SDK 2.6 installed. When creating the app, select Asp.Net Web Application, then Azure Api App (Preview).

Azure_API_App

For this post, we simply need one function. Here the code of the Get method that will wait and return us a string:
    // GET api/values
    public IEnumerable<string> Get()
    {
        var rnd = new Random();
        var waitFor = rnd.Next(500, 3000);

        System.Threading.Thread.Sleep(waitFor);
        var msg = String.Format("You have wait {0}. Sorry about that.", waitFor);

        return new string[] { waitFor.ToString(), msg };
    }

The application where telemetries will be added is a simple Asp.Net Web Application with MVC, created with the default template in Visual Studio. To add App Insights, just right-click on the project and select Add Application Insights Telemetry.

Add_Azure_API_App_CLient

Now we need to add a reference of the Azure API App. That could be easily done. Right-click, once again, on the project and Select Add, then Azure API App Client. A new window will appear, and we only need to select our just deployed API App.

Select_API_App[3]

The Base


Of course, just by adding the code spinet to the head of _Layout.cshtml you will have a lot of information about your server, your application but also the client experience and browser. This is all very useful, and it worth the time to navigate/ dig in the Azure portal to understand how your application is going/ doing.


Custom Metric


An interesting information could be to measure the time for each call to FrankApiApp. Let's started by adding a custom metric. To do that we will add a function in the HomeController and a new tab in that menu of the _Layout.cshtml.
public class HomeController : Controller
{
    private TelemetryClient appInsights = new TelemetryClient();

    public ActionResult ApiCall()
    {
        var stopwatch = System.Diagnostics.Stopwatch.StartNew();
        var client = new FrankApiApp();
        var result = client.Values.Get();

        stopwatch.Stop();

        ViewBag.Message = result[1];

        appInsights.TrackMetric("TimeDoingNothing", stopwatch.Elapsed.TotalSeconds);

        return View("Contact");
    }
}   

First, we create an instance of TelemetryClient. Then before calling the FrankApiApp's Get method we start a stopwatch. And we just need to use the TrackMetric method to push the metric.

After deploying and navigating a little in the application, let see what's we have available for us. Open portal.azure.com, and navigate to your application Insights. Click on the Metrics Explorer, a new blade now open with three empty charts. Click on the timeline, then in the Metric texbox type "TimeDoingNothing" (new metric's name). Now, click on the grid (third chart), add the metric name and select Group By Continent. Interesting right?!

TimeDoingNothing


Even more


Application Insight gives the opportunity to track many things: PageViews, Events, Exception, Requests, Trace and of course Metrics. Here some alternative of our ApiCall function using the TrackEvent and TrackRequest.
// Using TrackEvent
public ActionResult ApiCall()
{
    var stopwatch = System.Diagnostics.Stopwatch.StartNew();

    var client = new FrankApiApp();
    var result = client.Values.Get();
    stopwatch.Stop();

    ViewBag.Message = result[1];

    var metrics = new Dictionary<string, double> {{"processingTime", stopwatch.Elapsed.TotalMilliseconds}};
    var properties = new Dictionary<string, string>  {{ "MessageSuggestedElapsed", result[0] } };

    // Send the event:
    appInsights.TrackEvent("APICallProcessed", properties, metrics);
    appInsights.TrackMetric("TimeDoingNothing", stopwatch.Elapsed.TotalSeconds);

    return View("Contact");
}



// Using TrackRequest
public ActionResult ApiCallWithTelemetry()
{
    appInsights.Context.Operation.Id = Guid.NewGuid().ToString();

    var stopwatch = System.Diagnostics.Stopwatch.StartNew();
    var client = new FrankApiApp();
    var result = client.Values.Get();

    stopwatch.Stop();

    ViewBag.Message = result[1];

    // Send the event:
    appInsights.TrackRequest("APICallRequest", DateTime.UtcNow, stopwatch.Elapsed, "200", true);
    appInsights.TrackMetric("TimeDoingNothing", stopwatch.Elapsed.TotalSeconds);

    return View("Contact");
}



Wrap it up


I couldn't show everything in one post, it's up to you to create new metrics, events and query them in Azure Application Insights. Share your discovery or questions in the comment section bellow.

References



Reading Notes #197

P1010915Suggestion of the week

Cloud

Programming

Podcast

Miscellaneous


Azure SDK 2.7 my savior

Recently, I got a very unpleasant problem: I needed to remove all my Microsoft Azure accounts from Visual Studio. An error was popping every time Visual Studio was trying to connect to Azure preventing me to anything else. It could happen to everyone, so I decide to share that story so other could save time and energy trying to fix that.

The Context


Long time ago I created my Azure account using my Hotmail account. I modified the administrator to my Outlook.com when it came-up (approx. two years ago). When I installed Azure SKD 2.6, the problem started.

The Error


In Visual Studio 2013 Update 4 or VS 2015 RTM, every time VS was trying to connect to Azure, I was receiving this error message.

VS2013_loginError_VS2013_2015-06-27_0736
Every time Visual Studio 2013 Update 4 or VS 2015 try to connect to Azure...


The Fix


If you only need Visual Studio, remove the "damaged" Azure account. If you need Visual Studio to work with Azure you have two options:

  1. Azure SDK 2.5 will work, if that is an acceptable workaround. You would need to make sure Azure SDK 2.6 was never installed on the machine, otherwise it will still have the offending dll.
  2. Install Azure SDK 2.7 and/or Visual Studio 2015. In my case, it fixed everything!

~Frank


Reading Notes #196

Win10Suggestion of the week


Cloud


Programming


Miscellaneous


~Frank


Reading Notes #195

VS2015_2015-07-27_0945Suggestion of the week


Cloud


Database


Programming


~ Frank


Reading Notes #194

IMG_20150716_225401Suggestion of the week


Cloud

Customers can replicate on-premises workloads to Azure with Azure Site Recovery for 31 days at no charge

Programming


Documentation


Miscellaneous



~ Frank



Reading Notes 193

chaos-monkey-3_480Suggestion of the week


Cloud


Programming


Miscellaneous


Image from  Inside Azure Search: Chaos Engineering

Reading Notes #191

Image by FutUndBeidl / FlickrSuggestion of the week


Cloud


Programming

Miscellaneous




Image by FutUndBeidl / Flickr


The Journey of an Azure SDK upgrade

JourneyRecently, with my team, we needed to upgrade a web solution to Azure SDK from 2.4 to 2.5.1. The upgrade was much longer and complex then expected, so I decide to share what we learn so maybe other could benefit from our experience.

The problem


The upgrade of the code and library was not really a problem. The documentation is available on MSDN and it's easy to follow. Few breaking changes were part of the version 2.5. One is the reason of this post: Diagnostics configuration must be applied separately after deployment[...]

Continue reading full article here



~Frank


Reading Notes #190

Father's daySuggestion of the week


Cloud


Programming


Miscellaneous


~Frank

Reading Notes #189

2015-06-15_0745Suggestion of the week


Cloud


Programming


~Frank


Reading Notes #188


I was really happy to ear about Microsoft Azure Data Center that will be built in Canada. And it was definitely not only good thing that was published this week...

Suggestion of the week


Cloud


Programming


Database


Miscellaneous



Reading Notes #187

2015-05-30 12.54.59

Cloud


Programming


Miscellaneous



First VSCode Tasks in less than 5 minutes

I'm working on solution to automating the generation of my weekly post: Reading Notes. While this work is finished, I still need to do many steps manually. I introduced in a previous post VSCode, that already supports markdown. In fact, from any markdown file, you can press Ctrl+Shift+V to preview the oupput. However, today, it's not possible to do anything with this preview. This post explains how we can use VSCode task to fix this problem.

Goal

Create a task that will quickly transform my current open markdown file in HTML.

Step 1 - Get a Markdown parser

First, we need Markdown parser. I'm sure many different are available, but in this post, I will use markdown-js, a Node.js parser that is available on github. To install it, just execute the following command:
npm install -g markdown

Step 2 - Create a Task

Secondly, we need to create our task. Open Visual Studio Code, and type Ctrl+Shift+P to open the Command Palette and then start typing Configure Task. Press Enter or select “Configure Task Runner”. This will create a new file tasks.jon, with many different samples of tasks. Before you replace the content of the page by the following code, take a look at the comment block at the top of the page. You will see different context variables that are available.

// Simple Task to transform MarkDown to Html
{
    "version": "0.1.0",
    "command": "md2html",
    "isShellCommand": true,
    "args": ["${file}"]
}

This defines our task using the json format. The command name in this case is md2html and we pass the name of the current open file as parameter using the variable ${file}. Finally, the "isShellCommand" is set to true so the task will be triggered by pressing Ctrl+Shift+B.

Step 3 - Try it

To try it, open a markdown page, hit Ctrl+Shift+B, and voilà! You should see in the output the HTML code generated.




References



~Frank

Reading Notes #186

published by Gartner
I finally watch most of the recorded sessions from Build, Ignite and MVPvConf, and I had more time to read.

Suggestion of the week

  • Learning to git bisect (Rural) - Very, very interesting walkthrough, I never knew Git got that kind of feature.

Cloud

Microsoft is currently the only vendor to be positioned as a Leader in Gartner’s Magic Quadrants for Cloud Infrastructure as a Service , Application Platform as a Service , Cloud Storage Services and Server Virtualization

Programming


Miscellaneous


~Frank

Note about the image of this week: This graphic was published by Gartner, Inc. as part of a larger research document and should be evaluated in the context of the entire document. The Gartner document is available upon request here.

Microsoft MVP Virtual Conference, one more day to go


MVPvConf 2015

Yesterday, was the first day of the #MVPvConf 2015. I already write about this event presented by MVP for everyone.

I really enjoy switching from one path to the other following the best fits of my interest. I even got some real though decisions to take because two sessions were at the same time! But wait; there is more!


Today it's Day 2, and many great presentations will by available.

Developer track with topics like: Roslyn Windows 10 ASP.NET Azure Cross-Platform...

IT Pro track with topics like: DevOps System Center Hyper-V Migration Office 365...

Consumer track with topics like: Pivot Table Data Windows 10 Cortana OneNote Security...

LATAM track with topics like: Power BI Exchange Enterprise Mobility Suite (EMS) Office 365...

Brazil track with topics like: Azure Active Directory Hybrid Cloud SQL Server...


Build your own agenda, and come join-us!




Reading Notes #185

IMG_20150503_181242Suggestion of the week


Cloud


Programming


~Frank



Meet my new best friend: Visual Studio Code

On the last week of April, Microsoft was having a huge event call //Build. During three (3) days many great conferences were presented. You can watch them on-demand on Channel 9. The keynote of day one is a must! It was during this keynote that Microsoft reveals many amazing news. One of them: Visual Studio Code. In this post, I indent to share my impression of this tool after one week of usage.

The Beast

You may be thinking: VSCode, it must be a light version Visual Studio... To that, I will reply it's not.
VSCode doesn't go without remembering other modern text editor like Sublime text, or brackets. The interface is far different from Visual Studio though. At this day, three themes are available but you can customize e v e r y t h i n g.

VSCode_Theme_contrasteVSCode_Theme_darkVSCode_Theme_light
VSCode is free, and it runs on Windows, Linux and Mac, it includes great tooling for web technologies such as HTML, Asp.net, Nodejs, CSS, LESS, SASS and JSon. It has syntax highlighting and a true IntelliSense. It also included: package managers, repositories, Git experience, debug tools, tasks, and so more!

I could continue over and over, but all the features are well explained on the official website.

My experience

It took me less than a minute to install on my "old" surface one. The interface is fast, and everything was looking good... Until I try to do something.

First, I was a bit confused. How should I open or create a project? Where is the menu? How do I use the debugger? After few minutes reading the excellent documentation on the official website, everything became clear. Visual Studio Code is sharing his name with his big brother, but he is really different. VS Code is using a folder approach, and a lot of shortcuts (so you keep your hands on the keyboard). And you quickly learn to use the Command Palette (Ctrl + Shift + P) to do more specific work.

My initial test was why Ghost. I cloned the repository directly from Github to my computer. Then from VSCode, open the folder. Without changing / editing anything, VSCode knew my project was in JavaScript, and the coloring and IntelliSense were working. And(F5), the debugger and I felt already more at home.

Firstdebug

A little message informed me that I needed to specify the starting point in the configuration file and voilà! I was debugging a Node.js project, that was easy.


Verdict

After a really short adaptation, Visual Studio Code reveals to be a reel gem. I strongly suggest that you spend few minutes reading the documentation before, to enjoy all his capabilities! The further I use it the more I become completely addicted. Visual Studio Code is an indispensable tool for everyone doing web development or looking for a powerful code editor.

VSCode_Markdown
 
 
Reference:
  • Visual studio code: Official website where you can find documentation and download VSCode for your favourite platform.

Reading Notes #184

CDxQRhpUIAAqBij[1]Last week, Microsoft released tones of news during the //Build 2015. The event was broadcast live, but if you are like me, you probably work during the day.... That smile because the conferences were recorded and are now available on Channel 9

You should definitely take a look and create your own schedule, but in all cases, you must watch the day's one Keynote
Enjoy!

Suggestion of the week


Cloud


Programming


Miscellaneous