Thursday, April 19, 2018

Palimpsest, by Charles Stross

I liked the French book cover more This is how I love my sci-fi: short and to the point. We still get the Charlie Stross signature nice techie guy who falls for girls in sci-fi settings, but since this is a novella, Palimpsest focuses almost entirely on the catch, the "what if" kernel of the story. And that is another exploration of what time travel would lead to, in this case an out of time organization called the Stasis that exists solely to protect Earth from inevitable extinction by reseeding it with humanity whenever it happens, thus creating a sort of stagnating but stable civilizational time flow that last for trillions of years until the heat death of the universe.

But I liked the little details a lot. As the title suggests, once you can time travel, the timelines can be infinitely rewritten, leading to all kinds of (maybe literally all) possibilities. In order to join Stasis you first need to kill your grandfather and in order to graduate you need to kill yourself in another timeline! Mad and fun ideas are in abundance in the book and I particularly enjoyed that it presented them one after another and then the story ended. No need to take it further to some sort of personal conclusion for the main character. It is pure fantasy and then it ends. Love that!

Monday, April 16, 2018

Singularity Sky (Eschaton #1), by Charles Stross

book cover Charles Stross has a penchant for thinking big and then bringing that to the level of the average reader by the aid of pulp. That is why he is often discussing philosophical questions like what the world will be after millennia and what the consequences of time travel are or what if the Old Gods and magic were actually real in the context of a particularly handy tech guy who falls very easily in love and then spends the rest of the book saving the world and serving the one he loves. He is also an optimist who thinks people with all the information and power they could have will ultimately do the right thing with it.

While I love his positivism and the grandiose hard sci-fi approach, the pulp thing is a bit of a hit and miss with me. In the case of Singularity Sky, I think the pulp messed up something that could have been a very powerful metaphor of the state of humanity in the present day (and in any past day, too). But that doesn't mean the book is not good - I enjoyed reading it - but it doesn't even come close to another "singularity" book: Accelerando. I understand it's not fair to hold every single thing Stross wrote in the balance with what is probably his best work, but that's what I am doing, because I loved that one and I was meh about this one.

The story presents a subset of human starfaring civilization which chose to live in a similar way to the old Russia tzarist regime. Communication, technology and free speech and thought are strongly regulated and kept to the level of the 18th century in most cases. So what happens when one day phones drop from the sky that open two way communication with entities that could fulfill every desire you never knew you had? It is a very interesting metaphor to the way humans have lived throughout their history and how it is their choice and their addiction to monkey power games that keeps them in the dark ages. Also touches (very little) on why people would choose to live that way and how other might respect or disregard their right for that choice.

However, the main story is terminally fragmented by less interesting substories. Two spies, one in the service of the UN and the other helping the mysterious Herman, just have to fall for one another and waste precious pages. Feudal and imperial authorities have to spend pointless time to prepare a full military defense of their colony without even understanding who they were going to fight. Critics, a non-human-anymore species that starts the book as "criticizing" and the rest of it appears randomly and doing nothing interesting, except never getting the talking part right and sounding like Yoda. The list continues.

Bottom line: a fun read, but nothing more. A wasted opportunity for something a lot bigger. The author explains on his blog how the book came to be and why he won't continue the Eschaton series, which is probably for the best anyway.

Wednesday, April 04, 2018

Javascript ES6 way to update object properties: Object.assign

How many times did you find some code that looked like this:
// previous code
let someValue1 = 'something';
let someValue2 = 'something else';
let someValue3 = 'something blue';
let someValue4 = 'something entirely different and original';
 
// our code
const parentObject=new ParentObject();
parentObject.childObject.someValue1=someValue1;
parentObject.childObject.someValue2=someValue2;
parentObject.childObject.someValue3=someValue3;
parentObject.childObject.someValue4=someValue4;
and you really wanted to make it look nicer? Well now you can! Introducing the ECMAScript 6 Object.assign method.

And thanks to some other features of ES6, we can write the same code like this:
// our code
const parentObject=new ParentObject();
Object.assign(parentObject.childObject,{someValue1, someValue2, someValue3, someValue4});

Note that { someVariable } is equivalent to the ES5 { someVariable: someVariable } notation.

Tuesday, April 03, 2018

Aurora, by Kim Stanley Robinson

book cover Funny how these things turn out. After finishing Proxima, by Stephen Baxter, which was also about humans colonizing the planet of a nearby star, but in the end was very little about the planet itself, I've stumbled upon Aurora, by Kim Stanley Robinson, which does pretty much the same. I don't want to spoil things, but really, just a small percentage of the book is even related to the planet they briefly called Aurora.

Let's get one thing out of the way, though. Aurora is way better than Proxima ever intended to be. It is philosophical and filled with information and science and raises questions that are essential to space colonization. That's the great part. The bad part is that it feels like an old man book. It is introverted, focused on people, their feelings, their shortcomings and ultimately advises we care more about our planet, the one we are perfectly adapted to live on, rather than imagine we can always find a replacement in deep space. That was a disappointment, not only because I am in Tsiolkovsky's camp, who famously said Earth is our cradle and we can't stay in the cradle forever, but also because the future, as seen by Robinson, is stagnant, with no evolution, no desire, no dreams other than those he considers foolish and even criminal. Stay in the cradle till we finally die, enjoying the golden age of our senescence. Bah!

Other than that I really appreciated the attention to details, taken from all kinds of disciplines, that the author put in the book. Stuff like the difference of evolution rate between complex organisms like people and the microbiomes inside them, or mineral balances, the effect of Coriolis forces on the well being of people and machinery, and so on and so on. It was ironic that the person everybody in the book revered was Devi, an brilliant engineer who always thought outside the box and solved problems. When she couldn't do that, everybody else just gave up. There is also a moment in the story when the colonists split into two groups. I found it almost insulting that the book only described the adventures of one of them and completely forgot about the other.

Bottom line: I liked most of the book, if not its ending moral. The style is a bit difficult, almost autistic, as half of the story is from the standpoint of the ship's AI and the other from the perspective of the protagonist who is unusually tall (for no reason that has any impact on the story) and a little slow in the head. I understand why some people actually hated it, but as we can learn from every viewpoint, and often more from one that is different from ours, this book has a lot to teach.

Here is an interview with the author, but be careful, only the left audio channel has voice, the other is an annoying music.

Saturday, March 31, 2018

Devilman Crybaby - masterpiece or masturbation?

the Japanese Netflix poster I've watched several lackluster recent Japanese animes from Netflix and I was feeling bored and disappointed with the clichés spouted by almost every character, most of them as cardboard as they can be. So when I started with Devilman Crybaby, a very original show both from the standpoint of the manga it adapts and the animation style, I was hoping for not being bored. And I wasn't. The show is fast, jumping from scene to scene and asking the viewer to extrapolate what happened in between. The characters are complex and seldom critical of one aspect or another of society, or representing such negative treats. Violence and sex are everywhere, although they are often depicted as kinds of vices and impulses that people have to fight against. The animation style is weirdly psychedelic. So did I like it? Not really.

Even from the beginning I was off put by the animation style. It's paradoxically both artistic and very simple. It made me think of Aeon Flux (the MTV animated series), which had several other things in common with this, as well. But I didn't let it bother me and I continued watching. As I said before, the characters are complex and the story is meandering around the peculiarities of each of them, which made it interesting. However, the plot was full of holes! Things that were "revealed" later on were evident from the beginning, people acted in weird ways that were eroding the suspension of disbelief. There were fights, but simplistic in nature and more inline with the symbolism that the author was so hard on. There were substories, but kept to a bare minimum. Do you see a pattern already?

Yes, in its entirety, things that were not important to the philosophical message that the anime wanted to make were abstracted, simplified or removed altogether. It is hard to enjoy any of it after you've got the memo. Even worse, perhaps because of its heavy (handed) symbolism, all the articles and reviews online praise it as a masterpiece. I said it before and I will say it again: just because it is not the usual crap it doesn't mean it's good. There are so many sorts of crap. You read two or three of them, discussing "what they meant", and you realize they are as full of shit as the makers of the anime. If you need to explain what you meant, the joke wasn't very good!

To be less of a dick about it, the show has many redeeming qualities, that is why I can't discuss too much the particulars without spoiling it, and you might want to watch it. However, to me, those qualities were wasted in the pseudo spiritual and moral bullshit that suffused the show. One alleviating circumstance is the source material, written in the 70s, which I have not read, so I can't really compare, but it was the 70s. Weird and wonderful stuff came from back then. This is mostly just weird. And I really hated the title.

Here is the trailer:

Thursday, March 29, 2018

.NET Standard gotcha: unit tests don't need to be Standard

You created a library in .NET Core and you want it to be usable for .NET Framework or Xamarin as well, so you want to turn it into a .NET Standard library. You learn that it is simple: a matter of changing the TargetFramework in the .csproj file, so you do this for all projects in the solution.

But .NET Standard is only designed for libraries, so it makes no sense to change the TargetFramework for other types of projects, including some that are in fact libraries, but are not used as such, like unit test projects.

For example if you attempt to run XUnit tests in Visual Studio you will see that the tests are discovered by Test Explorer, but when you try to run them it says "No test is available in [your project]. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.". While this is an issue with XUnit, more likely, it is also a non-issue, since your test project should use the .NET Standard libraries, not be one itself.

Wednesday, March 28, 2018

ECMAScript/Typescript gotcha: Map has to be used with set/get not like a Dictionary in .NET

In ECMAScript 6 there is a Map class that looks and feels like a .NET Dictionary. As an extension of JavaScript, TypeScript code like this is totally valid:
let map:Map<number,string> = new Map<number,string>();
map[1]="Category One";
let name:string = map[1]; //name is now "Category One"

However, the code above is wrong. What this does is create a string property named "1" on the map object with a value "Category One". Its "size" is 0. The correct code would be like this:
let map:Map<number,string> = new Map<number,string>();
map.set(1,"Category One");
let name:string = map.get(1); //name is now "Category One", map.size is 1

Similar code for ECMAScript 6, you can just declare the map as let map = new Map();

Just in case you wonder why utilize this hard to use type instead of a normal object, it's a user choice. Most of the pros involve the type of the key (object keys can only be strings or symbols) and ease of counting and iterating, but these issues can be solved trivially in code, if ever needed.