Adding Application Insights to SharePoint

app insights sharepoint

TL;DR I helped write an SSW rule on setting up Application Insights in SharePoint.

I’ve been adding Application Insights to a number of SSW websites (such as SSW.com.auSSWTimepro.com and SSWLinkAuditor.com). Since being added, App Insights has been helping us to keep on top of our application metrics and unhandled exceptions.

We wanted to add Application Insights to SharePoint, but we couldn’t find any useful documentation online. I started some investigations into how I could do this manually myself. As SharePoint is an ASP.NET application, I started teased apart how Visual Studio adds hooks into projects. I created an empty git repository, created a website, checked it in, used Visual Studio to add App Insights, checked in, then diffed all the changes.

After investigating, we discovered that it was easier than I thought. You can track the browser metrics by simply adding the App Insights JavaScript to the SharePoint master page.

For the server side metrics, as it is an ASP.NET website, you can update the web.config file on the server to start tracking those metrics, we found that the Application Insights Status Monitor configuration tool was the easiest way to get this done.

A full write up of the SSW rule on setting up Application Insights in SharePoint is available for you to follow.
I have also helped write a series of SSW Rules to better Application Insights that can help you get the most out of it.

Improving your website with Application Insights

Application Insights Logo

TL;DR I helped write a series of SSW rules on setting up Application Insights that you can follow to improve the monitoring of your website.

One of my favourite Azure offerings is Application Insights. I think it is an extremely simple thing that should be added to every website you manage. It is free for basic usage and only takes a couple of minutes to set up.

I’ve been adding App Insights to a number of SSW websites (such as SSW.com.auSSWTimepro.com and SSWLinkAuditor.com). Since being added, App Insights has been helping us to keep on top of our application metrics and unhandled exceptions.

Because I think App Insights is a great product and want more people to get usage out of it, I helped write a series of series of rules detailing the hows and whys of Application Insights. My favourites are:

There are many more listed up there but those are just my getting started favourites. Check the rules out and start improving the monitoring of your application’s health.

Easily install Jekyll on Windows with 3 command prompt entries and Chocolatey

UPDATE 2017/05/17:
I now recommend using the “Windows 10 Subsystem for Linux” which provides an Ubuntu bash shell, to install and use Jekyll. This is how I use it myself.
Install guide is here https://davidburela.wordpress.com/2017/05/17/how-to-install-jekyll-on-windows-10-with-windows-subsystem-for-linux/

 

I’ve been using Jekyll to create static websites on GitHub Pages, but I was unsure how to install it with dependencies I wasn’t used to (NodeJS & Ruby). Here is the easiest way to get Jekyll set up on your machine in just a couple of minutes.

TL;DR if you have Chocolatey installed the 2 commands are:

  1. choco install ruby -y
  2. gem install bundler
  3. gem install jekyll

 

Prerequisite – Chocolatey 

You need to have Chocolatey installed on your machine. Chocolatey is the BEST way to install and keep applications updated on windows.

  1. Open a command prompt with Administrator access
  2. Install Chocolatey
    @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
  3. Close the command prompt as Chocolatey will not be available until you close and reopen.

Install dependencies & Jekyll

  1. Open a command prompt with Administrator access
  2. Install Ruby
    choco install ruby -y
    image
  3. Close and open a new command prompt with Administrator access
  4. Install gem bundler
    gem install bundler
  5. Install Jekyll
    gem install jekyll
    image
  6. UPDATE 2016/12/5: if you get an error about SSL, you will need to manually update Ruby Gems, because their certificate expired… Hopefully the new certificate will be bundled in the future
    http://guides.rubygems.org/ssl-certificate-update/
    image

Now you can use standard Jekyll commands to create a new site and serve it e.g.
jekyll new myblog
cd myblog
jekyll serve

 

Edits:
2016/12/05: Added details on how to get resolve the Ruby Gems certificate expiring. And added gem bundler which is a new requirement.
2015/12/05: From Jekyll 3.0 you do not need to install NodeJS. This brings it down to just 2 command prompt entries to install Jekyll

Dev Tip: Customising Visual Studio to use a different merge tool

One tip I picked up after many years of using Visual Studio and TFS is that the default diffing tool in Visual Studio is… lacking. But the great thing is that you can customise Visual Studio to use a different diff and merge tool.
My tool of choice is KDiff 3 (Package also available on Chocolatey.org) as it is free and open source. Meaning I am able to just install it via Chocolatey on all my machines without a second thought.

Here is a great example of why you may want to change your default diff tool. Below is a web.config file that was reformatted by a tool and simply put an additional space before the closing tag. Visual Studio flags every single line as having changed, but I can’t find the actual lines that were changed by me.
image

However in KDiff3 I can toggle to show whitespace changes, allowing me to focus just on the actual code that changed

Whitespace on
image

Whitespace off
image

 

Step 1: Install your diff tool of choice

Below are some I have previously used

 

Step 2: Open the Visual Studio Options

From Visual Studio select Tools –> Options. Then navigate to Source Control –> Visual Studio Team Foundation.
Then click Configure User Tools.
image

Step 3: Enter the command line parameters

In the configure use tools screen. Click Add.

  • For the extension enter .*
  • Command select the diff tool .exe
  • Enter the arguments from the table below based on if you are defining the compare or merge

image
image

The table below is duplicated from a 2006 blog post. I’d hate for the content to ever disappear off the web. All credits go to the James Manning’s original post.

Compare arguments

Product Command Arguments
TFS default diffmerge.exe %1 %2 %6 %7 %5 /ignorespace
WinDiff windiff.exe

%1 %2

DiffDoc (for Word files)

DiffDoc.exe /M%1 /S%2
WinMerge winmerge.exe /ub /dl %6 /dr %7 %1 %2
Beyond Compare bc2.exe %1 %2 /title1=%6 /title2=%7
KDiff3 kdiff3.exe %1 –fname %6 %2 –fname %7
Araxis compare.exe /wait /2 /title1:%6 /title2:%7 %1 %2
Compare It! Wincmp3.exe %1 /=%6 %2 /=%7
SourceGear DiffMerge DiffMerge.exe /title1=%6 /title2=%7 %1 %2
Beyond Compare 3 BComp.exe %1 %2 /title1=%6 /title2=%7
TortoiseMerge TortoiseMerge.exe /base:%1 /mine:%2 /basename:%6 /minename:%7
Visual SlickEdit win\vsdiff.exe %1 %2

 

Merge arguments

Product Command Arguments
TFS default diffmerge.exe /merge %1 %2 %3 %4 %6 %7
KDiff3 kdiff3.exe %3 –fname %8 %2 –fname %7 %1 –fname %6 -o %4
Visual SourceSafe ssexp.exe /merge %1 %2 %3 %4 %6 %7
Araxis compare.exe /wait /swap /a3 /3 /title1:%6 /title2:%7 /title3:%8 %1 %2 %3 %4
Beyond Compare (2-way merge) bc2.exe %1 %2 /savetarget=%4 /title1=%6 /title2=%7
WinMerge (2-way merge) winmerge.exe /ub /dl %6 /dr %7 %1 %2 %4
Guiffy guiffy.exe -s -h1%6 -h2%7 -hm%9 %1 %2 %3 %4
Ellie Computing guimerge.exe –mode=merge3 %3 %1 %2 –to=%4 –title0=%8 –title1=%6 –title2=%7 –to-title=%9
SourceGear DiffMerge DiffMerge.exe /title1=%6 /title2=%8 /title3=%7 /result=%4 %1 %3 %2
Beyond Compare 3 BComp.exe %1 %2 %3 %4 /title1=%6 /title2=%7 /title3=%8 /title4=%9
TortoiseMerge TortoiseMerge.exe /base:%3 /mine:%2 /theirs:%1 /basename:%8 /minename:%7 /theirsname:%6 /merged:%4 /mergedname:%9
Visual SlickEdit win\vsmerge.exe %3 %1 %2 %4

Translating emails easily in Outlook

I have been working with SSW’s Beijing office for over 12 months now. One common occurrence is that I am CC’d on emails to our Chinese customers, but unfortunately I can’t read Chinese. It is very useful for me to quickly read these emails so I have an idea of what correspondence is going on.

The easiest way I have found to keep myself in the loop and check in on threads periodically is by adding a button to the Outlook ribbon bar to quickly translate the current document for me. Here is an example of how to set it up and translate an email.

Step 1: Customise the ribbon
image

Step 2: Select the Home tab and create a new group. Call it Translation, then add “Translate Document”. Press OK to save it
image

Step 3: You will now see the translate button in the ribbon, press it to set up what language it should translate from and to.
image

It will then warn you that your email will be sent over the internet to the translation service
image

 

That is it. Now in your ribbon bar you will see your button ready to use.
image

Clicking it will open up a browser with your document translated
image

Getting married with Azure

After being with my partner for nearly 8 years, we finally tied the knot and got married. In the nerdiest way possible, I managed to organise the reception to be held in the “Azure Court” (without my wife realising). I was able to spend the day with the 2 loves of my life: my new wife, and Azure Winking smile

I mentioned to her that I was going to post about this and she recommended I link to the first time I mentioned her on my blog, when I was trying to figure out how to integrate Chinese & technology together:
Unicode not displaying correctly in Chinese apps and Creating a translation app to speak with her parents.

I have been an Azure MVP for 3 years now (with hopefully many more years in the future), however I’m hoping my new wife will outlast even my love for technology. Here is to many many happy years and the rest of our life together.

wedding with flowersdancing

Microsoft Virtual Academy – Windows 10 fundamentals & Azure

microsoft_ITHero_banners_02

Microsoft has a hidden resource for skilling up your technical skills, the “Microsoft Virtual Academy”. If you are looking to learn more about a specific Microsoft technology then it is a good way to learn from the experts. Some of the courses also help prepare you for Microsoft certification exams.

Today I am highlighting a few courses focused around

Windows 10 Technical Preview Fundamentals for IT Pros

Watch as the lead Windows 10 Enterprise Product Managers roll back the covers on the Windows 10 Technical Preview. Learn about new UI enhancements, find out how management and deployment is evolving, and hear how new security enhancements in Windows 10 can help your organization respond to the modern security threat landscape.

Windows 10 Technical Preview Fundamentals for IT Pros

Open Source Database on Microsoft Azure

Watch the experts, as they explore data storage in Azure and look at ways to design your data disk architecture for virtual machines (VMs). Plus, compare the performances of different VMs, and look at database reliability and availability.

Open Source Database on Microsoft Azure