Wednesday, 18 July 2018

Equipe de France

If 20 years ago someone had told me how obsessed with race our world would be in 2018 I would have rejected to believe it, but sadly, part of this world is as obsessed with race and ancestry now as it was in the worst times of history. One could think that it's just the fault of the White far-right (Rusia, Eastern Europe, Trump, and their satellites in Western Europe), but "Blacks", "Latinos" and the far-left have contributed to this mess in equal doses.

The kind of comments that have been stir up by the victory of the French football team in the World Cup are sickening. It's not just the Far-Right who considers the French team an "African team", but also African and Afro-American "personalities", or the Nicolas Maduro idiot. So some of the African people that complain about racism are as obsessed with race and ancestry as any of the very white "official racists". So for these people a Human being is not free to decide to what society he wants to belong, it's just his skin color or the birth place of his ancestors who determines that, that's all, the individual has no rights, it's only the "race", who has rights... This is revolting.

For the most part I don't give a shit about football, and I have little idea of the feelings of identity of the players of African descent in the French team. Maybe some of them love France with all their heart, maybe others are anarchists and don't care about nations, and yes, unfortunately it could happen that some of them is an "anticolonial racaille" that identifies himself with the country of his ancestors (from which they fleed due to poverty) rather than with the country that has provided him with food and education... I honestly don't know, and hence I apply my general rule, if you are born and/or have lived most of your life in one country, and you give no signs of disrespecting that country, you are a citizen of that country, regardless of your physical traits or those of your ancestors. That's quite simple.

Additionally, these "African nationalists" that want to appropriate the victory of the French team based on race and ancestry are missing a huge point. Would these guys have become good players if they had lived in Africa, rather than in France, with the Western welfare state and being trained by French (of whatever color) trainers?

Hopefully, all this crap has brought up some excellent reactions. Benjamin Mendy, from the French football team, came across a stupid tweet from some sport magazine that associated to different players the flag of their alleged "country of origin", he fixed it by assigning the French flag to all of them.


The (born and raised) French Basketball player (born to a Cameroonian father) Nicolas Batum went even further (sorry for my bad translation).

Sorry for my language, but those that say "Bravo Africa for your victory", go fuck yourself!. I proudly wear the blue t-shirt with "France" written on it, I've won several trophies and medals with the French team since I was 15, I sing La Marseillaise, when I am in the USA I cry high and strong that I am French. Then, yes, I have a Cameroonian father and a Cameroonian name, but we all have fought and played for France because we have been born here, we have grown here, we have learnt our sport here, we are proud of having the French nationality. We have won for France, for the French youth that looks at us and aspire to do the same and bear high the French colors. Let's be proud of that. Vive la république et vive la France!

When one sees this growing and deviated obsession with race, the move from the French National Assembly to remove the word race from the French constitution seems particularly appropriate.

Sunday, 15 July 2018

TweenJS and Canvas Basic Sample

I've been playing around a bit more with animations on the HTML5 Canvas. While in this previous sample I was doing the basic movement logic myself, for this new experiment I wanted to use some library that would allow me to use easing equations. After some basic investigation I've opted for tweenJS. I'm not animating DOM elements, but shapes that I draw on the canvas, so I needed a library that would accept any object and update its values on request based on the selected movement/evolution logic, and then I would take care of drawing it. TweenJS fits perfectly into this mindset.

As in the previous sample, I'm leveraging the power of async/await to make it simple to launch my animations in sequence. There is not much to explain, just launch your debugger to see the typescript code.

while (true){
        for (let y=0; y<itemsMatrix.length; y++){
            for (let x=0; x<itemsMatrix[y].length; x++){
                let item:TweenJSSquare = itemsMatrix[y][x];
                await item.animateDiagonal(new Vector(canvas.width - ((x + 1) * size), size * y )); //endPosition:Vector,);
            }
        }

        for (let y=0; y<itemsMatrix.length; y++){
            for (let x=0; x<itemsMatrix[y].length; x++){
                let item:TweenJSSquare = itemsMatrix[y][x];
                await item.animateFall(canvas.height - (size * (y + 1)));
            }
        }

        for (let y=0; y<itemsMatrix.length; y++){
            for (let x=0; x<itemsMatrix[y].length; x++){
                let item:TweenJSSquare = itemsMatrix[y][x];
                await item.animateDiagonal(new Vector((x * size), size * y )); //endPosition:Vector,);
            }
        }
    
        for (let y=0; y<itemsMatrix.length; y++){
            for (let x=0; x<itemsMatrix[y].length; x++){
                let item:TweenJSSquare = itemsMatrix[y][x];
                await item.animateFall(canvas.height - (size * (y + 1)));
            }
        }
    }

Monday, 25 June 2018

Taiwan

Some months ago I read a short text (in a nice book about geopolitics) about the China/Taiwan relations that quite surprised me. I knew that Taiwan as a country was created after the Chinese Civil War, when the losing side, the nationalists, retraited to the island. As part of the Cold War, USA decided to protect the island from an invasion from the mainland, communist China. Ever since China has reclaimed that Taiwan is part of China and there's always been the potential for an invasion. Well, there's quite a bit more to the story.

I used to think of Taiwan as a normal free, wealthy country, with a powerful hi-tech economy and a good standard of living. Their big problem, the fear of a Chinese invasion, would be similar (thought more intense and justified) to the fear that Baltic republics have for a Russian invasion. Well, I was a bit confused. One could say that Taiwan is not a a normal country, because it lacks a seat in the United Nations and basically no other nation (save for a handful of small ones) consider it a country and maintain official diplomatic relations with it (the rest of the world keeps informal relations). This lack of formal recognition is also the case for USA, even if they more or less protect the island from a mainlad Chinese invasion.

There are some key points to better understand this odd situation. What we commonly know as Taiwan officially calls itself Republic of China (ROC), while what we commonly call China officially calls itself People's Republic of China (PRC). So, yes, it seems like there are 2 Chinas... Well, not really... The One Chine Policy basically says that there is a single country of China, but with two governments, the ROC and the PRC. For example the ROC government tends to consider itself as the legitimate government of both Taiwan and Mainland China.

One could think that Taiwanese population would massively support independence save for the fear of being invaded by mainland China, but indeed this is not the case, as many people consider that both Chinas form a cultural unity and they should join together, but of course under a democratic government, not under the pseudo-Communist regime. As this is not feasible, many people support the current situation.

Bearing in mind that Taiwan's flagship companies like Acer and Asus have factories in mainland China, one should think that the relations between both countries are not so bad as they could seem.

Saturday, 23 June 2018

The Salafists and the Balkans

I've recently watched 2 very interesting and disturbing French documentaries about the expansion of salafism in the Balkans. La Bosnie-Herzégovine, fief du salafisme européen is not so suprising to me. It explains how the moderate (with many Sufist influences) Islam that was common for Bosniaks (Muslim Bosnian population) was first exposed to the radicalisation disease when Jihadists from Arab countries and Pakistan, Afghanistan and other shitholes (indeed many of them had just finished their "work" in the Afghan war) ran into the Balkans to support their Muslim "brothers" during the collapse of Yugoslavia. After the war, some of these scum bags decided to settle in Bosnia and began to spread their poisonous ideas. Some of them would settle in rural areas and create "salafist villages".

These yihadists played a role, but for sure the main actors in bringing and spreading fundamentalism in Bosnia have been the Golf countries and Turkey, that have built new mosques managed by imported or reeducated radical Imams and have funded "cultural associations" aiming to push Bosniaks into fundamentalist Islam. This is clearly seen in the documentary, with the "hispter salafists" leafletting on the streets and the caritative associations helping the poor to buy their acceptance.

This documentary was like the appetiser, the main dish is served by this other documentary, Bosnie, Serbie, Kosovo, les nouveaux territoires de l'islam radical. This is an excellent report. It starts with Bosnia, and shows an even more worrying portrait. The drift towards a much more strict interpretation of Islam can be clearly felt on the streets. It's not just a matter of the increasing presence of women with niqabs and men with the salafist dress code. Now many bars have stopped serving alcohol, the Halal market (not only for the soaked in suffering meat) has just exploded, and the socialization habits are changing. The part that surprised me a lot is that part of these changes are also due to the country having become a tourist destination for the middle classes of the Golf countries. Huge touristic villages (well, they are planning a city for 100.000 people) made up of secondary residences for Arab families are springing up like mushrooms. It makes sense, if you are a devote Arab family and want to enjoy a green, mountanious landscape (even ski sports) in a place where your strict moral views won't be disturbed, a place desperate for investment like Bosnia seems ideal (adjusting their secular Islam to a more rigorist one is just a compromise). It's particularly sad to see in this documentary how the huge radical mosques funded by Saudi Arabia are full of "believers", while a Sufi mosque preaching a tolerant and moderate version of Islam is almost empty...

Seeing how Arab investment is shaping (destroying) the present and future of Kosovo was not surprise to me either, but what shocked me is the influence of radical Islam in Serbia and Montenegro. Come on, Serbia!? a country that represents slav "culture" at its most (Orthodox Christianity, nationalism, conservadurism...), that during the wars against Bosniaks and Kosovars made of ethnicity and religion a huge factor... Well, to my surprise, there's a region stretching over the borders of Bosnia, Montenegro and Serbia, Sandjak, where there's a huge percentage of Muslim population, that is also being exposed to fundamentalist views. Odd that the Serbian authorities allow salafists to proselytize on the streets of its main city, Novi Pazar.

Sunday, 17 June 2018

Climate Engineering

I've recently watched a pretty good documentary about Climate Engineering (the deliberate and large-scale intervention in the Earth’s climate system). I came across with the Spanish version, "Un Clima Mecanico" (not sure about the English title), but there seems to be quite a few other documentaries on this topic.

I thought the idea of voluntarily changing the climate or the weather for someone's benefit lied mainly in the realm of fiction (let's exclude Global Warming, that could benefit a few people at the expense of the rest of us), but indeed it was already done by the USA during the Vietnam War, in the Operation Popeye. Furthermore, it seems like the Soviet Union used to artificially clean up the skies of Moscow for the May 1st parades, amazing.

Modifiying the local weather for one or several days seems scary (causing huge storms that can damage crops, flood cities...) but modifying the climate would have a global effect, and that's terrifying. If you modify the climate to do your country more rainy others will become drier, and the same goes for the temperatures. Conflicting entities would end up in a traditional war... The documentary shows how the Soviets had a crazy plan for melting the Artic to benefit of its resources, it's sad to see that they just had to wait a few decades to let Global Warming do the job for them.

For the moment, Climate Engineering remains such a dangerous and conflictive topic that apparently governments are not supposed to promote research on it... but well, who knows what is really under the surface...

Agriculture 2.0

This documentary about Vertical Agriculture is just amazing. I used to think of "Urban Agriculture" mainly as a nice hobby with a social component. If you live in a flat in a city you need to be a bit lucky to enjoy that hobby. The options are:

  • You have a balcony (relatively common in France, totally uncommon in Asturies) and you can grow there a few tomatoes, strawberries and even have a small orange tree in a pot.
  • The building where your flat is placed has some sort of private garden (rather common in France, very uncommon in Asturies) and the neighbours have agreed in setting a growing area. This could also happen in your building's roof.
  • Some neighbours association has agreed with the city council to set up some growing area in some park or unused space (this happens sometimes in France, is unknown to me in Asturies).

Well, all the above is cool, but has nothing to do with the documentary. This documentary is about how to set up agricultural facilities in towns that would really help to feed the town regularly (with veggies that in many cases do not grow in the city's climate), not just a neighbours lunch. City space is rare and expensive, so the idea is taking the conventional greenhouse to its version 5.0! You can start by hanging up if possible different layers of growing veggies in one container and then move to setting multistories plantations. You can also skip using soil and move into Hydroponics. The concept envisioned by one Swedish entrepreneur where a building would be used for office space and agricultural space is beautiful.

What amazed me the most is how by fully controlling the weather in your container: temperature, light, humidity... you can grow anything maximising its nutrients and taste. If you know that certain harvest a certain year in a certain place was particularly tasty, and you have access to the weather patterns in that place that year, you can be close to replicating it. Agriculture is becoming the new IT freaks realm!

When in October 2016 I was travelling by train from Amsterdam Airport to Rotterdam I felt totally amazed by the huge extension of modern greenhouses. These had nothing to do with the ones covered in plastic that are so important in Southern Spain, these were glasshouses, like the ones in a botanical garden, but on a massive scale. This shows up in the documentary and happens to be called Westland.

Tuesday, 22 May 2018

Async/await with Animations

Years ago I had fun coding an animation matrix (the sample has been moved here). Most cases involved a sequence of animations, each one starting after the previous one had finished. It was one more case where I had to simulate an asynchronous loop, where at the end of each "iteration" I would callback into an "orchestrator function" that would launch the next iteration. I realized that now that we have async/await, this could be done in a much more straight forward way, so I've prepared some sample code.

For the kind of animation that I'm doing it would have been more simple to just animate divs rather than drawing squares on a canvas, but lately I've been playing around with particle systems on a canvas, and I've preferred to continue with the canvas route.

Whatever item we are animating, the thing is that starting the animation should return a Promise that will get resolved when the animation completes. For this sample I'm animating a square that falls from the top to the bottom of the canvas and bounces a couple of times until it stops. You can see it here. The code (yep, I've jumped into the TypeScript trend) looks like this:


abstract class AnimationItem{
 currentPosition:Vector;
    endPosition:Vector;
    moving:boolean;
 resolveCurrentAnimationFunc:any;

 public abstract update():void;
 public abstract draw():void;
 
 public animate():Promise<void>{
  this.moving = true;
        return new Promise<void>((res, rej) => {
            this.resolveCurrentAnimationFunc = res;
        });
    }
}


//in our child, concrete class:
    public update():void{
        if(!this.moving){
            return;
        }

        this.ySpeed += this.gravity;
        //this.logger.log("speed: " + this.ySpeed + ", pos:" + this.currentPosition.y + ", " + this.acceleration);
        this.currentPosition.y += this.ySpeed;
        if(this.currentPosition.y >= this.endPosition.y){
            //let's place it just in the limit
            this.currentPosition.y = this.endPosition.y;
            if(this.bounces > 0){
                this.bounces--;
                this.ySpeed = -1 * this.ySpeed/2;
                this.logger.log("bouncing: pos:" + this.currentPosition.y + ", speed: " + this.ySpeed + ", " + this.acceleration);
            }
            else{
                //stop it
                this.moving = false;
                this.resolveCurrentAnimationFunc();
            }
        }
    }

So we have an animate method that returns a newly created Promise and stores in our class a reference to the resolve handle of this Promise. The update method takes care of updating the position of the object and resolving the Promise once the final position is reached.

I'm animating several of these items (rows and columns), one after another. With the power of async/await our code is so simple as just writing normal loops like this:

for (let y=0; y<2; y++){
        for (let x=0; x<3; x++){
            let item:AnimationItem = new FallingSquare(ctx, 
                new Vector(x * size, 0), //currentPosition:Vector, 
                new Vector(x * size, canvas.height - (size * (y + 1))), //endPosition:Vector,
                0, //speed:number, 
                size,
                "red",
                logger);
            
            animationSystem.addItem(item);   
            await item.animate();
        }
    }

I've uploaded along with the transpiled and bundled javascript file the original typescript source code and the source map, so to see the full code just launch the debugger!