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;
}

and has 1 comment
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.

and has 0 comments
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.

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.

and has 3 comments
I started reading The Stranger on a recommendation. A guy told me the main character was a bit like me. Having read the book there is only one question I want to ask: How did Albert Camus know about me in 1942?

Joke aside, this a rather short book detailing a bit of the life of a Frenchman that doesn't feel much, is a rational person and doesn't believe in God. Therefore everybody around him thought him a stranger, hence the title of the book. Camus has a way of writing this in the first person, but in a way that seems both introvert and totally outside. The character describes everything he sees in neutral terms, proving he is both very observant and completely indifferent. When other people talk, he quotes them, when he describes himself talking, the character is summarising to the minimum, with no quotes, giving the impression he is a stranger to himself, hence the title of the book.

In the end, it felt like the last part of the movie The Mist. The same irrational fear of the different, coming from a shapeless mass of mindless drones, blindly destroying everything. In my view, the character manages to maintain his decency by rejecting the smallest gesture of resistance. But what do I know?

Would I recommend the book? It certainly teaches the reader something. It describes a way of thinking and of being that is different from most people. It explores several philosophical schools of thought, but you wouldn't know about it unless you read Wikipedia :). It is short enough to not bother anyone, though. Why wouldn't you read it?

and has 0 comments
I have seen there is a marked difference between me, a casual chess player that has become interested in the theory of chess, and other people of my level that do not try to understand the theory. I usually beat them with the help of some of the information that lingers in my head. At the same time, there is an even greater difference between me and people that actively play chess online, not only when a colleague becomes interested in playing. They crush me immediately.

It seems to me that in order to grasp the chess theory I must also back it up with practice. So I have decided (after quite a while of fearing it would either become addictive or that I would suck terribly) I've made the first step and played a game there. And I won! Woo hoo! Unfortunately I played horribly and only luck can be attributed to my victory. As always, I've analysed the PGN and here it is. You will understand the shame of my victory (yes, it can happen) when you get to the end. Enjoy!

[Event "Siderite vs Mar09 2012.07.14"]
[Site "Chess.com"]
[Date "2012.07.14"]
[Round "1"]
[White "Siderite"]
[Black "Mar09"]
[Result "1-0"]
[BlackElo "2400"]
[ECO "C41"]
[Opening "Philidor"]
[Variation "Hanham, Steiner Variation"]
[WhiteElo "2400"]
[TimeControl "0+300"]
[Termination "normal"]
[PlyCount "77"]
[WhiteType "human"]
[BlackType "human"]

1. e4 {+0.11/16 10} e5 {-0.09/16 10} 2. Nf3 {+0.13/15 10} d6 {-0.31/15 10}
3. h3 {+0.15/15 10} Be7 {-0.15/15 10} 4. d4 {+0.16/16 10 Didn't know
anything about the Philidor defence that Black employed, except that it is
rather passive. So I decide to attack.} Nd7 {-0.26/15 10} 5. dxe5 {+0.26/16
10} Nxe5 {-0.24/16 10} 6. Nxe5 {+0.23/17 10} dxe5 {-0.23/17 10} 7. Qxd8+
{+0.23/17 10} Bxd8 {-0.15/17 10} 8. Bc4 {+0.04/17 10 computer thinks that
defending the pawn with the knight would have been better. As such, Black
has equality.} Ne7 {-0.23/16 10} 9. O-O {+0.27/16 10} O-O {-0.26/17 10} 10.
Nd2 {+0.20/18 10} Kh8 {-0.38/16 10 Analysis says this is a bad move and
gives White 0.2 because the pawn at f7 is defended only by the rook, but
Black intends to move it forward anyway.} 11. Nf3 {+0.35/16 10} f6
{-0.30/16 10} 12. Bd2 {+0.27/17 10 at this moment I am lost: I have no
strategy, no obvious attack and so I decide to improve my position a little
bit.} a6 {-0.28/15 10} 13. Bb4 {+0.24/17 10} b5 {-0.88/17 10 I thought
about the computer suggested move at the time: Bc4-d5, but dismissed it
because I felt it did not do anything.} 14. Bb3 {+0.46/17 10} a5 {-0.48/18
10 I almost always fall for pawn pushes. I tend to dismiss their
importance, you see, until it is too late.} 15. Bc5 {+0.48/19 10} a4
{-0.57/18 10} 16. Bd5 {+0.71/17 10 Bd5 is no longer as effective as it
would have been.} Ra6 {-0.54/17 10} 17. a3 {+0.54/19 10 The only move to
save my poor light bishop from getting trapped after c6.} c6 {-0.86/19 10}
18. Ba2 {+0.88/19 10} h6 {-1.97/17 10 You see what I should have done here?
Ra1-d1 would have threatened the bishop on d8, the only defender of the
pinned knight on e7.} 19. c4 {+0.59/17 10 Instead I tried to exchange a
weak pawn with a strong one, breaking the menacing pawn chain c6, b5, a4}
(19. Rad1 Kh7 20. Rxd8 Rxd8 21. Bxe7 Rd7) 19. .. Re8 {-0.72/18 10} 20. Rad1
{+0.43/18 10} Ng6 {-5.97/17 10 too late for Rd1, but do you see the winning
move for White here?} 21. g3 {+0.33/17 10 instead I get spooked by the
knight and try to block it and leaving my h3 pawn undefended.} (21. cxb5
cxb5 22. Bf7 {nice pin, one might think, but look closer: the rook at e8
has nowhere to go, the bishop on d8 is defended by the rook alone and the
knight on g6 is also under attack. This gives White a staggering 6 point
advantage.} Rg8 23. Bxg8 Ba5 24. Bf7 Nf4 25. Be8 {b5: completely
undefendable} Ne6 26. Be3 b4 27. Bb5 Ra8 28. Bc6 Ra6 29. Rc1 bxa3 30. bxa3
Nf4 31. Bxf4 exf4 32. Rfd1 Be6 33. Bxa4 Ra8 34. Bc6 Ra7) 21. .. Bb6
{-2.12/18 10 at this moment I still had the trap for the rook on e8, but it
was invisible to me.} 22. Bxb6 {+0.22/17 10} (22. cxb5 Bxc5 {this is the
best move in the situation} (22. .. cxb5 23. Bxb6 Bxh3 24. Rfe1 Rxb6 25.
Bf7 Reb8 26. Bxg6 {White has more than 2 points advantage here.}) 23. bxa6)
22. .. Rxb6 {-0.17/18 10} 23. Kh2 {-0.05/18 10 Yay, I saved the pawn!, I
thought at the moment... by doing so I have missed every opportunity and
reached equality with Black.} c5 {-0.38/17 10} 24. Rd5 {-0.15/17 10} Bb7
{+0.14/18 10} 25. Rxc5 {-0.17/19 10} Bxe4 {-0.07/18 10} 26. Nd2 {+0.09/19
10} Bd3 {-0.11/18 10} 27. Re1 {-0.04/17 10 the computer advises to take the
soon to be open c file. I miss that, too. Little did I know what incredible
edge it would give me at the end. Goooo, luck!} b4 {0.00/16 10} 28. Re3
{-0.07/16 10} Bc2 {+0.13/16 10 again, I decided to play aggressively. If I
could exchange the rooks, I would have a powerful passed pawn.} 29. Rb5
{-0.41/18 10} Rd6 {+0.45/19 10} 30. Ne4 {-1.51/16 10} Bxe4 {+1.64/17 10}
31. Rxe4 {-1.55/19 10} b3 {+1.62/17 10} 32. Bb1 {-2.36/16 10 my light
bishop is trapped. All one has to do is move the rook on d1.} Rd2 {+0.83/19
10 fortunately Black misses it.} 33. c5 {-2.11/17 10 and I ignore that f2
is undefended and, more, it would place me in check.} Rxf2+ {+2.10/19 10}
34. Kg1 {-2.13/20 10} Rxb2 {+2.19/20 10} 35. Re1 {-2.24/19 10 the situation
is dire. Black has 2 pawns ahead and if he sees that I attacked his knight
with the bishop while defending it with the rook, I am a goner.} Ne7
{+2.36/18 10} 36. Rb4 {-2.40/18 10} Nc6 {+1.73/15 10} 37. Rxa4 {-2.18/16
10} Nd4 {0.00/18 10 He saw the knight being attacked, but didn't notice the
pawn on e5 is pinned. It is not all lost for Black, since after a few
exchanges we reach equality. But check out the next moves!} 38. Rxd4
{+0.03/19 10} exd4 {-M1/69 10} (38. .. Rxb1 39. Rxb1 exd4 40. Rxb3
{complete equality and probably a loss for me, as I don't know much about
endgames.}) 39. Rxe8# {Yup. Mate. Neither of us has seen it. When I took
the rook I thought he resigned, as the game ended so suddenly. But no, it
was an accidental mate. How embarrassing.} 1-0

This will be a short blog post that shows my error in understanding what Javascript maps or objects are. I don't mean Google Maps, I mean dynamic objects that have properties that can be accessed via a key, not an index. Let's me exemplify:
var obj={
property1:"value1",
property2:2,
property3: new Date()
};
obj["property 4"]="value 4";
obj.property5=new MyCustomObject();
obj[6]='value 6';
console.log(obj.property1);
console.log(obj['property2']);
console.log(obj["property3"]);
console.log(obj['property 4']);
console.log(obj.property5);
console.log(obj[6]);
In this example, obj is an instance of object that had three properties and others are added. First the declaration notation is JSON like, then any object can be assigned to a property via two notations: the '.'(dot) and the square brackets. Note that the value of 'property 4' and of '6' can only be accessed via square brackets, there is no dot notation to escape that space and obj.6 is invalid.

Now, the gotcha is that, coming from the C# world, I've immediately associated this with a Hashtable class: something that can have any object as key and any object as value, but instead, a map is more like a Dictionary<string,object>.

Let me show you why that may be confusing. This is perfectly usable:
obj[new Date()]=true;
In this example I've used a Date object as a key. Or have I? In Javascript any object can be turned into a string with the toString() function. In fact, our Javascript map uses a key much like 'Sat Jul 14 2012 00:07:00 GMT+0300 (GTB Daylight Time)'. The translations from one type to another are seamless (and can generate quite a bit of righteous anger, too).

My point is that you can also use something like
obj[new MyObject()]=true;
only to see it blow in your face. The key will most likely be '[Object object]'. Not at all what was expected.


So remember: javascript properties can be any string, no matter how strange, but not other types. obj[6] will return the value you have set in obj[6] because in both cases that 6 is first turned into a string '6' and then used. It has nothing to do with the '6th value' or '6th property'. Those are arrays. The same for a Date or some custom object that has a toString() function that returns something unique for that object. I wouldn't use that, though, as you would probably want to use objects as keys and compare them by reference, not string value.

and has 0 comments
Greg Bear is the type of writer that I just have to love: he writes hard SciFi, but easy to read, he doesn't bullshit the reader with too much technobabble and, even if his writing is by no means simplistic, he doesn't bore you with how some person or another feels unless it propels the subject forward. Blood Music is also of a subgenre that I love: global pandemic, so I have to also love the book. So take that into account when you read my review.

The book starts with a preposterous idea: that cells can become intelligent. A brilliant scientist, but one that has always cut corners to get around, discovers this almost by accident and... well... cuts a few corners. The result is something that feels like John Saul's The God Project, but soon leaves it and reaches for the stratosphere. The end is typical Greg Bear, astounding and megalomaniac.

Blood Music has some flaws. One of them is that it is really a very short book, an extension of the original 1983 short story that won the Nebula. The other is that it is written in 1983 (similar to The God Project) and so the science background is both grandiose and a bit obsolete. But it is a good book and one that ponders on the significance of identity, thought, society and ultimately: the essence of reality. I've read it in about three days, so you have no possible excuse for not trying it.

and has 1 comment
I was in the mood for horror, something really disturbing and hopefully on the sci-fi side, and so I went scouring the net for good horror books. Origin, by J.A. Konrath, was suggested by some guy or another, so I started reading it.

The problem is that the book is not much more than an easy thriller. The writing doesn't suck, but neither does it shine; the subject is intriguing, but treated in a screenplay fashion, with not much depth and only a few characters; the book is easy to read and really short; the plot has numerous holes in it. But worst of all, it doesn't really scare! While some of the scenes were - let's say - gory, they were not horror, but rather expected consequences of previous actions.

What is it about? The United States government (who else, tsk, tsk, tsk) has found a strange sarcophagus while excavating the Panama canal. For a century the secret is kept and the subject examined in a specially built facility underground. In the sarcophagus is a massive creature with red skin, hooves, horns and wings. After 100 years of slumber, it awakens. What is it? A devil, THE devil, an alien, a strange prehistoric creature? You will have to read the book in order to get an answer to that question.

Bottom line: I read it in less than a week, didn't hate it, didn't love it, it was good for passing the time, but I would not recommend it for anything but a vacation, to read on the way or in other boring moments.

and has 2 comments
I usually comment on big political events in my home country of Romania, although I am not really that involved. The thing is, since the end of the Communist era, we Romanians have chosen worst and worst leaders as time went by, every time being certain in our righteous beliefs that the new guys will be better. Hell does seem to be paved with good intentions after all.

A quick recap for those of you who are not Romanians (or don't share my skewed views on reality). After Nicolae Ceausescu (the dictator, remember him?) was gracefully deposed by way of angry mob and firing squad, we chose Ion Iliescu as our first president. From the initial tableau of a murderous dictator being replaced by a fighter for freedom the image shifted over the years to a delusional old man being replaced by a shrewd manipulator of the system. We did not like that, although the people were pretty used with a single president for the rest of our lives and elected Ion Iliescu twice. Luckily our law says there are only two consecutive presidential mandates for a single person, so we had to change the guy with another.

Well, if we have to change the president, we might as well keep the party, we thought, still entrenched in our habitual maintaining of the status-quo. In order for that not to happen, all the other parties coalesced into a big ball of shapeless mud and rallied behind a single candidate, a university professor, an intellectual. And he won. Welcome to the glorious era of Emil Constantinescu, who, besides being a dusty professor who had no clue about politics or management of any kind, despite being a propaganda secretary for the Communist party in the past, he was a fool with no balls. During his single mandate nothing was done at all, since he didn't know what to do and the ball of mud, now in power, disintegrated immediately after elections. Constantinescu's party, a historical party, important in the political landscape of Romania, all but vanished into oblivion.

Yay! We get to elect our main guy again. Let's go with what we know: Ion Iliescu, the former Communist, posing as a freedom fighter, equally loved and hated. Personally, I think he was OK. You can't be a politician and not be a bit corrupt or manipulative or even downright evil, but Iliescu had style and, while he wasn't an angel at all, he rarely did obvious blunders of incompetence, stupidity or lack of self control. No wonder they chose him an honorary president of the party, he was their only real politician! Now over 70, Iliescu got another mandate before a new champion of justice entered the arena!

The next iteration, two people fought for the most visible position in Romania: Adrian Nastase, a corpulent minion of Iliescu, with an intellectual allure and a lordish demeanour, versus Traian Basescu, a populist fellow, former ship captain and behaving mostly like a Romanian Popeye, championing for democracy and the people in the most crowd pleasing ways. It was tight, so tight that the real results of the election will forever be uncertain. Basescu won, while Iliescu's party won everything else. Nastase's allure and demeanour made him appear too arrogant in front of the populace and they could not possibly elect someone who looks down on them. Also, all that façade with no intelligence to back it was ridiculous.

We have now reached "modern times", the actors having relevance today, after two of Basescu's mandates. You see, as president Basescu immediately moved to impose his position over parliament and senate. If the people have chosen him as their champion, then it would make no sense to have his party as the opposition party. He wiggled his way until his party was in power, through all kinds of tricks and alliances. During his reign, Basescu frequently overstepped his presidential responsibilities, being, again, both loved and hated for it. Adrian Nastase, former Prime Minister, was almost forgotten, like any loser in Romanian cock fights.

Fast forward to today. Basescu is at his last legal mandate. The economic crisis and the abuses of both himself and his party have left him without political capital. Attacked from every side, the two main opposition parties having united into a single political entity (even if their ideological platforms are completely different), Basescu and his minion Emil Boc held on to power as much as they could. Until anticipatory local elections were forced and finally removed Basescu's party from rule. He is next. Again democracy has prevailed.

Or has it? The opposition parties are led by arrogant, relatively young politicians Victor Ponta and Crin Antonescu, more mouth than political clout or experience. Happy to have won the anticipatory elections they see the period until normal elections as an opportunity to consolidate their power in order to have a stable mandate. Instead, they fall into traps (some of them really obvious) at every step. Like the old Romanian fighters, Basescu has retreated and poisoned the wells behind him. If the local elections showed the lowest possible confidence in Basescu's party, now at every mistake of the new power, that confidence seems to grow. So what happened?

First Adrian Nastase is sentenced to jail for stealing as much as he could in a ridiculous and stupid way. The first major politician to go to jail, former prime minister, the mentor of now party leader Victor Ponta, almost president (remember the close elections), he not only loses badly, he attempts suicide when the police come for him... and he fails! He is the laughing stock of the entire country. Yes, that's how we are, if someone tries to commit suicide and fails we laugh at them for being stupid (sometimes we show them how its done, to demonstrate our superior intellect).

The silly thing is, even with Nastase going to jail, I would still choose him over Basescu as president. That is how high hate can rise in this story.

Second Victor Ponta, a doctor of political science, is accused of plagiarism in his doctorate. We could talk of this for ever and still find something new to say, but the truth is that everybody in Romania plagiarises in doctorate thesis. The teachers themselves point towards places where one should gather material for their papers. If you wrote something original (in that rare case you actually did something for yourself instead of Googling it and translating it) the teachers tell you you need five times as large a paper, so they point you to chapters in the books of the people that taught you in university. Take one from three of their books, write a conclusion and you have your five fold quantity of wasted paper. It's how the system works.

Of course, instead of just laying down and accepting such an obvious fact, Ponta half denied it (aka failed to properly deny it and again lost face), then in a wave of brutal and ridiculous moves, dismantled the plagiarism committee and even the Constitutional Court. Well not exactly like that, but it certainly felt like that. The populace is in shock, of course: didn't we elect someone in order to not have fists shoved in our mouths?, they ask.

Finally, as the conflict between Prime Minister Victor Ponta and President Traian Basescu cannot continue like this, the coalition of victors (yes, yes, a pun, sorry!) moved to impeach Basescu. And they did, only now, by law, a popular vote must be organised to see if they can remove the president from office. And guess what! Even if there are virtually no chances for Basescu to remain in seat, there will be so many votes in his favour that the power parties will lose immense political capital which will hurt them badly in the coming permanent elections.

In this light, a question begs for attention: Isn't it possible that Basescu allowed for the party change just after he carefully prepared his attacks against the opposition? Wasn't this all a big political entrapment? And of course it was. Basescu has proven himself a shrewd manipulator himself, a "playing president" as he himself imagined he would be. Instead of winning prematurely, the eager beavers stepped right into it and failed miserably. Remember what happens in Romanian politics when someone fails at something?

So let's review this long long story. We changed a dictator with a freedom fighter, only to find him a former Communist with great political skill. We replaced him with an intellectual, only to find the guy incompetent. We went back a bit, electing a 70 year old man as president for the third time, then replaced him with a populist alpha male with psychopathic tendencies, which now will be replaced, probably, by a loud mouth fool that fell into every trap that was set for him (and his buddy Ponta) Am I the only one who sees this trend as going down?

and has 0 comments
Another song that I've been listening obsessively for the last day or two. I am fascinated by the mouth on that girl. So filthy the words, so beautiful a smile, so machinegun the speed. Not something that I would have associated with Manhattan , either. Here is the video, I will paste the lyrics below, because you may not understand them from the song alone :) You may also understand why at first I didn't believe it was on a TV music station, where I heard it the first time.



Hey, I can be the answer
I’m ready to dance when the vamp up
And when I hit that dip, get your camera
You could see I been that bitch since the Pamper
And that I am that young sis, the beacon
The bitch who wants to compete and
I could freak a 'fit, that pump with the peep and
You know what your bitch become when her weave in
I just wanna sip that punch with your peeps and
Sit in that lunch if you're treatin'
Kick it with ya bitch who come from Parisian
She know where I get mine from, and the season
Now she wanna lick my plum in the evening
And fit that ton-tongue d-deep in
I guess that cunt getting eaten (4x)

I was in the 212
On the uptown A, nigga you know what’s up or don’t you?
Word to who made ya
I’m a rude bitch, nigga, what are you made up of?
I’m-a eat ya food up, boo
I could bust your eight, I’m-a do one too, fuck ya gon' do?
I want you to make bucks, I’m a look-right nigga, bet ya do want to fuck…
Fuck him like ya do want to cum
You're gay to get discovered in my two-one-deuce
Cock-a-licking in the water by the blue bayou
Caught the warm goo in your doo-rag too, son?
Nigga you’re a Kool-Aid dude
Plus your bitch might lick it, wonder who let you come to one-two
With ya doo-doo crew son… fuck are you into, huh?
Niggas better oooh-run-run
You could get shot, homie, if ya do want to
Put ya guns up, tell your crew don’t front
I’m a hoodlum nigga, you know you were too once
Bitch I’m 'bout to blew up too
I’m the one today, I’m the new shit, boo, young Rapunzel
Who are you, bitch, new lunch?
I’m-a ruin you, cunt (4x)

Ayo (ayo), I heard you're riding with the same tall, tall tale
Telling them you made some (made some)
Saying you're grinding but you ain't going nowhere
Why you procrastinate girl? (-nate girl)
You got a lot, but you just waste all yourself
They'll forget your name soon (name soon)
And won't nobody be to blame but yourself, yeah

What you gon' do when I appear?
W-when-when I premiere?
Bitch, the end of your lives are near
This shit been mine, mine (x2)

Bitch, I’m in the 212
With the fifth cocked nigga, its the two-one-zoo
Fuck you gon' do, when your goon sprayed up?
Bet his bitch won't get him, betcha you won't do much
See, even if you do want to bust
Your bitch’ll get you cut and touch you crew up too, Pop
You're playing with your butter like your boo won’t chew cock
The gun, too -- where you do eat poon, hon?
I’m fucking with you, cutie-q
What’s your dick like homie, what are you into, what’s the run, dude?
Where do you wake up? Tell your bitch keep hating, I’m the new one too, huh?
See, I remember you when you were
The young new face, but you do like to slumber, don’t you?
Now your boo up too, hon
I'm-a ruin you, cunt

What you gon' do when I appear?
W-when-when I premiere?
Bitch, the end of your lives are near
This shit been mine, mine (x2)

I have a pretty bad opinion of Apple products: expensive pretentious gadgets that impose all kinds of restrictions upon the user. So bad, in fact, that I delayed saying anything about the iPad I got from work until I was certain I wasn't completely biased. I mean, so many people using iStuff can't be wrong; it had to be me.

But today the bubble just burst. I lost so much time searching for simple apps that open one type of file or another, only to be reminded again and again that Apple doesn't support that kind of file. Why does Apple need to support anything? I just want the app that opens it. The "there's an app for that" meme doesn't seem to apply to most of what I want!

Basically, what I desire is to have access to the files I copy to the pad with the best software available for those files. I don't want to use iTunes, I don't want to split my files based on type and most, most of all, I want to either use paid or free applications, not something in between, like a diseased mutant.

Oh, maybe you didn't know about the "freemium" ecosystem on the iPad. You go to their AppStore application (a software so bad that it forgets the options you chose if you change the search string) and you select if you want applications for IPad and/or IPhone, free and/or paid, based on user rating and category, etc. You see something free that you like, you install it, only a button away, then you start using it. It may be a game or a utility and at first it is all well. And when you want to get a better weapon, continue to the next level, finish the workflow a utility is supposed to support, you get a "buy the full version". This is called "freemium", a disgusting offspring of shareware applications that makes that look benign.

You have the option to "jailbreak" your iPad. There is an app for that (hee hee), many in fact, that hack your Apple jewel and turn it into something that you have full access to. You get a Linux like command line, a place where you can get a lot of the software you want and need, all a button away. Apple does not like that. At every step of the way they will try to fix their broken machine in order to stay broken. So no, my naive friend, the iPad doesn't work like a computer not because they couldn't do it, but because Apple forced this on you. If I didn't give the pad to my wife, I would have jailbroken it for the principle alone.

But why? would somebody ask. What has Apple to gain from maiming their own device, creating crappy applications for a small tablet that costs as much as a decent laptop? It is all because of the AppStore, of course. If they can make a zillion assholes sell you useless junk that my 386 computer did better in the day, they can share a bit of the profit. So not only they rip you off with their cheap device made by labouring children that barely get something to eat, they keep getting money off of you, a trickle at a time. And, because you don't have complete access to the machine, they can force whatever software they want, unsecured, crap, cheap, but one that you can't hack, can't crack and can't use until, yes, you pay them.

Today I searched for an hour for an iPad application that would read .lit files. Yes, the Microsoft ebook format. There are CHM readers, why can't there be LIT readers? Apparently the "Steve" way is to convert the lit files to .epub (on the computer that I have to have in order to use the pad) and then copy them (with iTunes, not directly) in the ebook reader sandbox. If it happens for me to have a movie or some text files and maybe a picture in the same folder, I cannot access it with the epub reader, I have to move everything in its place.

Luckily I found something that even slightly resembles what I need: FileApp it is called, it allows for me to copy files to my Pad via FTP. I can open them, and that means they get copied where the program that uses them needs them (even if they are 4Gb of DVD image). Not a perfect solution, obviously. And you still need applications that can open the files you own without having to convert them.

I hope Windows Surface will be a huge hit, something that would sweep this crap away. Apple can buy Facebook and go to hell together to rot. When Android will be what Linux is today and Windows will be.. well, Windows, and the iPads will be relegated to the bottom, with all the other mini game consoles, then I will be content.


Programming Game AI by Example is one of those books that would have changed my life had I had read them when I was 15. Mat Buckland is taking a really high tech portion of game making and turning it into child's play. With source code!

From the very beginning we are being told that AI in games is different from what we would normally associate with Artificial Intelligence. AI in games is the thing that makes game agents look smart, but let the user enjoy the game the most. In other words, something that seems smart, but is just stupid enough for you to continue playing.

The book is comprised of ten chapters, heavy with code, but very well structured. The main tool in use are Finite State Machines, but we first get a mechanics physics lecture in chapter 1 where we learn what a vector is and how to normalize it and how to use this in the game physics. Moving to chapter 2, we learn what a state machine is and how to optimize memory by making each one a singleton, how to compose them and why more exciting aspects of artificial intelligence, like say neural networks, are not used more in games. We delve further into methods to optimize what we have learned to make it practical: prioritized dithering, partitioning, BSP, quad and oct trees, fuzzy-Q logic, cell space partitioning, all with code examples, in chapter 3. Chapter 5 is reserved for graphs, Dijkstra, A* and such. Chapter 6 goes into integrating Lua into your games, as a good tool to define and tweak the innards of your game before compiling it all for performance into a single code base. Raven, the example game engine, is detailed in chapter 7. Path planning is described in chapter 8, complete with many optimizations and tricks to make an algorithmic movement of units look natural and smart. Chapter 9 is about goal driven agent behaviour, where we learn how to make an agent define goals and act upon those goals. The composite pattern is suggested as a good solution for goals within goals. We end with a very interesting chapter about fuzzy logic. The basis of this is to fuzzify a situation, infer a behaviour, then defuzzify into a usable algorithmic value.

The bottom line is that this is a very easy book to read, explaining matter-of-factly how to easily create the intelligence in games like Fifa or Counter Strike. The code examples are extensive, but not necessary to understand the gist of things. At the end, it is both a fascinating and intriguing read as well as a good reference book for when you actually need this stuff.

I end this review with a quote from Dijkstra that was also mentioned in the book: The question of whether Machines Can Think... is about as relevant as the question of whether Submarines Can Swim. Very nice book and a recommended read.

Yesterday I wanted to upgrade the NUnit testing framework we use in our project to the latest stable version. We used 2.5.10 and it had reached 2.6.0. I simply removed the old version and replaced it with the new. Some of the tests failed.

Investigating revealed all tests had something in common: they were testing if two collections are not equal (meaning not the same instance) then that the collections are not equivalent (meaning none of the items in one collection is found in the other), yet that the values in the items are the same. Practically it was a test that checked if a cloning operation was successful. And it failed because from this version on, the two collections were considered Equal and Equivalent.

That is at least strange and so I searched the release notes for some information about this and found this passage: EqualConstraint now recognizes and uses IEquatable<T> if it is implemented on either the actual or the expected value. The interface is used in preference to any override of Object.Equals(), so long as the other argument is of Type T. Note that this applies to all equality tests performed by NUnit.

Indeed, checking the failing tests I realized that the collections contained IEquatable types.

I loved the first Avatar animated series. It was deep, funny and yet innocent. A perfect kid show, but one in which an adult could find finer underlying levels of understanding. So it is no wonder that I eagerly awaited the release of Legend of Korra.

Now, that the first season is over, I can have an opinion on it. The show is not about a little kid anymore, it's about a teenager avatar. She, for she is a female, lives in a technological steampunkish world, something that is pretty hard to understand, considering she is the granddaughter of Ang, the hero of the first series, and it all happens merely 70 years afterwards. The innocence of childhood is replaced by the impetuosity of teen age, complete with mood swings, romantic feelings and a strong false sense of infallibility. The elemental countries are now united, so the only possible threat can come from a terrorist organization. There are moments of real fun, but not that many.

Bottom line: it's a completely different show! While in the first Avatar one could find strong moral values underlying what the characters did and the viewer would watch the show waiting to see what would Ang do next in the face of overwhelming adversity, now the focus is on what the avatar girl is feeling when she is not the center of attention and how she gets angry and motivated to use power to solve things. Not something terribly surprising in an American show, but really disturbing in a sequel to such beautiful a series.

So, while the show is nicely animated, the world interesting and the story passable, the overwhelming feeling I get is disappointment. I really do hope something will come out of the next seasons, which I will watch religiously, but let's face it: I do it for Ang.