Monday, 12 February 2018

Get rid of annoying Application Insights Telemetry output items in ASP.Net Core web projects

I was working on this web ASP.Net Core 2.0 project that was spewing a lot of "Application Insights Telemetry (unconfigured): ..." messages in the Debug Output window. At first I thought I should just remove the Microsoft Application Insights NuGet package, but it didn't work. By default, it will still use insights even if you don't have it referenced anywhere in your code.

The solution is to do have installed Microsoft Application Insights NuGet package, but then set
Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.DisableTelemetry = true;
somewhere in Startup.cs (the constructor is fine).

Apparently, in the preview versions of Visual Studio 2017 there is an option under Options → Projects and Solutions → Web Projects → Disable local Application Insights for Asp.net Core web projects, too.

Update: A comment suggested you need to Disable the automatic loading of hosting startup assemblies which can be done in two ways:
  1. setting ASPNETCORE_preventHostingStartup to True or 1 in the project properties → Debug → Environment variables
  2. Doing something like
    WebHost.CreateDefaultBuilder(args)
    .UseSetting(WebHostDefaults.PreventHostingStartupKey, "true")
    ...
    - available from .NET Core 2.0

Either of these works, and although I agree with Andrei that the underlying issue for the unwanted telemetry is the automatic loading of hosting assemblies, I feel like the first option, the one that actually contains the word Telemetry in it is better for reasons of readability. But it's good there are three options to choose from.

Sunday, 11 February 2018

The Atrocity Archives (Laundry Files #1), by Charles Stross

book cover The Atrocity Archives tells the story of a technical computer geek enrolled by force in the British governmental organization that keeps us safe from supernatural threats. By Charles Stross' own admision, as a mix of Len Deighton and H.P.Lovecraft by way of Neil Stephenson (with a bit of Le Carré and Flemming thrown in for good measure), the book seeks to bridge the emotional catharsis of facing one's fears (the realm of the horror) with the desire to reveal the truth of the thriller. Bundled with it, the short story The Concrete Jungle, continues the saga of our protagonist.

I liked the book. A master of technobabble and fast paced intelligent action, Stross first came to my attention with the wonderful Accelerando, which I will never stop recommending. In the Laundry Files series, he tackles with equal humor horrors that could suck the universe dry of energy and life and things like bureaucracy (less efficient versions of the same thing) in government agencies. The pace is alert, the writing good and easy to read, the characters sympathetic if a little too shallow, funny, punny and, once I got into it, this book was almost impossible to put down.

I don't know if I will continue with the rest of the series, but as science fantasy goes, The Atrocity Archives is a pretty good book.

Saturday, 10 February 2018

Angular gotcha: every import path needs a directory specified

This is actually a TypeScript module resolution thing. The shape of the import name tells TypeScript what kind it is. The relative path imports always need a directory specified, so './myModule' and not 'myModule'. That's because myModule could be the name of an already declared ambient module.

Well, it's more to it, but the takeaway is that you have an import like import {something} from 'folder/something' and you want a similar import with a file from the same folder, you don't just delete folder/, you replace it with a dot, like this: import {somethingElse} from './something-else'

Tuesday, 6 February 2018

A Natural History of Dragons (The Memoirs of Lady Trent #1), by Marie Brennan

book cover Written as a 19th century explorer's memories, this book subtly achieves several things, effectively and decently. First of all, it is a sort of fantasy, although really if one removes the dragons, it's pretty much normal history. Second of all, it is a feminist story, but one done well. Instead of describing the horrible things done to women by evil cardboard characters, we get an intelligent and driven female hero that makes the most of her advantaged situation to expand her goals and enrich her life, despite social norms, but supported by friends and loving family. She is young, attractive, but not extraordinarily so, and her fascination towards dragons and science books leads her towards a career normally reserved for men. She is inspiring as a model, rather than complaining about her helplessness. She gets by through her efforts and skill, not by magically being gifted super powers. The fact that the action is set in a reasonably old period so that folk don't get touchy about it, but close enough so that it describes people that thought themselves the pinnacle of civilization helps with making the reading comfortably remote, but seriously instructive. Thirdly, it is written in an easy to read way, a personal memoir that can be understood by adults and children alike.

As such, I think A Natural History of Dragons is one of the few books that can claim to have made the world a better place, as it provides both escapist pleasure and educational value. That doesn't mean it's a perfect book. Marie Brennan's educated Victorian noblewoman style starts off as refreshing, but quickly gets old, the details providing less and less context and just filling up space. The book is well written, but at times I just wanted to get past the way people were dressed or how the architecture influenced the mood of the main character. The title is misleading at best, as the story is marginally related to dragons and instead focusing on one person and her incidental fascination with them. You learn almost nothing "scientific" about dragons but you sympathize while you observe this young woman desperately trying herself to understand more.

In conclusion, this is a book that I would gladly give to a hypothetical young daughter to read. As an adult, it is light enough to be enjoyable. The world is built thoroughly and perhaps the next books will be more action packed, while expanding on our view of it. The story is a bit lackluster, but nothing to complain about. It reads as a light fantastical autobiography. A more alert pace would have made it more accessible, but it would have probably detracted from the character's voice.

Tuesday, 30 January 2018

PreterNatural (Carter Bailey #1), by Matt Hilton

book cover I really tried to read and enjoy this book, which is highly rated and reviewed, which makes me wonder whether there is something wrong with me. Whatever the reason, I couldn't even finish it. Everything in this book is grating my senses, from the writing style to the scenes details, from the editing to the basic story outline. If you've read Dexter (the book the TV show is based on, not the TV show itself) you will have found a similar plot, but as I thought that book was bad, this one felt worse. I can't imagine who in their right mind would give this a full rating.

I've found a blog post by the author, Matt Hilton, that describes the unfortunate period in which he wrote the book. His seventeen old daughter just died. Maybe that affected the writing style, maybe the fact that it was written in several versions that then were edited into this one. I don't know. He has my sympathy for his loss, but not for PreterNatural. In his situation I would have expected to at least get the grief part right. Instead the character lives with the mind of his family's murderer in his head and has humorous dialogues with it.

It's a bad book. I won't recommend it in any way. Considering this is the first and only book in the Carter Bailey series, I think even the author probably agrees with me.

Monday, 29 January 2018

Renouncing New Scientist

New Scientist is a science oriented news site that has existed in my periodic reading list for years. They had great content, seemingly unbiased and a good web site structure. But they went greedy. Instead of one in ten articles being "premium" now almost all articles I want to read are behind a pay wall. While I appreciate their content, I will never pay for it, especially when similar (and recently, event better) content can be found on phys.org or arstechnica.com completely free. So, I feel sad, but I need to remove New Scientist from my reading list. I understand there is an effort in what they do and that quality requires investment and cost, but brutally switching from an almost free format to a spammy pay wall is unacceptable for me.