Friday 31 August 2012

Ship of Fools, by Richard Paul Russo

Book cover Ship of Fools is a sci-fi book written by Richard Paul Russo. It reads a lot like a journal, written in the first person, with little (or badly evoked) emotional involvement or dynamic action. Add to this that the main character is called Bartolomeo and he is on board of a ship with no history and going nowhere in particular, where there is always a struggle between the captain and the bishop and the people of the lower class, and you kind of get the impression you are reading a Spanish crewman ship log adapted to science fiction. The low focus on technology and the way people are thinking and acting increases the feeling that this is something futuristic only by accident, and the reality of it is some feudal world, only milder than one would expect those dark times to have been. Somewhere in the second half of the book the plot veers slightly towards Event Horizon, an opportunity to make some biblical references. Even then, the book is written in the same linear and descriptive way, despite being in the first person.

The title comes from a long existing concept in Western literature, usually depicting a bunch of ridiculous people travelling together, but without an aim, and also characterizing the society from which they came as a whole. However, the book doesn't really feel like a satire and the fact that it won the Philip K. Dick award in 2001 makes me think that maybe I missed something.

Bottom line: An interesting subject, but approached in a manner that I did not enjoy very much. I could empathize with the main character, but only to a point. When actual technical decisions were made, I thought everybody was kind of stupid. Luckily enough, it is not part of any series, it is a standalone book.

Thursday 30 August 2012

The myth of the almighty inline style in HTML

To my shame, I've lived a long time with the impression that for an HTML element, a style attribute that is written inline always beats any of the CSS rules that apply to that element. That is a fallacy. Here is an example:
<style>
div {
width:100px;
height:100px;
background-color:blue !important;
}
</style>
<div style="background-color:red;"></div>
What do you think the div's color will be? Based on my long standing illusion, the div should be red, as it has that color defined inline, in the style attribute. But that is wrong, the !important keyword forces the CSS rule over the inline styling. The square will actually be blue! And it is not some new implementation branch for non-Internet Explorer browsers, either. It works consistently on all browsers.

Now, you might think that this is some information you absorb, but doesn't really matter. Well, it does. Let me enhance that example and change the width of the div, using the same !important trick:
<style>
div {
width:100px !important;
height:100px;
background-color:blue !important;
}
</style>
<div style="background-color:red;"></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
$(function() {
// $('div').width(200); // the width remains 100!
// $('div').width('200px'); // the width remains 100!
// $('div')[0].style.width='200px'; // the width remains 100!

// $('div').width('200px !important'); //this is not a valid value for the width parameter! in IE it will even show an error
// $('div').css('width','200px !important'); //this is not a valid value for the width parameter! in IE it will even show an error
// $('div')[0].style.width='200px !important'; //this is not a valid value for the width parameter! in IE it will even show an error

var oldStyle=$('div').attr('style')||'';
$('div').attr('style',oldStyle+';width: 200px !important'); // this is the only thing I found to be working!

});
</script>
As you can notice, the might jQuery failed, setting the width property in style failed, the only solution was to add a string to the style tag and override the !important keyword from the CSS with an inline !important keyword!

Update (via Dan Popa): And here is why it happens: CSS Specificity

Dilbert

I've heard about Dilbert as this corporate satire comic that is very funny. I've avoided it as much as possible, probably because I was afraid it would make fun of my way of life and find it makes valid points. Today, I succumbed to my curiosity and clicked a YouTube Dilbert video.



Conclusion: I am Dilbert...

Monday 27 August 2012

Neil Armstrong is dead.

Apparently it is the week of eulogies on my blog. Neil Armstrong died on August the 25th. You may remember him: he was the guy that first stepped on the Moon. I didn't know the guy, other people say he was inspiring, a great person and other things like that. A good emotional blog post you can read at the Bad Astronomy site.

But I think that his death, at 82 years of age, is less relevant than the fact we stopped going to the Moon. From the dirty dozen that walked on a space body other than Earth, only 8 remain alive and they are, without exception, born in the early 1930s, so all around 80 years old. Depending on many factors that usually cancel out, these people have around a decade of life left in them, so expect that in 10 years or less we will have no man on Earth that went anywhere else. The death of the last man to have walked on the Moon would be even sadder than Neil's.

That's not only romantically ugly, emotionally wrong, it is plain stupid. It's like we close our senses, humanity as a whole, to the options we have, to the alternatives laid out right in front of us. We act like those retarded tourists that go to an exotic location only once in their life and they return with "Meh! No one spoke English, I didn't have the guts to try the food and the service was crap". Forget the accounting bottom lines and the terribilistic "We gotta stop putting our eggs in a single basket", just think that in a few years we, as the human race, we'll have forgotten what it is like to step on the Moon, the experience gone from our collective memory. We will just sit there, on the bloody couch, counting our money and looking at the picture of the imprint of Neil Amstrong's foot, a simple postcard to replace memories lost.

Sunday 26 August 2012

Blindsight, by Peter Watts

Yes! Another good sci-fi book. Blindsight is a hard science fiction standalone novel in which, using the idea of contact with an impossibly alien species as a pretext, Peter Watts discusses hard subjects like the future of humanity and its very definition, the nature of conciousness and the difference between intelligence and self awareness. It also features vampires (ugh!), but with a good scientific background and true relation to the plot.

There is no romance in this bleak and autopsic book, where the essence of all the characters gets dissected to complete the tableau of the human race under cold fluorescent lighting. Good stuff! But one gets to expect this from Canadian writers, eh? :)

The other cool reason why you should read the book is that it is free at Watts' site: Blindsight. Enjoy!

Tony Scott died

Of course that when an international celebrity, a man who touched the lives of many, a loved friend and movie person dies, I make it all about me. But you see, I can't not feel guilty, as I believe I am at to blame for Tony Scott's death.

I have long known that I am part of the long tail, that part of humanity that is forever ignored and shunned as a bunch of individually strange mutants with odd tastes that can't appreciate the world and can't be appreciated by the majority of other homo sapiens (or even each other). But it goes much farther and creepier than this.

When I like a restaurant or bar, it closes down immediately. If I think a particular location is quaint and pleasant it is immediately assaulted and raped by supermarket and hotel chains. If I enjoy using a line of bus or tramway, it gets redirected or work starts on it and never ends. If I like a movie, it never gets sequels (or prequels or parallel stories or spin-offs or any kind of remake). If I like a TV series, it promptly gets cancelled, sometimes in mid season even when the rest of the episodes have already been filmed and montaged. And, of course, if I like an actor or a director, they die. It is a fact of life. I liked Tony Scott, I enjoyed his creations, so he had to die.

Funny thing is, I've enjoyed Scott's movie creations without caring that he did the work, Top Gun, Beverly Hills Cop II, Days of Thunder, The Last Boyscout, Enemy of the State, to name a few. I only noticed him in TV series, having worked together with his brother Ridley on some of the best shows there are out there. Even if the plot was about the usual stuff, like police procedure or lawyers or whatever, the shows always had that human dimension that made you feel like you are watching real people living their life. Numb3rs and The Good Wife enter this category. And I said "Tony and Ridley Scott make the best TV shows!". That was my mistake and now Tony is dead.

"Why Tony?", you may ask. There is an answer to this, too. I really, really, really hated what Ridley Scott did to Prometheus, thus ensuring a healthy and long lived franchise and dooming poor Tony.

Now, about Tony Scott and the feelings that his work and his death evoked to normal people, even if I knew anything about it, I couldn't write it better than the guys at The Horror Club. Sorry M'Hael, it was me!

The Legacy of Heorot, by Larry Niven, Jerry Pournelle, and Steven Barnes

The Legacy of Heorot is a good sci-fi book, part of yet another trilogy: Heorot, written by no less than three authors: Larry Niven, Jerry Pournelle, and Steven Barnes. You've heard of Niven by way of Ringworld, the others are no first time writers either, but I have frankly never heard of them.

The book is about a colony of people on the fourth planet of Tau Ceti. They call it Avalon and the colony Camelot, declaring their ideal of an honest equalist society that has the good of the people at heart. But of course, as the title of the series suggests, the plot moves towards the story of Beowulf rather than any round table. In face of doom and disaster, people tend to go through standard phases, starting with denial, while any façade of equality and reason quickly crumbles.

And this above paragraph pretty much details the subject of the book as well as the reason why I was partly disappointed with it. I was afraid that the story would be yet another actualization of the myth of Beowulf, which would have bored me to hell, but it wasn't. Yet it wasn't really a strong psychological or social commentary either. More of an optimistic view of the first human interstellar colony. Like any government or corporation would spend a whole lot of money on a space ship, in order to send it to another planet and then made it a present to the crew of the ship, fire and forget like. (See how I start and finish sentences with "like", I'm pretty rad, huh?) And all the people there, selected by a well designed process, would be nice and intelligent and having no social pathology at all.

But the book is nice enough, regardless of my bleak and neurotic projections. It focuses on the planet's (very simple) ecology and the way the colonists interact with each other and fight for their prize. They have colonized a small island in order to minimize threats, but there is a huge unexplored continent waiting for them, therefore the trilogy. It was nice, though, that the first book is rather standalone. If you choose to read it and you do not want to continue the series, there is no hook at the end, it just satisfactorily finishes all that was started.

Blood and Magic, by Lena Austin

I was searching for horror books and I tried this list from a book site. Little did I know that the asshole that wrote the list had a vampire fetish and so he listed all the books with vampires that he ever read.

Blood and Magic, by Lena Austin, is not a horror book, it's an adult fantasy book where sexy vampire bitches have sex with magical and well endowed unicorns. That should say enough about the book, and yet I have read it. It was easy to read, being a short single threaded narrative that had the only purpose of getting the main character (said red headed vampire girl) well fucked, respected and pretty much anything she wanted. I am sure sometime in the future will be discovering that she is also a princess of sorts.

This ends my review.

Impressions from Obzor, Bulgaria

I've just returned from a holiday spent in the lovely Bulgarian town called Obzor. At least other people say it's lovely, I thought it was full of them (people, I mean) which would explain both their assessment and mine. Anyway, my wife and I stayed at this hotel called The Cliff and spent 8 days together celebrating her birthday and 10 years of marriage. Happy birthday, love! These are my impressions of the journey.

First we had to get there and there are two major routes from Bucharest to Obzor: through Ruse and across Bulgaria and through Durankulak, after driving on the newly constructed A2 highway in Romania (the digit two coming from the fact that we only have two highways at the moment and this is the second). We went via Ruse and returned on the highway, with similar time results and positive feelings. The GPS did it again and chose a more scenic route running through small villages like, for example, Sindel. I shouted "Fatality!" when we exited the village, to my wife's dismay. Even so, it was a good quality road, which in Romania you rarely see in small rural areas and we enjoyed the wilderness.

Ok, we got there. The Cliff hotel is located just outside Obzor and is a four star hotel. That means... at the moment I have no idea what it means, I just assumed it would be way better than a three star hotel, but it appears it is about the same, only with a pool and a lot more expensive. Actually, I want to spend some time discussing The Cliff. It is one of those hotels that have so much potential and yet the experience is being spoiled by little details which I suspect are the fault of greedy little owners not understanding that they are serving people, that's their job, not just owning stuff and getting richer.

About The Cliff hotel in Obzor, BulgariaThe hotel is situated on a cliff (surprise!) and is in fact a complex of buildings having a system of interconnected pools at the center. The buildings are nice and the pool almost great. Imagine this medium sized pool that has between 1.3 and 1.7 meters in depth, that connects to a smaller one via a jumping point which doubles as a waterfall. Then a small canal takes the water to an even smaller pool, designed for small children. Somewhere in the middle of the meandering canal there is a small jacuzzi. This pool alone and the way it looked make The Cliff a beautiful hotel. One can get to a rather isolated part of the beach via a long set of stairs or by going with the car in Obzor. A taxi can be employed, charging the enormous sum of 10 leva for a 2-3km run, or one could walk the same way.

The beach is one of those great fine sand beaches, only there are some unexpected rocks further into the water. This freaked me out a little, as I was starting to swim and I found myself hugging a gigantic boulder. The rock was covered with algae, not with razor sharp shells, so it was more of a psychological shock. I suppose that makes that part of the beach so remote and isolated. We didn't even try the commercial part of the beach because of all the people, the noise and the fact that we had a perfectly fine chlorinated pool inside the hotel! I didn't have to suffer floating garbage, stinging eyes or the smell of decaying algae and seashells, which other people find so endearing. I don't know about that, wouldn't the same effect be obtained with a bit of garbage in a salt shaker? But returning to the subject of the beach, can you imagine that 10-20m from the edge of the sea, the depth was still around my waist?

So, The Cliff is a beautiful hotel, isolated, with few people and a great pool. What could possibly go wrong? Everything else, of course.

The staff had almost no knowledge of English or Romanian, except maybe some of the folks at the reception. Even so, the others were morose unhappy people that kind of drifted, like some ghosts from The Shining. The reservation included free breakfast and my wife tried to drink the coffee, only to notice it was instant coffee. She asked for an espresso and was told she had to go to the bar and buy one.

Nobody can stand between my wife and her coffee! Civilisations rise and fall when she gets angry. I am an engineer, I can easily find what is the weakest point in a system and make it break, but she is the destroyer of worlds! She is like a cute sexy Dalek. She exterminates anything standing in the way of her daily coffee.

Also the prices from the restaurant were impossible for the quality of the food. I had to pay 25 leva for 5 shrimps in a plate. For the same amount of money I get a full platter of all kind of seafood at the Regina Maria hotel in Balchik, around 80 kilometres above Obzor. (BTW, I can't recommend that hotel enough, also four stars, but one feels good there).

The room had a TV, an old AllView with only 20 total channels that showed anything 10 seconds after you turned it on. That's OK, since we could only get 15 channels anyway with only BBC World in English and the rest in Bulgarian. Two of those were music televisions, but one had horrible audio and both had horrible music. Seriously, Romanian music television is no bastion of good taste, but that was utter crap. There was wireless Internet, only it only worked when not many people were using it and was slow as hell when it did work. We had air conditioning, but the windows could not open, just the main balcony door. There was easy access from other balconies and even from the hotel stair to our balcony so, in the interest of personal security, we had to choose between torpid fresh air and insects and no security or cool air conditioned stale air in a little safe cocoon. The bath was big and had these retro looking finishes, only they went too far. The bath curtain bar was rusted and stained all towels placed on it and the shower head was like a gardening implement with small pressured water jets that hurt rather than cleaned. The insect repellent smell of the bath went away in about three days.

The hotel also had a spa. That included massages with expensive cosmetics, colon cleansing, sauna, etc. The prices were huge, though. Imagine that you had to pay 80 leva for an hour of massage. What bothered me even more is that, after two days, a "promotional" price list was left under our door. They took 25% off some of the procedures. So if you are stupid enough to pay from the first two days, no promotion for you. So you go to a hotel with spa, you pay 80 euros a double room per day and then they tell you the prices are different for any spa procedure so they don't offer you any in the price of the room.

Now, all the hotels have those little annoying cards that double as keys. You have to place them in a slot in order to have electric current. So you can't charge your devices or leave the air conditioning on while you go to sun tan next to the pool. Unless you have a different, similarly shaped card, which I had, the only possible use for those spammy fidelity cards you get at various medical or shopping facilities. But that's like a general rule when going on holiday: always have a standard shaped card to leave in the electric current slot in the hotel.

To summarize: if they bought a little more Internet bandwidth, paid for satellite TV and upgraded the TVs in the room, made some sort of window that you can open without letting everyone in and, above all, didn't think to rip you off at every opportunity, the hotel would have been great! Instead, it felt like a below average overpriced tourist trap.

We also had an unexpected surprise from them. You see, in order to book a room there, you authorize them to take half of the staying sum from your account. For all practical purposes you pay that sum. You then go to the hotel and pay the rest of the sum. Then, they take the sum you authorized them to take when making the reservation, then the rest of the sum, then they "unblock" the authorized sum when you leave the hotel. That means you pay 1.5 times the actual sum until the original half is returned to you. We left on Sunday, and we were kind of... disconcerted... when we noticed a negative balance on our purely debit card. So take that into account (sorry for the pun).

Getting back. A few hundred meters below The Cliff there is the yooBulgaria resort. One could probably go over the Net, find this hotel and choose it, just like we did with The Cliff, to spend their holidays. We went there. It looked nice, but the entire hotel was surrounded by abandoned buildings, victims of the economic crisis in times of great investment in the tourism business in Bulgaria. Seriously, it looked like the hotel was the lucky building that survived a full aerial bombardment of the entire zone. I am talking about empty concrete scaffolds with graffiti on them. Horror movies and parkour videos could be made there.

The town of Obzor was actually a village till 1984. Then it was promoted and then the Communist era ended and the tourism took hold. As a result it is a combination of greedy tourist corporations, small family owned businesses and a tourism oriented management.

We searched the Internet on the best restaurants there and we found: "Starata Kushta", recommended by three different sites that had the same text in them. We couldn't find this restaurant and so we went to recommendation number two: the Tania restaurant. It is a nice little thing, but rather expensive. The guy recommended the pizza there; he probably never went to Romania. Their pizza is mediocre at best. Try the fish things, but do not, under any circumstances, ask for sauces. They are horrible. Then we tried our luck with what was there (and this is my recommendation for anyone visiting Obzor: try your luck, eventually you will find something you will like) and found Morska Perla, or the Sea Pearl. There was this deliciously looking waitress there. We were, of course, served by the old ugly one that didn't know English. The fish was OK, the prices reasonable, but they had this apricot brandy that was really something. We also tried Dionisi, right next to Tania. The pizza in Tania was about 14 leva and rather small. The one at Dionisi was the same size and 4.5 leva. Unfortunately you paid for what you got: pizza from supermarket dough and some cheap stuff sprinkled over. The spaghetti were floating in oil.

The last restaurant I want to mention was almost great: it's called Rai (Heaven) and it is also located around Tania, about 500 meters from it. They have this Rai Calamari dish that has 500 grams and costs 27 leva. I thought it sounded OK, but I really expected some piece of fried cephalopod and instead got a squid filled with a mix of onions, oyster and small shrimp and served with four jumbo shrimps. So, even if the menu didn't advertise it (bad for them) the dish was actually a seafood plateau, something I had been searching for unsuccessfully in Obzor and went up to Balchik to have at Regina Maria (did I mention the hotel and the restaurant are great? They have sushi!)

The only problem with Obzor restaurants and bars is that they don't have dark beer. None of them! I also asked for lemonade and none of them had any! It's water with lemon and something sweet, for crying out loud... I drank a lot of Grozdova Rakia (grape brandy), a Bulgarian speciality, and Kamenitsa, their beer.

That's about it. We visited close by Nesebar, which is nice, but filled with tourists. There was a cool restaurant there, called Hemingway. Not in any way connected to the writer, but good food. We never got to Burgas and we only passed through Varna a few times. Bottom line: Obzor is a nice see side town, but I wouldn't want to be housed in that cacophony of noises, music and smells. The Cliff was a good option, remote as it was, although the sounds from Obzor occasionally made their way there, as well, but it had its flaws.

Wednesday 15 August 2012

The Strain, by Guillermo del Toro and Chuck Hogan

One of the vampires kindly posed for us before eating the photographerYes, it's that Guillermo del Toro and he wrote a book, together with this Chuck Hogan dude. Actually he wrote more books, this is part one of the Strain trilogy which, judging by the name, should have been about either a contagion or some sort of pulled muscle, but instead is about vampires.

Now, I don't want to be mean towards poor Guillermo. Vampires, even if really overdone nowadays, are pretty cool. The ones in the book are not even sparkling or talking with a Russian accent, but are vicious creatures that have in mind only one thing: to feed. That makes them the more believable type of vampire, although the technical details that are trying to explain in scientific terms the process of vampirification are complete rubbish.

The book is about a contagion of sort, that of vampirism. A "master" comes in New York (where the hell else), wreaking havoc and turning everybody to vampires. They even say this type of vampire is a virus incarnate, although the analogy gets a little strained (get it?). An old Jew is the only one who knows what vampires truly are and how to fight them and he teams up with this New Yorker epidemiologist (and later a pest control rat hunter second generation Russian) in order to fight this asshole vampire.

This melange of different cultures gives opportunity to talk about the Holocaust and 9/11 and even Romania, all at the same time! The writers shamelessly abuse this without actually connecting these facts with the story in any significant way. That bothered me. I understand people can become a little obsessive over things like this, but what kind of a jerk keeps using them to further their careers and books? Anyway, before turning this into another "stop using Hitler, the Holocaust and 9/11 as arguments" extension of the Godwin law, let's get on with the book.

The writing itself is not bad. The only things that kept me getting out of the atmosphere of the book (except the shamelessness above) were some of the emotional background stories used to describe the beginning of the infestation. I would blame that on me, though, as I am often prone to get annoyed by the feelings of others, especially when they get in the way of a good storyline.

Being a trilogy, the book doesn't really end at The Strain. It's just a broken shard of a whole story. You get some hints on what would happen and also some of the arches are closed by the end of the book, so it isn't completely annoying.

Bottom line: Hmm, it was good, not really a masterpiece. It reads like a movie, with a simple almost linear plot. The thing is that, even if it managed to convey the terror of such an occurrence in general, it didn't really evoke in me feelings of horror or at least some empathy with characters that feel that horror, and that is what I was looking for. I've read the book in under a week, but I am not really prepared to spend another two reading the continuation.

Friday 10 August 2012

How to force a browser render on elements in Internet Explorer (and other browsers as well)

I know of this method from the good old Internet Explorer 6 days. In order to force the browser to redraw an element, solving weird browser refresh issues, change it's css class. I usually go for element.className+='';. So you see, you don't have to actually change it. Sometimes you need to do this after a bit of code has been executed, so put it all in a setTimeout.

More explicitly, I was trying to solve this weird bug where using jQuery slideUp/slideDown I would get some elements in Internet Explorer 8 to disregard some CSS rules. Mainly the header of a collapsible panel would suddenly and intermittently seem to lose a margin-bottom: 18px !important; rule. In order to fix this instead of panel.slideUp(); I used
panel.slideUp(400/*the default value*/,function() { 
setTimeout(function() {
header.each(function(){
this.className+='';
});
},1);
});
where panel is the collapsible part and header is the clickable part. Same for slideDown.

Do not remove the element having focus in Internet Explorer 9!

I had to fix this weird bug today, where only in IE9 the entire page would freeze suddenly. The only way to get anything done was to select some text or scroll a scrollable area. I was creating an input text field, then, when pressing enter, I would do something with the value and remove the element.

It appears that in Internet Explorer 9 it is wrong to remove the element that holds the focus. Use window.focus(); before you do that.

The perils of instanceof in Javascript

I was having one of those Internet Explorer moments in Javascript, when I wanted to use Array.isArray and I couldn't because it was IE8. So, I thought, I would create my own isArray function and attach it to Array, so that it works cross browser. The issue now was how do I detect if an object in Javascript is an Array.

The instanceOf operator came to mind immediately. After all, don't you do the same thing in C#, compare if an object "is" something? Luckily for me, I checked the Internet and reached the faithful StackOverflow with an answer. The interesting bit was explaining why instanceOf would not work for all cases and that is that objects that cross the frame boundaries have their own version of class.

Let's say that you have two pages and one if having the other in an iframe. Let's call them innovatively testParent and testChild. If you create an array instance in testChild like x=new Array(); or x=[];, then the result of x instanceOf Array will be true in testChild, but false in testParent. That's because the Array in one page is different from Array in the other. And, damn it, it makes sense, too. Imagine you did what I did and added a function to the Array class. Would that class be the same as the Array in the iframe, without the function? What if I decide to add
Array.prototype.indexOf?

So, bottom line: in Javascript, instanceOf will not work in any meaningful way across frame boundaries.

Oh, and just so you do have a good way to check if an object is and array, do this:
var strArray=Object.prototype.toString(new Array());
Array.isArray=function(obj) {
return Object.prototype.toString(obj)==strArray;
}

Tuesday 7 August 2012

That's the way the world works

I am linking four news items. Do you see the connection?
Standard Chartered accused of over $250bn of illegal transactions to Iran
Kim Dotcom judge rules mansion raid was illegal
Gary McKinnon extradition decision delayed until October
TV Shack founder loses round in extradition battle


So let me break this down for you. A British bank is accused of dealing with Iran, against the American embargo laws, to the sum of 250 billion $. It risks losing its licence to operate in the state of New York.

Kim Dotcom, the mega rich founder of MegaUpload, site used almost exclusively to store and share copyrighted material. There are emails of the employees and his detailing the ways they were sharing links to stuff they knew were copyrighted. The New Zealand government raided their offices, arrested him, prepared him for extradition to the US. He was released on bail and the link above explains how the raid was found to be illegal.

Gary McKinnon, a hacker looking for evidence of the US government suppressing information about UFOs and free energy in their military servers, is fighting against extradition to the US. He did minimal damage, and that according to his accusers (McKinnon denied it), he didn't leak the information, he just snooped. The link above shows he is not being extradited yet as the UK home secretary is busy with the Olympic events. If convicted in the US, he is facing up to 70 years of jail. The problem the US government seems most damaging seems to be the bloated cost of 700000$ to "track and correct" the problems McKinnon allegedly caused. In other words, they want him to pay their security costs.

Richard O'Dwyer has hosted links to copyrighted material (not the materials themselves) on UK servers, where such linking is legal (or may be, the discussion rages on). No matter, he is awaiting extradition to the US, where such practices are apparently illegal. The link above shows he lost the first battle against extradition. If convicted in the US, he is facing up to 10 years of jail.

Now do you see the connection? The smaller you are, the larger the punishment. The deed is irrelevant (especially in Great Britain - not so great now, eh?) as well as any national laws when the US is involved. Frankly, I was expecting something like this from my own government, a ridiculous joke that sways whatever way the other nations say, but not from the UK. Canada almost has the same problem, but there the citizens actually rise up against American influence.

Monday 6 August 2012

House of Leaves, by Mark Z. Danielewski

It is hard to describe House of Leaves in relation to any other I have read before. It is clearly a masterpiece, a mad foray into personal darkness and schizophrenia, maybe Mark Z. Danielewski's (it is certainly difficult to imagine a non-extraordinary person writing this).

What is it about? At the surface, it involves a guy that works in a tattoo parlor finding some old papers in the apartment of a blind old man and getting obsessed by them. You see, this old man has written an extensive analysis of a house made movie than was released to critical acclaim and that was viewed and analysed by a lot of others. Only the film does not exist, the references are mostly bogus and the people that happen to be real deny any connection with this fictitious film.

Now, the old man, Zampano, has died in a house that was sealed from the outside, with various implements used to cover every open bit from the door and windows. Now Truant, the tattoo guy, is reading the Zampano papers and starts to get similarly affected, being overwhelmed by a subtle horror emanating from the old man's writing.

The film itself is about a guy, Navidson, a famous international photographer, who decides to move with his family to a new house, a gesture of healing and reconnection, as his job often took him away from his wife and two children. This house, though, has a secret. Suddenly, there is a corridor in one of the walls of the house. It is terrifying through his deep black color and the fact that the wall is an exterior wall and no evidence of its space is visible from outside. More than that, the corridor twists randomly and seems to go forever, even changing configuration.

These are not the only dimensions of the book. Indeed, the fact that a terrifying hole in a wall exists in their family home terrifies the wife, who forbids anyone going in there, under the threat of leaving. Navidson, though, an explorer and a man dedicated to committing the world to photo and film, feels the need to explore it. The very house that was supposed to bring the family together, breaks it apart.

Zampano's notes are comprehensive, academic, with references from linguistics, physics, philosophy, psychology and literature. They contain numerous quotes from documents and books written about the film. The notes have a lot of footnotes, that contain not only more details about the analysis, but personal ideas and emotional outbursts.

Now, Truant is not really a scholar, but he transcribes all of Zampano's work and adds his own notes, together with the story of the document and bits of his personal life. He does drugs, goes clubbing and has a lot of sex, all while obsessing over his bosses girlfriend. But it is not enough to switch him from his transcribing work and the dark effects this has on him.

And that's not all, either. At one time a foot note describes Truant going into a random bar and hearing a band singing about something in Zampano's notes. He asks the members of the band and they show him the published version of the House of Leaves, by Zampano, annotated by Johnny Truant. Truant starts seeing more and more horrible versions of his own life, only to switch back to reality and not be sure which is which.

The book itself is written in 3 different colors, emphasizing Truant's and Zampano's notes. The references are often insane, hyperanalysing a single quote or sequence of the film through analogies with psychological complexes, Latin quotes and mathematical analysis of sound when it echoes. The notes often end abruptly and continue with Truant's story that itself ends with no discernible pattern.

However, the story somehow remains cohesive and the feelings of alienation and unspeakable, more: undefinable, horror transpire through the book. The early Truant drug trips go further in defining this weird combination of Lovecraft, Kafka and Philip. K. Dick.

Bottom line: this book is as brilliant as it is insane. I have never read a book like it and I can only bow to the immense effort of constructing it. It is itself like a dark corridor, ever shifting, and totally gigantic. You should read it.

Be forewarned, though, this is ergodic literature. To truly understand it, you need to read it on paper or in PDF form; OCR doesn't really work on this book and various rtf, doc, html versions you might find are probably close to unreadable.

Friday 3 August 2012

Updating a T-SQL table from rows in the same table

I had to do a very simple Microsoft SQL query in which I wanted to update some of the values in a row from a row in the same table. Actually, the query was already there, but was using two local variables to store the information, then make the update. Something like this:
DECLARE @Var1 INT
DECLARE @Var2 INT
SELECT @Var1=Column1,@Var2=Column2 FROM MyTable WHERE ID=1
UPDATE MyTable SET Column1=@Var1,Column2=@Var2 WHERE ID=2
I really hated that I was using two SQL statements and all that declaring to do a simple update, so I looked up the syntax for the UPDATE statement. It said that if I want to update a table from a source I need to use the FROM keyword, like this:
UPDATE MyTable 
SET Column1=Alias.Column1,Column2=Alias.Column2
FROM MyOtherTable AS Alias
WHERE ID=2
AND Alias.ID=1
As you can see, we use an alias to name another table or query, we use the Alias name for all the conditions for that table and nothing for the conditions on the table we update. Easy, no? I even tested it and it worked. So I tried this:
UPDATE MyTable 
SET Column1=Alias.Column1,Column2=Alias.Column2
FROM MyTable AS Alias
WHERE ID=2
AND Alias.ID=1
I used the same table to update and to alias and it seemed to work. However, the number of updated columns was always 0. Remarkable how difficult it is to find on the net a straight answer about a simple situation like this.

It turns out that even with the alias, MSSql is confusing some things. The solution is to use a query from your table, rather than the name of the table itself. Here is how you do it:
UPDATE MyTable 
SET Column1=Alias.Column1,Column2=Alias.Column2
FROM (SELECT * FROM MyTable) AS Alias
WHERE ID=2
AND Alias.ID=1


SQL 2005 also introduced Common Table Expressions, which can be used to clarify a query. In this case, using a CTE results in the same execution plan and makes the entire query even more convoluted:
WITH Alias(Column1,Column2)
AS (
SELECT Column1, Column2 FROM MyTable
)
UPDATE MyTable
SET Column1=Alias.Column1,Column2=Alias.Column2
FROM Alias
WHERE ID=2
AND Alias.ID=1

Even if the documentation says you can specify a CTE without declaring the column names, I couldn't do it in this situation, I don't know why. I admit I only tried the CTE solution for a minute before discarding it as too verbose.