Tuesday 30 October 2018

Jamal Khashoggi

I'm pretty upset with the murder of Jamal Khashoggi, particularly with the reaction from Western countries. OK, maybe you're a bit bewildered now, wondering what's the problem, whether it's that I think that he had deserved it or whether it's that I would expect a much stronger reaction from Western governments. Well, neither of them. For sure it's terrible that a repressive government murders an innocent, but well, it's something rather common... In this case, the murdered person was just an average guy, I mean, he was not a humanitarian worker, a human rights activist or nothing of the sort, he was just a journalist that was slightly critical of the hideous Saudi kingdom, so well, I see no particular reason to pay more attention to this victim than to any other "average" victim.

Anyway, for sure I'm pretty happy with any kind of punishment to the Saudi bastard kingdom, whatever is prompting it. What bothers me so much is that all these years we've had so many much more important reasons to attack Saudi Arabia, and I don't mean just at an economical level, I mean many good reasons for sending the military and burning the whole country to ashes... and we've done nothing, on the contrary, our governments have continued to do business with them, allowing them to persist in their aim to destroy our civilization.

Since 1979 the Wahabist kingdom has been spreading all over the world their sickening fanatical vision of how society must work, trying to subdue our free societies to their Islamic vision. They have been the main factor in the "reislamisation" of the second generation of migrants in countries like France, and hence the main responsible for the communitarism, the oppression of women and not muslims or "not muslim enough" inhabitants in the neighbourhoods controled by the islamists, the increase of rapes, homophobic and antisemitic attacks (most of this kind of violence in Western Europe comes from "rigorist" muslims), the increase of criminality... Just note that for "radical" muslims the "non-believers" have no rights, so we can be robbed, extorted, raped or killed without any moral problem... So Saudi Arabia has been attacking us for decades and our governments have continued to do business with them as if nothing were happening, and suddenly the murder of a journalist (by the way, a guy that that though allegedly "a moderate muslim" was still a supporter of the Muslim Brotherhood and a good friend of the Erdogan IslamoFascist beast) has prompted this reaction!!! What the fuck?

Sunday 21 October 2018

Class Properties and Arrows

The other day I came across a piece of TypeScript code that confused me a bit. In a class definition, among normal method definitions, there was a line like this (the "oddThing" declaration):

class A{    
    
    public normalMethod(msg:string):string{
 //whatever
    }

    public oddThing = (msg:string):string => {
        //whatever
    }
}

So, what is that arrow function doing there? Well, it's called class properties and at some future version should make it into standard javascript. So we are declaring a property and initialising it inline, rather than in the constructor (something very common in C# or java). So that declaration is equivalent to doing this in the constructor:

constructor(){
    this.oddThing = (msg:string):string => {
        //whatever
    };
}

In the end, that declaration and inline initialization is pretty normal for data, but what seems odd is why to do that for a "code block" rather than just using a normal method definition?
Well, the idea is pretty clear if we think about the big difference between arrow functions and normal functions (that is what is used for normal methods), the value of "this". While in "normal functions" "this" is dynamic and depends on the object used to get the function and invoke it, in arrow functions "this" is static, it's bound to the function at the moment of the declaration (similar to doing a Function.prototype.bind). So if we intend to use "oddThing" mainly by passing it around (think of callbacks, event listeners...), and not through an instance of the class where it's defined, using this property declaration instead of a method is a good option (or we could just create a closure trapping the intended this or use "bind").

I've put some code together:

class Formatter{

    public format3: (string) => string;

    constructor(private txt1:string){
        //equivalent to what we do with format2
        this.format3 = (msg:string):string => {
            return this.txt1 + msg + this.txt1;
        };
    }

    //normal method
    public format1(msg:string):string{
        return this.txt1 + msg + this.txt1;
    }

    //class property assigned to an arrow function rather than using a method 
    public format2 = (msg:string):string => {
        return this.txt1 + msg + this.txt1;
    }
}

let formatter1 = new Formatter(" || ");

let formatFn = formatter1.format1;

console.log(formatFn("hi"));
//so PROBLEM, "this.txt1" is undefined

console.log("----------");

//we could use the typical closure trick to trap the intended "this" (formatter1)
formatFn = function(txt:string):string {
    return formatter1.format1(txt);
};
console.log(formatFn("hi"));

console.log("----------");

formatFn = formatter1.format1.bind(formatter1);
console.log(formatFn("hi"));

console.log("----------");

formatFn = formatter1.format2;
console.log(formatFn("hi"));

console.log("----------");

formatFn = formatter1.format3;
console.log(formatFn("hi"));

//output:
// undefinedhiundefined
// ----------
//  || hi || 
// ----------
//  || hi || 
// ----------
//  || hi || 
// ----------
//  || hi || 

Update 2019/05/10By the way, this technique is perfectly valid in C# assigning lambdas to a field/property. In C# you can assign lambdas to a field/property, but that lambda can not use "this", the compiler will spit a "this" is not available in the current context error.

class Person
{
 public string Name = "aa".ToUpper();
 Func NameToUpper;
 
 public Person(string name)
 {
  this.Name = name;
  this.NameToUpper = () => this.Name.ToUpper(); 
 }
 
 //does not compile:
 //"this" is not available in the current context
 //public Func NameToUpper2 = () => this.Name.ToUpper(); 
}


Wednesday 17 October 2018

Symphonies of Salvation

I grew up as a person (I got into it at my late teens, so my physical growth was mainly done) as part of the punk-HxC scene. On the music side, I enjoyed most of its different subgenres, with particular interest first in GrindCore and then in Crust, Screamo and its different derivates/hybridations. On the social/political one, it greatly helped to shape the person that I am now (from my critical/questioning attitude to my food habits). Around 2003 I began to grow disenchanted with many of its social/political aspects, and that disillusionment moved me away from the music styles themselves. I started to dive into pretty different sounds, like extreme electronics, post-metal, post-rock and more and more social rap.

In the last months I've gone through quite a lot of personal stuff, and somehow I've ended back into many of those bands that were so important to me in the late 90's, and they've helped me a lot, as they had done at that time. I've also been discovering many new bands, their "successors" we could say, but that will be the topic for another post. I've got hooked again with 90's French screamo, mainly Ananda, Undone and Anomie (I absolutely recommend these amazing posts giving a so complete retrospective of that scene. As it had happened 20 years ago, walking along that path of emotional, intense French sounds necessarily led me again to its dark reflection to the other side of the Atlantic, those Canadian bands that explored the darkest boundaries of the genre, Union of Uranus and One Eyed God Prophecy (Drift do also deserve a special mention). It's hard to explain to what extent the person that I was in my early twenties got trapped into the magic sounds of One Eyed God Prophecy, and it's been beautiful to see how the so similar and so different person that I'm now in my early forties has got mesmerised again by those same sounds. Life is a constant battle against different enemies, and bands like this give me now the strength that they gave me in the past, some medicines never expire.

In the late 90's we were not exposed to the overdose of information that universal access to internet has made possible, and at that time I hardly had any data about OEGP. Searching information about them I've felt quite surprised when seeing that not much has been put up about them (or Uranus) in these 2 decades... which is due to the rather shocking fact that they are not considered a particularly cult/foundational band by good part of the current screamo scene. It seems really odd to me, and it's funny to read this interview to Orchid (a later band seen by many as a cult band) stating We were obsessed with One Eyed God Prophecy and all the Per Koro bands and were trying our hardest to rip them off.

This said, I've come across an amazing 3 pieces retrospective about Acme, Uranus and One Eyed God Prophecy. The choice of these 3 bands as the major representatives of new HxC punk sounds that would continue to grow and evolve over the next 2 decades all over the planet is really appropiate. However, I have to say that though I love Acme and I still get goose bumps in the rare occasions when I listen to their 7", I would have chosen another band to accompany Uranus and OEGP in that podium, maybe His Hero is Gone.

Saturday 6 October 2018

Tear Down the Bastille

As you well should know in the unlikely case of being an avid reader of this blog, I love Paris and consider it the most beautiful city in the world. Walking along the left banks of the Seine facing the Louvre on the other side in a dark winter afternoon is an almost magical experience for me. However, you can also find some ugly pieces of architecture. Some of the most hated buildings in Paris from the last decades are the Tour Montparnasse (that I love), and the Pompidou Centre (that I don't dislike). Most people do also deeply hate the high-rise appartment blocks that you can find in some areas of Paris intra-muros, like Italie 13, les tours de Orgues de Flandre, Front de Seine, and some other mid-rise housing states in the Belleville/Menilmontant area. Well, I have to say that I quite like those areas. For sure, save for some of the ones in Front de Seine, the architecture of these tower-blocks is not remarkable, but they add architectural diversity and reference points.

It seems like in the last years the Louis Vuitton Foundation (I have not seen it in person yet, but I guess I'll pretty like it) and the new Holy Trinity Ortodhox Cathedral (it quite disappointed me, indeed I think I prefer the old, Alexande Nevsky one) have become new targets for the dislike of Parisians and visitors alike.

In my last visit to Paris I came across one construction that since my first visit quite caught my eye for its ugliness. Over the years, this impression has not improved, I'm talking about Opera Bastille. This building looks really ugly to me, probably in other location it would not look so bad, but in the middle of Paris it really stands out.

Reading the wikipedia article I've learnt that it was part of the Grand Travaux of the Francois Mitterrand era. I thought these "Grand Travaux" had been just the Louvre Pyramid, le Grand Arch de la Defense and the Biblioteque Francois Mitterrands, 3 works that I absolutely love, but the article lists some more projects. One of them, the Ministry of Finances, is not particularly appealling to me, and the another one, The Arab World Institute, I just hate it, not for its architecture, but for what it is.

City of so many contrasts, when going from Bastille to the Seine I came across one very nice and unexpected surprise, Le Bassin de l'Arsenal.