Friday, November 17, 2017

Madness, madness everywhere

It seems to me that there are more and more crazy people around me. They are relatives, friends, colleagues, random people on the street and I have no idea where they came from. I don't remember as much insanity from when I was a boy, but then again I was even more oblivious then than I am now, and that's saying something. Yet, since then the population of the planet grew from 4.5 billion to 7 billion and, more importantly to me, the population of my home city of Bucharest grew from about 1.5 million to a city where just as many people come from outside the capital to find opportunities. But the percentage of mentally afflicted seems to have more than doubled. But what is crazy?

I mean, I just saw an old lady, looking like she was chronically homeless, shouting obscenities to no one in particular. Who else was she to talk to except herself? She can't even trust another human being enough to talk to them, even if the thought came to her mind. And if she has an audience of one, just as sane as she is, who is to say she's talking crazy? Or when you see some company executive make stupid after stupid decision, then boldly coming on stage and presenting it as the best idea since fire was invented. Do they know they are sociopaths? Does anybody else know? Do they even care? There is a quote in the Mindhunter TV series: "How does a sociopath become the president of the United States?", asks the young FBI agent. "How does one become president if they are not?", responds the psychology professor. And I am reading this book, that I am going to review in a few days, about the counterculture in America, during the 60's. If those people would appear in front of me right now, foraging through mall trash and explaining cosmic truths while loaded with speed and LSD, I would probably catalog them as insane.

Maybe insanity is not a state, but a perception. It's just a socially unacceptable behavior. It does hurt the person using it, but that's mostly because they can't fit (or maybe they fit too well). Have I become more sensitive because of the carefully constructed shell that protects me from hardship? Anything going through it hurts like hell because I am not used for stuff to come through. I have thin skin covered by layers of callousness. Maybe society is more exclusive now? It is easier to become crazy, as you only have to fall a little bit before you get into an unstoppable spiraling decline. Certainly you can't experiment now with personal freedom; it's almost gone, taken away bit by bit, not (only) by repressive governments, but by our willingness to waste time and resources until there are none left. Open relationships? Life on the road? Chemically expanding your mind? Forget about it! You get homeopathy and holotropic breathwork and feel enlightened.

There is another hypothesis worth exploring. Maybe people are not crazy at all. Perhaps I am the mad one. At every stage I expect the full weight of social scorn to come over me and crush me like the bug I am. How dare I? I wouldn't even know what I was guilty of - which, paradoxically, would prove I am even more guilty. They would come at me with carefully crafted smiles and expressions taken from shows or movies they have all seen and burn me alive, giggling all the way, like they are making the greatest joke in the world while providing me with the help they know I desperately need. All these people that apparently speak only to themselves, yet somehow communicate with others by methods unseen, they would suddenly all turn towards me, pointing their fingers and letting out inarticulate cries. Then, of course, I would know that I am insane, because I would never be able to do any of that.

I just don't know. Where does this vomitous mountain of madness come from? Maybe more importantly, where is it going?

Tuesday, November 14, 2017

Star Trek Continues ... ends

Star Trek Continues, a fan production which started in 2013, ended with the eleventh episodes. As so many others, they are ending a perilous enterprise (pardon the pun) through CBS legal issues and moving to other, non Star Trek related, productions. And it's too bad, because you can see that this series had quality rivaling official Star Trek franchises. I have embedded the playlist with all the episodes. Enjoy!



Here is what Vic himself had to say about the ending of the production:

Friday, November 03, 2017

Drown, by Junot Díaz

book cover Drown is a tiny collection of 10 stories about Dominican people, written from the viewpoint of an adult talking about their childhood. Up until the end of the book I was convinced I was reading the story of the same family, written in some weird ass way, and I am sure the stories were changed a little to reflect a similar point of reference; however in truth the 10 stories have little in common other than the fact that they are about Dominicans and that I liked each and every one of them.

It is so interesting to see a good writer pour out his heart on paper. I felt like a greedy vampire, drinking on the lifeblood of the writer. Junot Diaz is, of course, Dominican and the stories are partially autobiographical. I find fascinating how sure of themselves and focused are underprivileged people, as compared to my own experience of ever doubting myself and never feel like I am good enough. In a perverse way, the stories show how liberating it is to know and to be constantly reminded that you are not good enough. You handle rejection well, you always try, because any success, not matter how small, is a victory. No character in this book is ever happy, but they are rarely unhappy. Discontent? maybe. Rebellious and angry against the shit cards they have been dealt? sure. Not giving a shit about anyone but themselves? unfortunately so. But at every step we are reminded of the struggle of the characters to get anywhere in life.

Bottom line: to me it was a refreshing subject, with great writing style. I don't think I will actively pursue any other work from the author, but as a first contact, it was nice, short and to the point.

Monday, October 30, 2017

Black Milk: On Writing, Motherhood, and the Harem Within, by Elif Shafak

I've vaguely heard about Elif Shafak before, but she only came to my attention when she did a TED talk that I really liked. I mean, it was a little on the feminist side, but the speaker was both articulate and correct - not to mention cute, so I wondered what she wrote about. So I started with Black Milk. And it was as much feminist as they get, discussing women writers in the context of the author's own challenges as a woman and a mother affected by postpartum depression. Therefore, if you don't like these kinds of books, don't read it.

Personally I liked the writing a lot. I didn't really feel interested in the subject so much, but that's also a plus for the book: if you can make people like reading about something they don't care about, then you are doing it right. I find different viewpoints on life interesting, as well, so all in all I enjoyed reading the stories. Yet, the feminism bit threw me off a little. Shafak identifies a lot not only with being a woman, but being a feminist middle East female writer, and she doesn't let anyone forget it. It is difficult to feel connected with the author when she's constantly reminding you of the differences between you. Even the thumbelinas in the book (thumb sized representations of the facets of her personality) are all female. It is true that you hear a lot more about the feminine side of guys rather than the masculine side of women, but still.

What I thought was a little bit misleading was the description of the book as a memoir. In fact, there is little of the author's actual experiences in the book. Instead, there are short anecdotes of her life, strongly dramatized and fantasized, followed by longer analogies with other female writers and their own stories. The book does present a very personal viewpoint on all it describes, but it reveals the author just through comparison rather than through confession. It does not feel intimate, it feels pretentious, an intellectual treatise on things Shafak claims very personal and emotional.

Bottom line: while I liked it, as something very different from what I read and a well written book by a very imaginative author, I think it would have benefited more from a more personal and less argumentative touch.

Wednesday, October 18, 2017

Monday, October 16, 2017

The False Admiral (Evagardian #1), by Sean Danker

Book cover Imagine a space pulp "escape from a room" story and you get The False Admiral (also known as simply Admiral). Sean Danker writes a short and fast paced story about three Evagardian space navy members that find themselves on a derelict ship on an unknown alien planet. From start to end the hero of the story, helped by the other younger three, must solve problem after problem in order to keep them alive. It's a short, fun and simple book.

At first I was convinced that this was not the beginning of the story. The main character mentions previous events that are not described in the book and he makes efforts to hide his real identity from the others, to the point where they have to choose between trusting him or arresting him as an enemy spy. But no, that part of the story is not written yet. A second book in the Admiral series has been released, called simply Free Space, but I will probably not read it. And this is not because I did not enjoy Admiral, but because I have other stories I would rather read.

Bottom line: when you need a quick disconnecting read, try this book. It's dubious sci-fi and it is rather more similar to detective noir than space opera or military stories, but it is fun.

Friday, October 13, 2017

Memory alignment in C++ and C# and probably in every other language that can integrate with C++

I've learned something new today. It all starts with an innocuous question: Given the following struct, tell me what is its size:
public struct MyStruct
    {
        public int i1;
        public char c1;
        public long l1;
        public char c2;
        public short s1;
        public char c3;
    }
Let's assume that this is in 32bit C++ or C#.

The first answer is 4+1+8+1+2+1 = 17. Nope! It's 24.

Well, it is called memory alignment and it has to do with the way CPUs work. They have memory registers of fixed size, various caches with different sizes and speeds, etc. Basically, when you ask for a 4 byte int, it needs to be "aligned" so that you get 4 bytes from the correct position into a single register. Otherwise the CPU needs to take two registers (let's say 1 byte in one and 3 bytes in another) then mask and shift both and add them into another register. That is unbelievably expensive at that level.

So, why 24? i1 is an int, it needs to be aligned on positions that are multiple of 4 bytes. 0 qualifies, so it takes 4 bytes. Then there is a char. Chars are one byte, can be put anywhere, so the size becomes 5 bytes. However, a long is 8 bytes, so it needs to be on a position that is a multiple of 8. That is why we add 3 bytes as padding, then we add the long in. Now the size is 16. One more char → 17. Shorts are 2 bytes, so we add one more padding byte to get to 18, then the short is added. The size is 20. And in the end you get the last char in, getting to 21. But now, the struct needs to be aligned with itself, meaning with the largest primitive used inside it, in our case the long with 8 bytes. That is why we add 3 more bytes so that the struct has a size that is a multiple of 8.

Can we do something about it? What if I want to spend speed on memory or disk space? We can use directives such as StructLayout. It receives a LayoutKind - which defaults to Sequential, but can also be Auto or Explicit - and a numeric Pack parameter. Auto rearranges the order of the members of the class, so it takes the least amount of space. However, this has some side effects, like getting errors when you want to use Marshal.SizeOf. With Explicit, each field needs to be adorned with a FieldOffset attribute to determine the exact position in memory; that also means you can use several fields on the same position, like in:
[StructLayout(LayoutKind.Explicit)]
    public struct MyStruct
    {
        [FieldOffset(0)]
        public int i1;
        [FieldOffset(4)]
        public int i2;
        [FieldOffset(0)]
        public long l1;
    }
The Pack parameter tells the system on how to align the fields. 0 is the default, but 1 will make the size of the first struct above to actually be 17.
[StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct MyStruct
    {
        public int i1;
        public char c1;
        public long l1;
        public char c2;
        public short s1;
        public char c3;
    }
Other values can be 2,4,8,16,32,64 or 128. You can test on how the performance is affected by this, as an exercise.

More information here: Advanced c# programming 6: Everything about memory allocation in .NET