Thursday 31 December 2009

Black and White Aurora

I've spent a couple of days in Santiago de Compostela this week (I usually go there once a year). Santiago is the incredibly beautiful, charming capital city of Galiza. The historic center is impressive, pedestrian streets with old homogeneous buildings (not one fucking new building breaking the harmony). You can breath the centuries of History on every step. It looks even better on rainy days (there many of them in one of the most rainy cities in Europe), when the cobbled streets turn into small rivers by the moment, the colonnades welcome you and the moss living on every wall and tree looks greener. This little gem is absolutely worth a visit (for me it's quite more beautiful than cities like Cambridge, Oxford or even Bratislava, and just a bit below such an incredible city as Edimburgh). It's mainly famous because of Christianity (Saint James Way and all that) but the religious thing has no influence on my devotion for this city (for me churches are just historical buildings with architectonic interest).

The main reason for posting this entry is that one day at night I enjoyed a really beautiful visual effect. I was in Praza das Praterías and when looking at Praza da Quintana through the space between 2 buildings, the sky gave me a nice present, the combination of the lights that point to the back facade of the Cathedral, the heavy rain, the clouds moving very fast (we had like 100 km/h winds in nearby towns) and my view angle gave place to something that I could almost qualify as a poor guy "Black and White Aurora". I've never seen a real Aurora, so sure I'm exaggerating, but anyway the view was fantastic. This crappy picture below does not make any justice to what I'm trying to describe, but I think all blog posts need at least one pic.



Another curiosity. I'm quite a fan of what I usually call "Turkish fast food" (I'm vegetarian, so no Döner Kebab, but Falafel, mainly in Dürüm). There are a few of these restaurants in Santiago that are managed not by Turkish people, but by Kurdish people. They had a nice map there of their Stateless Nation that called my attention:



The Falafel that I enjoyed there was a bit above the average, but I think the friendliness that I tend to feel for oppressed territories (and particularly those forgotten ones that very rarely do headlines like Western Sahara, Chiapas, Kurdistan...) made it taste even better.

Sunday 27 December 2009

FIC Xixón 2009

Some weeks ago we could enjoy the 47th edition of FIC Xixón, a film festival mainly focused on independent cinema that is held in my town.
This year I attended a total of 11 films, of which only 2 were unbearable, 3 were absolutely great, and the rest fall somewhere between OK and Good.
Maybe one day I'll feel like writing some full reviews, but so far here is a brief description:


  • Cargo 200 (Aleksey Balanov), Thursday 19th. I quite liked it, but it didn't live up to my rather high expectations. I liked the industrial wasteland cityscape and the depressive atmosphere, but maybe it was not enough. The 80's Russian Punk band playing on the car's casete was a plus.


  • Los Fugaos, Saturday 21st. I ended up in this projection a bit by chance. There was a huge queue to get the tickets for this session and someone with tickets left gave me one. It's a documentary about people that after the end of the Spanish Civil War stayed hidden in the mountains fighting against the Fascist Dictatorship. It's OK, but it's rather lame that the directors chose a shitty politician like A. Guerra, a compulsive thief responsible of the economical destruction of Asturies, to talk about these heroic guerrilla.


  • War (Aleksey Balanov), Saturday 21. It was OK if what you expect is just an action film, because that's what it is, sort of the Russian Rambo, killing Chechens instead of Vietnameses. Of course Chechens are very, very, very bad people, evil terrorists, compulsive rapists... This vision would be acceptable if it were the opinion of one of so many Russians that have to struggle to make ends meet, with few chances and interest to go beyond Krenmlin's propaganda... but it's too simplistic for an acclaimed film director that is able to travel all over the world... I'm not neglecting some of the attrocities commited by some Chechen yihadists... but what I'm missing in the film are references to the attrocities commited by Russian forces against Chechen civil (moderate muslim or light muslim) population...


  • Contra la Pared (Fatih Akin), Sunday 22. Wow, this film blew me away. Great, great, great. It seems like a recurrent topic in this great German-Turkish director to depict the lives of German-Turkish people, how they have got integrated in Western society, which cultural elements they keep and which ones they replace, and of special interest, how they see themselves. This film is an absolute must, the story moves between comedy and drama, between hilarity and tragedy, with interesting shifts and many great moments.

  • Between Two Worlds, Sri Lanka. Sunday 22. Absolutely unbearable. Terribly boring with no reference to the Tamil conflict in Sri Lanka nor to the "disaster capitalism" in their coasts after the tsunami...


  • Barking Water, Monday 22:15. A good film, not as tough as the synopsis could make us think, but tough anyway. A couple of native Americans with have shared their lives with ups and downs, several interruption, set off for their last journey, as the man has a terminal disease. Drama road movie with some great visuals.


  • Mammoth (Moodysson) Tuesday, 22:30. Not as impressive as Lilya 4-ever, but anyway a good film. It links together 2 troublesome stories through the life of a wealthy, happy family which bliss is at risk. All in all the general feeling is not gloomy at all, but rather happy (this great song in the soundtrack by LadyTron can give you an idea).


  • Louise-Michel Wednesday, 22:15. Sort of French bittersweet comedy. Between smile and smile you get a good critic to economical globalization, tax havens, desensitized human beings... A small factory in a French village gets closed from one day to another, and the (un)employees decide to take revenge. I like that attitude.


  • Fish Tank, Andrea Arnold, Thursday. Wow, take note of this name, Andrea Arnold, and keep it somewhere accessible in your head. 2 films and she's a cult director for me. After the incredible Red Road that I could enjoy in FIC Xixón 2006, we get a great depiction of realities that may seem far to us but are really close. How shitty it can be being a teenager in an impoverished housing state area in UK. There are some moments in the story where things are in the verge of total disaster... and it gives you that uneasiness that lasts for a while after the lights are on.

  • Border, Friday. Unbearable film-documentary or whatever they want to classify it as.


  • Polytechnique, Saturday 22:15. Absolutely amazing. The perfect culmination for an excellent edition of this festival. Impressive film, it manages to turn a story of disaster (the Canadian Columbine) into an astonishing beautiful visual and narrative discourse. It's been compared with Elephant, but for me the comparison does not make it justice at all, this is a much better film in all senses. The first sequence in the film blows you away, it's one of the most stunning starts in a film that I can think of, but the rest of the film is just at the same level. This external review perfectly describes my opinions:
    "The paradox may sound grotesque, but it must be stated loud and clear: Denis Villeneuve and the cast of Polytechnique have transformed the tragedy of the Montreal Massacre into a work of profound beauty."



Wednesday 23 December 2009

CIL Debugging

Some weeks ago while chatting with a friend something came up in the conversation that brought to my mind some old memories of those times (it was in 2003) when I used to do some coding in CIL (also known as MSIL). The thing is "how do you debug CIL code?".
With the VS Debugger, MDBG or SharpDevelop Debugger you can't debug at the CIL level, just high level language (with Native Assembly view). The answer is simple, and now you can find some more entries explaining the wholeprocess, but given that it's something that I found out by myself back in those times, I'm feeling like posting about it.

First, an obvious question, what do we need for our source level debugging?
We need the .exe, the source code file and a .pdb file that somehow links the .exe with the source file. When we compile with the csc using the /DEBUG option, we're linking to the C# source, so if we want to link with the CIL source, we need that CIL source and the corresponding compiler.

So, all this comes down to giving an odd detour from your initial C# (or VB.Net...) code to the final .exe using some of the tools available with the Framework.


  • First we compile from C# to .exe
    csc debug2009.cs


  • then, we disassemble that .exe, and get a .il file
    ildasm /OUT=Debug2009.il debug2009.exe


  • and then we assemble that .il file into a new .exe, using the /DEBUG switch.
    ilasm /EXE /DEBUG Debug2009.il
    this last step is the fundamental one, this way we obtain a .pdb file containing debug information for the CIL code, not for the C# code.



So, now we can launch the new .exe file, attach a debugger to it (for example the SharpDevelop one) and all the magic happens when the information in the .exe, .pdb and .il files is used together:



In those times when I had some CIL knowledge (it's gone terribly rustied after not using it for years) I wrote some basic articles about CIL programming for @rroba, a Spanish magazine (hey, I even got paid for it!). It's in Spanish, and sure contains some conceptual errors that I think I would not reproduce now, but anyway I'll leave it here just in case it could be of any use to someone.



(Sorry, I still have not been able to upload the files)

Friday 18 December 2009

Web War I, cyberattacks on Estonia

Some days ago I came across this fantastic site with short video reports on science and technology, WiredScience.
There I found an interesting report about one of the most important and less known war episodes in the last years, the Russian cyberattack on Estonia in April 2007.
OK, nobody was killed in those events, not even physically injured, so sure that with thousands of people dying in armed conflicts in Irak, Congo, Afghanistan, Pakistan... my previous sentence could sound like pronounced by someone who does not know the limits between Second Life and real life, but that attack is one advance of how wars will be waged in the near future, and raises questions and concerns that our societies will have to address.
So, what happened and why it is so important?

Estonia, a European Union member and former Soviet Republic (well, I would better say a former Russian Colony, for me the USSR was never a union, but one of the last colonial powers in the classical sense) was attacked by Russian hackers. It was mainly a massive DDOS attack that made unavailable great part of Estonian network based infrastructure (ATMs, Government web sites, newspapers...). This attack was launched by naZionalist "hackers", probably linked to the Nashi, a proPutin Russian youth movement with some resemblence to the Hitler Youth. I wouldn't dare to say that the rusian government were directly involved in the attack itself, but it has been protecting the attackers by hampering the investigations (and of course, it's responsible for the wave of fanatic nationalism that sweeps Russia and fills the streets with ultraviolent nazi skinheads responsible for hundreds of attacks and murders each year) The main source of the attack could be based on Transnistria, a Russian puppet pseudostate broken away from Moldavia (and which "strange" legal status makes very difficoult any sort of international investigation).
The anger and hate of these zealots was motivated by the relocation of a Soviet Soldier statue to a non centrical place (for ethnic Estonians Soviet occupation was even worse than German occupation, so probably if I were them I would have relocated it to a landfill) . Well, that's simplistic, the real reason here is that there's a proportion of Russians that do not understand that they're no longer an empire. They don't understand that Estonia, Latvia, Lithuania, Ukraine, Georgia... want nothing to do with them. That these sovereign nations want to cut their ties with a past of horror and famine. That the end of WWII brought no liberation to them, but slavery...
These people still consider these countries as misbehaved children that sometimes deserve some punishment from Mother Russia (be it a cyber attack, be it cutting gas supply in the middle of winter, be it direct war...)
Worst of all is when you have the enemy within, and unfortunately this also happens in these countries. The footage in the video report showing some individuals vandalizing shops while shouting "Russia, Russia" is rather disgusting. These ethnic Russians have not understood that now they live in a sovereign nation called Estonia, and so they have 2 options, either they behave like Estonian citizens (and leverage the good things of being a European Union citizen) or go back to their beloved, destructured, maphia governed Russia... Seems like these people have forgotten that their parents or grandparents were injected into Estonia by Stalin to replace a part of the ethnic Estonian population (forcibly "relocated" out of their land) and russify the remaining ones, replacing their culture, language, myths...

This seems so important to me cause it's one of the first examples of the kind of combats to be waged in the near future. Attacks that can paralyze an entire country in a way that it's not easy to know who's the enemy (goverment, mercenaries, a self organized group of volunteers...) In 2007 EU and NATO governments did not know how to respond to an attack like this, but seems like it has given place to the creation in Tallinn of the CCD COE. Sure the near future will be riddled with similar events and we'll look back to see when all this started.

By the way, I was lucky to be in Estonia for a few days in April 2008, beatiful place really worth a visit.

Thursday 10 December 2009

Arma-X, Zona Minada

Great, a new video by Arma-X, one outspoken Asturian MC.
Arma-X (well, his previous project Stoned Atmosphere) is responsible for having got me interested into Hip Hop some years ago. It was by the end of 2004 when I found "Patria sin Sol", one astonishing Hip Hop track with Political lyrics about the demise (economical, social, even moral) of our homeland, Asturies. This track turned into sort of a hymn for many of those few Asturians that are aware of how fucked our land is.
Some months after releasing Issue 4 (and having made us enjoy with some memorable concerts) St.At. broke up and Arma-X started to work on his own. Different musicians provide the bases, and he adds voice and message (it's that message what turns it into the best "art product" coming out from Asturies in the last decade). Lyrics are furious and inspiring, criticizing everything from our local scope to the global one, but always with particular emphasis in "La Cuenca" (the former coal mining area in Asturies were he was born and that has been transformed, as the rest of Asturies, by the successive Spanish Governments into a reservation for sold out syndicalists, retired miners and and their cocaine addicted children, while the rest of the population emigrates).
Yes, my last paragraph may sound weird, but that's my land now... and this is how it sounds...


Zona Minada (good play on words: coal mines zone - Minefield) (video from december 2009)



Patria sin sol (video from december 2005)



Enjoy/que vos preste.

Friday 4 December 2009

JavaScript playground


I'm using this just to test how well jQuery and some JavaScript play with blogger.





this is a text

Basic Performance Tricks

These (language agnostic) performance tricks are rather basic, but in the current programming world where most of the thinking revolves around adding more layers or more objects (one more interface for decoupling, one more class for better cohesion)... these things involving binary operators seem almost like assembler for many of us (at least for me) but it should not be that way... Performance tricks like these can help to balance the performance downsides inherent to modern (and necessary) techniques like virtual calls, delegate calls (in .Net world), dynamic languages... and anyway, it's fun stuff to know about :-)

So, there we go (to understand it just think it in binary with a couple of samples):


  • Check if a number is odd or even:
    this is faster than using the classic module operation.
    if (num & 1 == 1)
    // num is odd,
    else
    // num is even

  • Check if a number is a power of 2 ( I found this among the comments of this interesting codeproject article)

    //for num >= 1
    (num & (num-1)) == 0


  • and well, this is terribly basic, but at least it's a good sample to me of what bit shift operations can be useful for (outside low level programming):
    Multiply for/divide by a multiple of 2:

    num << 1 == num * 2
    num << 2 == num *4
    ...
    num >> 1 == num / 2
    num >> 2 == num / 4



As an additional note, checking the Bitwise operation entry in wikipedia, I found this:
On most older microprocessors, bitwise operations are slightly faster than addition and subtraction operations and usually significantly faster than multiplication and division operations. On modern architectures, this is not the case[1]: binary operations are generally the same speed as addition (though still faster than multiplication).

And well, this is not language agnostic, but C# and VB.Net (by the way VB, you've ever been ugly and will ever be, regardless of how many cosmetics MS applies on you) specific, but given that we're talking about performance and it's so short that does not deserve a full blog entry:
Cost of Method Calls:

  • Virtual method call time is 1x.

  • Delegate method call time is 1.5x

  • Interface method call time is 2x


No, I've not done any investigation myself further than finding the info here. Delegate calls being more expensive than Interface calls caught me a bit by surprise, thought well I'd never done serious thinking about it.