It all started with the source code for NonCapturingTimer, a static factory class that was creating a System.Threading.Timer without capturing the execution context and was described as "A convenience API for interacting with System.Threading.Timer in a way that doesn't capture the ExecutionContext. We should be using this (or equivalent) everywhere we use timers to avoid rooting any values stored in asynclocals.". What did that even mean?
An issue opened by David Fowler sheds some light on this: "Any lazy activation of timers will capture the ExecutionContext. Combining this with a lazy initialization of the HttpClient and the handler graph may end up holding onto AsyncLocals for longer than expected. This could end up looking like a memory leak". This follows a Twitter thread from Fowler declaring AsyncLocal as evil.
And if you look at the ASP.Net sources on GitHub, they do use the class mostly for one time timer calls and periodic cleanup calls. I should mention that Ben Adams from Microsoft calls this way of creating timers ugly.
I don't have the time to go down further on this rabbit hole, but maybe people will find answers here when looking into this and comment on their findings.
The Macht series is not related to anything Germanic, as the name might imply, but is instead inspired by the Greek Hoplites. Even if The Ten Thousand happens on another planet that has different continents and two moons and three intelligent races, Paul Kearney could have written it just as well as a historical novel set in ancient Greece, with Greek mercenaries getting hired by Persians as weapons in a civil war that went awry. In fact, the story really is inspired by an actual historical group called the Ten Thousand and the main character, with the unfortunate name of Rictus, seems to be inspired by that of real life Xenophon. The book seems to be a retelling of Anabasis.
Now, the story is well written and short. I read the whole thing in a day. It's like a 300 novel, with the courageous and lethal Macht force finding itself on a foreign continent, surrounded by overwhelming hostile forces and having to march through rough and deadly terrain in order to get home. There is a lot of fighting, technical and military, some romance, bro-mance and feudal politics, but it's essentially the story of a huge march seen through the eyes of an experienced soldier, but young and new to the mercenary troupe.
Bottom line: I don't know if I am going to read any other Macht book. This one felt self contained and I am not that much into ancient fights in the Bronze Age. I liked The Ten Thousand, though, and I recommend it as a short and captivating read.
The Luminous Dead has only two active characters: a cave diver, covered in a special suit that enhances her strength and completely isolates her from the environment, and her handler, the person who guides and provides support remotely. At first glance it's a sci-fi story, as it happens on another planet, with futuristic technology, different rules, alien lifeforms, etc. However, it starts to itch at you that with the tech that was described, the tasks at hand could have been completed a lot more efficiently and safely, so what gives?
Turns out the story is more of a metaphor than a fantastic cave adventure on another planet. Probably inspired by the death of Caitlin Starling's mother, it explores the damage done by losing your parents, the obsessions that drive the affected, the extent to which someone will go to quiet those voices in their heads. But I liked it. It's got just enough action and adrenaline to keep you going while it touches the painful emotional bits that the book was really about.
Bottom line: I urge you to ignore all technical aspects of the story. It's not that the author did not made the effort to make them believable, it's that they are irrelevant to the moral of the book. Also ignore the wild emotional fluctuations of the characters: they are supposed to behave that way. The book feels as if following a personal journal with the events of the story being just sci-fi versions of the items there.
While being hosted in a small house in the Arges county, I found myself face to... err... hairy body to hairy body with a large spider, at least 10 cm from the tips of the front legs to the tips of the hind legs. The body itself was about 2 cm in length. I tried to catch it, but it ran away and I didn't exactly feel safe handling it. However, from my standpoint, the adventure was just beginning. It starts with a picture:
In a previous post, I was telling you about a web site that recognized plants from blurry pictures I had taken. I assumed that somewhere there was something similar for spiders. Alas, it doesn't seem to be the case, so I reverted to the classic Google search with descriptive words: a European spider 10 cm in length. I found it almost immediately, clearly a member of the genus Tegenaria in the family Agelenidae. Or is it?
Funny enough, most of the spiders assigned to Tegenaria were recently (2013) moved to another genus, Eratigena, based on DNA and molecular analysis. So my spider, likely a "giant house spider", can be found either as Tegenaria atrica or Eratigena atrica (not to mention Tegenaria duellica, Tegenaria gigantea and Tegenaria saeva). I also can't be completely sure of the identification. As far as I can tell, it's a male, based on the large (pedi)palps, used not only to hold on to prey, but also to deposit sperm in the females. But while I think it looks most like an atrica, based on the pictures I found online, it could also be an Agelena labyrinthica or a Tegenaria parietina, even if the first is found in Denmark and should be smaller and the second is rare and native to Central Asia.
Considering it's a giant spider I found in a house, I will go with Eratigena atrica, but one has to wonder how active biology as a science is to have species of common arthropods reassigned from one genus to another just a few years ago. So yeah, a nice little story, for me at least, all starting from a picture of a spider in a bathroom.
Tate no Yuusha no Nariagari is one of those isekai animes where a normal Japanese boy is summoned in a magical realm to fight monsters. Once there, he realizes that the world and his character work exactly as in a fantasy video game, complete with items with upgradeable stats, waves of monsters and revealing female armor. He is summoned there with three other heroes, also from Japan, only from alternate universes, each of the heroes having their own magical item that defines their style. His item is a shield and immediately he notices that he is treated differently, with all honors given to the other three and only disgust for him. Long story short, he is forced to hone his skills through his will and efforts alone, while the others, spoiled by their environment, make no effort and therefore level up less.
I liked this anime and I will continue to watch it, although it's a bit ridiculous. I've read the manga as well, which is also new, and there are slight differences in the sense that the anime is a little more serious. If you want a mindless game like experience in anime form, go for it. Here is a trailer:
Violet Evergarden is set in a steampunk universe in which technology, other than metal prosthetics, is at the 19th century level, and the main character is a girl that was used as an elite child soldier in a terrible war who now has to find a purpose in a civilian life. She takes on the job of a "auto memory doll", a person who needs to put into words the feelings of others. That's a bit of a stretch, because she doesn't know how to feel herself... it's like me taking on a job in psychology or artistic design so as to learn a new skill. Certainly great for me, but kind of sucks for my employer!
Anyway, the animation is really well done and the acting is top notch. The story itself is beautiful, even if at times inconsistent. After watching the 14 episodes of the first season, I was itching for more, only to hear from a colleague that the studio responsible for the animation, Kyoto Animation, was destroyed in a terrible arson attack. That doesn't bode well for a sequel, yet a spin-off film had already been announced, so who knows?
Bottom line: it's not for everyone. PTSD romance, I would call it. But it nicely animated and I liked the story. I felt that the characters were a bit off, but not annoyingly so. Here is a trailer, in English:
There is a trope in fantasy writing that goes like this: young person is uprooted from their life as they learn a new skill or gain a new power, while people in authority teach them things so slowly and inefficiently that the young person needs to make efforts to learn by themselves. Harry Potter had it. The Binding has it. Only in the case of this book, the young person is someone who is always sick without knowing why, is suddenly sent off from home to be an apprentice for someone he doesn't know and while he understands nothing of what he is supposed to do. Months later and 25% of the book in, he still hasn't learnt anything, although he is always tired and exhausted for no good reason whenever he is about to. If he doesn't collapse, his mentor will! And, spoilers ahead, his mentor then dies.
So after a quarter of the book, absolutely nothing happened while I had to suffer a depressed weak and barely teenage boy who didn't want, know, or want to know anything. Bridget Collins' writing is competent and I am sure things are going to get better from here (I mean, they can hardly get worse), but I just won't continue to read the book.
Magic for Liars is one of those stories where magic exists in a hidden layer of our world, yet it doesn't bring any happiness. People are still people, regardless of their power. And what better way to explore human nature than writing a detective story in a high school for magical kids?
Sarah Gailey writes the story from the viewpoint of the detective, a woman who's greatest frustrations stem from her sister being a magician, while she is just "normal". Yet when she is tasked to find out the circumstances of the death of one of the teachers in the magic school, she jumps on it, making her realize more about herself and the relationships with family and other people.
Yes, the magic is quite incidental and the detective part quite secondary and it could just as well been written in a space academy or science lab or anywhere where flawed people have to manage each other and the balance of power between them. And while I feel the main character was compelling and the story well written, I can't quite shake the feeling I've been duped into reading a touchy-feely type of drama that I didn't really intend to read. You will not read about the specifics of magic in any kind of way; it is quite bluntly used as a tool that the reader needs not understand. You will not be amazed by the amazing feats of deduction of a fascinating detective; the main character is by definition a very normal person with a penchant for introspection and focusing on her own messed up feelings.
In the end you know the spouse did it, or the butler, or the person who flirts with the detective, or the god-like magician, or the weird kid. The culprit isn't even that important for the plot. It's all about the theoretical dynamics between the people and what makes them tick.
Bottom line: a fine investigation into the core motivations of people, woven in a rather short and bland story which purely incidentally features detectives and magic.
The talk is a bit overreaching, doing more things than it should have tried to do, in other words not very efficient, but it contains some really interesting ideas and it's extremely well articulated. As a software developer, I always thrive for efficiency, but what Margaret Heffernan says is that efficiency is good only when the future is predictable. In a fast changing world (and getting faster), efficiency doesn't just not help, it makes things worse. Sometimes you can't plan, but you can prepare.
As expected, I wasn't as interested in the humanistic part of the talk as I was in the technical aspects: algorithmic efficiency is only good with things that can be measured. If you want to innovate or to adapt, it's trial and error that works best. I got that giddiness I get when people tell me "you can't do THAT in software!". Oh, ye of little faith! But there is something there, something extremely useful, a tool that I can use whenever I get stuck in logic loops or some manager tells me that he needs data in order to make a decision about the project that would generate the data.
The problem described here was slightly false. The issue was that IOptionsSnapshot was registered as Scoped and I was just getting the service from the root IServiceProvider. The solution is to call provider.CreateScope() and with that scope as a provider use ActivatorUtilities. Even better, create a scope, then use it to get an instance of a business class that now would support Scoped services as well as Transient, just like a Controller would.
Warning, though: you need to dispose the scope, but you need to make sure you don't use any service that was created there outside the scope (after disposing).
I guess another solution would be to somehow register IOptionsSnapshot<> as transient, but haven't tried it.
And now for the original post
I was trying to create an instance of an object from a service provider to resolve any dependencies, using ActivatorUtilities.CreateInstance<MyObject>(_serviceProvider) and I was getting the exception:
System.InvalidOperationException HResult=0x80131509 Message=Cannot resolve scoped service 'Microsoft.Extensions.Options.IOptionsSnapshot`1[ExternalConfiguration]' from root provider.
My object was receiving a parameter of type IOptionsSnapshot<ExternalConfiguration> and upon further investigation, my service provider (which came as a resolution from the dependency injection for IServiceProvider) was actually a ServiceProviderEngineScope which just refused to resolve any IOptionsSnapshot! Funny enough, if I replaced IOptionsSnapshot with IOptionsMonitor, which in my mind is a heavier interface, it worked without issues. Further still, the problem appeared only inside an IHostedService (a BackgroundService hooked up with services.AddHostedService<T>); if I wrote the same code in a controller action, for instance, it worked fine.
The .NET 2+ implementation of IOptionsSnapshot<T> is OptionsManager<T>. If I manually resolved an instance of OptionsManager before my object, then added it as a parameter, the code worked:
var optionsSnapshot = ActivatorUtilities.CreateInstance<OptionsManager<TestOptions>>(_serviceProvider); var myObject = ActivatorUtilities.CreateInstance<MyObject>(_serviceProvider, optionsSnapshot);
So, specifically, the issue is that in .NET Core, the service provider implementation cannot resolve IOptionsSnapshot interfaces in worker services. You can still do that manually, but I suspect it is a bug, since there is no problem using an IOptionsMonitor instead of IOptionsSnapshot.
A possible solution is to use an additional service provider only for IOptionsSnapshot. Warning, this will not work in a general situation if the dependencies from the additional service provider also need parameters that would be found in the original service provider:
// initialization code var serviceCollection = new ServiceCollection(); serviceCollection.AddSingleton( typeof(IOptionsSnapshot<>), typeof(OptionsManager<>) ); serviceCollection.AddSingleton( typeof(IOptionsFactory<>), typeof(OptionsFactory<>) ); _additionalServiceProvider = serviceCollection.BuildServiceProvider();
There are writers like Steven Erikson, describing worlds so vast that characters seem to drown in them, there are writers like William Gibson or Charles Stross, who go so far into the future that people seem to lose their relevance, yet none of them dare to ignore their characters or fail to make them interesting. Yet, that's what Sam J. Miller does in Blackfish City.
10% in and I couldn't bare reading any more of this book. I couldn't care less about the asexual person that is whining about his life, I couldn't care less about the orphan girl whining about her life, I couldn't care less about the sick homosexual boy who is whining about his life and I couldn't care less about the anonymous radio show that narrated what the city was instead of the action showing me. Should I care about all the world getting sunk under the water until the only livable places are floating megacities reminiscent of Waterworld and run by semi abandoned AIs? Should I care about the artificial drama, weird futuristic disease or the grey whining world that Miller describes? No. I refuse!
Bottom line: a poor man's cyberpunk story, with the mechanical "woke", but irrelevant to anything else, sexual and cultural references, with boring characters and a story that I had to make an effort to wade through and still didn't seem to go anywhere.
It takes the third book to see that the "hero's journey" is actually Sigrud's, even if he is the lead character only in this final book of the Divine Cities series. And yes, it is the final book, with a satisfying and very permanent ending, with no hope of dragging it on. Hell, if you consider there are three books and two cities and no gods left, you could wonder how would anyone continue the story if pressured by publishing companies.
Robert Jackson Bennett did not disappoint with City of Miracles, switching registers a little by turning the usual steampunk-noir detective story into more of a chase and revenge thriller. The villain is revealed quite soon, the mystery split into multiple little quirks that nag at you until the end of the book and a massive divine battle to top it all up. Yet I was a little disappointed with the ending. I know, rationally, that it is a great ending, but emotionally I didn't get what I needed from it, especially as I was still fired up on the penultimate chapter only to get an "aftermath" chapter for last.
Maybe it was that one of the options they employed at the end could have easily been the first and solved a lot of problems to boot. Or the fact that a lot of the grief in the final third of the book came from Sigrud not checking his kills, which is something he would never ever do. It felt a little stretched and tired compared to the other stories.
Sometimes I wonder, is it easier or harder for a writer to just abandon a world that he so carefully crafted? Is it a burden that everything that is successful needs to be turned into a trilogy or a series, or is it like coming home, writing about good friends living in your head? Either way, I am kind of grateful to Bennett for ending it all. I would have read more and more books like these if he wrote them, because I am an addict at heart, but I believe both of us can do better.
Bottom line: It's kind of difficult to compare the three books in the series. The first one was the most captivating, but also first, the second one was darker, yet in the same vein, while the last felt philosophical and like the writer wanted to get it done with. You can read either as standalone, although it makes more sense to read the whole trilogy from first to last. I recommend it and I will read more from the author.
Robert Jackson Bennett caught my attention with the first book in the Divine Cities series: City of Stairs. It was a steam-punk and magic detective story featuring a strong female character and her trusty sidekick, with great world building and character work. City of Blades is kind of the same, but slightly darker.
What surprised me in this book was that the author chose to abandon his hero of the previous volume and bring forth one that was a secondary character in that. It's still a whodunit, it's still a strong female lead fighting divine but malevolent forces. If it ain't broke, don't fix it, right? Only City of Blades is more about the personal pain of people, their sacrifice and service, their (dashed) hopes and dreams, the promise of the afterlife.
Long story short, I was planning to read something else at the end of the book, but instead I've just started immediately with City of Miracles, the third and last book in the trilogy. I love this series!
I am going to try something new with this blog post. Usually, when I go somewhere on vacation, the things that capture my attention are not what interest about anybody else in my entourage. I am also not a very lyrical writer, so what's the point of enumerating the places I've been from the perspective (oh, so much used!) of the casual tourist. I imagine myself writing one of those horrid "10 things to do in..." articles, promptly vomit and desist from thinking about it.
With this post, though, I am going to tell you of the wild (but accessible) area that I've explored and where to find it, how I felt and, if I can find the references, what plants and animals live there. You see, when I go somewhere, I avoid people and take really bad pictures of flowers and plants, butterflies, weird things and sometimes landscapes.
The place
I've been to Cheile Bistritei Valcene (the canyon of the river Bistritza from Valcea - there is another one in the north of the country) and in the valley of the Luncavatz river. The vegetation and insects are very similar, so I am going to treat this as a single area, even if their locations are 20 KMs apart:
Cheile Bistritei: from 45.189828, 24.039859 to 45.197871, 24.030284
Raul Luncavat: from 45.186682, 23.917856 to 45.190084, 23.914488
The area is very nice, easy to get to by car, but not very touristic yet, so not a lot of people having picnics and listening loudly to music. Leave your car and walk on the sides of the river(s) and the scenery is verdant and quiet. I have to warn you that even if in Romanian they are called rivers, they are more like creeks, especially at this time of the year. You can even find some caves in the area and if you are the long walk type of person, some 4-5 hour hike routes to more remote areas. Some flowers are white, but the vast majority of them are either yellow-orange or violet in color and probably are much more interesting in ultraviolet than human vision.
Animal life
I haven't seen any animals other than birds, a running lizard and a lot of insects.
I saw several species of butterflies, the most common by far being a medium sized orange with black spots, a fritillary, probably the Silver-washed fritillary (Argynnis Paphia) or mantia imparatului in Romanian. They were frolicking on these tall yellow flowers with large leaves: the yellow oxeye (Telekia speciosa) or brusture and ochiul-boului in Romanian. The next most common was a shy dark butterfly with a crimson edge on its wings. Probably the Woodland ringlet (Erebia Medusa), I have no idea what the Romanian popular name for it is.
Argynnis Paphia on a Telekia speciosa
Erebia Medusa
Some other butterflies: the cabbage white (Pieris rapae) or fluturele de varza in Romania, the peacock (Aglais io) or ochi de paun de zi in Romanian, the swallowtail (Papilio machaon) or coada de rindunica in Romanian and even one glimpse of what I think was a marbled white (Melanargia galathea) or tabla de sah in Romanian.
Pieris Rapae
Aglais Io (during my youth Innachis Io)
Papilio Machaon
Melanargia Galathea
One fascinating specimen looked similar to a peacock butterfly from afar only for it to settle in a triangular black and white shape when it stopped. It must have been a moth! I've identified it as a Jersey tiger moth (Euplagia quadripunctaria) or fluturele urs dungat in Romanian.
Euplagia Quadripunctaria
What I also found fascinating is a tree that had apparently been colonized by ants. A lot of wood dust was on the ground and a lot of activity was inside the trunk. Still, there was another hole in the trunk that was filled with wood dust, but no ant activity. Could it have been some sort of other factor, termites or perhaps a disease, that destroyed the tree trunk's interior and the ants were just opportunists?
[youtube:5ewcsMPzSm4]
Ants or termites? New behavior or opportunism?
Plants
Now, plants are easier to photograph, but harder to identify. I've mentioned the oxeye. Then there was the touch-me-not (Impatiens noli-tangere) or slabanog and bradulet in Romanian, which appears to have been used traditionally for its medicinal properties, mostly related to kidney or gynecological issues. The Spreading bellflower (Campanula patula) was there, together with its close relative, the Creeping bellflower (Campanula rapunculoides) - both are called clopotei in Romanian. There was the mountain geranium (Geranium robertianum) or napraznic and priboi and iarba sfintului Robert in Romanian, which appears to have anti-stress, anti-cancer and fertility related purposed in traditional medicine.
Impatiens Noli-tangere
Campanula Patula
Campanula Rapunculoides
Geranium Robertianum
Field mustard was present as well (Brassica rapa). This plant was and is used for a variety of reasons in many cultures. The leaves and roots are rich in oil. In Puglia they use the buds as cimedirape in the making of orecchiette pasta. It is a plant from the cabbage family of plants, probably explaining the presence of the cabbage butterflies.
Brassica Rapa
A very interesting flower has a very weird name: the Viper's bugloss (Echium vulgare) or iarba sarpelui in Romanian. It has blue flowers but the filaments of the stamens are red, contrasting with the petals and giving it a violet color per whole. It has medicinal uses as well, as an antidote for snake bites and for its antibiotic and astringent properties.
Echium Vulgare
Another violet flower, with uses in homeopathic medicine but also in poisonings, is aconite or wolfsbane (Aconitum napellus) or omag in Romanian. It contains powerful alkaloids and at one time it was forbidden to grow this plant anywhere in the Roman Empire on penalty of death. Death from intoxication with the plant can occur in as little as half an hour!
Aconitum Napellus
And since we are talking about a violet flower with medicinal properties, how can we ignore the heal-all (Prunella vulgaris) or busuioc salbatic in Romania. The young leaves and stems can be eaten raw in salads; the plant in whole can be boiled and eaten as a potherb; and the aerial parts of the plant can be powdered and brewed in a cold infusion to make a beverage and it is used as an astringent in folk medicine.
Prunella Vulgaris
Not often, but when it happened it was a whole field of them, I found the Orange mullein (Verbascum phlomoides) or luminarica in Romanian. It is also a medicinal plant, used for the calming, sweat inducing and expectorant effects.
Verbascum Phlomoides
I've seen some daisies in the area and also another flower from the same family: the fleabane (Erigeron annuus) or bunghisor in Romanian. Used in salads as well as against the common cold or stomach aches in folk medicine.
Erigeron Annuus
Last, but not least, the evening-primrose or sundrop (Oenothera biennis) or luminita noptii in Romanian. It started as an American plant, much like the fleabane, but it was brought and naturalized in Europe. It has been used medicinally by the native Americans for all kinds of ailments, as it is an edible plant containing an oil with anti inflammatory properties.
Oenothera Biennis
There were a lot of plants without flowers, but I haven't had the time or patience for them. There was one with huge leaves and I photographed it for identification purposes. It turns out it was either the butterbur (Petasites hybridus) or the burdock (Arctium lappa) both called brusture in Romanian, but different species altogether. It's probably the Arctium, but I can't be sure!
Petasites hybridus or Arctium lappa? A lot of stuff called brusture in Romanian!
Resources
It would have been a lot more difficult for me to write this post if it weren't for sites like:
Pl@ntNet - upload photos of plants and get an instant AI driven identification
... and of course Wikipedia and Google, which will let me find the correct association between a Latin name and the regional names
Even with these great resources, it was obvious that not many people will publish nature related posts in any systematic manner. Even this post, three hours in the making, is a random mess of blurry pictures and random observations.
It wasn't the writing, it is competent, without having any other redeeming quality. It wasn't the story, which is as banal as the book cover and the title, but bearable. It was the main character, a person so ordinary that he freezes whenever he is in danger, loses everything he loves several times from people who threaten him with violence and who for seven chapters, under the guise of thinking like a scientist, attempted in vain to realize what was obvious to the reader from the start. Yeah, OK, how dare he not be a superhero with indomitable courage and magical powers! I accept my part of the responsibility, however I could not for the life of me continue to read Dark Matter past chapter 7.
I am going to go on a limb here, though, and guess that the rest of the book will be just the same: a perfectly ordinary man, thrown into another world, whining about everything and not understanding anything because he clings to his idea of normalcy and refuses to adapt, only to somehow find some strength in the end and reach a partially satisfying ending. It's not really science fiction, it's just one of those "what if you would have made other choices in life" things masquerading as science fiction. I have other things to do that read about the emotional torture of a guy who is just too easily tortured. It's like stealing candy from children. I know the hero's journey starts from a state of pleasant equilibrium then something happens to upend that and the hero must fight to reach another state of equilibrium, but the initial state for this book is a boring guy living with his family and incapable of the basest reasoning skills.
So, yeah, I stopped reading it midway. Sorry, Blake Crouch!