Tuesday 30 April 2019

Knights of the Borrowed Dark (Knights of the Borrowed Dark Trilogy #1), by Dave Rudden

book cover Knights of the Borrowed Dark is a typical fantasy story filled with tropes like: "the one", "son of..." (or "noble family" or "everybody is related to everybody"), "secret war (for no good reason)", "light versus dark", "evil must be fought with swords", "no one tells you anything, even if it makes no sense", "dark king" and so on. The main character is a Mary Sue, an orphan who doesn't know his parents and has lived his entire life in an orphanage, but somehow is a balanced, well read individual who favors rationality to emotion, yet has no problem using both. Add the trope of trilogy to this and you have a complete picture.

Now, does that mean I was not entertained? Nope. It was all fun and games and I've finished the book in a day, yet I can't but be disappointed in both the formulaic nature of the story and the fact that I liked it anyway. The bottom line is that Dave Rudden writes decently and has enough skill and humor to make the same story you've read or seen a dozen times already feel pleasant. So read it, if you like that kind of thing, but don't expect anything above ordinary.

Monday 29 April 2019

Magic Is Dead, by Ian Frisch

book cover I liked the book, but not a lot. Ian Frisch is an investigative reporter who happened to enter a circle of disrupting young magicians who want to shake the industry and make it ...err.. fresh again. Really didn't intend that pun. However, if you expect revelations of how tricks are done or the deep exploration of the human soul, you won't get a lot of satisfaction from this book.

Full title Magic Is Dead: My Journey into the World's Most Secretive Society of Magicians, it feels more like a roadie story, where the young author gets sucked into a group of charismatic artists and ends up in their group. You can't use it as a barometer of the state of the magic industry, as the story is pretty one sided. The writing style isn't that great either, with some of the ideas repeated several times and none of the emotional bare stripping of the soul that I've come to love in autobiographies. There is no big drama or action of any kind - this is not Point Break or The Magician or anything. Moreover, the "secretive society" isn't all that secret, it is just a club of people hand picked for their innovative contribution to what many see as a stagnant industry and that many people know about. The title is pretty confusing as well, since it is not about magic being dead, alive or anything in between, but rather the pinhole perspective of the author while seduced by this group of very talented and interesting people.

As an introductory work in the world of magicians as a whole, it works pretty well. There is a lot of name dropping and some starter resources for wannabe magicians. It presents the mind set required to do magic in a way that satisfies not only you, but the customs of the magician community. But that's pretty much it. I can't recommend it, while I can't criticize it too much either. I would call it average.

Sunday 21 April 2019

The Priory of the Orange Tree, by Samantha Shannon

book cover The Priory of the Orange Tree is a typical fantasy story, with realms, heroes, heroines, dragons, magic and the mandatory evil one. It is a large book, that others would have made a trilogy out of; considering it is a single story, I find it most honest that the author published it directly. Samantha Shannon writes really great for a 27 year old and considering she already has under her belt a seven book deal under which she already published four (The Bone Season series), she seems to be doing good. People even hailed her as the next J.K.Rowling, which I personally would think it feels annoying rather than flattering.

So what is the book about? There are several countries with different religions that all stem from the same event: the bounding of The Nameless One, a huge evil dragon with intents to conquer the world. Some think all dragons are evil, some think dragons are cool, some think only some dragons are evil and the others are gods, and so on. There are conflicting stories about who is the hero that defeated evil a millennium ago, too. And of course, evil is stirring once again and a new generation of heroes rises to the occasion. They are mostly female, although some males are prominent in the story. Also, at least three characters are gay and one may be asexual.

About the gay thing, I found it not annoying. Although major events of the plot depend on the love towards another person of the same sex, it wasn't forced towards the reader and it didn't feel like it was glue added to the story. But it was also funny, because in the whole book romance is either gay or really short, chaste, doomed or kind of second rank. I imagine this is how a gay person reads a straight romantic story, where homosexuality exists on a conceptual level at best.

The point is that the story is not difficult at all, except at the beginning when you have to get acquainted with too many characters in too many countries all at once. Then it just flows, sometimes a little bit too smoothly, towards the predictable end. I read it all in a weekend. The main characters are complex and competent, although the minor ones are kind of one dimensional. If anything, I was disappointed with the villains. They were cartoonish, almost. I mean, the most evil of them all was called The Nameless One, like some extra that has one line in a public bathroom in a movie: "the guy in the bathroom". He didn't even have a "same thing we do every thousand years, Pinkie!" moment. Lazy as hell, all the dirty deeds were done by his henchmen... errr henchfolk? And that ending...

Bottom line: nice story to read, above average clearly, but not something to be amazed by.

Tuesday 16 April 2019

A Girl Corrupted by the Internet is the Summoned Hero?!, by Eliezer Yudkowsky

book cover I've had a blast reading Harry Potter and the Methods of Rationality, a humorous take on Harry Potter if he were educated in science and not just another emotional teen lucky enough to be "the one", so as I was reading A Girl Corrupted by the Internet is the Summoned Hero? I was really hoping it wasn't just a one off. And it wasn't! Although much shorter and not so rich with references, this novella from Eliezer Yudkowsky is just as funny as I hoped.

A self proclaimed translation of a Japanese manga that was never written, the story follows a girl that gets summoned into another realm as the virgin hero to save the world from evil. However, the reason she is still a virgin is habituation to Internet pornographic depravity and losing interest in any normal relationship. The world she arrives in is a world of prudes and the power of the magic there relies on one) being a virgin and two) asking prudish demons to do something awfully depraved so that they refuse.

I won't spoil it for you, but it's funny and short and I recommend it highly.

Nature's Nether Regions, by Menno Schilthuizen

book cover I guess when your main work concerns the sex organs of animals, you have to own a healthy sense of humor. That is why, even if I wasn't terribly interested in the subject, I continued to read the book mostly because of Menno Schilthuizen's writing style. This book - full title Nature's Nether Regions: What the Sex Lives of Bugs, Birds, and Beasts Tell Us About Evolution, Biodiversity, and Ourselves - kept being funny and captivating, despite being about a niche subject treated in a very scientific way.

But having read it, I don't regret a thing. There are a lot of interesting insights to be drawn from the book, things I wouldn't have probably thought about for myself. The focus is on sexual organs - mostly in invertebrates, but not only - an area that is both fascinating and rarely explored in a rigorous fashion. Why are they so important? Because in almost every species they are changing from generation to generation faster than anything else. Many species that basically look the same, having evolved in the same particular niche and maybe even from common ancestors, have wildly different genitalia and strategies for impregnation, an intriguing fact that leads Schilthuizen to explore the theory of sexual evolution, in other words changes determined by the choice of partners. You know, like the Pompadour hair style...

Forget human sex, or even mammalian sex. It's spiders, insects, worms and snails that will amaze you with the weird and kinky adaptations in their romantic lives: females that store the sperm of various pretenders and only use the one from the guy they liked most, spoon like penises used to scoop out the sperm of rivals before climax (humans have this, too, BTW), complicated female organs and mechanisms meant to thwart male attempts at forceful insemination and males who choose to stab their mates and short circuit the whole thing. Oh, and did you know snails are hermaphrodites? How does that work?

Bottom line: a very well written little book that may surprise you both through how entertaining and interesting it is. No, a penis is not just a syringe and a vagina not only a hole that accepts anything you put in it. In this book you will learn why, how sexual organs evolved and, indeed, continue to evolve faster than any other organ in most species.

Saturday 13 April 2019

Theming your site using CSS variables and using no Javascript

I've stumbled on an article called Create A Dark/Light Mode Switch with CSS Variables which explains how to style your site with CSS variables which you can then change for various "themes". Her solution is to use a little Javascript - and let's be honest, there is nothing wrong with that, everything is using Javascript these days, but what if we mix this idea with "the CSS checkbox hack" as explained in Creating useful interactive elements using only CSS, or "The Checkbox Hack"? Then we could have a controllable theme in our website without any Javascript.

Just in case these sites disappear, here is the gist of it:
  1. Define your colors in the root of the document with something like this:
    :root {
        --primary-color: #302AE6;
        --secondary-color: #536390;
        --font-color: #424242;
        --bg-color: #fff;
        --heading-color: #292922;
    }
  2. Define your themes based on attributes, like this:
    [data-theme="dark"] {
        --primary-color: #9A97F3;
        --secondary-color: #818cab;
        --font-color: #e1e1ff;
        --bg-color: #161625;
        --heading-color: #818cab;
    }
  3. Use the colors in your web site like this:
    body {
        background-color: var(--bg-color);
        color: var(--font-color);
    
        /*other styles*/
        .....
    }
  4. Change theme by setting the attribute data-theme to 'dark' or 'light'
Now, to use the CSS checkbox hack, you need to do the following:
  1. Wrap all your site in an element, a div or something
  2. Add a checkbox input on the same level as the wrapper and styled to be invisible
  3. Add a label with a for attribute having the value the id of the checkbox
  4. Add in the label whatever elements you want to trigger the change (button, fake checkbox, etc)
  5. Change the theme CSS to work not with [data-theme="dark"], but with #hiddenCheckbox:checked ~ #wrapper, which means "the element with id wrapper that is on the same level as the checkbox with id hiddenCheckbox"
This means that whenever you click on the label, you toggle the hidden checkbox, which in turn changes the CSS that gets applied to the entire wrapper element.

And here is a CodePen to prove it:

See the Pen
rbzPmj
by Siderite (@siderite)
on CodePen.

Friday 12 April 2019

Updating your NuGet references

Sometimes you get an annoying error after updating your .NET Framework or some of the packages or libraries in your project: "Some NuGet packages were installed using a target framework different from the current target framework and may need to be reinstalled. Visit http://docs.nuget.org/docs/workflows/reinstalling-packages for more information. Packages affected: <name-of-nuget-package>".

The problem stems from the fact that NuGet packages have variants for different .NET flavors and in your project they are "hinted" at by the <HintPath> child element in the <Reference> elements in your .csproj file. Somehow, the hint still points to a different variant than the one you need and that's why you get this error. The explanation in length can be found in this great post: Why, when and how to reinstall NuGet packages after upgrading a project, but just in case his blog disappears (as so many great ones did in the past), here is the gist of the solution:

In Visual Studio go to Tools → NuGet Package Manager → Package Manager Console and type:
Update-Package <name-of-nuget-package> -Reinstall -ProjectName <name-of-project>

To add some value to Derriey's post, you can solve all the similar issues in your solution by copying the entire list of errors from all projects by going to the Output pane, selecting them all and right clicking Copy, then run search and replace in your favorite editor with this regular expression:
^.*?Visit http://docs.nuget.org/docs/workflows/reinstalling-packages for more information.  Packages affected: ((?:[^,\s]+(?:, )?)+)\t([^\t]+)\t\t\d+\t\t$
and replacement pattern
Update-Package $1 -Reinstall -ProjectName $2

Then make sure there is only one project on each line, copy paste the result into the Package Manager Console window and the entire solution will get fixed.

Example: Error Some NuGet packages were installed using a target framework different from the current target framework and may need to be reinstalled. Visit http://docs.nuget.org/docs/workflows/reinstalling-packages for more information. Packages affected: Microsoft.Extensions.Configuration, Serilog MyProject.Common 0

Turns into: Update-Package Microsoft.Extensions.Configuration, Serilog -Reinstall -ProjectName MyProject.Common Since Update-Package only supports one package and regex replace doesn't have a syntax for multiple captures in the same group, you will have to manually turn this into:
Update-Package Microsoft.Extensions.Configuration -Reinstall -ProjectName MyProject.Common
Update-Package Serilog -Reinstall -ProjectName MyProject.Common

Copy paste the result and the two projects will be reinstalled on the affected projects in your solution.

Sunday 7 April 2019

Tiamat's Wrath (The Expanse #8), by James S.A. Corey

book cover Tiamat's Wrath comes after a roller coaster of a ride. I absolutely loved the TV show so I started reading the books, concluding that the show was better. Of course, being good, it almost got cancelled until it was picked up by Amazon (thanks, Jeff!), but I continued to read the books. The part that I loved, the realistic colonization of the Solar System, got quickly left behind in favor of Stargate-like portals to other worlds, not one but two God-like alien races and, in the seventh book, a Nazi-like occupation of the entire humanity. Like? Even the small hints that suggested space travel using (impossibly efficient) fusion drives takes months and years got left behind in favor of fast paced action. The books themselves followed the same pattern of going bad, then coming back up again and being amazing, with the only commonality being the crew of the Rocinante, smack in the middle of everything, somehow always influencing things at planetary and civilization level.

So how was the book? Predictably bad. Predictably good. Equal bite size chapters that tell a rather bland story until the end when everything comes together in a cathartic way and kind of makes up for the rest. The writing style of the two authors known as James S.A. Corey is professionally good, without anything outstanding. The characters are empathetic: a major one dies, one is reborn, a new one appears. The same roller coaster and the expected, but still annoying, desire to read the next book when I know it will take another year for it to be written.

As far as I know, the next and ninth novel will be the last of the series, which is painful, because The Expanse, for me, was the perfect blend of pulp and space science. Typical to serialized American fiction it went too far too fast (leaving its soul behind to catch up). Yet I still enjoy it. I wonder what my response would have been without the TV series. Still, if you are new to the subject, I recommend you read the first three or four books, then watch the TV series.