and has 0 comments

Full title "Factfulness: Ten Reasons We're Wrong About the World – and Why Things Are Better Than You Think, by Hans Rosling, Ola Rosling, Anna Rosling Rönnlund", this is a book that everyone should read. It's not a masterpiece, in fact it feels banal, but it's this banality that makes it so powerful. Hans Rosling is capable of showing with actual proof that your world view is really really wrong. And not only you, but also the politicians that are supposed to fix the world, the specialists that are supposed to find solutions to all of our problems, the reporters who are supposed to report on the news and the large majority of people are just as confused as you are.

And it is proof of the power of the book that someone like me, who knew who Rosling was and watched his very inspiring TED Talks, was still surprised by its content and teachings.

The book claims that the instincts that helped our ancestors survive are clouding our judgement of the much less dangerous, but more abstract modern world we live in. Rosling enumerates ten, with anecdotes that feel like scenes from TV dramas only to make you doubt who is the villain and who are the heroes. It is the main idea of book that only by working with fact based information we can make the best decisions and take the best possible action to move us forward.

This is not a book that will amaze you with its writing style, it will not make you laugh out loud, nor is it intended to make you feel good, although it probably will. It is facts about things that you felt you knew, but in fact were ignorant of. It is for example heartbreaking to read the part about immigrants in Europe dying and being taken advantage of because of really dumb European laws, not because of their destination countries regimes or from poverty. It is uplifting to know how much the world has changed for the better in just a few decades and all over the place. As a Romanian, I've always assumed that the rest of the world was rich and plentiful outside the Iron Curtain and that the recent improvements in life style were caused mostly by the fall of Communism in the area. I had no idea how similar life was for so many around the time I was born and that life has improved dramatically all over, not just here. It is empowering to know that women make more or less children in consistent correlation to their income and not their culture, religion or regime. When people don't need to have children, they don't make them, regardless of what Mao, the Pope or anyone else says.

Bottom line: you have to read this just as much as you have to get a general education. It simply should be taught in schools.

I had this annoying warning that appeared whenever I would build my Wix setup project. I know, Wix sucks, but what can you do? The warning was warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "SomeProject\Some.dll", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

What is worse, the warning would come in the VS Errors window with no warning code, so I couldn't even supress it. And yes, the text above does show a warning code, but it just wouldn't be intrepreted by Visual Studio.

In order to fix it, apparently I had to set ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch to None, as according to this StackOverflow answer. But where should I add this wonderful property? It didn't work in the .wixproj file, it wouldn't make a difference in the projects mentioned in the warning.

In the end, I decided to customize my build! Final solution:

  • add a file called Directory.Build.props to your solution folder
  • paste in it
<Project>
 <PropertyGroup>
   <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
 </PropertyGroup>
</Project>

and has 0 comments

I will show you some code, like in an interview question. Try to figure out what happened, then read on. The question is: what does the following code write to the console:

class Program
{
    static void Main(string[] args)
    {
        var c = new MyClass();
        c.DoWork();
        Console.ReadKey();
    }
}
 
class BaseClass
{
    public BaseClass()
    {
        DoWork();
    }
 
    public virtual void DoWork()
    {
        Console.WriteLine("Doing work in the base class");
    }
}
 
class MyClass:BaseClass
{
    private readonly string _myString = "I've set the string directly in the field";
 
    public MyClass()
    {
        _myString = "I've set the string in the constructor of MyClass";
    }
 
    public override void DoWork()
    {
        Console.WriteLine($"I am doing work in MyClass with my string: {_myString}");
    }
}

Click to expand

and has 0 comments

Permanent Record is a very well written book. Ed Snowden has the rare capacity of deep introspection and when he explains what happened and why, he makes connections to his upbringing, events in his life and the world and has a very clear view of his internal processes when making any decision or taking action. He also has a way with words. He's a guy easy to either hate or love, obviously, depending on how prone to envy one is.

There are several important takes from this book.

One is how extraordinary Snowden's position was to make him able to do what he did. Not only is he this brilliant guy who lives in his head and plans everything in advance, not only did he have specialized training on how to do what he did and get away with it, but he was given free access to the underlying technology of the CIA and the NSA. As he himself admits, he was on a list that probably contained under a dozen people, and that only from incompetence and lack of oversight.

Another is that every large organization is the same. Be it the NSA, the state run companies or private corporations in any country, they all impose hiring limits that they break by using contractors that don't affect the count (or their declared principles). It's amazing how similar my own experiences were, but in (supposedly) very different contexts. The contractor system is a global disease that too few benefit from and too many are affected by.

A more salient point is that technology is what happens when there is something we can do. We will ultimately do it, just because we can. As much sympathy I have for Snowden, his actions will probably have short lived consequences. The machine to get all the data from everybody is already there. No one will put that genie back into the bottle. If anything this book helps the very people who the author hopes to thwart by giving them valuable intelligence in the mindset of the whistleblower and on the limitations and vulnerabilities of their technical, administrative and indoctrination systems. As I was saying before, the chances that Snowden happened were astronomically small. Now they are orders of magnitude smaller.

It was devastatingly depressing to read how few places in the world are even marginally free of the American hegemony. Ironically, he had to go to Hong Kong to maximize his chances of remaining free. That says something terrible about the state of the world. I felt like the most hard hitting bits were those that explained what the government would do to discredit him (or anybody in their way), using deeply personal histories, fabricating evidence if none found or amplifying the one that does exist. This makes Snowden even more outstanding, for being a guy with very little dirt in his life to be turned into a weapon.

On a more personal note, it's amazing that reading Permanent Record, I was reminded most of Gary Sinise's autobiography than anything else. Thinking of what Snowden did, a family tradition of serving the country military and strong patriotic spirit is not what would first come to mind, yet that applies to him and he did what he did because he strongly believed in his country and in service to it. Even now, hunted by the US government in the most blunt, unimaginative, bureaucratic and cruel way possible, like big bullies do, Ed Snowden still loves his country and believes in it.

At a glance, Permanent Record is a book on hacking. As a child, Ed starts understanding how the world works and manipulates it to his advantage, only to grow up working in an organization that has hacked the Constitution and society as a whole in order to manipulate it to their advantage. People of our generation grew up with at least the illusion of a fair society, people who would take you at your value and judge you on it, whatever the outcome. The new hacked society cannot see you as you are, to the point that makes you doubt yourself of who you are. There cannot be a fair process of evaluation anymore because everyone comes out distorted.

This is a must read book and I recommend it highly to all adult readers of any level or education. It's easy to read, captivating and relatively small. Fair warning: it's not a happy story.

and has 0 comments

Let's say you have a Type and you want to find it by the simple name, not the entire namespace. So for string, for example, you want to use Boolean, not System.Boolean. And if you try in your code typeof(bool).Name you get "Boolean" and for typeof(bool).FullName you get "System.Boolean".

However, for generic types, that is not the case. Try typeof(int?). For FullName you get "System.Nullable`1[[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]", but for Name you get "Nullable`1".

So the "name" of the type is just that, the name. In case of generics, the name of the type is the same as the name of its generic definition. I find this a bit disingenuous, because in the name you get encoded the fact that is a generic type or not and how many generic type attributes it has, but you don't get the attributes themselves.

I admit that if I had to make a choice, I couldn't have come up with one to satisfy all demands, either. Just a heads up that Type.Name should probably not be used anywhere.

and has 1 comment

Welcome to my new blog!

Please let me know what you think.

and has 0 comments

I've had some issues with Blogger and that pushed me towards the step that I have been too lazy to make for so long a time: my own domain and hosting. So, from today on, my personal blog is at https://siderite.dev. I am working on it, still, so forgive the occasional hiccups.

Let me know if anything is wrong or, even better, that everything is right!

Siderite

and has 0 comments
I haven't been as frustrated with a book as with Lightless for a long time. Everyone in it is incompetent to the level of cretinism. The only people remotely good at what they do are psychos, all of them.

I understand why books like these need to be written: when you write a character based play-like story you become a better writer, but it doesn't mean what you write is any good. In this case, a character based story has cardboard shapes moving around randomly instead of characters. It failed. The main character is a computer programmer. As one, I felt insulted that C.A. Higgins believes we are that moronic.

As for the plot, that's the most redeeming factor, but it's not great either. In a future where mobile devices don't exist and locks are still based on physical keys and the Solar System is under the iron boot control of ... err... The System, an organization straight out of Blake's 7, with the same cartoonish efficiency, a mysterious ship is boarded by two people who turn out to be criminals the System wants. 90% of the book is people being dumb and talking to each other, all while assuming they are the bread of the universe. The rest is people doing really dumb things.

Conclusion: all the "smart" bits of the book were obvious from the start, making the journey of the buffoons in the story to figure them out really boring. The idea of the Ananke was added only to make this, of course, a trilogy. It reads like a theater play with people being stuck in a room.

FizzBuzz is a programming task that is often used for job interviews, because it shows the thinking of the candidate in an isolated and concrete case. The requirements may vary slightly, but is goes like this: A loop is going through numbers from 1 to 100. The candidate must write the code in the loop that will display, for each number, a string. This string is: "Fizz" for numbers divisible by 3, "Buzz" divisible by 5 and "FizzBuzz" for numbers that are both divisible by 3 and 5. For all other numbers, just display that number.

There have been many implementations of this, for example my own in JavaScript from a while ago and FizzBuzz Enterprise Edition, which is always a good read about how not to complicate your code. However, since I've last written about it, JavaScript has changed, so I felt compelled to write an updated version. And here it is:
(d=n=>('0369'.includes((f=n=>n>9&&f([...''+n].reduce((s,v)=>+v+s,0))||n)&&f(n))&&'Fizz'||'')+(/[05]$/.test(n)&&'Buzz'||'')||n)*(i=n=>n>100||console.log(n+': '+d(n))+i(n+1))*i(1)

Among the abominations there, some of them inspired by C++ because why not, there are some of the new JavaScript constructs, like arrow functions and the spread operator. I know it seems pointless, but it's not: try to understand what the code does. If you want to see it in action, open Dev Tools in any browser and copy paste it in the console.

A funny feature that I've encountered recently. It's not something most people would find useful, but it helps tremendously with tracing and debugging what is going on. It's easy, just add .TagWith(someString) to your LINQ query and it will generate comments in SQL. More details here: Query tags.

and has 0 comments

One of the best things you could do in software is unit testing. There are tons of articles, including mine, explaining why people should take the time to write code in a way that makes it easily split into independent parts that then can automatically tested. The part that is painful comes afterwards, when you've written your software, put it in production and you are furiously working for the second iteration. Traditionally, unit tests are great for refactorings, but when you are changing the existing code, you need not only to "fix" the tests, but also cover the new scenarios, allow for changes and expansions of existing ones.

Long story short, you will not be able to be confident your test suite covers the code as it changes until you can compute something called Code Coverage, or the amount of your code that is traversed during unit tests. Mind you, this is not a measure of how much of your functionality is covered, only the lines of code. In Visual Studio, they did a dirty deed and restricted the functionality to the Enterprise edition. But I am here to tell you that in .NET Core (and possibly for Framework, too, but I haven't tested it) it's very easy to have all the functionality and more even for the free version of Visual Studio.

These are the steps you have to take:

  • Add coverlet.msbuild NuGet to your unit tests project
  • Add ReportGenerator NuGet to your unit tests project
  • Write a batch file that looks like

    @ECHO OFF
    REM You need to add references to the nuget packages ReportGenerator and coverlet.msbuild
    IF NOT EXIST "..\..\packages\reportgenerator" (
      ECHO You need to install the ReportGenerator by Daniel Palme nuget
      EXIT 1
    )
    IF NOT EXIST "..\..\packages\coverlet.msbuild" (
      ECHO You need to install the coverlet.msbuild by tonerdo nuget
      EXIT 1
    )
    IF EXIST "bin/CoverageReport" RMDIR /Q /S "bin/CoverageReport"
    IF EXIST "bin/coverage.opencover.xml" DEL /F "bin/coverage.opencover.xml"
    dotnet test "Primus.Core.UnitTests.csproj"  --collect:"code coverage" /p:CollectCoverage=true /p:CoverletOutputFormat=\"opencover\" /p:CoverletOutput=\"bin/coverage\"
    for /f "tokens=*" %%a in ('dir ..\..\packages\reportgenerator /b /od') do set newest=%%a
    "..\..\packages\reportgenerator\%newest%\tools\netcoreapp3.0\ReportGenerator.exe" "-reports:bin\coverage.opencover.xml" "-targetdir:bin/CoverageReport" "-assemblyfilters:-*.DAL*" "-filefilters:-*ServiceCollectionExtensions.cs"
    start "Primus Plumbing Code Coverage Report" "bin/CoverageReport/index.htm"​


    and save it in your unit test project folder
  • Optional: follow this answer on StackOverflow to be able to see the coverage directly in Visual Studio


Notes about the batch file:

  • newest is the current version of ReportGenerator, if that doesn't work, change it with whatever version you have (ex: 4.3.0)
  • the DAL filter tells the report to ignore projects with DAL in their name. You shouldn't have to unit test your data access layer.
  • the ServiceCollectionExtensions.cs filter is for files that should be ignored, like extension methods rarely need to be unit tested


Running the batch should start dotnet test and save the result in both coverage.opencover.xml and also some files in the TestResults folder. Then ReportGenerator will generate an html file with the coverage report that will get open at the end. However, if you followed the optional answer, now you are able to open the files in TestResults and see what parts of your code are covered when opened in the Visual Studio editor! I found this less useful than the HTML report, but some of my colleagues liked the option.

I hope this helps you.

and has 0 comments
If you want a book about women feeling stuff and constantly interrupting each other whenever they are about to communicate anything relevant while acting like space pirates in a desolate corporate universe, but doing nothing particularly consequential, Ascension is the book for you.

It is the distant future: space is called The Big Quiet, the universe has turned into a cosmic version of bankrupt Detroit because of the infusion of magic tech coming from a different universe (well, it's baryonic matter infused with human will, but yeah... magic) and all major characters are women and most of them are lesbian. About what you would expect from Jacqueline "(J)" Koyanagi, who describes herself via marketing as "writes science fiction and fantasy featuring women of color who love other women, disabled characters, neuroatypical characters, and diverse relationship styles.".

The main character is a female engineer (ugh, space surgeon) that falls in love with a peg leg female captain of a starship (that she also falls in love with) while being pursued by the authorities for something they didn't do. The physical attraction between the two girls is so strong that events like death of her family or genocide are just pushed in the background.

I guess we need books like these to realize how someone might act annoyed with books that only contain straight male characters, but other than that this is just low quality space pulp. And this trend is taken to a point so extreme that in the whole book there are only three males: a man who is part wolf, full of muscle, brooding silence and the occasional snarl, a security guard who is incapacitated before acting and the husband in a random family who's first act is to isolate and attack the protagonist before also being quickly disabled. I pity women who see males like this.

Bottom line: I read it all just to see if behind all the agenda bullshit there was anything interesting related to story or characterization or world building. But no.

and has 0 comments
The autobiography of an artistic daughter of a beer tycoon, Beer Money has almost nothing to do with beer, but everything to do with how we can't really choose your family and how toxic interacting with them can be. I liked the writing and sad as it is, the book was not meant to be dramatic, only truthful.

It was a difficult book to finish, even as it was very personal, as I like biographies to be. Mostly because it is just biographical, with nothing in the lives of the characters that has any meaning. The only lesson one can learn from the book is that once you realize your family is crap, you should stay away, no matter how difficult it would be. A very valuable lesson, I agree, but singular.

Frances Stroh is part of the old German family that introduced fire brewed beer to the US on a large scale. Their Detroit empire imploded from bad management by family members, the collapse of the car industry and so on. And while that was going on, she had to contend with a passive mother, a father with an inflated ego who couldn't care less about the people around him unless in rare moments that seemed like a heavenly gift to respect and love deprived children, siblings who went into drugs and alcohol to avoid the pain and last but not least the lukewarm reaction of the world to her own artistic ambitions.

The author seems to have accepted her fate and the strained love/disappointment relationship with the most important people in her life. I liked it and I thought Frances Stroh has a gift for melancholic writing, but I can't really recommend it to most people.

and has 0 comments
Just has a revelation. There are studies that show the moment you introduce currency in a social transaction, the dynamics change dramatically, leading to conflict, selfishness and the dissolution of societal and even emotional bonds. For a random reference check this article: Why Good Deeds and Money Don’t Mix.

I've been struggling with this new political correctness movement because 1) I didn't get it 2) almost every one of the people actively acting offended in this context appears to be... not nice and 3) it doesn't seem to be helping any. So, am I the bad guy? I started to ask myself. Am I a racist homophobic sexist misogynistic normie white male working in the tech field or is there something else going on? Judging by how far from normie people who actually know me think I am, I started to think about it more.

And it came to me! Political correctness is a form of currency forcefully introduced into our social transactions. Not only is it causing trouble for people who are assholes, but also for normal people who suddenly feel they have to pay something. And, as currency does, it breaks society, not strengthens it.

That is why so many people caught in this are so violent and partisan about it. That is why when you are nice towards a - I don't even know how to call them these days - not white person it feels good, as it would being nice towards anybody else, but when you are forced to do it, it well... feels forced. It feels like duty, like work, like paying a tax. The concept of balance slowly creeps in and makes one push back. Maybe with a joke, maybe with an angry tweet, maybe with something worse like actually picking on someone for their skin color, sex, age, religion or anything else. And they do it because picking on someone for being... I don't know... Romanian, doesn't feel like restoring anything. And now Romanians are pretty angry, because offending Jewish people or of recent African descent is somehow "wronger", so they get offended and feel left out. It's wrong to pick on anyone either way, deal with it!

In the end, introducing currency just pushes people into two diametrical opposed groups: the payers and the people who are owed. And of course, the people who ride the wave and get their little percentage to convert it to any other currency: money, hate, power, etc. We become slaves to the middlemen even when we interact with other people! Hell, they want to introduce ethics for computers now. Where does it end?!

So, as I am an egalitarian in my misanthropy, I submit that you should get offended by people just like any other person would. Leave currency to bankers. Or pick on them! No one ever got into a twist for calling bankers names.

and has 0 comments
I started reading The Troop after reading some amazing reviews on how creepy and scary it is, how well it is written and so on. I agree this is a good book, but not without its faults. It felt like a rollercoaster, because at first I thought it's going to be a monster body horror, which I like, then it turned out it could be a contagion story, which I love, maybe even a world wide epidemic, which I always hope for, but yet it wasn't. I thought it resembled a cross between King's Dreamcatcher and Golding's Lord of the Flies.

The best part is Nick Cutter's writing. He is careful with his characters, goes deep into defining their motivations, their inner thoughts. I loved that he would have filtered their previous experiences through a horror lens, so even their histories are aligned to the mood of the book. I know it's a common writer tool and he's a bit obvious about it, but I personally enjoyed it. Then there is the story, which happens on an isolated island and involves children being horribly killed by a relentless organism. I'm a sucker for those. Overall, the book was great. It felt like a Stephen King novel and the author paid homage to the writer in the acknowledgements section.

However, there were some elements that annoyed the hell out of me. One of them was the use of interviews and official reports and news stories about what was going to happen. It spoiled so much of the plot! Then there was the character dynamic. Such wonderfully crafted people seemed to not do anything of what they were supposed to do and the idea is that in terrible circumstances, our mettle is truly tested and the real person surfaces, but in many cases what the characters did made no sense. Even if well written, the basic archetypes were kind of obvious, too. And finally the technical aspects of the plot looked good on paper, but do not stand up to scrutiny.

Some notes: the horror of Lord of the Flies comes from showing how horrible ordinary people, children, can be. They are not psychos, they are people. Cutter overused psychopaths in The Troop. The tension in King's novels is growing and growing and is almost never released until the very end. Cutter spoiled what was going to happen and even if he described horrible things, he kind of did it in a constant way that got tiresome after a while. Worst of all, these flaws in the book made it predictable.

Bottom line: the book proves great writing talent and knowledge of people's character, however the author feels too nice to push the boundaries to do something truly brilliant. Well, he is Canadian...