Sunday, 31 March 2013

Links that do not show in the popup dialog

I noticed that some links in the blog, for example YouTube links, did not show in the dialog that opens when you just click on the link. That is caused by a security improvement in modern browsers and I've changed the script to open the link normally in another window for the YouTube domains. However, there might still be sites that have this issue and I urge you to tell me about links that do not open in the dialog (aka, a black window that shows nothing) so I can fix the script for those domains as well. As usual, the workaround for this (or for if you don't like the dialog) is to middle click the link and it will open in a new tab.

Update: I've solved the problem, somehow, by filtering the domains (you report) that have the issue and making it so that links leading to them open in a new tab/window. Also, I added a link to the iframe so that if it does not load, you can click on the link and open it in another tab/window. Sorry for the inconvenience so far.

TV Series I've Been Watching - part 14

So many new series and I haven't started watching them all and there are more still coming!



Let's start with the already described ones:

  • Doctor Who - episode six of the seventh season has just appeared. I will probably watch it tonight.
  • Torchwood - no news at all for the fifth season. The only new things about it (for me) is that a Torchood episode has 50 minutes on Starz and 60 on BBC One.
  • Criminal Minds - episodes keep piling up, but it never came up as a priority.
  • Dexter - season 8 of the series will be the last. It's official. The launch date is June 30, 2013.
  • Fringe - Fringe has ended! Finally! The whole observer invasion thing was like a stupid rehash of German occupation movies.
  • True Blood - June 16, 2013 is the release date. The trailer seems to imply something epic.
  • The Good Wife - the show seems to be oscillating between working and not working, with all the unnecessary complications that add no value to the story. Like a hard drive that develops bad sectors I expect it to fail any time now, even if I still like the series.
  • Haven - The third season is over, a fourth was announced. The ending of the third season leaves me with few expectations.
  • Falling Skies - season three will start on June 9, 2013. It's one of those that are just good and sci-fi enough to keep watching.
  • Southpark - season 17 starts on September 2013. Can't wait.
  • The Killing - still on my watch list, haven't started watching it.
  • Suits - third season is about to start. It doesn't make much sense, but I like it.
  • Breaking Bad - I was saying in the last post that the fifth season has ended. It hasn't! There is still one half left starting July 2013. This will end the show. Maybe then I will watch it all to see what happened. Reading the episode synopsis might work as well.
  • Californication - I have demoted Californication to neutral. It feels really tired. The LA back and forth talk doesn't do it for me and there doesn't seem to be any (relevant) action.
  • Beavis&Butt-head - It seems the show was quietly axed. I haven't heard anything about it for a long time.
  • Homeland - I've seen two seasons of Homeland and it's pretty cool. Season three is announced to start on September 29, 2013. I can't empathise with ANY of the characters, but I like it.
  • The Walking Dead - slow walking dead people don't really seem a threat anymore. Instead, psychopathic humans do! Oh, and Lennie James appeared as a recluse madman in the last episode, and the season three finale airs today.
  • Game of Thrones - season three premiers tonight. There are many fans of the books and series in my friend circle and I like the show so far. I still feel that it doesn't capture the feel of the books, but then again, maybe it will develop its own.
  • Mad Men - season six is to premier on April 7, 2013. I will keep watching it, because it is just great.
  • Misfits - the show has been renewed for a fifth season. I will watch it, but I don't have much hopes for it.
  • Sherlock - the third season of the series will begin probably late 2013. I liked it, even if a bit too... Moffaty? I really don't want to see more and more people acting like Doctor Who. One is enough.
  • Spartacus - Vengeance - I had hopes for this season, but it seems it's just the same thing, with a slave rebellion thrown in. It will probably have a Braveheart ending.
  • My Babysitter's a Vampire - No news of a third season, but the show has built a faithful (if childish) fan base. What, they don't sell stuff to children in Canada?
  • Continuum - the second season starts on April 21, 2013. Sci-fi cop show? Have to watch it.:)
  • Copper - the second season of this cop drama starts late 2013. I liked the show and the characters.
  • Longmire - still now date for the second season, but I liked the characters and the setting. The script is well written, too.
  • The Newsroom - my wife loves this. I will watch the second season, but I can't decide if I like it or not.
  • Arrow - I still watch this, as a superhero show with beautiful actors.
  • Beauty and the Beast - removed from my viewing list.
  • Battlestar Galactica - Blood and Chrome - there will not be more. It was a series of webisodes that were part of a pilot that no one bought. I really liked it, though.
  • Elementary - watching it, but it's not great.
  • Hatfields and McCoys - This American Civil War miniseries was filmed in Romania and stars Kevin Costner. I really wanted to see it, but didn't get around to it, yet.
  • Hit and Miss - A new show I really know nothing about. Six episodes so far.
  • Hunted - Cinemax still negotiating a second season without BBC support. Boo, BBC! Anyway, hopes are waning.
  • Parade's End - another miniseries. The trailer looks really promising and I haven't read the book. As soon as I watch it you will know.
  • Primeval - New World - I really tried to like this show, but I didn't. I removed it from my viewing list.
  • Restless - a miniseries. A young woman finds out that her mother worked as a spy for the British Secret Service during World War II and has been on the run ever since. The synopsis sounds interesting. Two episodes so far, that I have yet to watch.
  • Ripper Street - It's a bit like doctor Watson working for Lestrade, but I like the characters and the setting.
  • The Fear - A Brighton crime boss turns entrepreneur and then he goes crazy. Like mentally ill crazy. I haven't started watching this miniseries, but it might be interesting.
  • Vegas - It seems that to keep audiences happy, unreasonable dramas and conspiracies must be presented. Again I feel cheated, as I really like the show but I already see how the mass production version of the script looms its ugly head.
  • Wizards versus Aliens - there will be a second season, starting late 2013. I don't know if I will still watch it, but it's childish fun.

And now for novelties

  • Banshee - for a show I almost decided I did not like, it seems crazy that I watched all episodes so far. The basic premise is that a recently released inmate assumes the identity of a cop in a small town, where he has to battle local thugs, Serbian mobsters and the town's crime lord. The characters are just fun enough to enjoy, even if the story is totally implausible.
  • Bates Motel - A TV series based on Psycho. Haven't started watching the two episodes that aired so far.
  • Black Mirror - the second season of Black Mirror is here! Didn't watch it, yet, but probably will. There are three one hour British sci-fi stories with a moral per season.
  • Borealis - Weird pilot about a future where nations battle control over Arctic resources in a very covert way. The result, a frontier town Western set in the future, didn't convince anyone and therefore did not materialize into a series.
  • Broadchurch - Another small town cop thing? At least it is British, with David Tennant playing the main character (and cannibalizing some other former Doctor Who actors. It seems to have good production values, as well.
  • Cracked - Another Canadian cop production. Cracked follows the newly formed Psych Crimes Unit within a Canadian police department set up by a psychiatrist in partnership with the police.
  • Cult - the series centers on a journalist blogger and a production assistant, who investigate a series of mysterious disappearances that are linked to a popular television series named Cult. The bad guy is T-bag from Prison Break.
  • Do No Harm - A horrible attempt at a TV series, it features a surgeon that secretly has a split personality. A Jekyll and Hyde thing? No. Just a bad show. I removed it from my viewing list.
  • Girls - this is not a new show per se, but one I didn't watch until recently. It sounded like a smart Sex and the City, so I got around to check it out. It stars an incredibly ugly, stupid and self centred girl and three of her friends. One of them is really hot, but it couldn't save the show. Weird and ugly people that attempt to appear interesting. They are not.
  • Golden Boy - The series follows the successful, meteoric rise — from age 26 to 34 — of Walter Clark, an ambitious cop who becomes the youngest Police Commissioner in New York City history.So, yeah, a police drama again, but it seems more than the usual crap. We'll see.
  • House of Cards - I almost added a "want" status to this new series on the basis of Kevin Spacey being the lead actor alone. It is an adaptation of a previous BBC miniseries of the same name which is based on the novel by Michael Dobbs. This also lends support to the theory that the show is good. People that started watching it liked it, as well. So, all I need is to start watching it.
  • In the Flesh - Another zombie TV series! And it's British! What's even funnier is that the main character is a rehabilitated zombie Partially Deceased Syndrome sufferer. I didn't yet got "the bug" for it, but it might become a "want". I have watched two episodes so far.
  • Labyrinth - I don't know what to say about this show yet. John Hurt stars in it, it seems to involve a connection with the long lost Christian sect of Cathar and is a darma fantasy. People seem to like it well.
  • Mayday - the story of a missing May Queen teenager in a small English country village and the dirty secrets this brings up from the depths of its inhabitants. It's a British miniseries, but the viewer response has not been positive.
  • Metal Hurlant Chronicles - This is a low budget European sci-fi series based on the comic books with the same title. Only five episodes and probably there will not be a second season, but it was fun enough.
  • Monday Mornings - In the last post I was saying that I was in the mood for a good medical drama. This is it so far. Not so much medical, as ethical, though. The story revolves around the weekly meetings of all the surgeons in a prestigious hospital to discuss medical incidents. I like the actors and so far it has been a pretty solid story. A bit too melodramatic, but for an American medical drama, it's good.
  • Monsters vs. Aliens - this is a kiddie animation show based on the movie with the same name. After a mere 20 seconds of loud colourful characters smiling and talking maniacally, I stopped and deleted the file. Will not ever watch this.
  • Motive - Motive is a Canadian police procedural drama following working-class single-mom Detective Flynn (Lehman) in her investigation of crimes. Each episode also reveals the killers and victims at the start of the show, unusual in police procedural dramas. Haven't watched it yet.
  • Orphan Black - The first episode aired yesterday. It's a sci-fi drama, something to do with clones. I hope it will be good.
  • Privates - BBC One drama television series set in 1960 which follows the stories of eight privates who are part of the last intake of National Service, and their relationships with their officers and non-commissioned officers, civilian staff and families. Didn't start watching it, yet.
  • Red Widow - a housewife from Northern California whose husband, a figure in organized crime, was killed. She has to continue his work to protect her family. Don't know how good it is yet.
  • Rome - only two seasons in all, but it told a story from start to finish from the perspective of two friends, soldiers in the Roman legions. Great production values, great acting, loved the actors. At the end, even if it was a great show, I didn't feel like I was hooked and needed more, which is rare with TV series.
  • Scandal - an American political thriller television series created by Shonda Rhimes, of Grey's Anatomy fame. I fear the moment when I will present this to my wife and she might like it.
  • Seed - A comedy about a guy that donates sperm and finds himself cornered by the resulting offspring. Started badly, was clearly a cliché from the start.
  • The Americans - Set during the Cold War period in the 1980s, The Americans is the story of Elizabeth and Philip Jennings, two Soviet KGB officers posing as American citizens and a married couple. Another show waiting for my attention, but it stars Keri Russell, who I love, so I will probably watch it at some time.
  • The Blue Rose - a New Zealand crime drama television series about some lowly clerks who join forces to fight the corporate corruption that caused the death of one of their colleagues.
  • The Carrie Diaries - Wow! A TV shows based on King's horror story! Nope. It's the TV version of Sex and the City, with a teenage Carrie... the horror, the horror...
  • The Doctor Blake Mysteries - an Australian television series. Doctor Lucien Blake returns home to Ballarat in 1959 to take over his deceased father's general medical practice after an absence of 30 years. Doctor Blake is a keeper of secrets and a solver of mysteries. No data on the quality of the show yet.
  • The Following - a series about a psychopath obsessed with Poe's writings that creates a cult following of wannabe serial killers. Interesting premise and it stars Kevin Bacon, but it might fizzle.
  • Twisted - A teen with a troubled past reconnects with his two female best friends from childhood. He becomes the prime suspect when a fellow student is surprisingly found dead in her home. Didn't start watching it, but it doesn't sound great.
  • Utopia - a British conspiracy thriller that follows a small group of people who find themselves in possession of the manuscript sequel of a cult graphic novel called "The Utopia Experiments" which is rumoured to have predicted the worst disasters of the last century. This leads them to be targeted by an organisation known as 'The Network', which they must avoid to survive. Sounds interesting and has a high IMDb rating.
  • Vikings - a Canadian-Irish historical drama television series, inspired by the epic sagas about the raiding, trading, and exploring Norsemen of early medieval Scandinavia. It follows the exploits of the legendary Viking chieftain Ragnar Lodbrok and his crew and family. Sounds cool, but I didn't look at it, yet.
  • Wallander - I liked this British adaptation of a Swedish police drama. It stars Kenneth Branagh and is still placed in Sweden, even if spoken in English. It is as much a classical police inspector centred series as one can be, straightforward three seasons of three episodes each. Now, I can't say it was great, but me and the wife watched all nine episodes in about a week.
  • Star Wars - The Clone Wars (animated series) - I can't really give this a bad rating. If the show is made for children, then it's not really that awful: count Duqu and his Syth lords are being mischievous and evil, while Master Yoda and his Jedi are always kind and good. But that is what makes the show an awful experience for anyone over the age of 12. If you think about it, the movies were not that different from this, but they showed real intrigue, violence, tough choices, even grey characters like Darth Vader. While this show lasted for five seasons, there were only a few moments when they tried to show the evolution of Anakin Skywalker from a Jedi knight to a servant of the Syth, while the technology and thinking in this series was antiquated and childish. That made me stop after a season or so, I watched the last episode of the third season, didn't see an improvement and now it has been announced that the fifth season will be the last.

Tuesday, 19 March 2013

Wired for Love, by Stan Tatkin

book cover This book (complete title: Wired for Love - How Understanding Your Partner's Brain and Attachment Style Can Help You Defuse Conflict and Build a Secure Relationship) is a layman's terms summarizing of research done in the area of romantic relationships. Stan Tatkin is not the greatest psychologist ever, but he does a good job in writing this reference book. He lists ten principles that would help people retain their relationship and improve on it. Simple things like making eye contact, hugging till the other relaxes in your arms and fighting smart - for the couple, not against your partner, can make huge impact with little effort. Tatkin suggests that we are all untrained in this relationship crap and so he goes towards making a sort of abridged manual in how to proceed.

Now that I've said all those nice things about him, Tatkin is clearly not God in all matters relationshippy. He admits that the reason why he started the research was the fact that he went through a divorce. That must be especially jarring for a psychologist. Wasn't he supposed to know about people? What happened? He then proceeds fast pace to categorize people and tell them which parts of the brain and which bits of education made them like that and what to do in order to get to the "good" category. I particularly disliked that he branded people into three categories, then was obviously biased towards only one. That doesn't mean he is wrong and certainly when going for simple straight results you just have to put caution aside and go all in. But that's just it: this book is not THE solution, it's just a solution, one that felt right to Stan Tatkin, and so you must take it with a grain of salt.

The basic ideas of the book start from brain structure. We have parts of the brain that are wired for war, what he calls primitives, like the amygdala, who is responsible for the fast reactions that keep us alive. When we get into fights, for example, the amygdala gets excited and furiously fires neurons that prepare your body for a physical conflict. At this time other parts of the brain are more suited to assess the situation and define danger and behavior, parts he calls ambassadors, like the hippocampus. If we are too focused on our basic emotions, we start arguing and hurting the other in order for us, the individual, to come up top in the battle and miss important cues on how our partner feels and what are the correct measures to make the couple get through the situation. Tatkin makes the simple case that as long as we go through episodes where we fight for us and against our partners, this hurts, obviously, the relationship. The thing we should strive towards is the "couple bubble" (I know, terrible name) where both parties can feel protected and safe together with the other significant.

The author splits people into three categories. There is the island, which in childhood was not engaged by their parents, not hugged enough, they did not feel protected. They come out as individualists valuing their personal space and sensible to any close or intimate contact. They believe that as long as two people are self reliant and have a good life, they can have a good relationship without actually needing each other, only enjoying the company. There is the anchor, someone who was loved and engaged during childhood, with lots of attention and careful interaction with caregivers. They are balanced in their emotions, easily empathize with others and form natural couple bubbles, are fond of affection and close personal contact. And there are the waves, who oscillate between the two, alternatively needing affection and intimacy, only to run away when they receive it, for fear of being rejected or abandoned. From all three categories, the anchor is "the way", while the others something our childhood regretfully forced us to be. Thankfully, treating our partner right and being treated right back can change our affiliation.

Needless to say, I don't wholly agree with the guy. The categories feel arbitrary and unidimensional. Of course that restricting your metric restricts your vision of the world, but at the same time one can take this book as an advocate for a specific system. It is the job of others to find and validate others. This is what worked for Tatkin and so he shares it with the reader.

Here are the ten guiding principles of the book. For details, read the book. It's pretty short.
  1. Creating a couple bubble allows partners to keep each other safe and secure
  2. Partners can make love and avoid war when their primitives are put to ease
  3. Partners relate to one another primarily as anchors, islands or waves
  4. Partners who are experts on one another know how to please and soothe each other
  5. Partners with busy lives should create and use bedtime and morning rituals, as well as reunion rituals
  6. Partners should serve as the primary go-to people for one another
  7. Partners should prevent each other from being a third wheel when relating to outsiders
  8. Partners who want to stay together must learn to fight well
  9. Partners can rekindle their love at any time through eye contact
  10. Partners can minimize each other's stress and optimize each other's health

Conclusion: A book that can open eyes. One must be careful not to close them in other directions or look only this way. As I said earlier, it seemed as a theory based on a single dimension, the need to feel safe, with little bleedthrough in other areas. Some of the things in the book are so easy to do that not trying them to see if they work would be a shame. Also, whenever something feels too obvious, try to remember when (and if) you actually rationalized this before. Sometimes obvious things need to be said.

The Adobe KickStart Innovation Workshop

I have attended the Adobe KickStart Innovation Workshop, which is the latest Adobe attempt to increase innovation in the corporation. You see, having a pyramidal structure where the top instructs the bottom, stifles initiative and sucks the life out of people was not working for them anymore. In all likelihood the move was sparked by Adobe not being in the list of top 100 most innovative companies and they took that to heart.

That being said (in a mean spirited, ranty and spiteful way, of course) I really liked Mark Randall, the guy that introduced the concept. You see, he is a rather brilliant entrepreneur, almost hugely successful several times and certainly above most business people I know of, who uses the ideas of Lean startups to create companies that "change the world". He is also kind of funny, in that personally distant way that Americans often display, but still funny and smart. He is as far away from the classical corporate vision as he could be, as he advocated structures that self organize under the scrutiny, but lack of involvement of the management. In a sort of "If you build it, he will come" sort of way, he thinks that if you create a system that allows for everybody to win, then people will automatically use it, improve on it and make it work, without the need for suffocating oversight. And that is what the KickStart project entails.

There is a lot to say about this, including my ongoing efforts in it (the two day presentation was just the preparation for the actual work, which I must do for myself), but I will keep this to a minimum. It could be enough to say that I really liked the idea, even if I completely disliked the presentation video, with all the diversely ethnic people excited about the opportunity to rise from the dirt by the all enabling Adobe. In truth, I opened my big mouth again asked Mark why the video sucked so much and he said that it was made in a day with only the people that could come on short notice. So I guess the excited people were actually the excited ones.

Anyway, let me summarize the concept of KickStart. You go to this two day preparatory presentation with Mark Randal where he gives everybody a red box containing the blueprint for a business. He lists the six steps that one must take in order to get the blue box, which I guess is the symbol of success. One of the most important ideas that can be taken from this process is that you do not need to do any actual development of the idea in order to validate its success. You get the idea, you share it with people, ask for feedback of the people that would use and/or buy your product, improve the idea, prototype something fast, without anything in the background, and iterate through this until you have some sort of metric of success: is your idea good? Would people use it? Would they pay for it? After you have changed the idea to conform to the realities of business and the clients needs and after you have gained support behind the idea, only then you get to make the actual development. In other words: gather data as fast as you can on the interest people have in your idea before you actually get to work. It's based on science: gather data, make a hypothesis, test the hypothesis, iterate.

Now, what does KickStart mean in the context of the corporation? It means they give you 1000$ (on a card that is valid only for the duration of the workshop - one and a half months) that you can use to further your business (like buying a domain and hosting, advertising, research, etc) and they want you to do the work that validates the idea. The sixth step is convincing the Adobe executives that your idea is good and not only that, but in sync with Adobe's strategy and values. What strategy and values, you ask? I could not answer that, neither could Mark Randall. The example business plan that won the blue box in another workshop was some kind of online challenge based on photos that where connected by their GPS location. And even if this really aligns with the Photoshop+mobile+creativity Adobe thematic, he still got to change the idea until it became something more marketable. You also have to fight out of the blue concepts like "Adobe doesn't do hardware" or "Adobe doesn't do games". Who comes up with these? Executives. They don't have an anti-porn charter, but they assume it's common sense not to pitch your newest Creative Sexuality idea.

And here is the kicker (pun intended): if your idea does not pass, you have gained invaluable knowledge as an innovator and a possible entrepreneur. If your idea does pass, you gain more support to expand on it, under the corporation protective umbrella (insert Resident Evil jibe here). In fact, if you are hugely successful, the business belongs to Adobe, not to you. It only makes sense, since they supported you from the beginning. And if it works, who else to run it and earn the big bucks but you? so I don't see it as a big problem, but you have to be aware of it.

Last but not least is the question: Who the hell is Mark Randall? He is the guy that in the 90's could have revolutionized the video and photo industries with little gadgets that they did with heart and a lot of work. He and his best friend Paul worked their ass off for five years (and here I mean off! They lived in their offices, even if they had rented apartments to live in) until they reached from a garage shop the size of a company that was going to go public for 650 million $. I won't spoil the story that Mark himself tells during the initial presentation, but enough to say that the feeling and vibe of those days he is trying to kindle into others, to make them live the same wonder - if they chose to.

Meet Tyrion, my dog!

Picture of my puppy dog Meet my new puppy dog, Tyrion! The name is, of course, taken from A Song of Ice and Fire, where it is the name of a dwarf who is kind, intelligent and, when needed, ruthless. Of course, if it were a female puppy, she would have been named Arya.

The dog is a West Highland White Terrier, a breed that is known for a lot of sturdiness for their size, curiosity and intellect and also a strong personality which pushes them to claim leadership of the house, even over their owners. Even if the owners are assertive and consistent, only one of them is likely to be considered "leader of the pack", with the other a peer at max. He is supposed to be very stubborn.

That being said, Tyrion is a small lovable little puppy of only three months who so far liked every person that came into the house and was likewise liked in return. He seems to love us even if we do evil things to him like vaccinations or shouting at him when he poops all over the place. On the other hand, a Lannister always pays his debts, so you never know. In all fairness the vet warned us that he might need a few weeks to adjust to the house and learn to relieve himself in a single spot, but he is well on the way there. In only a week he learned to excrete on the Pampers like sheet we placed on the floor. More or less. Also, until we vaccinate him, he is not allowed outside, and that means he will stay indoors for at least another month.

And before you think I am in that "Ya gotta see the baby!" mood, let me tell you I am not. I am quite attached to the affectionate little fur ball, and he to me, but that's the extent of it. This is an informative post, just so you know why instead of blogging cool stuff, I put out puppy pictures.

Sunday, 17 March 2013

The chess learning problem

As I mentioned in previous posts, I've started a chess learning program with a professional, so I can increase my understanding of the game. I was tired of watching Dennis Monokroussos' videos and understanding little of them. Why was he able to breeze through openings and only start explaining from move 20 or so? Why are the chess masters that I watch on videos able to say "this cannot be taken because of..." followed by a four move scheme that makes obvious the mistake, but that I couldn't see it?

And so I got this Romanian dude, Catalin Carmaciu, as an instructor. He may be a bit off putting at first, as it seems he is willing to teach you for free and show you everything he knows, give you any material you ask for and even take time to analyse your games, with any sort of payment as your choice. So, if you don't like open generous guys who are also very smart, I don't recommend him. Otherwise, he is great! His chess site is in Romanian. Anyway, he looked at the deplorable state of my chess understanding and said "What do you want to do? Win games or learn to be better?" I said I wanted both, of course, as any decent Neo who would swallow both pills. Of course, it is not easy. You might want to ask about the difference between the two. Isn't it obvious that if you play the game better you will also win more games? What kind of choice is that? And the answer is that for winning games you acquire a repertoire of openings and defences which you learn and exercise repeatedly, while for playing better you read and exercise tactics and strategy books.

My first reaction was disappointment. Here there was this brilliant chess player telling me I had to mechanically learn a series of openings, while I wanted to understand the concept of chess as a whole. But I was wrong to feel that way. You see, since then we've decided on four openings: two defences for standard White openings (e4 and d4) and two replies to defences by Black to my opening with e4 (e5 and c5). While at first it seems you learn some moves in a mechanical way and your only advantage is previous knowledge of a situation that you set up, the reality of it is that you choose the setup and for each you have a long term plan! In the middle game and end game you have a clear vision of what you want, where the attack goes, where to hinder the enemy's movements and what are the triggers for each. It would have been easy to say "for any possible game, you must make a strategic plan before you play", but unless you know what you are doing, that plan would suck. So, while playing these apparently memorized openings, I've developed a practice and an understanding of strategic planning in chess. I have also found answers to other, less common, openings. For example White might move Nf3, but that prohibits me playing e5, so I go with the d5 plan which was originally designed to stop White's d4. And behold, White then plays d4, transposing into a standard d4 opening.

Wait a minute, you jump, but you said the other "learning branch" was the one where you learned tactics and strategy! It is true: strategic thinking is exercised in both situations, only the first is somehow more adult: you learn by doing. Oh, I do have some tactics books that I am looking through and some general strategy books that are supposed to be awesome, but until I find the time and disposition to focus on them and read carefully and understand what is written there, I have the option of playing chess and learning as I go.

Another thing about getting a chess instructor is that he isn't doing much. There is no magical method that he can wield that improves your chess. Instead he instructs you on what is good to do and you must do it. The effort is yours. The bonus comes from his filtering the chess materials so you get the ones that actually help you. The rest is up to you. After a week of playing, he may look at your chess games and quickly tell you where you went wrong, but they have to be your games.

One thing that my instructor is adamant about is not to use chess engines to analyse your games. That's right! He is telling a computer programmer to not use computer programs for chess. I know, a bit off putting, but he finally convinced me completely when he said that after a (simulated) rating of 2000 ELO, the computers don't move anything like a human. As a 2500 player himself, he cannot prepare for chess championships or games with other players by playing with a computer. His method of analysis is personal: take your game, think of what you thought when you made the moves, see what went wrong with your plans, see what better moves you could have done. It makes sense, after all, to not use computer programs to analyse your strategic plans, since they don't have any.

So, in order to summarize, my solution for learning to play better chess is to find the opening repertoire that you want to use for most chess games. You don't do that in order to trap the other into little known situations, as I did for a while, but in order to set up a game where you are aware of the strategic plans that you and your opponent are prone to use. In the end the order of the moves might be different, the situation may change one way or another, but as long as you follow the plan, you should be OK.

Tuesday, 12 March 2013

Filtered Indexes in Microsoft Transact SQL 2008

I had this case today when I had to add a new column to a table with a gazillion rows and also create an index on this column. In my mind, having a column with NULL values would make the creation of the index instantaneous. I was wrong! In order to create the index, the SQL engine still scans all the rows and for tables with a lot of rows it takes a long while. But it felt really stupid. I knew that the column was filled with NULL values, I didn't need the computing of any index when I create it, instead only on INSERT/UPDATE/DELETE operations. So I started to look into solutions.

Enter filtered indexes! In Microsoft SQL Server 2008 an option for filters on indexes was introduced. The index must not be clustered and the definition it just the same as before, only with a WHERE clause that applies the filter. This seems to be the right solution to my scenario.

In order to test this I created a table called Test with two columns, a and b, both nvarchar(255). I filled the table with ten million rows having values for a and no values for b. Then I created an index on b; it took about 30 seconds. Then I created an index on a; it took 50 seconds. I removed the indexes and created a filtered index on b on the condition that b is not null. The operation was instantaneous. Success!
And here are the actual operations with more exact values (check out the comments for extra SQL tips on speed):
CREATE TABLE Test(a NVARCHAR(255),b NVARCHAR(255))

DECLARE @i INT = 625000 -- ten million divided by 16

BEGIN TRAN -- if not using a transaction, SQL will create a transaction per insert!

WHILE @i>0
BEGIN

SET @i=@i-1
INSERT INTO Test(a) VALUES(CAST(@i AS NVARCHAR(255)))

END

COMMIT TRAN -- 625000 rows with a filled and b empty [8 seconds]

-- insert selects are a lot faster than the while above
INSERT INTO Test(a)
SELECT a+'x1' FROM Test -- 1250000 total rows [3 seconds to create another 625000 rows]

INSERT INTO Test(a)
SELECT a+'x2' FROM Test -- 2500000 total rows [7 seconds]

INSERT INTO Test(a)
SELECT a+'x3' FROM Test -- 5000000 total rows [18 seconds]

INSERT INTO Test(a)
SELECT a+'x4' FROM Test -- 10000000 total rows [46 seconds]

CREATE INDEX IXa ON Test(a) -- [27 seconds]

DROP INDEX IXa ON Test

CREATE INDEX IXb ON Test(b) -- [25 seconds, approximately the same]

DROP INDEX IXb ON Test

CREATE INDEX IXa ON Test(a) -- there are no null values in the a column [56 seconds, double for a filtered index with a useless filter]
WHERE a IS NOT NULL

DROP INDEX IXa ON Test

CREATE INDEX IXb ON Test(b) -- [0 seconds - instant!]
WHERE b IS NOT NULL

A lot of good things can come from using filtered indexes, like for example a unique index on non-null values (which was pretty much a pain in the ass to do otherwise), but there are also gotchas. One of the things you have to watch out for is using filtered indexes on numeric columns. In this case the SET ARITHABORT ON command must be used (or insure in some other way that the option is on for all SQL sessions - SQL Management Studio and code both!, otherwise errors might occur or the index might be ignored. Also there seem to be some bugs that have not been addressed even in SQL 2012, like when using MERGE or when using filtered indexes on column being or not being null.

An more detailed article on this feature can be found here: SQL University: Advanced Indexing – Filtered Indexes.