Sunday 30 August 2015

Some films I've watched this year

In the last year my rate of film watching has quite decreased, so I have hardly posted any reviews. Anyway, there are a few rather interesting films that deserve at least a short mention here. Here it goes:

  • The East. I watched this excellent film 1 year ago, but never found the time to do a full review. It tells the story of a group of eco-fighters and the "spy" that infiltrates them. It stars the "indie diva"Brit Marling and the so cute Ellen Page. It's no wonder that the eco-militant thing reminded me of 12 Monkeys, one of my all-time favourite films.

  • The Captive. I watched this film early this year in Toulouse ABC cinemas. I quite liked it, it's slow but thrilling, with a broken narrative that makes it difficult at some moments to fully follow the story (maybe this is also because I watched it in English with French subtitles). I guess it's loosely inspired by Natascha_Kampusch's story.

  • We need to talk about Kevin. Wow, quite a shocking film. If you don't have kids and do not plan to do so, this is a nice story to reinforce you in your positions, and will be pretty handy to recommend it to your parents if they ever get a bit tiresome with the "you are not making us grandparents" kind of disappointed complaints :-)

  • Ex Machina. Best science-fiction film in a long while. A software developer performing a Turing test and falling in love with the target... well, something like that could have come up from my head! By the end of the film you'll be in love (or at least pretty horny) with the I.A.

  • La ninha de Fuego. It seems like this film has gained quite attention and pretty good reviews in France (I watched it last week in Utopia cinemas, and it was also on display in ABC cinemas). Slow and intense, it suggests but hides, making your imagination flow and leaving you with some open questions. I love how sexual domination is used as one of the main ingredients of the story, but no sex is shown (other than a nude image of the main female character, a tortured "femme fatale". This kind of strange story slightly reminded me of Almodovar's The skin I live in.

Monday 24 August 2015

Solidarite Toulouse - Kurdistan

This last Saturday I came across a demonstration of the Kurdish community in Toulouse against ISIS and their sponsor the Turkish islamo-nationalist government. Indeed I think this demo was prompted by the last brutal attacks and repression exercised by the Turkish fascist state: bombing of Kurdish freedom fighters and civilians, the delivery of Kurdish prisoners to a certain death and torture in hands of Al-Nusra, the rape, torture and murder of a Kurdish female fighter... and the list goes on and on and on. Not that my French language skills are sky rocketing, but once joined to the demo I managed to chant some slogans like:

  • Erdogan assasin!
  • Daesh (ISIS) Terrorists!
  • Kurdistan libre!
  • Solution politique pour le Kurdistan

Obviously I took some pictures:



The organizers were handing out to the passers by an interesting pamphlet explaining this new chapter of Turkish dirty war and violence against the Kurds.







BOYCOTT TURKEY!!!!!!!!

Friday 21 August 2015

Cyprus

I think many people don't know that Cyprus is a divided (invaded) country, and its capital Nicosia is the last remaining divided big city (along with Jerusalem). Though I quite knew about this situation, watching a few documentaries [1] and [2] on this topic last weekend has really infuriated me. Sure this is fostered by the visceral hate that I have developed lately for Turkey (as a state): the permanent neglect of the Armenian, Assyrian and Greek genocides, their ongoing joint venture to perpetrate a Kurdish genocide and destroy any kind of coexistence among religions (Syria...)

The passivity of the international community towards the Turkish invasion of Cyprus and the ensuing murdering and looting is shocking, not only at that time, but particularly now. With Cyprus being a member of the EU, the whole EU should exercise a hard boycott on Turkey, damaging their economy as badly as possible, putting them to the corner to force their complete withdrawal from Cyprus and strong economic compensations. The EU has just done so with different actors and without a real reason. I'm talking about the economic sanctions to Russia because of the conflict with Ukraine. I've already said it before, basically I don't give a shit about any of those 2 countries. In my eyes they are probably the 2 most xenophobic, utranationalist, racist and homophobic societies in the world (yes, sure, I'm judging them as a whole, it goes without saying that sure there are normal Russian and Ukrainian individuals that abhor their societies as much as I do), so I don't think we should spend any effort with them. Anyway, the alleged "Russian invasion" of Eastern Ukraine can not be compared in anyway to what happened in Cyprus. Russia is supposed to have entered into a territory where most of the population is of Russian descent, while the percentage of Turks in Norther Cyprus before the invasion was pretty lower. Likewise, so called "progressive" forces in Europe seem never tired of remembering us about the drama of the Palestinians, but stay oblivious to the drama of Kurds, yazidis or Eastern Christians being slaughtered by ISIS and the collaborationist Turkish government.

Hopefully I think in the last years the idea of Turkey joining the EU has been losing momentum, and indeed, I think it's just impossible. In principle all EU member states have to agree on a new country entering the Union, and obviously Cyprus will never agree, and I assume that Greece either. I had always opposed to the idea on cultural and historical basis, now it's purely that I can't consider Turkey a civilized country.

As a curiosity, I'll have to admit that Turkey seems to have done one good action in these years regarding this island, they have constructed a rather unique undersea pipe to carry water to the chronically water deficient island (to the Turkish occupied side, of course

We can all wish that with the rising tensions in Turkey (I think they could be on the verge of a civil war between islamo-nationalist scum on one side and Kurds and left-wing Turks on the the other side), some Left-wing Kurdish or Turkish fighter will make justice and get us rid of the current Turkish Fuhrer, that vicious torturer and murderer called Erdogan.

Saturday 15 August 2015

Bytecodes, ASTs and so on

These pieces of news: [1], [2] and [3] about WebAssembly have made a pretty intereting read. It's not that I am interested in using it, I think 99% of web development projects will continue to be done in an every day more powerful and beautiful JavaScript, but the concept is pretty interesting since a technical stand point.

Being able to write high performance code for the web so that game engines can run smoothly on the browser is cool, but as I've said, I guess few people will ever need it. Having your Browser Virtual Machine running for a same "application" two parsers (one for JavaScript and one for WebAssembly) compiling to a common bytecode language is cool, but nothing new (you've been able since a long while to mix Python and Ruby into a C# application, and the same for Java). What is funny is that in the CLR and the JVM the first citizens were the static, "low level" languages (C#, Java...), and then the dynamic and more feature filled languages (Python, JavaScript, Groovy) were added as second citizens, for the web it has been right the contrary path.

What I find really interesting is that the code written in this "binary format for the web" is not bytecodes, in the sense that is not a set of instructions for a stack based (CLR, standard JVM) or registers based (Dalvik) Virtual Machine, but a bit upper level, a binary representation of an Abstract Syntax Tree (AST). Does this ring a bell? Well, it's just what is done with the DLR languages, that are compiled at runtime into a DLR AST that will be then transformed into .Net bytecodes.

The main performance advantage offered by WebAsm over JavaScript is that parsing this binary AST into bytecodes is way faster than parsing JavaScript. Though quite unrelated, my mind established a link between this and JerryScript, a JavaScript engine for small embedded devices. In the article they explain how they managed to make this engine fit into just 64KBs of memory:

From the perspective of IoT, we only focused on memory footprint.

JerryScript is a pure interpreter in contrast with multi-stage adaptive JIT engines today. So it has no overhead for storing compiled code. Even the parser doesn’t store AST. It produces bytecode line-by-line directly from the source code. For data representation, objects in JerryScript are optimized for size. JerryScript is using compressed pointers, bytecode blocks with fixed size, a pre-allocated object pool and multiple representation of Number objects to achieve both standard compliance and memory optimization. We will keep continue to reduce the memory footprint in various ways.

Friday 7 August 2015

WPF vs WinForms

I don't like WPF. I've ever found it complex and overarchitectured, with a rather steep learning curve (and most times the VS designer does not seem able to draw effectively a XAML form) . For thin client applications a HTML5 SPA using your favorite JavaScript Framework/toolkit is usually more than enough. For thick clients sometimes is also enough. For those that it's not and for purely client applications you can try some of the HTML5 and node combinations discussed here. Anyway, for business line applications, Windows client applications are still needed and demanded. For those cases, I still would prefer to avoid WPF and stick to Windows Forms, and seems like I'm not the only one.

Sure there are many horribly architectured Windows Forms applications out there, just a continuation of the classical vb5 and vb6 nightmares. Obviously that's not Windows Forms fault, and many people have been developing pretty well desinged WinForms applications. The use of MVC (well, indeed I think it is MVP) demonstrated here is quite similar to what I've used in the few WinForms projects I've worked on.

With this in mind, the other day I was wondering if there is really any advantage in using WPF over WinForms. The resulting "research" did not give me conclusive answers, but made me refresh my poor knowledge of how Windows GUI applications work.

Apart from XAML, the recommended patterns and the new controls, under the covers the main evolution from WinForms to WPF is that WPF uses Direct X for rendering while WinForms uses GDI. DirectX can discharge this drawing to the Graphic Card, while GDI will do it in your CPU. This means that WPF drawing should be much faster that WinForms drawing. However, in principle WPF objects are more heavy than WinForms objects (in .Net terms). You can read more about it in these interesting StackOverflow posts [1] and [2]

One interesting point raised there is:

That being said, if you have a LOT of controls, WPF can actually outperform Windows Forms by a fair amount. In Windows Forms, each control requires a separate window handle, and receives its own message sets. With a lot of controls, this can actually slow things down pretty dramatically.

So in "Windows terms" WPF controls are lighter. But, what does this window handle and messages thing mean?

The most essential feature of any Windows GUI application (either .Net or native) is the existence of a Message Loop. The main thread in your windows application runs in a loop waiting for messages (a click, a timer, a refresh...) and when a message is received it will pass it to the code (Windows Procedure) associated to the affected Window. The notion of what a Window is at that level is quite important. At this level a Window (a Win32 Window) is not just your "normal Window" (with is blue title bar, close button...) but also controls like buttons, combo boxes, edits... you can see it here. They are created with the CreateWindow Win32 function, that is how under the covers WinForms, classic vb, MFC,... create their controls.

Both WinForms and WPF are based on the Windows message loop (it's created and kept hidden from you by Application.Run), but WinForms works much closer to the Win32 reality. Underneath it uses the CreateWindow function in user32.dll for creating most of its controls. In turn, user32 uses GDI for drawing these controls. From here:

User32.dll is a core windows dll used for windowing and other interactive user program tasks. WPF does not use it much.
Windows.Forms is mostly a .net wrapper around User32, and so is still based entirely on GDI,GDI+, and window handles.

WPF uses CreateWindow just for creating "real windows" and then it will create its controls by drawing on these Windows via DirectX (as if it were drawing shapes). As an analogy, think of how html controls work. An html button or textbox looks like its WinForms counterpart, but it's not a Windows Control, but a shape that the browser draws (for example via Cairo in Firefox)

You can verify this by running Winspector and trying to select a control in a WinForms application and a WPF application.

In the WinForms application you can select controls, for example a button:

While in the WPF application the only thing you can select is the "normal Window":