I've found a small gem in Javascript ES6 that I wanted to share:
let arr = [3, 5, 2, 2, 5, 5];
let unique = [...new Set(arr)]; // [3, 5, 2]

and has 0 comments
There is a rule in writing, that if you are trying to tell the story from the viewpoint of another character than the main one, for example the villain, and it is boring, then your story is not good enough. It seems to me that this was the cardinal rule that Manuel Gonzales used to write The Regional Office Is Under Attack!. He wrote tiny interlaced chapters that alternately were describing the action, then the motivations and personalities of the characters through flashbacks. At first it felt fresh, then it just got annoying. There is only so much you want to hear internal monologues.

It would have been great if the story would have been better, or if the characters would have really been fleshed out. However, this book feels more like an exercise in writing, a funky experiment, than a real story. There are very intimate details about how people thought and why they did some things, but they also are empty, doll like characters. And that is too bad, because Gonzales is clearly a talented writer and the plot made me want to read on and find out what will happen to all the characters, only to be left high and dry at the end of the book, which stopped abruptly and spitefully. It was like "Hey, you wanted something else than to experience my new idea? Fuck you! You get nothing."

In the end, it was something that felt like a fairy tale, reinvented for art's sake and modernized just because it's fashionable. It's not even a first part of a series or something. It's a standalone book that showcases the author's idea of presenting many viewpoints on some incidents that have only marginal connection to science and fiction. It could have just as well been a soap opera about highschoolers and be just the same book. It wasn't bad, but I can't quite recommend it either.

and has 0 comments
I've decided the functionality of the Bookmark Explorer extension was pretty close to final and, before I refactor it to a new form, I wanted to make sure it works for all the browsers that support the WebExtensions mechanism, mainly Chrome, Firefox and Opera. Frankly, I have no idea why anyone would use Firefox or Opera, but if you do, I've got great news for you: I have published the extension for all of them:
Haven't tested extensively, I am going to do that in the near future, but rejoice, now you can read your news at speed and comfort, then remove them from your bookmarks once you have grown tired. There are some changes to the extension that need to be addressed:
  • The most significant is changing the keyboard shortcut for "Previous Bookmark" to Ctrl-Shift-O for Firefox and Opera, because changing extension key shortcuts in Firefox is really difficult and Ctrl-Shift-K is already used by the developer tools
  • The default settings have been updated. Now, when you install the extension for the first time you will get:
    • 30 second wait for the "Read Later" links to autoclose, giving the browser time to cache the title and icon
    • Preload next tab is now true by default, leading to loading the content of the next news item while you read the current one
    • When creating bookmarks - from anywhere - their URLs will be stripped of some marketing bullshit
  • A lot of bug fixes and speed improvements went into this aparrently minor release

I also plan to make a video of how to use the extension, since letting users read the long description and figure out what the extension does didn't quite work :) I am considering changing the name of the extension for version 3 and I am open to suggestions. I am thinking of Bookmark Surf or something like this. Please let me know of any problems with the extension. I will fix bugs and I will write new features if I agree they are good for my users. All you have to do is ask!

Enjoy!

Update: I was so happy that Firefox for Android supports addons that I just installed it immediately and expected it to work. Unfortunately, the support for the Web Extensions API is very limited for the Android version, most importantly not having a bookmarks API, so the Bookmark Explorer doesn't work. I did make the extension more robust, though, by debugging it on the Android version.

and has 0 comments
Finally, finally there is a TV series about an asteroid coming towards Earth and what we are going to do about it. It is called Salvation and it fails in every single respect.

The first alarm bell was Jennifer Finnigan, the female costar from Tyrant. She was terribly annoying in that show where she posed as the voice of reason and common sense, while being a nagging and demanding wife to the ruler of a foreign country. I thought "shame on you, Siderite! Just because she was like that in that show it's no reason to hold it against the actress". In Salvation, she plays the annoying nagging and demanding voice of reason and common sense as girlfriend to the secretary of the DOD.

But that's the least of the problems of the show. The idea is that a brilliant MIT student figures out there is an asteroid coming towards Earth. He tells his professor, who then calls someone and then promptly disappears, with goons watching his house. Desperate, he finds a way to reach to an Elon Musk wannabe and tell him the story. Backed by this powerful billionaire, he then contacts the government, which, surprise!, knew all about it and already had a plan. Which fails. Time to bring in the brilliant solution of the people who care: the EM drive! For which there is a need of exactly two billion dollars and one hundred kilograms of refined uranium. And that's just episode 2.

The only moment we actually see the asteroid is in a 3D holographic video projection, coming from most likely a text data file output of a tool an MIT student would build. Somehow that turns into a 3D rendering on the laptop of the billionaire. Not only does it crash into Earth, but it shows the devastation on the planet as a fire front. Really?

Bottom line: imagine something like Madam Secretary which somehow mated with the pilot episode of the X-Files reboot. Only low budget and boring as hell. There is no science, no real plot, no sympathetic characters, nothing but artificial drama which one would imagine to be pointless in a show about the end of the world, and ridiculously beautiful people acting with the skill of underwear models (Mark Wahlberg excluded, of course). Avoid it at all costs.

Update: oh, in episode 3, the last one I will watch, they send a probe to impact the asteroid and they do it like: "OK, we have a go from the president!" And in the next minute they watch (in real time from Io and from a front camera on the probe) how it is heading towards the asteroid. I mean... why write a story and not make it use anything real? What's the point in that? Even superhero movies are more realistic than this disaster. I know the creators of the show did other masterpieces such as Extant and Scream: The TV Series and Hawaii Five-O, they don't know any better, but at least they could have tried to improve just a tiny sliver. Instead they shat on our TV screens.

and has 0 comments
I loved this book about the far future where humanity is ruled by benevolent AIs and vicious technological wars are being fought with xenophobic alien races. The greatest quality of Dark Intelligence is how it managed to define a world of varying degrees of power and intelligence that somehow manage to coexist without straining suspension of disbelief. I also liked that throughout the book there were hints on various hidden truths in the story, but Neal Asher didn't simply spoil the ending with them, nor did said ending rely solely on disclosing the twists that were glimpsed from those hints. The style of the writing was focused, easy to read, capturing the reader in the world the author created. I finished the book in just two days.

The subject of the story is also one that is very dear to my heart: what is the meaning of identity and personal purpose in life when anything can be changed, altered by either yourself or others, sometimes god like intelligences that just don't see galactic life as any more interesting than we would an ant hill. And while the book is part of a series set in a universe that Asher wrote a bunch of books about, the story is quite stand alone and can be read with pleasure without fear of a cliffhanger ending ruining it all. I liked it and probably I will try other books from the series and from this author.

and has 0 comments
It was difficult for me to finish Tea From An Empty Cup. While it was a rather classic cyberpunk novel, which I usually enjoy, I felt it was obsolete in a way that could not be fixed. You know, like when designers or artists try to imagine how computers will be in the future. Only after reading it I realized it was written in 1998, so it was normal for that time and age to misunderstand how humans behave in networked environments, but still... even if the subject was a bit interesting, I actually had to make an effort to go through with it. I think the reason for why I didn't like the book was that the characters were paper thin. Concerned to describe a chaotic virtual reality world in which anything is possible and nothing is regulated (although everything is billed), Pat Cadigan forgot to make us feel anything for the protagonists. And considering that this is a story about how technology is affecting our perception of identity, it made the book unpalatable.

Imagine a Matrix in which people enter voluntarily because the real world is boring by comparison. They create their own intricate fantasies that go well beyond the basic human needs like food or sex and focus on social cues that the participants struggle to constantly redefine and grab for themselves. In this, Pat Cadigan was spot on. However, other than this simple idea that nowadays is ubiquitous on the Internet via the various social networks, the book is nothing but a boring detective story, complete with the "normal" policeman character that enters this virtual world as a complete noob and somehow solves the case. The action is very inconsistent and the feeling I got from the flow of the plot was one of a dream sequence where stuff is cool just by merely being defined as such. At no time while reading the book I was enticed by the scenes in the story.

The concepts inside the book are interesting, but explored very little. The author seems to be under the impression that by merely listing them, the story will somehow become interesting by association, an ironic parallel with the characters in the book. Just think that this book was published at the same time The Matrix movie was released. The difference in quality between the two stories is just too big.

and has 0 comments
Today I've discovered, to my dismay, that two Integer objects with the same value compared with the == operator may return false, because they are different objects. So you need to use .equals (before you check for null, of course). I was about to write a scathing blog entry on how much Java sucks, but then I discovered this amazing link: Java gotchas: Immutable Objects / Wrapper Class Caching that explains that the Integer class creates a cache of 256 values so that everything between -128 and 127 is actual equal as an instance as well.

Yes, folks, you've heard that right. I didn't believe it, either, so I wrote a little demo code:
Integer i1 = Integer.valueOf(1);
Integer i2 = Integer.valueOf(1);
boolean b1 = i1 == i2; // true

i1 = Integer.valueOf(1000);
i2 = Integer.valueOf(1000);
boolean b2 = i1 == i2; // false

i1=1;
i2=1;
boolean b3 = i1 == i2; // true

i1=1000;
i2=1000;
boolean b4 = i1 == i2; // false

i1=126;
i2=126;
boolean b5 = i1 == i2; // true

i1++;
i2++;
boolean b6 = i1 == i2; // true

i1++;
i2++;
boolean b7 = i1 == i2; // false

i1 = 2000;
i2 = i1;
boolean b8 = i1 == i2; // true

i1++;
i1--;
boolean b9 = i1 == i2; // false


Update: the same thing also applies to Strings. Two strings with the same value are not == although they are immutable, so even the same string won't be equal to itself after changes. Fun!

I now submit to you that "sucks" applies to many things, but not to Java. A new term needs to be defined for it, so that it captures the horror above in a single word.

Tonight I went to an ADCES presentation about SQL table partitioning, a concept that allows for a lot of flexibility while preserving the same basic interface for a table one would use for a simpler and less scalable application. The talk was very professionally held by Bogdan Sahlean and you should have been there to see it :)

He talked about how one can create filegroups on which a table can be split into as many partitions as needed. He then demonstrated the concept of partition switching, which means swapping two tables without overhead, just via metadata, and, used in the context of partitions, the possibility to create a staging table, do stuff on it, then just swap it with a partition with no downtime. The SQL scripts used in the demo can be found on Sahlean's blog. This technology exists since SQL Server 2005, it's not something terribly new, and features with similar but limited functionality existed since SQL Server 2000. Basically the data in a table can be organized in separate buckets and one can even put each partition on a different drive for extra speed.

Things I've found interesting, in no particular order:

  • Best practice: create custom filegroups for databases and put objects in them, rather than in the primary (default) filegroup. Reason: each filegroup is restored separately,
    with the primary being the first and the one the database restore waits for to call a database as online. That means one can quickly restore the important data and see the db online, while the less accessed or less important data, like archive info, loaded afterwards.
  • Using constraints with CHECK on tables is useful in so many ways. For example, even since SQL Server 2000, one could create tables on different databases, even different servers, and if they are marked with not overlapping checks, one can not only create a view that combines all data with UNION ALL, but also insert into the view. The server will know which tables, databases and servers to connect to. Also, useful in the partition presentation.
  • CREATE INDEX with a DROP_EXISTING hint to quickly recreate or alter clustered indexes. With DROP_EXISTING, you save one complete cycle of dropping and recreating nonclustered indexes. Also, if specifying a different filegroup, you are effectively moving the data in a table from a filegroup to another.
  • Finally, the SWITCH TO partition switching can be used to quickly swap two tables, since from Sql Server 2005 all tables are considered partitioned, with regular ones just having one partition. So one creates a table identical in structure with another, does whatever with it, then just uses something like this: ALTER TABLE Orders SWITCH PARTITION 1 TO OrdersHistory PARTITION 1; to swap them out, with minimal overhang.

and has 0 comments
Just a heads up on a technology than I had no idea existed. To get the details read this 2009 (!!! :( ) article.

Basically you define a MemoryMappedFile instance from a path or a file reader, then create one or more MemoryMappedViewAccessors, then read or write binary data. The data can be structures, by using the generic Read/Write<[type]> methods.

Drawbacks: The size of the file has to be fixed, it cannot be increased or decreased. Also the path of the file needs to be on a local drive, it can't be on a network path.
Advantages: Fast access, built in persistency, the most efficient method to share data between processes.

and has 0 comments
Fuck Java! Just fuck it! I have been trying for half an hour to understand why a NullPointerException is returned in a Java code that I can't debug. It was a simple String object that was null inside a switch statement. According to this link states that The prohibition against using null as a switch label prevents one from writing code that can never be executed. If the switch expression is of a reference type, that is, String or a boxed primitive type or an enum type, then a run-time error will occur if the expression evaluates to null at run time.

and has 0 comments
Central Station describes a very interesting cyberpunk style of future, where amazing yet commonplace technology mixes with the traditional and with the local culture in a world in which the Solar System has been colonized. And then the book ends. Lavie Tidhar manages to imagine all of this creative world, but doesn't succeed on making the book more than the collection of short stories it actually is. That doesn't mean the book is not worth reading or that other works from the author will not benefit from the world building in it, but it feels like a missed opportunity. The book is short, it describes interactions between a surprisingly small and somehow related people and then it just ends with none of the threads in it being resolved in any way. The main character remains as the background city of Central Station, former Tel Aviv.

The writing style is also a bit heavy. It is descriptive, a little pretentious, but it might have felt like that because I was reading in the subway or when going to sleep and I wasn't in the mood for intellectual work. Even so I believe that a lighter style with more attention to story development would have benefited this book.

Bottom line: I liked the story immediately and felt betrayed after it abandoned me right when I was intrigued enough to seek closure. It is worth a read and I hope Tidhar expands the world in other stories beyond the insular location of the book. I am also looking forward to reading other things from the same author.

and has 0 comments
Oh, SyFy does it again with a show that is wild, totally over the top and really really fun. Post-apocalypse, hot rod cars that use human blood for fuel, cannibals, wild sex, murder sprees, wild people, Colin Cunningham, corporate overlords, awakened psychotic robots, making fun of corporate overlords, ridiculously attractive people surrounded by ridiculously ugly people... Blood Drive is just too silly to care and too wild to not enjoy. I am watching the third episode already and I am laughing my ass off: "Praise synergy for it provides us with low hanging fruit!", you gotta love that.

Update: of course something truly fun can't last. Blood Drive has been cancelled after just one season.

and has 0 comments
Finally, a fresh, unapologetically sci-fi story with so many interesting ideas and cultural innovation that I can barely wait for the second book in the series to come out.

Yoon Ha Lee creates this far into the future universe in which everything from social structure to space travel and military technology is run by rigid doctrine that uses a particular calendar. Certain battle formations, using certain weapons, doing specific things leads to "exotic effects", carefully manipulated through higher mathematics, that power society and military expansion. Of course, there are multiple possible calendaristical configurations, but they interfere with each other, so after choosing one, any deviation is considered heretical. Add to this an Asian view of hierarchy and politics and you get the most delicious book I've read in a long, long time.

Ninefox Gambit is, unfortunately, merely the beginning of the story. While one could consider the entire thing a standalone book that leaves the rest of the story to the imagination of the reader, the rich universe that it creates makes followups inevitable. In this case, I can barely wait for them. There isn't much else to say about the book other than urge you to read it. As with any good writing, the plot is simple, but the individual scenes give its flavor. It is an almost unspoilable story, since it doesn't rely much on twists, but on bringing value in every chapter, through rich characterization and original scenecraft.

and has 1 comment
The Mist is a novella by Stephen King that has been adapted into a great horror movie. I mean, I rated the movie 10 out of 10 stars. So when the TV show The Mist came around I was ecstatic. And then... I watched three episodes of the most insipid and obnoxious series I've seen since Under The Dome. Nay, since Fear of the Walking Dead.

Imagine they removed most of the monsters and replaced them with mostly insects, then they enhanced everything else: small town politics, family matters, teenagers, etc. OK, the original Mist was great because it showed the greatest ugliness was not the interdimensional creatures, but the pettiness of humans. However, it was the right balance between the two. Now, in a TV show that censors words like "fuck", you get to see teenage angst, drug rape, power hungry egotistic policemen, one of the most beautiful actresses from Vikings relegated to the role of an overprotective mother, husband and wife interactions - lots of those, junkies, amnesiac soldiers, priests, goth kids, nature freaks, old people... oh, the humanity! Three episodes in which nothing happened other than exposition, introduction of lots of characters no one cares for and that's about it.

I am tired. I really am tired of hearing that price is driven by offer and demand - which is quite true because that's the definition of price, it has nothing to do with actual value. Same with stories: they are all about people, because people care about people and most people are people. No need for anything too exotic when all you need to do to please most people is to show them other most people. Grand from a marketing point of view, but quite pointless overall, I would say. But who's gonna listen to me, I am not most people after all.

Bottom line: lately there has been a lot of effort invested into TV. HBO and Netflix have led the way by caring about their productions enough to make them rival and even beat not only film productions, but also the original literary material. This has led me to hope against hope that The Mist will be the best horror TV show out there, one that would maybe last two or three seasons at most, but burn a bright light. Instead it is a dying fire that wasn't properly lit and is probably going to take two or three seasons just to properly die out without anyone noticing it is gone, yet managing to poison the legacy of the film forever.

and has 0 comments

The only fantastical element in this book, except for a ghost that makes a short appearance, is a change in location. The rest is historical fiction in some place that feels exactly like Renaissance Europe, only it has another name and other gods. Worst than that, the story is boring and the writing mediocre. I couldn't finish it.

The story in Children of Earth and Sky follows a few chosen characters while they navigate the treacherous waters lying between warring (and spying) nations. I mean this both metaphorically and literally, since it is also about ships crossing the sea. Guy Gavriel Kay has been writing published works since 1984 which is why I was surprised to see such an amateurish writing style. He uses several tools again and again and again, without much effect. The worse, for me, was describing the same scene from different viewpoints, one after another, even if it did nothing to enrich the story or develop characters. Another is a certain repetition of a phrase for emphasis, something like "He didn't like the book. He didn't." OK, emphasized enough! Also I felt that the author coddled his characters too much. Instead of making them suffer in interesting situations, he just lets them off easy with crises that they can easily handle or at least manage with heroic skill. In one of the most important scenes, one of a battle, he kills off a major character, at which point I was thinking "OK, it's getting started", only to resurrect them immediately after. Ugh!

So beside being a boring historical drama (I mean boring even for a historical drama!), it really nagged me that it was marketed as fantasy. Maybe I am just getting fed up, considering I've just read a western and a heist story, both included in the fantasy and sci-fi genre because they happened in the future or in spaaaaaace. Bottom line: I can't in good conscience recommend this book and I am quite amazed that it has such a high rating.