Sunday, 18 October 2015

.Net 4.6

While starting to try to put me up to day with .Net 4.6 I've come up with a few interesting things. Let's see.

I already wrote some months ago about how .Net 4.5 is an in place replacement for .Net 4. With 4.6 is right the same, and the same technique described in that post applies in order to verify which is the .Net version that you have installed. If I check on my PC the version of the clr.dll, I'll see that it is now: 4.6.96.0.

As you know Microsoft has been working for a while on a new and improved JIT (Ryujit). In the past it was possible (I never tried it) to install it (protojit.dll) side by side with the standard one(clrjit.dll), and select one or another. In 4.6 this new JIT has become the standard, and as such has been renamed to clrjit.dll. The old JIT is distributed with the framework in the compatjit.dll file, and if needed you can force an application to revert to it by setting a value in app.config. It's explained here.

.Net 4.6 comes with C# 6, and the long awaited Roslyn. However, the whole thing is quite a bit bizarre. The csc.exe compiler that you'll find in the Framework installation folder (C:\Windows\Microsoft.NET\Framework64\v4.0.30319) is the old compiler, not based on Roslyn and with support only for C# 5. You can verify this by just trying to compile some code taking advantage of some new C# 6 feature. For example, trying to compile a program including a line like this:

int? length = list?.Count;

will give you these errors:

error CS1525: Invalid expression term '.'
error CS1003: Syntax error, ':' expected

So the new Roslyn based, C# 6 compiler is not installed with the Framework!!!

Microsoft has gone crazy or what?
The new compiler is installed when you install Visual Studio 2015, and seems to get placed in: $ProgramFilesx86$\MSBuild\14.0\bin (it's explained here). This appears not to be a big problem for most developers, as you can install Visual Studio Community for free, but as it's a fully functional Visual Studio, the installation is slow and painful. I really can not understand how you can install SharvDevelop in 1 minute and less that 50 MBs while installing Visual Studio continues to take hours and GBs and GBs.

Hopefully, for those few of us that don't plan to install VS 2015 (on my personal laptop), we can install Roslyn on its own in 1 minute anyway. You just need nuget (that by the way, can now also be installed and used on its own, just download the binary from the nuget site), and run this command:
nuget install Microsoft.Net.Compilers
as explained here.
The new C#, roslyn based compiler is still named csc.exe, but its version is:
Microsoft (R) Visual C# Compiler version 1.0.0.50618
while the version of the the non Roslyn compiler is:
Microsoft (R) Visual C# Compiler version 4.6.0081.0!!!

Yes, pretty bizarre, thanks Microsoft for adding more confusion to our lives... I have installed the Roslyn compiler to a Roslyn folder and renamed the binary to csc6.exe, cause as I have the folders for both the old and the new compiler in my path environment variable, I needed a way to make sure I'm using the correct one.

Thursday, 8 October 2015

Call the scum Daesh

For some time I had been wondering why almost all the French media tend to call the ISIS monstrosity by its Arab name, Daesh. It caused me some discomfort as to some extent it seemed to me that using the Arab name entailed some sort of recognition to them. I've just found that I was totally confused, you can read here that the Islamo-Fascists beast considers the Daesh term as an insult, because itsounds like the Arabic words Daes ("one who crushes something underfoot") and Dahes ("one who sows discord"). I've read somewhere that the French government sent a recommendation to the media to call this abomination "Daesh".

I pretty much like this stance, and I'll try to adhere to it myself. In the past I've found it quite revolting that many media (CNN for example) called them "militants". This is a neutral term (indeed I would tend to give it a positive undertone), and for the most part I don't believe in neutrality, indeed I hate neutrality, not taking sides is just a sign of cowardice and mercantilism. One can not be neutral before sadism and wickedness, one has to take sides and push others into also taking sides, not doing so turns you into an accomplice. You have to use a term that shows disgust, repulsion and contempt, you can not call Daesh "militants, you can not call Saudi Arabia or Qatar "states", you can not call Erdogan "president" and you can not call the Turkish repressive forces "an army", you have to call them "sadists", "terrorists", "vicious murderers" and "genocidals", because that's what they are. I hope someday history books will call them like that, and will call HEROES to all those that fight against them, like the Kurdish freedom fighters (YPG/YPJ, PKK) and the international volunteers.

Well, I think I'll leverage this post to put here a link to this inspiring video by the Kurdish left wing rapper Castro, and this other one. Would love to see those Kurdish troops enter one day in the Turkish presidential palace and burn it down to ashes. Long live to the Kurdish revolution! and Boycott Turkey, let's destroy their economy same as they torture, murder and rape innocent Kurds. Hopefully economic pressure could force progressive Turks and "normal" Turks to unite and revolt against Erdogan and the AKP scum, but well, honestly, with a population that votes massively for the Erdogan beast, I'm afraid there's little good to expect from the "average Turk", as the "average Turk" seems to be an Islamo-nationalist that denies other people's rights, denies the Armenian genocide, agrees with the invasion of Cyprus, and so on and on.

Sunday, 4 October 2015

REC 4

[REC 4] has been a pretty nice surprise. I wanted to leverage the Cinespanha festival in Toulouse to go watch some film, but I didn't feel like spending much time going through the program, so when I found they were showing one more instalment of the [REC] franchise, the plan was done.

I had great memories from [REC 1] and [REC 2], but [REC 3] was crap (this is not just my feeling, it seems common to most critics), so much that I have to admit that I even hesitated about stepping back and save me the 7 euros of the ticket. Well, maybe [REC 3] would not feel so bad if you just looked at it as one more Zombies film, but if you put it along with its prequels, it's just crap. So, I was intrigued (and a bit scared) as to whether this 4th instalment would be in line with the good ones or with the shit one. Hopefully, it's been the former.

[REC 4] is a perfect continuation of the story developed in 1 and 2. It's as thrilling and intense as its predecessors. Though also set in a closed space (a ship rather than an old building), it does not achieve the same claustrophobic atmosphere, but it's just excellent anyway. I quite liked the turns given by the 3 films in explaining what is happening. While [REC 2] moved us from the infectious disease realm into the paranormal, demonic posession territory, [REC 4] moves us back into the infectious disease land.

The [REC] series (except for the third, crappy film, on which he was not involved) are the best known works by Spanish/Catalonian (I have no idea of which are his feelings of identity) director Jaume Balaguero, but his previous films: The Nameless, Darkness and Fragile are pretty good (Darkness in particular). I have realised that I had missed "Sleep Tight", so I'll have to put it in my ToDo list, aong with watching again [REC 1 and 2].

Sunday, 27 September 2015

Merge and Divide

France lacks of peripheral nationalisms, except for Brittany and Corsica, and anyway it's minimum when compared to Basque or even Galician nationalism. Not event regional feelings are any strong. Based on wikipedia Midi-Pyrénées has one of the strongest regional feelings, probably it's true, you will see the Languedoc/Occitanie cross here and there, and of course Toulousains are very proud (and with good reason) of our city. Indeed, I would say that when compared to Spain, French nationalism is pretty soft (yes, forget about the huge support for the FN, I've said it in some other posts, it's quite a mystery that does not fit at all with what I perceive in my daily life in France, but at the same time I more or less begin to understand what prompts that vote, and for sure in most cases is not a particularly strong national feeling what is behind it).

With this in mind, it's not strange that the decision taken by the government some months ago to merge several regions (effective next January) did not stir strong passions or painful debates among the population (wow, imagine how different it would be in Spain...) On the other side, some local politicians were quite belligerent. The main problem with these merges is that you have to reduce duplicated structures and you have to choose a capital, so in the case of the merge of Midy-Pyrénéés and Languedoc-Roussillon this was quite painful for the latter. The decision between Toulouse and Montpellier was pretty clear for anyone with a brain. Don't get me wrong, Montpellier is a beautiful, modern city full of history, but it can not be compared to Toulouse, neither in terms of population (Toulouse is twice the size of Montpellier, both for the cities proper and for the Metropolitan areas), economic relevance and historical role (capital of the Visigothic kingdom, Battle of Toulouse, County of Toulouse). Indeed, I guess this easy decision is what mainly led to the fusion with L-R rather than with Aquitaine,a region with which in principle there are more economical sinergies (the Aerospace valley...). But choosing a capital between Bordeaux and Toulouse would have been pretty tough and I guess nobody wanted to get caught in such a battle.

Anyway, politicians in Montpellier were ready to cry and fight, and in the end they managed a sort of split of competencies. Toulouse will be the capital, but will get 6 out of 11 regional administrations, Montpellier will get the other 5. Of course this has not been well received in Toulouse, and many (me among them) question this decision and the merge itself.

I considered this to be a problem unique to this new region, as I thought it was the only one with 2 big cities, though notice that other already existing regions like PACA or Rhone-Alpes have this same situation (Marseille-Nice, Lyon-Grenoble-Saint Etienne), but reading this week's issue of Charlie Hebdo I found out that the case of Alsace-Champagne-Ardenne-Lorraine is even worst, they are joining 3 regions and you have to split competencies to keep everyone sort of happy between Strasbourg, Reims and Metz/Nancy (as Lorraine already had 2 big cities...) Obviously this will be really convenient for citizens... and is an excellent way to spend the brutal (yes, you can only qualify them as that, brutal) taxes paid by French workers. As Charlie notes, it follows the tradition of competence and money saving established by the European Union and its split of administrations between Brussels and Strasbourg...

Regarding my new region, some people proposed an idea that would have been really costly, but in terms of history and structuring of the territory was not that bad, to move the capital to Carcasonne, that though located in L-R is much more related to Toulouse (30 minutes far by train) than to Montpellier. The next point is deciding on a name, as the M-P-L-R thing is just something provisional. There is one poll in La Depeche about it. I voted for Pyrénées-Languedoc (Toulouse was the capital of the historical Languedoc), but Occitanie seems to be the one favoured by most people. My problem with naming it Occitanie is that the historical Occitanie comprised a much bigger territory.

Friday, 25 September 2015

UAC

I still find things around UAC confusing sometimes, so I'll put up here some notes. This paragraph in Wikipedia explains pretty clearly what UAC means:

When logging in as a user in the Administrators group, two separate tokens are assigned. The first token contains all privileges typically awarded to an administrator, and the second is a restricted token similar to what a standard user would receive. User applications, including the Windows Shell, then start with the restricted token, resulting in a reduced-privilege environment - even under an Administrator account. When an application requests higher privileges or when a user clicks a "Run as administrator" option, UAC will prompt standard users to enter the credentials of an Administrator account and prompt Administrators for confirmation and, if consent is given, continue or start the process using an unrestricted token

The restricted Access Token is also called "filtered" token. We say that an application is running elevated when it is running with the unrestricted (full) token. As far as I know a running process can not be elevated, is something that can only happen when the process is started (same as you can not switch the user under which a process runs). So when a process is started it gets assigned an Access Token for a given user (and if that user is an Administrator it can be the restricted or the unrestricted one). Of course a process can use impersonation, but that's something at the thread level (impersonation token). One important point that I tend to forget is that if you are an Admin you can force a process to be started with the elevated token (rather than wait to see if windows offers you that with its UAC promp) by launching it with Run As Administrator

What does this restricted token really mean? Well, Access Tokens contain information about the Identity and the privileges of a User, as in Windows security works at 2 levels, on one side you have ACL's for securable resources (files, folders, registry keys), your permissions on these resources come determined by your user/group, so in this sense a restricted and unrestricted token for the same user behave just the same. On the other side we have privileges to perform certain actions (for example create Global Objects or use impersonation). Thanks to this pretty good article I learnt about the whoami /priv /user command that you can use to see the permissions associated to your current token.

Checking if a process is running elevated is pretty simple, you just have to enable the elevated column in Task Manager. There you can check that if you run a process elevated (for example cmd) and from it you start a new process (for example notepad) the child process will also be run elevated.

And, how do UAC and impersonation play together? Let's say you are running a process as a normal user and you impersonate one of its threads to run with the token of an Administrator (that you have obtained via the LogonUser API function), will it obtain an elevated or a restricted impersonation token?

I have not tested it myself, but from this StackOveflow discussion it seems like if you are in an interactive session you will get a restricted token, but if you are in a non interactive session you will get an elevated token.

By the way, reading over this post about Impersonation that I wrote time ago has been quite useful to refresh some concepts.

Sunday, 20 September 2015

Eritrea

Regardless of my interest in geography, history and social issues, I have to admit that my knowledge about Eritrea was pretty low. I knew the basis: Horn of Africa, independent after Italian rule and a war against Ethiopia, an "Italian style" capital, and well, what sadly you have to assume about mainly any African country, it's poor.

It seems like the second biggest group of refugees in the current humanitarian crisis are Eritreans, for example the shocking refugees camp that existed between last summer and this summer in central Paris under one of those beautiful overground metro tracks was basically populated by Eritreans, Sudanese and Ethiopians. So this woke up my interest in the country and made me go in search of some information.

It's very complicated to get a full idea of how the situation is there. The vision that most western media and governments promote is that Eritrea is a very poor and horrible repressive state. This article and this BBC documentarystand on that side. On the contrary, I found 2 fascinating documentaries, "A nation in isolation" and "Behind the Crisis"", that portrait a quite better image. Probably there's truth on both parts. On one side the goverment has made the economy, the health and educational systems improve and move forward, but is paranoid about dissidents and rules with an iron fist. Well, in a continent where hunger, AIDS and lack of education are so common, overcoming them at the expense of some personal freedoms does not seem such a bad deal to me...

I'll try to continue to learn about the country, cause apart from this intriguing/worrying political situation, there are some facts that make it quite interesting, for example:

  • Roughly half of the population is Christian and half of the population is muslim and they live together without friction. Churches and Mosques stand close to each other without a problem.
  • There are 9 main ethnic groups in the country, and again, there seem to be no conflicts among them.
  • Asmara is a sort of masterpiece of Italian modernist architecture.
  • Assab, the city with probably the most horrible weather in the planet (almost no rain, annual mean average temperature of almost 31 degrees and very high humidty. Notice that this contrasts with Asmara, that has rather pleasant climate.
  • During their heroic fight for independence against Ethiopia, the Eritreans were considered the best guerrilla army in the world.

Friday, 18 September 2015

Bordeaux

Bordeaux, "la belle endormie" (the sleeping beauty) is a really beautiful city. It's a little more than 2 hours far from Toulouse by train (and you can leverage a deal and get a return ticket for 30 euros, les samedis de intercité), so I have gone there in a good bunch of occasions. An easy an effective way to describe the city is to label it as a small Paris. I pretty enjoy the architectural change between Toulouse and Bordeaux. Toulouse architecture is amazing, but it does not follow the archetypical French style (the same happens with Marseille), on the contrary, Bordeaux is right what you would expect of a French city (in architectural terms) if your reference is Paris (indeed, Hausmann used Bordeaux as a model for transforming Paris). By the way, Lyon and Nantes are other 2 "very French" cities (well, Lyon is just incredible).

In my last day trip there I came across a few "different" images of the city that have prompted this post, so here they go:

Bordeaux will be connected to Paris by high speed train (LGV) in 2017, which means a travel time of 2 hours (meaning that Toulouse will be little more than 4 hours far from Paris! as we wait for the not yet confirmed LGV extension between Bordeaux and Toulouse). As a consequence the St Jean station is undergoing some important renovation and expansion works. The renovation of the beautiful and classy ceilings involves this astonishing scaffolding:

Le Garonne river flows really, really wide through Bordeaux (it's already pretty wide in Toulouse), and there are 2 modern bridges (Pont d'Aquitaine and the vertical lift bridge Pont Jacques Chaban-Delmas) that seemed to be worth a visit. In the end I didn't find them particularly remarkable, but on my path there by tram I spotted a couple of places that deserved a short stop. In the docklands area (area where the Italian fascist regime set up a submarine base) I came across this astonishing piece of Street Art:

Walking north from there I found quite a few painted walls, this piece quite caught my eye, as it is reminiscent of the amazing ROA

And from there I got to an amazing area that seemed a bit like copy-pasted from Berlin, Les vivres de l'art (beautiful memories of the courtyard of the sadly extinct Tachelles):