Sunday, December 31, 2017

The Dream

So I am having this dream. Or I am so having a dream? Anyway, weird fucking dream, like Coscarelli meets Happy! via those explaining videos where someone talks very fast while drawing what is going on while an obnoxiously and totally unnecessary music plays joyfully in the background. Although that was mostly a way to graphically depict my inner thoughts... in the dream... so that I could understand what I was thinking. The dream concerned altered states of mind, biology, physics, logic, anything really.

Everything was altered, but also very real. It was all real. One moment I am doing something horrible, like killing innocent bystanders by throwing them from a tall place onto other people that were trying to make me stop killing people or pushing terrified (and annoying) kindergarten kids out of my way, my wife in tow, enjoying every second, the other I am home, waiting for the cops to show up, amazed that I got away, only for someone to force very strong psychiatric meds down my throat and make me realize that it was all a fantasy of someone who isn't even who I thought I was. Then I wake up and I am a terrible (and amusing) force of evil trying to understand both who I am and why do the people that force feed me medicine look like my parents, while they clearly are not. I terrify them and so I can tell them what to do, maybe they won't discover I am as terrified of not knowing what the hell is going on. But I will be having fun, as a God given right.

And then it switches again, with a good friend arranging the trip that will take us out of the country, on a touristic toury tour that me and the wife will use to escape the authorities that no doubt are looking for us right now because we killed all those people in probably the very tour we are organizing because they were standing in our way and we were bored. And in the dream I realize that every such permutation of reality is part of the dream, but also very real. I could stop at any moment and that would be reality for a while. So I switch again, I escape, barely conscious of where or who I am, I jump some stairs, a dog is chasing me, but I know he knows me and wants to play, I get out of the building, pretend to be a PTSD affected veteran to get clothes and stuff, including guns, until someone asks me where I served. So I just have to take out the guns and commandeer a vehicle. The fact that the people in the car are sexy women who can't help feeling terrified and also strangely excited by this display of violence is surely coincidence. And then cops show up and the girls run away. I shoot after them until the bullets run out, while the cops are weirdly apathetic, standing next to me on the hood of their car. "Are you done?" they ask, and I sigh and acknowledge and give up, allowing to be handcuffed and thrown into a car that doesn't seem to be a police car. And a woman is there, old, crow feet eyes, one of those people who can laugh at anything, you know, smoking nonchalantly.

I realize it is all part of the great machine that revolves reality, like one of those game machines that gives you a prize on TV when they rotate it, only it seems the real good prizes are never chosen. And I know now what this is and I look into her eyes and I know that she knows I know, but maybe she could stop smoking, since it irritates me, and she laughs. Told you she could laugh at anything. I am proud of not panicking, of taking it all in and being cool with it, I can see the old woman nodding appreciatively, too. "So what now?", I ask, but I already know the answer.

It is clear to me that anything could happen, and it does happen, the whole world dies and I get that fast talking graphic that explains why everything alive is not alive anymore except one thing, me. And it doesn't make any sense at all other than what if it could happen and if it could happen why wouldn't it and I am it, the thing that can breathe what nothing else can and still draw fancy pictures of what happened while explaining itself how it survived. But then surely I could animate one of the dead, just for fun, so it can be irritated (as I was) at how fast I am talking when depicting my inner monologue. And I try variations on the same theme, all wonderful and terrifying and apparently dangerous, only that I can change them even after something bad happened to me, so they're not. I especially enjoy the ones where I am enjoying what I am doing, even if it doesn't seem like something anyone would enjoy. I congratulate myself for choosing a reality I enjoy what I am doing so much that I need to congratulate myself about it.

I am trying to describe the experience as accurately as possible while fully knowing that the memory of it is fading and that even if I would still be part of it I couldn't express it fully. It stank of multidimensionality, it purposely lacked any purpose, anything at all was possible and it was, overlapping and existing at the same time and space. It had a soundtrack, and even if I knew, for example, that Come Together was taken directly from my recent viewing of Justice League, I also knew that it had a completely different meaning in this context, except maybe for the YouTube bots who would flag my whole life as copyrighted. There was no moral to it, no catharsis, no epiphany. It refused definition and I relished it. It was the polar opposite of a spiritual experience: no hope, but infinite potential, no lessons to be learned, but filled to the brim with experience, no gods other than myself.

I could have been anyone, anything, everything, but I chose the reality where I would wake up, recognize the room, the laptop, and blog about it. Maybe only then see life extinguished, just for the kicks of knowing that everything I spent horrible confused lonely moments (while aware of the singleminded and boring nature of this chosen reality) typing was pointless, no one would read it, even attempt to understand it and fail miserably, because the Internet would still work for a bit, but everybody would be dead. Fortunately it was all a dream, and you will read and fail to understand this post, not even the least bit grateful for being all alive and shit and not the punchline to a joke that I alone (pardon the pun) would find funny.

Saturday, December 30, 2017

Using SVG images in Internet Explorer

I am sure I've tested this, but for some reason the icons in my blog disappeared for Internet Explorer. They are using Font Awesome SVG background images, declared something like this:
.fas-comment {
    background-image: url("data:image/svg+xml;utf8,<svg height='511.6' version='1.1' viewBox='0 0 511.6 511.6' width='511.6' x='0' xml:space='preserve' xmlns='' y='0'><g fill='#2f5faa'><path d='M477.4 127.4c-22.8-28.1-53.9-50.2-93.1-66.5 -39.2-16.3-82-24.4-128.5-24.4 -34.6 0-67.8 4.8-99.4 14.4 -31.6 9.6-58.8 22.6-81.7 39 -22.8 16.4-41 35.8-54.5 58.4C6.8 170.8 0 194.5 0 219.2c0 28.5 8.6 55.3 25.8 80.2 17.2 24.9 40.8 45.9 70.7 62.8 -2.1 7.6-4.6 14.8-7.4 21.7 -2.9 6.9-5.4 12.5-7.7 16.9 -2.3 4.4-5.4 9.2-9.3 14.6 -3.9 5.3-6.8 9.1-8.8 11.3 -2 2.2-5.3 5.8-9.9 10.8 -4.6 5-7.5 8.3-8.8 9.9 -0.2 0.1-1 1-2.3 2.6 -1.3 1.6-2 2.4-2 2.4l-1.7 2.6c-1 1.4-1.4 2.3-1.3 2.7 0.1 0.4-0.1 1.3-0.6 2.9 -0.5 1.5-0.4 2.7 0.1 3.4v0.3c0.8 3.4 2.4 6.2 5 8.3 2.6 2.1 5.5 3 8.7 2.6 12.4-1.5 23.2-3.6 32.5-6.3 49.9-12.8 93.6-35.8 131.3-69.1 14.3 1.5 28.1 2.3 41.4 2.3 46.4 0 89.3-8.1 128.5-24.4 39.2-16.3 70.2-38.4 93.1-66.5 22.8-28.1 34.3-58.7 34.3-91.8C511.6 186.1 500.2 155.5 477.4 127.4z'/></g></svg>");

I had to try several things, but in the end, I found out that there are three steps in order to make this compatible with Internet Explorer (and still work in other browsers):
  1. The definition of the utf8 charset must be explicit: data:image/svg+xml;charset=utf8 instead of data:image/svg+xml;utf8
  2. The SVG code needs to be URL encoded: so turn all double quotes into single quotes and then replace < and > with %3C and %3E or use some URL encoder
  3. The colors need to be in rbg() format: so instead of fill='#2f5faa' use fill='rgb(47,95,170)' (same in style tags in the SVG, if any)

So now the result is:
.fas-comment {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg height='511.6' version='1.1' viewBox='0 0 511.6 511.6' width='511.6' x='0' xml:space='preserve' xmlns='' y='0'%3E%3Cg fill='rgb(47,95,170)'%3E%3Cpath d='M477.4 127.4c-22.8-28.1-53.9-50.2-93.1-66.5 -39.2-16.3-82-24.4-128.5-24.4 -34.6 0-67.8 4.8-99.4 14.4 -31.6 9.6-58.8 22.6-81.7 39 -22.8 16.4-41 35.8-54.5 58.4C6.8 170.8 0 194.5 0 219.2c0 28.5 8.6 55.3 25.8 80.2 17.2 24.9 40.8 45.9 70.7 62.8 -2.1 7.6-4.6 14.8-7.4 21.7 -2.9 6.9-5.4 12.5-7.7 16.9 -2.3 4.4-5.4 9.2-9.3 14.6 -3.9 5.3-6.8 9.1-8.8 11.3 -2 2.2-5.3 5.8-9.9 10.8 -4.6 5-7.5 8.3-8.8 9.9 -0.2 0.1-1 1-2.3 2.6 -1.3 1.6-2 2.4-2 2.4l-1.7 2.6c-1 1.4-1.4 2.3-1.3 2.7 0.1 0.4-0.1 1.3-0.6 2.9 -0.5 1.5-0.4 2.7 0.1 3.4v0.3c0.8 3.4 2.4 6.2 5 8.3 2.6 2.1 5.5 3 8.7 2.6 12.4-1.5 23.2-3.6 32.5-6.3 49.9-12.8 93.6-35.8 131.3-69.1 14.3 1.5 28.1 2.3 41.4 2.3 46.4 0 89.3-8.1 128.5-24.4 39.2-16.3 70.2-38.4 93.1-66.5 22.8-28.1 34.3-58.7 34.3-91.8C511.6 186.1 500.2 155.5 477.4 127.4z'/%3E%3C/g%3E%3C/svg%3E");

Friday, December 29, 2017

White Sands: Experiences from the Outside World, by Geoff Dyer

White Sands is a collection of essays that try hard to come together as a coherent book. Some are short travel anecdotes, examining places that are either too touristic to be anything or too artistic to be objective and needing a critical analysis from a cultured person like Geoff Dyer. I liked these the most, since they were both teaching something about places I probably will never visit and also showing the sarcastic internal thoughts of the author, complete with interesting references and in depth research. Well written, too.

Two chapters try to explore not just short visits to distant places, but places Dyer lived in, like Los Angeles. These are so packed with references and quotes and longer than the others and I almost didn't finish the book, short as it is. One chapter is about a mild brain stroke he had, almost robbing him of the thing he identifies with most: his brain. It is weirdly distant, like it happens to another person, as probably during those times he was either in complete shock or some kind of denial. I couldn't believe that neither he nor his wife recognized the medical signs of a stroke and chose to go for a coffee and a croissant before going to the hospital. Then again, he was probably listening to jazz while reading artsy books when I was watching Dr. House.

Bottom line: I recommended the book to a friend while reading the first chapters. I found it fresh, funny and intellectual in the same time. I wouldn't recommend the book now that I have finished it. As I was saying, it is hardly a book and more a collection of various things Geoff Dyer wrote during his life, different in style, scope and how much they interested me. It is not by any means a bad book, and probably people that enjoy a different sort of art and culture will love it, it just wasn't for me, in the end. Since the chapters are unrelated, one can take whatever part of it they enjoy most and discard the rest, though.

Wednesday, December 20, 2017


There are two girls standing right in front of me on the subway escalator, riding up towards the gray, unforgiving, cold Bucharest weather. I am standing there, looking at their backs and my mind starts to wander. I imagine their long young hair hiding one of those smiles to yearn for, expressing both calm and potential, contentment and desire, purity and mischief. I imagine the skin on their back and neck, clean and unmarred, smelling faintly floral, not because of some stupid perfume, but coming from its rose petal smoothness and their very inner nature, tasting like heaven. The long coat and pants hide the perfect ass, not fat and not muscular, not big and not small, not even sexual, the ideal origin for two perfect legs. One of them turns to the other and they start talking and in a completely involuntary act of political correctness they become human, ordinary, just like me, and I resent them for that. Why couldn't you remain goddesses? What is wrong with you?

Tuesday, December 12, 2017

[Solved]Samsung phone keeps restarting and drains the battery to empty when enabling Mobile data

I am a pretty constant guy. I've repaired and used my computers well after it was cheaper to buy new, much better ones, and the same thing applies to my smartphone, which has now the venerable age of four years (yeah, it was sarcasm. My Nokia phone still worked for a week on a single charge after 8 years of use). Anyway, my problem is not actually the phone as it is the battery, which is "spent" and for which I need to buy a new one. Good luck finding anything for four year old hardware!

Ridiculously, the problem only occurs in a specific situation which I am going to detail next. For the rest of the usage, the battery, as it is, is good enough. I can talk, I can read books, I can watch movies, I can use WiFi. But when I am turning on Mobile Data, it first lags, then freezes, then restarts and keeps restarting until it gets to 0% charge in a matter of minutes. The only solution to stop this is to remove the battery or plug in the charger.

So what is going on here? When you turn on Mobile Data, all the apps you have installed are trying to access the Internet - some want to load data, some to load ads, some to check for updates - the problem is that they are all doing it at the same time. The phone is trying to use too much power and it fails in ways no one had predicted (or bothered to fix). Funny that it doesn't happen with the Wifi, which is probably more optimized for power use. The solution, then, it to prevent the apps for using the internet on mobile connections.

For me, the worst was Google Play Store and Google Services, together with Facebook, Twitter, WhatsUp and TripAdvisor, but also some unexpected applications that have nothing to do with Internet use, such as Alarm Clock or Office Suite. This also has unexpected secondary benefits: stops you from going to Facebook or Twitter in places without Wifi, which are usually transit zones or transportation vehicles. Instead, read a book.

Saturday, December 09, 2017

Gotta give it to Travelers

The main cast of the show There is this TV show out there, called Travelers, already well into its second season, that no one seems to be talking about. It's not based on comic book characters, it is actual original content (gasp!). It's Canadian, of course. With no flashy budget and subtle acting, it manages to slip through some ingenious ideas. For one, it is the only show I've seen so far where humanity's fate is controlled by a benevolent artificial intelligence, something I feel it is inevitable.

Groups of people are being "directed" to do things, using the huge computational resources of the AI called The Director and the convenient fact that it resides in the future. Its role is to change the past as to avert the horrible future humanity got to. So called Travelers are being sent to inhabit the bodies of people in the present, essentially killing them and taking over their lives. Very interesting dynamics based on the merging of the traveler personalities and the connections of the people they replaced, too. Considering changing enough of the past would change the circumstances that created The Director, it is a fine line that the show needs to thread. I also find it amazing that a show involving time travel can actually be good, considering most stories break horribly when exposed to the cheap time travel stuff they usually employ for movies and TV.

The cast is great, too, with talented actors in strong roles. You probably know Eric McCormack, Patrick Gilmore, Jennifer Spence or Leah Cairns, but all the others have shows to their belt. The individual episode stories feel fresh, too. They could have gone with the tired storylines of the "team" that solves problems used in a zillion shows before, but instead they go their own way, with a different feel that reminds me of European sci-fi, rather than American.

My recommendation is to give it a go, watch a few episodes, see if it grows on you. It is not something that people see a few scenes of and fall in love, but something that needs a bit of a grind before you become a fan. It is worth it.

Thursday, November 30, 2017

Butcher Bird, by Richard Kadrey

book cover I think Richard Kadrey didn't know exactly what he wanted with this book when he started it. The full title is Butcher Bird: A Novel of the Dominion, but it's his only book related to the Dominions as far as I know and Butcher Bird is a rarely used name for a secondary character in the story. Even the Dominions didn't really feature for more than a few pages in it.

Leaving the title aside, this was a pretty fun book. Not a masterpiece, but one of those fish out of water fantasy stories where the hidden realm reveals itself to the main character, then pulls them into weird adventures. This one features angels and demons as ordinary denizens of the "spheres" among other crazy intelligent species, magic, flying ships, trips to Hell, getting friendly with Lucifer, old gods, cities of old memories and lost things and so on and so on.

It was an easy read, so it didn't take me much to finish the book. It wasn't so much wanting to know how it ended (which was obvious - the heroes win) but what other weird visions Kardey can conjure before it does. The lead character is a bit uncommon, as well, as a motorcycle riding tattoo artist called Spyder who is still a nice romantic at heart. At least it's not an adolescent child in an English boarding school!

Bottom line: I am kind of curious about the many Sandman Slim novels by the same author, so this book was a success. If you want something easy and fun, this is it for you.

Saturday, November 25, 2017

About sexual harassment

People know that I sometimes like to hold controversial opinions, sometimes just for the kicks. So first I will ask some questions, ask you to find your own answers, then read about what I think.

Why is sexual harassment different from any other type of harassment?
Why is leaving from a job where your boss or colleague is an asshole any different because they are sexual harassers as opposed to regular assholes?
Why is offering sexual services, including just dressing or behaving a certain way, a natural way of expressing oneself, but asking for them is illegal?
Why do these things seem to happen only in the US?

Now, I am a technical person. While I am certainly not for sexual harassment at work, I need to understand why some types of behaviors are punished so differently from others that are very similar. Consider an employee who is humiliated and disrespected publicly at work, but not in a sexual manner. How could they ever support this outcry against sexual harassment, when their own plight is getting ignored? I mean, do we need laws to tell us when we crossed the line while being jerks? Why is there a legal segregation of jerkness? Why is someone abusing their power more or less guilty based on the type of abuse they chose to exercise?

And, as you might think, my opinion extends to a lot of these special exceptions to civilized behavior. They are called positive discrimination, affirmative action, employment equity and so on, but they boil down to one thing only: another type of discrimination. In the end, like any sort of forced empowerment, they will get abused. The rallying cry of Gretchen Carlson will fizzle out in a sea of false claims and malicious law suits. In fact, it only takes a few to invalidate all the others. It's like trying to make a drink less bitter by adding sugar, rather than removing the bitter ingredient. Or paying someone after you had sex with them against their will, if you see what I mean.

But what am I advocating? Certainly if we abolish the special rules, then all one can do when sexual harassed is to find another job. The asshole in power will hire more and more people until some are weak or desperate enough to accept their advances. If we extend the rules to cover any type of harassment, we expose employers to abuses and tie their hands in how to run their business. Neither option is acceptable, but neither is cherry picking which type of behavior is bad enough to be illegal based on its popularity. This entire issue is systemic: there is no way for the system to self regulate.

When all this #MeToo business started going on, I went and asked women about this. And girls here were supportive of the women who were coming forward, but not supportive of the ensuing publicity circus and these arbitrary lines being drawn in the sand. While the virality of discussion inspired so many people to come forward, which is a good thing, we have to consider why they failed to do so in the past and what will happen when fatigue will inevitably remove this from the public interest. Company policy and employee training, harsher laws? No formalization of common sense (which doesn't seem to be so common anymore) is a good idea.

To summarize this, if you behave like a douchebag and people around you don't call you out on it, then it is culturally OK to continue. It is not right, but putting it into a law won't stop it from happening. The recent publicity around this seems to be coming not from the gravity of the behavior, but from the number of people who suddenly came forward to expose it. If that would have been naturally possible, it would not have been news, it would have just been the normal process of weeding out assholes, so it is clear to me that the problem is not as much the specific type of harassment, but the system that makes difficult the public exposure of it and a subsequent moral censure.

I don't have a solution. I am sure if I could figure it out, so would a lot of other people, and this would be solved already. However, it doesn't hurt to look at these cases from a different perspective from time to time. Like from a different country, with a different culture. Or from high enough to understand which of the social values you foster lead to assholes in power getting more and more power and then abusing it. Let's not get hung up on local solutions for specific problems, turning everything into a legal and moral labyrinth where no one is comfortable, and solve the big problems first.

Thursday, November 23, 2017

Sleeping Where I Fall: A Chronicle, by Peter Coyote

book cover Sleeping Where I Fall is an autobiographical book from Peter Coyote. You might know him as a Hollywood actor, a man with a stern face, playing congressmen, detectives and conservative dads or other such people in authority. What you probably don't know is that before he was 40, when he decided he would try his hand at an acting career on the big screen, he was a "live off the land" hippie, a fervent believer in alternative cultures that eschew capital and personal property and value human connection and respect of the land and of the spirit, a man who chose his last name as most representing of himself. The guy on the cover is Peter Coyote, too. This book is an amazing recounting of those times, one of the works that I believe need to be read, whether you like them or not.

Personally, I found it amazing. It's not the writing style or how it played with emotions, but the information buried within that makes it a valuable experience reading it. In fact, if I was to critique anything about it, it is that is so packed with anecdotes and mind blowing ideas and descriptions of people, groups, ideologies and places, but does little to bring the reader to the emotions of the writer. It is too intellectual, trying so hard to be accurate and objective as to make the reader numb. Everything else, though, is top notch.

I don't think I would do the book service to summarize it in this review, but it goes so many different and interesting places: hippie communes, motorcycle gangs, famous artists, drugs, politics, road trips, changing the world, personal stories, psychology, acting, music, environment, native American culture, Wall Street, Easy Rider and so on. I do feel that the man who wrote this book is a great human being, but I have the nagging feeling that he misrepresents some of what he describes. Perhaps it is the somewhat neutral tone, the elevated language to render heart wrenching moments or just the fact that I find it so hard to believe a man could go through all that in just under two decades. I don't want to read Emmett Grogan's book Ringolevio on the same period, but you might want to, in order to cross reference and get a more accurate picture.

I recommend this book to just about everyone. It is one of those things that open your eyes a little to what was lost and what could be different and what you never thought about.

As additional resources, you might want to look at The Digger Archives online, where the site is terribly out of date, but the information there is (as is the Digger way) free. Frankly, I am disappointed to see that neither Sleeping Where I Fall or Ringolevio are offered free on that site.

Tuesday, November 21, 2017

Advice for software developers and other human beings

Growing up I always had this fantasy of writing a journal. My sense of privacy - being sure someone would read and judge it - stopped me from pursuing that, as well as the simple fact that I didn't need a journal, I just saw it as a cool thing I should do. Little did I know that in my older years I would want some sort of record of my forgotten youth and find none. Yet the idea persisted.

I started an actual journal as soon as I had a computer and I understood the concept of encryption. It didn't really work, either. It was full of self serving bullshit and it described a person that I really wasn't. One could (and should) read between the lines in order to understand the smug and ignorant state of mind of the author. Later still, I started to write a book, something called The Good Programmer or something of that sort. Phaw! Even if I could have gotten past my chronic impostor syndrome, being a good programmer is nice, but not my goal in life. If it were, I would have made other life choices. And again, it was full of self serving bullshit.

You may detect a pattern here and it might inform your reading this blog post. Anyway, its point is to generalize my experience as a programmer, as fast and as clean as possible. Hope it helps.

Every time I write software - that I care about and have influence over its technical quality - I tend to generalize things: reuse components, refactor duplicate code and so on. In other words, find similar problems and solve them with the same tool. It is not Golden Hammering problems away, that's a different thing altogether, since it is I who is shaping the tool. So how about doing that for my life? I should care about it and have influence over its quality.

First time I started writing code I was actually writing it on paper. I didn't have a computer, but I had just read this beginner's book and I was hooked. The code wouldn't have worked in a million years, but it was the thought that counted: I played around with it. Later on I got a computer and I started using the programs, understanding how it works, not different from getting a smartphone and learning how to phone people. Yet, after a while I found issues that I wanted to solve or games that I wanted to play but didn't have, then I made them myself: I found a problem and solved it. But writing code is not just about the end result. As soon as I explored what other people were doing, I started trying to emulate and improve what they did. I played around with compression and artificial intelligence, for example. And I was a teen in a world of no Internet. I went to the British Council and borrowed actual books, then tried the concepts there a lot.

It was years before I would become a professional programmer, and that is mostly because the hiring process (in any country) is plain stupid. The best HR department in the world is just looking for people that have already done what is required, so that they do it at the current company as well. But that's not what a developer wants. Software is both science and art. The science is a bit of knowledge and a lot of discipline, but the rest, a very large chunk, is just intuition and exploration and imagination. People who want to do the same thing over and over again are not good developers; instead they are probably people that just want to make a buck with which to live their "real" life. For me, real life has been writing code - and I still think I am being paid for putting up with the people I work for and work with, rather that for doing what I love.

Professional work is completely different from the learning period. In it you usually don't have a say on what you work on and the problems that software is supposed to solve are at best something you are indifferent to and at worst something you wouldn't understand (as in will not, even if you could). Yet, the same basic principles apply. First, you are required to write good code. By this your employers mean something that works as they intended, but for you it is still something that you feel pride in having written, something that is readable enough so you understand it a few weeks later when you have to add stuff or repair something. You are expected to "keep up to date", by which they understand you would keep studying in your spare time so that you do work that they don't know they need done, but for you it is still playing around with things. Think about it! You are expected to keep playing around! As for the part where you see what other people do and you get to emulate or improve on that... you have a bunch of colleagues working on the same stuff that you can talk to and compare notes and code review with. Add to this the strong community of software developers that are everywhere on the Internet.

Bottom line: Just keep doing three things and you're good. First play around with stuff. Then find a problem to solve (or someone to provide it for you) and write code for it. Finally, check what other people do and gain inspiration to create or improve your or their work. Oh, did I say finally? This is a while loop, for as long as you are having fun. Hey, what do you know? This does scale. Doesn't it sound like a good plan, even if you are not a software dev?

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:
    public struct MyStruct
        public int i1;
        public int i2;
        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

Thursday, October 12, 2017

Hex, by Thomas Olde Heuvelt

book cover Hex has a very King-like feel. The quintessential American little town, the close knit community, the apparent order and control, the breaking of chaos and the reveal of the true face of humanity. And yet, the inspiration for the story came from Roald Dahl's The Witches and it was originally about a little Dutch town. However Thomas Olde Heuvelt saw an opportunity while reviewing the English translation of the book and updated it for an American audience.

The premise is interesting enough. Imagine a modern town that is also haunted by the 350 year old witch that cursed it. People have molded their lives around the witch, using the Internet and technology to monitor her and hide her from the world outside their little town. And when something goes wrong, it goes very wrong. However, I loved that the end was not the typical American horror story, in which the baddie does unspeakable things and the heroes suffer and maybe prevail after grievous losses. It's difficult to talk about it without spoiling the ending, so you will have to read the book and remember me when Katherine displays shock.

Now, I can't say I loved the book. It is well written and the characters are compelling enough. However, it did feel like someone was excited to write a story in the American way, and that is exactly what I did not expect from the author. I mean, I've read The Boy Who Cast No Shadow and that was both powerful and fresh. Hex is not very long, though, and easy to read. Perhaps its best feature is also its worst: it is predictable. You read it and it's like those supposedly funny fail videos where you know something is going to happen, you can even guess what it is going to be, but you are still watching to see it unfold. If you like Stephen King, you will like this book.

Friday, October 06, 2017

Counterfeit Sky - Failure

As an experiment, try to find this video without knowing the name of the song or of the band. I tried so hard until my brain just gave up and remember the name of the band. So here is the video, so I can always find it when I need it. Cool song and video, I think.

And so that other people can find it: it's a music video about an astronaut crash landing on an alien planet and finding his own dead bodies and more versions of himself continuously falling and dying in different ways.

Obsidian and Blood, by Aliette de Bodard

book covers for the three bookds Obsidian and Blood is a collection of all the works in the Aztec magical universe created by Aliette de Bodard. It contains the three books Servant of the Underworld, Harbinger of the Storm and Master of the House of Darts, plus three short stories (which perhaps you should read first). The stories can be found online, if you want a free taste.

Now, while I enjoyed the books, I felt a little cheated. In fact, these are not fantasy books as much as policiers, just set in the tiny and magical Aztec world. Acatl, priest of the Dead, is trying to solve the mystery of various murders and magical transgressions. He is driven, moral and relentless, willing to sacrifice everything in order to save his friends, loved ones and ultimately the world. So it's basically a cop book, only with Aztec gods around.

The writing style is very technical, reminding me of so many other authors that learned the craft in writing classes, with a mentor and a group and so on. However, it was in no way innovative. I felt that the books are the written equivalent of TV movies: professional, but mediocre. And while I stuck through all the books instead of stopping with the first, it's kind of like watching the rest of a miniseries just because you watched the first episode.

The context is the only thing that elevates the book above average. It is an interesting setup to base the stories on Aztec mythology, but I felt that modern sensibilities prevailed and the author chickened out when it came to child sacrifices and ritual torture and so on. They are mentioned, but everybody, whether heroic or villainous, is rational and follows a modern way of thinking.

Bottom line: I wish these were filled with the horror and majesty of the old blood gods, making me feel something visceral and true, more like the short stories and less than the books. As such, these are just police mystery stories set in the Mexica empire.

Monday, October 02, 2017

Debugging in Eclipse

For anyone coming from the welcoming arms of Visual Studio 2015 and higher, Eclipse feels like an abomination. However, knowing some nice tips and tricks helps a lot. I want to give a shout out to this article: Again! – 10 Tips on Java Debugging with Eclipse which is much more detailed that what I am going to write here and from where I got inspired.

Three things I thought most important, though, and this is what I am going to highlight:
  1. Show Logical Structure - who would have known that a little setting on top of the Expressions view would have been that important? Remember when you cursed how Maps are shown in the Eclipse debugger? With Show Logical Structures you can actually see items, keys and values!
  2. The Display View - just go to Window → Show View → Display and you get something that functions a bit like the Immediate Window in Visual Studio. In other words, just write your code there and execute it in the program's context. For a very useful example: write new java.util.Scanner(request.getEntity().getContent()).useDelimiter("\\A").next() in the Display window, select it, then click on Display Result of Evaluated Selected Text, and it will add to the Display window the string of the content of a HttpPost request.
  3. Watchpoints - you can set breakpoints that go into debug mode when a variable is accessed or changed!

For details and extra info, read the codecentric article I mentioned above.

Friday, September 29, 2017

Star Trek Discovery vs The Orville

Discovery vs The Orville Hungry Trekkies, not nourished enough by the latest Star Trek movies, have been treated with not one, but two Star Trek series this fall. One is Star Trek: Discovery, the other is The Orville.

You may be incredulous at first, considering you are likely to not have heard of The Orville at all and, if you did, you thought it was a Star Trek parody. But no. Four episodes into the series it's pretty clear that this is a serious sci-fi opera, with some comedy added for spice. What about the new Star Trek series? Well, it's set before The Original Series, it has the visuals closer to the Abramsverse Star Trek (but without the flares, thank you very much), it has redesigned Klingons and a pretty impressive first two episodes.

It is too early to discuss the plot of Discovery yet as the premise hasn't even been revealed in its entirety. As of yet I can only tell you that I hate the main character. A human female raised by the Vulcans behaves in a way that makes one believe her education was acquired only from Vulcans in Pon Farr. CBS went all in and made the show available on their own CBS All Access network and hired actors like Michelle Yeoh to play in the pilot.

Yet Orville, with clearly less money and with TV actors and comedians managed to do better. The episodes are separate, like in a traditional Star Trek series, rather than a long serialized story. The plot of each episode is related to social or moral issues, like in traditional Star Trek series. People are positive and talking about themselves and their feelings, like traditional Star Trek series. There is comedy, but it is not part of the scaffolding of the stories. It's just a funny crew in a Star Trek clone that's as close as it gets. And if we are at the subject of celebrity actors, episode four has freaking Liam Neeson in a few scenes.

Conclusion: it may go either way, but right now The Orville seems to have done what I thought people would do: renounce the CBS/Paramount property and their money grabbing schemes, but keep faith with Gene Roddenberry's vision. Because that is the soul of Star Trek, not the money thrown by corporations to turn it into an all action and explosions piece of crap. Still, I have hope for Discovery as well. Only time will tell.

P.S. Now if they would only do Andromeda right...

Thursday, September 21, 2017

Blood of Elves (Saga o Wiedźminie #3), by Andrzej Sapkowski

book cover While Blood of Elves is the third work in Andrzej Sapkowski's Witcher series, it is the first actual book, the rest being collections of short stories. The style is the same, the characters the same. What changes is the scope of the story, the size of the described universe.

Is that a good thing? I can't say. While I applaud Sapkowski's attention to historical detail and the way the names are written or spelled in human or elven languages, the action still feels like I'm watching one of those Polish TV plays for children. A lot of dialogue, some exposition, no end to the moralizing stories about the environment and how politicians suck. So I am undecided whether this is a better way of treating The Witcher. However, I can say that the first book in the saga is nothing more than a chapter in a large story. A lot of set up, a lot of discussions, a lot of "almost there, but not quite" and then the book ends when you were starting to wonder what is going to happen. That makes the book incredibly disappointing as a stand alone story and, as I don't intend to read more of the Witcher, kind of a waste of time.

It is similar to one of those Hollywood movies that get split into two parts and it is never a good idea to watch the first part, then wait for a year to see the continuation. While I could read it really fast and there was nothing complex in it other than the political and geographical details, the story is almost nonexistent. I didn't like that at all. To add insult to misery, the book is about Ciri, the princess/witcher/witch, and very little about Geralt who appears mostly in memories and does very little in the story.

Bottom line: unless you are committed to read the entire Witcher series, don't bother reading this volume. It's not that it is badly written, it's that it does nothing but setting up the next books. It is an oversized chapter of a larger story and cannot be entertaining as a stand alone.

Sunday, September 17, 2017

Lilith's Brood (Xenogenesis), by Octavia E. Butler

book cover This book is NOT about vampires. For a long time I avoided reading it because the title so suggested some steamy vampire young adult crap. But no! The book is a hard sci-fi book about the end of humanity, written in a style that I can hardly imagine any man would be able to adopt. And that's a good thing.

Lilith's Brood is in fact a collection of three works (Dawn, Adulthood Rites, and Imago) by late writer Octavia E. Butler. That is why it is so damn long. Since she died, there won't be any more books in the series, so the "Xenogenesis #1-3" label is a bit misleading, just the name of an out of print collection that gathered the three stories together.

The story is about a species of aliens who decide to save the human race after a global war that had doomed it to extinction. The aliens are very interesting, but even more interesting is how the author surfs the edge of defining them as good or evil. Some of the things they do are benevolent and generous, others are, by human standards, insidious and evil. Imagine a benevolent Zerg species coming to Earth. Or a biological Borg with good intentions. Or an intelligent virus that rationalizes its actions as for the better good. It is difficult to keep reading as it pretty much describes the salvation of the human race as a centuries long rape and corruption process by a species that is much more advanced than us, but in very important ways, more animal than humans are. And we are almost helpless. Imagine you are a pet of omnipotent new-age vegans. It's something like that.

I was saying that only a woman could have written about it in this way because the focus is on survival and procreation, on protecting and avoiding death, on how the body feels rather than the mind. I do think that males were presented as either violent mindless rapey idiots or sensitive pacifist weak side characters. The arrogance of the aliens also has a strong vibe of "mama knows best", which explains why males were reduced to enraged murderous states. I mean, that's always the result of that "educational method". But the book is good enough to make you ignore that.

The bottom line is that this is a great book, one that is incredibly detailed and focused on characters, rather than technology or some story arch that has to end at some defined point. It made me think of so many things. I've once had this fantasy of writing a book about people being treated as pets. This is as close as I've read so far. Lilith's Brood made me reconsider the way I raise my dog! It also made me think of the nature of individuality, its benefits and perils, or the definition of humanity. Can you still be human when stripped of all dignity? As I said, while very very good, it is not easy to read. I was sometimes putting the book down and fantasizing on things I would have done if I were some character in the book.

Worth a read, that's for sure.

Saturday, September 16, 2017

100% CPU usage when using The Pirate Bay site

You may have noticed that when using the Pirate Bay site, your CPU usage goes up all to the top. That is because the web site is silently using CoinHive, a distributed cryptographic currency miner that uses the processing power of web users. The easiest solution for me was to go to %windir%/System32/drivers/etc/hosts and add the line
This tells your computer that the coin-hive server is in an unreachable place. You could add URLs with coin-hive in your URL filter or ad blocker software instead.

Now, CoinHive is not a bad thing. (Using it silently is. I wonder if they do this for mobiles as well, destroying their battery life.) In fact, the idea is pretty interesting and I've considered it before in a different context. I may still use it. You are browsing a web site and there are no ads on it or you have a mighty good ad blocker. How is that site to sustain itself? It does so by using some of your processing power. Before the advent of cryptocurrency, there was not way of efficiently monetize CPU power. People have tried, with projects like SETI@Home, but it was always a not very granular process. It only worked for processes that could be split into tiny pieces that were still relevant.

So there you have it, an interesting idea, used in a nefarious way :) Or, if you want to support the site, leave it on. You will make them money.

Question for programmers [Regular Expressions 2]

As with all the programmer questions, I will update the post with the answer after people comment on this. Today's question is:

Friday, September 15, 2017

Question for programmers [Regular Expressions]

Here is a question for programmers. I will wait for your comments before answering.

Tuesday, September 05, 2017

The Last Wish (Saga o Wiedźminie #1), by Andrzej Sapkowski

The Last Wish is not what I expected. I liked the Witcher games reasonably well, but I liked the character in the stories of the games more than the one in this book. Andrzej Sapkowski creates this character who is trained by pain, knowledge, poison and discipline to become the ultimate monster killer. However, the result is a very ordinary person, one who is better at fighting and resisting various magic or chemical attacks, but still a regular dude. He has friends, he falls in love and has moral qualms, he gets defeated and knocked out.

The book is actually a collection of short stories with Geralt the witcher as the main character. Some are reimaginings of classical folk tales, but all of them are about real versus perceived monsters. Is something huge with dagger like teeth a monster to be killed or is there a cursed person inside. Is a normal human less monstrous just because he looks normal, or is he a cruel and vicious villain? In all stories there is a lot of dialog, with characters that are not clearly developed talking a lot about what is going on. I didn't like that. It felt like reading plays.

But even so, I would have said that the book is OK. Like someone trying to write a fairy tale of their own. Why not? But there was this expectation from the games that the witcher was a womanizer that decides who lives and who dies based on his own strange code and lives on the edge by the strength of his skill. In fact, in the books he is the most decent hero I've read about in a while. He is one of the last of a dying breed, like samurai or American native warriors, not because of the monsters that kill them off, but because of humans spreading everywhere and expecting everyone to live by their code of conduct. If he would kill all the monsters in the world, he would be the very next to be destroyed by the people who no longer need him and have always hated him. Let me tell you that it is hard to reconcile my expectations with the book character.

Bottom line: an OK book. Certainly not great in any respect. I recommend you read it before researching the character or playing the games. I think that the book makes the games more interesting, by adding a backdrop story, but the games make the story hard to enjoy... because they are simply better.