and has 0 comments
I am in the process of converting an old web site to Angular 5 CLI. Little technical value other than I need to understand the underlying concepts, but I needed to take some Javascript code and execute it in Typescript, the de facto language for Angular. And you hear that Typescript is a super set of ECMAScript, but it's not as easy to integrate existing code.

So, first of all, we are talking pure Javascript code, not set up as a module or anything more advanced. Let's say something like function say(message) { return 'I say '+message.content+' ('+messsage.author+')'; }. It's a simple function declaration receiving a message object with the fields content and author and returns a string. How to use it in Typescript, which is a strong typed language?

First of all, you need to load the script itself. The file can be added to angular.cli.json, in the scripts section, like this:
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"assets/js/someJqueryThing.js",...

Next, in the Typescript file you want to execute the code, import the script:
import('someJqueryThing')
(note that it is not some import something from something else syntax, just the name of the script, so that it is bundled in for that page. But at this moment Typescript tells you there is no say method, and that's because you have not declared it for Typescript.

There are two options. One is to add a file called someJqueryThing.d.ts in the same folder with the .js in which you declare the signature of the say function, the other is to declare it in the .ts file you are running the Javascript from. The syntax, for this case, is
declare function say(obj:any):string;
You could declare an interface and specify what kind of object say receives
interface Message {
content:string,
author:string
}
declare function say(message:Message):string;
, or you can even declare var say:any;

I did something and suddenly my API was not run in IIS Express anymore, but in Kestrel. I reviewed code changes, configuration changes, all to now avail. I don't want Kestrel, I want IIS Express!!! Why did Visual Studio suddenly decided to switch the development server?

Solution: it is your Visual Studio. The button you use to start debugging has a little dropdown that allows you to choose which server to use. I had probably pressed the wrong one at some point.

and has 0 comments
You will quickly understand why I felt the need to say I was unbiased, but let me first demonstrate how much unbiased I was: I went into this raw fruits store, with an errand from the wife, and wanted to get something from me. Usually I like the caju and macadamia nuts, but I didn't want to have the conversation about why did I spent so much on something I eat out of boredom, so I looked around to get something else. And here they were, packaged and sold just like any other dried fruits or nuts: bitter apricot kernels. So I bought a 200 g bag.

Back in the office, I opened the bag up and I started eating. They were bitter as hell, but I didn't mind it much. I was eating some of them, then switching to candied ginger (which I'd absolutely love if it weren't so sweet), then back again. After a while, though, I'd had enough. About half of the bag in, I couldn't really find a reason to keep eating them. My colleagues had all refused to eat (and spit) more than half of one. But I was curious what they were actually for. People who love bitter tastes, maybe?

So went on the Internet and KABOOOM! mind blown. Just for scale, try to look for yourself at the dimensions of the can of worms I'd just opened: apricot kernels.

Turns out that the "active ingredient" in the apricot kernels is amygdalin, a substance that turns to cyanide in the gut. Yes, you've heard that right: I had just bitten the tooth, dying for the motherland before I could spill the beans. Google had already failed miserably, by serving first a page that explained how Big Pharma and governments conspired to keep this wonder drug from the public. The second page was Wikipedia, then every single conspiracy nut site, sprinkled with the occasional very dry scientific study that bottom lined at "we don't really know".

But I am getting ahead of myself. At this point I was already severely biased and I first need to describe my earnest experience to you. Short story: accelerated heartbeat, fever, terrible headache and nausea that lasted for half a day. Also, didn't die, which was good.

Back to my rant. So, some guy looked at the chemical structure of amygdalin and thought it looked like a B complex vitamin, so he named it vitamin B17. It was quickly marketed as a cure for cancer, despite numerous trials to show that it wasn't. And no, it's not a vitamin for humans either. It is not made in the human body, but it's not needed, either. The bag was not labeled anything dangerous, because it came from the outside of the European Union, which has a law regarding this. Here is some advice for both the EU and the US. Turkey was OK, though, so it only said "great for cancer, eat 5 to 8 seeds daily, not all at once".

So how fucked was I after eating about one hundred of them? A European Food Safety Authority article said that eating three kernels exceeds the safe level for adults. A toddler could do that from just eating one. An article from Cancer Council Australia detailed the child fatalities due to ingesting apricot seeds. Another article was telling me of an adult who got poisoning, but he was both stupid and extreme (he was taking a concentrated extract) and didn't die anyway. A thousand other sites were telling me how amazing my health will be after I had just eaten ten times the daily dosage they suggested.

Drowned in the sea of controversy regarding apricot kernels I've decided to look for the chemical and medicinal treatment for cyanide poisoning. Step 1: decontamination. It was kind of too late to go to the toilet and do the anorexia thing. Step 2: take some amyl nitrite (and then some intravenous things). Wait, that's a party drug. I could maybe get one in a sex shop. There was no home remedy and most of all, even if the amyl nitrite seems to work, no one seems to know exactly why other than the vasodilating effect it obviously has. Another possible antidote is (ironically) hydroxocobalamin, also called vitamin B12a. In the end some vitamin C and a headache pill did wonders, just in case you eat a bunch of apricot kernels and feel awful. Obviously, if it were a serious condition I would have died at the keyboard, trying to wade through the marketing posts and the uselessly dry official reports. Also, not enough easily available party drugs, I dare say.

So, days later the bout of shaky hands, fever and the horrible headache that only blood oxygen deprivation can bring, I decided to write this post. I doubt people will find it with Google, but maybe just my immediate friends will know not to eat this crap.

and has 2 comments
A pilot for the much awaited Stargate Origins series was released. My prognosis: it will be a disgusting flop, yet remember that Stargate SG-1 was kind of terrible in the beginning and it went very far in the end. Since SG-1 and Atlantis went really over the top, the only solution was a prequel, but considering the Stargate universe, I bet it will be very difficult to reconcile any prequel with the events in the existing series.

First of all, there is the distribution format: it's a web series. Instead of a pilot episode lasting 45 to 60 minutes, they released three episodes, 10 minutes each. The "webisode" format doesn't give me a lot of hope. However, this might be a marketing ploy, to check how many people are actually still interested in the franchise. If they see they have a big fan base, they can always improve the show or start a serious one.

But now comes the real bummer: the quality of the show, from the productions values to script and acting, is abysmal.

They went with the gender swap crap: female protagonist, female director, etc. Yet instead of a character we can sympathize with or want to be her, we get an abusive, annoying and very stupid person who, if they were male, would have been pathetic and offensive. As female, it grates the nerves. See the scene where, tied up, surrounded by Nazis with guns who have her father hostage, she spits, bites and says "you're a dead man" and "next time I'll really make you bleed" to a Nazi officer. It does feel like the role was written for an adolescent, maybe prepubescent boy, then it was changed just a little for a 19 year old woman.

Which brings me to the next point: the Nazis. The Nazis again, portrayed as they always are: ugly, mean, pompous, fanatical, always mentioning their Führer, stupid, narrow minded, etc. How can you do any good writing with cardboard characters? The answer: you can't. Start a show like this and you miss out the opportunity to see the Americans, British and Nazi Germans cooperate against the teachings of their respective cultures in order to defeat the Goa'uld threat. I have high hopes for the camerawoman, who in all this disaster seems to have escaped with good characterization and a decent actress.

Last, but not least, the production values would have been bad in a student project. Almost no post processing, the special effects are horrid, the soundtrack is slapstick from other series and there are some moments (an alien landscape seen through a window which is an obvious pastel drawing, for example) that make you wonder which 10 year old genius made that for a school project.

So you have a cheap production that a few fans in a basement would have done better, marred by bad setup, unusable characters and stupid writing. All of these can change: money can be spent, writers and directors changed or motivated, step taken to improve something that fans have been waiting for for a long time. However, what cannot be changed are the actors. The lead actress is bad, as are the two "young good guys". There is no getting around that. The others are not much better. Even Connor Trinneer, who you might remember as Trip, the engineer in the Star Trek: Enterprise series (and was also in a few episodes of SG Atlantis) and in this plays "the father", acted dazed and confused, as if asking "how did I get here? what am I doing?" in every scene. He was probably regretting taking the role. And he is 48 years old, he could have played the dad without the cheap white hair and mustache.

Bottom line: Trying to YoungIndianaJonesize Stargate was always a tough sell. Doing it with such lack of respect for the franchise and to the cinematic art is mind boggling. Didn't they want to succeed with this? I am baffled. Here is the trailer.

and has 0 comments
Annihilation, by Jeff Vandermeer, is a very short book that seems to be inspired by the Strugatsky brothers' Roadside Picnic. The same timeless quality, thoughtful introspective characters and a weird area that seems to defy the laws of physics and biology. But nothing is truly revealed, or learned, other than the somewhat senseless thoughts that the main character has. The other three women quickly succumb to the influence of "Area X", so we are left with a weird chick moving around in an unexplainable place with unfathomable rules. If Dallas' Pamela would have woken up from a dream at the end of the book, it would have meant just about the same as the actual ending.

I only read the book because of the upcoming movie. I am fairly certain that it will be better than the book, which manages to bore in half the pages of a decent story. It isn't that I disliked it, it's that I did not actually like anything in it. Everybody is acting crazy and without context and in the few pages that bring some context, it's the boring relationship between the lead and her husband and I couldn't care about any of them.

I am sorry, but when you write a book about a scientific expedition, it's customary you write about characters that behave like scientists, not like directionless drunkards with self-traumatic histories. I don't understand how this book won any science fiction award. It is well written, but it's barely average. I am not going to read any of the other books in the trilogy.

Update for .NET Core 3.0:

Seems for .NET Core 3.0 the solution is much simpler:
  • install the Microsoft.AspNetCore.Authentication.Negotiate NuGet package
  • add authentication in ConfigureServices like this:
    services
    .AddAuthentication(NegotiateDefaults.AuthenticationScheme)
    .AddNegotiate();
  • use the authentication in Configure (above app.UseAuthorization();)
    app.UseAuthentication();

No need to UseIISIntegration, UseHttpSys or anything.

Original post:

If you get the System.InvalidOperationException "No authenticationScheme was specified, and there was no DefaultChallengeScheme found." it means that ... err... you don't have a default authentication scheme. Solution:
  • Install NuGet package Microsoft.AspNetCore.Authentication in your project
  • add
    services.AddAuthentication(Microsoft.AspNetCore.Server.IISIntegration.IISDefaults.AuthenticationScheme);
    to the ConfigureServices method.

Update: Note that this is for IIS integration. If you want to use self hosted or Kestrel in debug, you should use HttpSysDefaults.AuthenticationScheme. Funny though, it's the same string value for both constants: "Windows".

Oh, and if you enter the credentials badly when prompted and you can't reenter them, try to restart Chrome (as in this answer)

and has 2 comments
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.

and has 0 comments
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.

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'

I used to put all my work in a folder called !Projects, for the simple reason that it would make it the first folder to appear in the file explorer. Due to a limitation in WebPack, Angular cannot work with paths containing the exclamation mark character.

and has 0 comments
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.

and has 0 comments

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.

and has 0 comments
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.

and has 0 comments
The quote So what's the moral of this story? - Moral? Our stories don't have those! perfectly describes the narrative of LaRose. The book is well written, there are a lot of very well described characters that go through their own arcs that intersect often and in uncommon ways, but you are just left with knowing a bunch of people better than before you began reading the book.

Louise Erdrich describes an intertwining world of traditions, history, real life, strong emotions, cool heads and above all, the feeling that it all somehow makes sense (without it actually reaching that point). It could have easily been completed at the middle of the book or continued for a few more volumes, it lacks finality, with the last chapter feeling forced in the way that it tried to complete some concepts. I can imagine Woody Allen saying "It involves Native Americans" after reading it for twenty minutes.

Given what I've said above, it's difficult for me to rate such a book. I enjoyed reading the words, but did not enjoy the book. I ground the words into submission with the whole intention of finishing the story and then reading something else. I loved the characters, even if the myriad of details about them did not interest me in the least. I learned about a people that is, as the book itself recognizes, rapidly going extinct. Is this a good book? Yes! Would I have read it if I knew what I know now? Probably, because I am vain like that. Should I have read it? Probably not.

Bottom line: I will rate it above average, because it most obviously is, but that's about the only reason.

and has 1 comment
I have invented a new way to write software when people who hold decision power are not available. It's called Flag Assisted Programming and it goes like this: whenever you have a question on how to proceed with your development, instead of bothering decision makers, add a flag to the configuration that determines which way to go. Then estimate for all the possible answers to your question and implement them all. This way, management not only has more time to do real work, but also the ability to go back and forth on their decisions as they see fit. Bonus points, FAPing allows middle management to say you have A/B testing at least partially implemented, and that you work in a very agile environment.