The Roberto Selbach Chronicles

About |  Blog |  Archive

Blog

Cedilha no Fedora 25

Quem utiliza teclado US Internacional para escrever no Linux já deve ter dado de cara com o fato de que na maioria das distribuições, a combinação ‘+c gera um “ć” em vez de um “ç”. Resolver isso no Fedora 25 é fácil, mas não evidente.

tl;dr – eu criei este script que faz todos os passos abaixo automaticamente. Basta rodar isso:

curl https://raw.githubusercontent.com/robteix/c-cedilla-fedora/master/c-cedilla-fedora | bash

Se você preferir não executar o script, continue lendo.

Primeiro, vamos criar um novo mapa de teclado para seu usuário. Rode o comando abaixo:

sed -e 's,\xc4\x86,\xc3\x87,g' \
    -e 's,\xc4\x87,\xc3\xa7,g' \
    < /usr/share/X11/locale/en_US.UTF-8/Compose > ~/.XCompose

Isso copia o arquivo de mapeamento de teclas do Fedora para o diretório $HOME do usuário, substituindo o “Ć” por um “Ç”.

Agora vamos configurar o GNOME para que ele não controle a configuração do teclado, para que possamos usar nossa própria:

gsettings set org.gnome.settings-daemon.plugins.keyboard active false

Para selecionar o input method apropriado, o Fedora fornece um programinha chamado im-chooser que não é instalado por padrão. Para instalá-lo:

sudo dnf install im-chooser

Por fim, executamos o im-chooser e escolhemos “Use X Compose table”:

Clique em “Log out” para aplicar as modificações e a partir de agora deve ser possível gerar o c-cedilha com a combinação ‘+c.

The Woman the Mercury Astronauts Couldn’t Do Without

Must-read article on “human computer” Katherine Johnson. Not only was she a key figure in pushing NASA’s efforts forward, but she did it while fighting misogyny and racism:

Outside the gates, the caste rules were clear. Blacks and whites lived separately, ate separately, studied separately, socialized separately, worshipped separately, and, for the most part, worked separately. At Langley, the boundaries were fuzzier. Blacks were ghettoed into separate bathrooms, but they had also been given an unprecedented entrée into the professional world. Some of Goble’s colleagues were Yankees or foreigners who’d never so much as met a black person before arriving at Langley. Others were folks from the Deep South with calcified attitudes about racial mixing. It was all a part of the racial relations laboratory that was Langley, and it meant that both blacks and whites were treading new ground together. The vicious and easily identifiable demons that had haunted black Americans for three centuries were shape-shifting as segregation began to yield under pressure from social and legal forces. Sometimes the demons still presented themselves in the form of racism and blatant discrimination. Sometimes they took on the softer cast of ignorance or thoughtless prejudice. But these days, there was also a new culprit: the insecurity that plagued black people as they code-shifted through the unfamiliar language and customs of an integrated life.

Katherine understood that the attitudes of the hard-line racists were beyond her control. Against ignorance, she and others like her mounted a day-in, day-out charm offensive: impeccably dressed, well-spoken, patriotic, and upright, they were racial synecdoches, keenly aware that the interactions that individual blacks had with whites could have implications for the entire black community. But the insecurities, those most insidious and stubborn of all the demons, were hers alone. They operated in the shadows of fear and suspicion, and they served at her command. They would entice her to see the engineer as an arrogant chauvinist and racist if she let them. They could taunt her into a self-doubting downward spiral, causing her to withdraw from the opportunity that Dr. Claytor had so meticulously prepared her for.

Source: The Woman the Mercury Astronauts Couldn’t Do Without

New stuff coming in C# 7.0

Mads Torgersen wrote a blog post highlighting what’s new in C# 7.0:

C# 7.0 adds a number of new features and brings a focus on data consumption, code simplification and performance.

The changes all seem to be in line with the recent trends of borrowing syntax sugar from other languages to C#. Nothing wrong with that: copy what’s good and shed what’s bad.

One of the changes is related to out variables. These are the C# way to deal with not being able to return multiple values (see below for good news on that front). It’s basically the same as passing by reference in, say, C. For instance:

int myOutVar;
changeMyOutVar(out myOutVar);

You could have the value of myOutVar set inside changeMyOutVar. Simple. What is changing in C# 7.0 is that you would no longer need to predeclare myOutVar:

changeMyOutVar(out int myOutVar);

The scope of the new variable will be the enclosing block. I have to say it: I don’t like it. It feels obfuscated to me. The variable doesn’t look like it should be in that scope. Compare with this popular Go idiom:

if err := DoSomething(); err != nil {
    return err;
}

The variable err is created inside the if and its scope is there as well. I know a lot of people who hate this for the same reason I don’t like the way the new out variables are to be created in C#. I find it much more clear in Go though.

The feature I absolutely loved to read about is tuples. Error handling in .NET is often done with exceptions, which I find clunky and cumbersome. With tuples, we might be able to move to something more Go-like:

(User, bool) FindUser(string username) {
    var found = _userList.Find(u => u.Username == username);
    if (found == null)
        return null, false;
    return found, true;
}

So we could do something like:

var (user, ok) = FindUser("someusername");
if (!ok) {
    // user not found, deal with this
}

Check his post for more features.

Millie 0.9.6, or “installers are hard”

I’ve been terribly busy with work lately and so I haven’t really had much time for my side projects. I did however managed to get a new version of Millie out of the door.

Got get it here.

Changes are mostly infrastructural though.

User “visible” changes:

  • Add .deb installation files for Linux
  • Add support for electron-builder
  • New settings system
  • Fix missing icon on Win64 installer
  • Split generation of 32- and 64-bit installers on windows

Minor changes and fixes

  • Merge branch ‘builder’ of github.com:robteix/millie
  • Ignore backups
  • Add missing dependency
  • Ignore main.js.map
  • Remove warning on unknown props
  • Cleanup
  • Move background declaration to MillieView
  • Stop loading old settings
  • Add script to generate release files
  • Remove log file left from first commit

That said, this release reminded me of how hard installers are to get right. Actually, they’re hard to do at all.

MacOS installers can basically only be made on macOS due to there not seeming to be decent implementations of DMG anywhere else. You can compile and create a ZIP file with your binaries, sure, but who wants that? To create a nice DMG, you need to be on macOS.

Windows is also hard to do in other systems. Not impossible, just annoying. You can get by with Mono in Linux or macOS but you need to get around a bug here and there. It works though.

Linux installers (meaning .dpkg and .rpm) are easy to do in macOS but barely doable on Windows.

In practice you end up having to create each installer on its own environment. Linux and Windows are easy to do with VMs, but you’ll need a macOS box eventually.

Windows has its own share of problems though. I hear they’re working on finally fixing their dumb limitations on path length but it’s definitely not there yet. This is important when working with things like npm that create paths hundreds of levels deep. Trying to something simple like deleting a node_modules directory on Windows is an exercise in frustration.

The installers for this release were all created in a Linux VM though. It was the closest thing I got to building it all in a single platform. No DMG for macOS though.

I’m sad today

So this is me today.

640px-Sad-pug

Years ago, my wife and I had a friends couple we worked with for some years. Someday they stopped talking to us. They refused to answer our calls or answer our emails. They never accepted out friend requests on Facebook.

We never knew why.

This happened over 10 years ago so naturally life moved on. From time to time, it happens that I see something from them on Facebook seen as we have a lot of friends in common, but neither of us acknowledges the present of the other.

I recently joined a Slack team and to my (and I’m sure his) surprise, my former-friend was there as well. Over the course of the next few weeks, we’d be talking in the same channel to other people but again, never directly to each other. I wanted to but I knew he was mad at me for something and I didn’t want to force it. What I did try doing was to engage in the channel as if nothing ever happened, just like everyone else.

But it was unconfortable. There was always that elephant in the room. So last Thursday I send him a message in private. I told him I never knew what I had done but that I apologized for whatever it was. I told him that he didn’t have to forgive me but I would really appreciate knowing what it was.

But he wouldn’t answer. So today I decided that there was no point in making two people uncomfortable all the time and I left the channel.

In the end, it’s no big deal. As I said, this was something that happened (whatever it was) over 10 years ago. But it makes me sad that I’ll never know what I did wrong.

(Image CC-BY-SA by Wikimedia Commons)

Une lettre ouverte à la madame qui a pointé son doigt vers ma fille

Conscient du fait que mon français n’est pas très bon (j’apprends), je pense cependant qu’il est important de l’écrire dans cette langue, car vous m’avez fait savoir que toute autre langue n’est pas acceptable.

Il y a quelques jours, j’étais chez un restaurant Valentine avec ma fille de six ans. Nous y étions allés parce qu’elle adore leur hot-dog et puisqu’elle avait fait un super effort à l’école ce jour-là, j’avais décidé de la récompenser. Vos raisons pour y être doivent être encore plus mondaines que ça.

Nous sommes arrivés au Québec depuis moins de trois mois et ma fille est toujours en train d’apprendre le français. Et bien qu’elle s’efforce de se faire comprendre par un monde qui ne la comprend pas, elle a encore des difficultés. Elle devient souvent frustrée. Et pourtant elle persévère. Sachez que je suis très fier d’elle.

Elle venait d’entrer à l’école avant les vacances d’été, juste pour apprendre le français. Un jour, les élèves devraient avoir un examen de mathématique et les enseignantes avaient décidé de sortir ma fille de la salle pour continuer à étudier le français. Ma fille a commencé à pleurer et supplier. Les enseignantes ne comprenaient pas pourquoi. Ils m’ont alors appelé et je suis allé à l’école. En y arrivant, nous avons finalement compris : elle se croyait punie et elle ne savait pas ce qu’elle avait fait pour le mériter. Elle implorait le pardon. C’est de ce genre de situation à laquelle elle doit faire face tous les jours.

Encore une fois, elle a six ans.

Elle a perdu toutes ses amies. Elle a dû laisser presque tous ces jouets. En tant que père, ça me brise le cœur de la voir en regardant des autres enfants qui jouent, parce que je sais qu’elle veut jouer avec eux, mais elle est souvent gênée à cause du français.

Je suis certain que vous serez d’accord avec moi quand je dis que ça n’est pas facile pour un adulte, et encore moins pour une petite fille. Mais elle fait un vrai effort là et je suis tellement fier d’elle. Vraiment fier.
Et c’est pour cette raison qu’il m’a fait tellement mal quand vous avez décidé de lui réprimander de ne pas parler français avec son papa.

Elle jacassait comme d’habitude quand vous l’avez interrompue pour me dire qu’il fallait parler français au Québec. Ça m’a surpris un peu, mais j’ai commencé quand même à vous expliquer qu’elle apprenait. Vous avez décidé de m’ignorer et de pointer votre doigt à une petite fille et de crier « en français ! »

Je suis un nouvel arrivant et je n’avais aucune idée, à ce moment-là, comment réagir. Je ne savais pas si vous auriez l’appui du reste des gens chez le restaurant ou pas. Mon instinct était juste de protéger ma fille de vous. Ma petite fille qui se protégeait derrière moi, intimidée par une madame qui partait en colère pour quelque chose qu’elle ne comprenait pas.

Et pourquoi ?

Je vous demande, madame, c’est à quoi exactement que vous vous attendiez ? Je comprends que vous considérez votre langue importante. En général, j’appuie l’idée que tout le monde doit être capable de se communiquer en français au Québec. Je pense que c’est absolument juste que personne ne vous demande de parler l’anglais ou d’autre langue, quelle qu’elle soit. Vous êtes au Québec et le français devrait être suffisant pour y vivre. Je suis d’accord avec tout ça.

Mais si ma fille veut parler à son papa en sa langue maternelle, qu’est-ce que vous avez à voir avec ça ?
Essayez de vous mettre dans notre place. Essayez de vous imaginer à un autre pays. Est-ce que vous arrêtiez de parler français avec vos enfants ou votre conjoint ? Soyez honnête.

Je ne sais vraiment pas ce que vous pensiez à réussir, madame, mais ce que vous avez réussi à faire c’est de me faire repenser le Québec et les québécois. Vous m’avez fait me demander si les québécois sont tous des colons. C’est ce que vous avez réussi, madame.

Mais même là, vous avez échoué.

Lorsque vous êtes partie, des gens chez le resto sont venus s’excuser de vous. Une femme a donné à ma fille des crayons et une feuille de papier pour qu’elle puisse dessiner afin d’arrêter de pleurer.

J’ai donc conclu que non, vous ne représentez pas le Québec. La plupart des québécois avec qui j’ai eu le plaisir d’interagir m’ont traité avec respect. La plupart des québécois avec qui j’en ai parlé m’ont dit la même chose : vous, et ceux comme vous, avez perdu la guerre. Vous êtes une relique d’un passé honteux de cette belle province. Vous représentez le passé.

Ma fille est l’avenir. Deal with it.

Best icecream I’ve ever had

Years ago, I was part of a project that went completely off the rails. A little context: we were a services company and we had local offices in cities all over the country. My team provided 2nd-level support which means we often had the PMs call us from those via an annoying Nextel radio.

I won’t go through the details but suffice it to say this project envolved one such branch going rogue and committing actual fraud, with criminal proceedings and all. People were on the edge, and the relationship with that branch was increasingly hostile. There was also an internal power struggle in the company between some directors at that point. In other words, a clusterfuck I’ll always cherish, if by cherish you mean hate hate hate. Anywho…

One time, there was a national holiday on a Thursday and we were going to make it a long weekend. As customary, I communicated with all the PMs about contigency plans. This PM then told us that we could not take Friday off because the customer wanted us to fly over there. We were supposed to be at the customer’s site early Friday morning. That meant we would have to fly Thrusday afternoon. I wasn’t happy.

It immediatly felt arbitrary too. As I said, the relationship was not good and we suspected he was just trying to cost us our days off. I knew enough of the customer to be fairly sure they would not have requested us that Friday. Why did the customer want us then? There was nothing yet on production and if it was just to show progress, surely we could move it to Monday. At worst, can’t we make it over the phone? No, no, no, he said. The customer was adamant that we be there on Friday. Sucked to be us.

So we flew over Thursday afternoon and on Friday morning we headed to the customer’s offices only to find it closed. They too had made it a long weekend and wouldn’t be back until Monday.

Normally I would be furious over the waste of time but to be honest, both I and my colleague smiled at that. It confirmed that the PM just tried to screw us and the customer have never asked for us. We headed back to the local office.

Before coming in, we both bought ourselves some icecream. My friend stayed in the little garden in front and I went in. The PM immediatly saw me and demanded to know why I wasn’t at the customer yet. I didn’t answer. Instead I grabbed the Nextel radio and headed back out with the PM following. I then sat down on the grass and called my director. Smiling and staring at the PM, I told him about the office being closed. The PM’s face froze when my director asked to talk to him.

We sat outside under the sun, enjoying our icecreams while the PM got shouted at. It was the best icecream I’ve ever had.

Is it really as bad as it looks?

Hi, I have a question

Do you ever not?

“Learning never exhausts the mind.”

Leonardo DaVinci? I’m proud of you. Go ahead.

Thank you. I’ve been reading all these horrific news stories about the Olympic games and Rio…

Oh that. Yeah, I’ve been getting asked that question regularly lately.

Is it really that bad?

Yes and no. There is a lot of sensationalism out there. But it’s bad and, at least to us Brazilians, not at all unexpected because Rio is widely known as a hellhole among us.

Years ago, when the games were announced, most of us in Brazil expected the worst. Rio is widely perceived by Brazilians as a hellhole.

I spent a whole month there once because of work and it left a strong mark in me. I’ve seen people being mugged, a dead body was left outside my hotel one night, I was in the middle of a shooting between rival gangs, and — crème de la crème — one day some big shot drug trafficker was killed in jail and what followed was, to me, surreal. The city is beautiful though.

What happened?

All thoughout that day, people kept telling me about the news of this guy who got killed. I could not care less, to be honest. But at the end of the day I finally understood when I tried leaving the office and people said I was nuts. I wasn’t allowed to go because the drug gangs issued a curfew on the city.

A. Curfew. On. The. City.

At times like that, commerces close their doors all over the place and the police completely disappears.

That’s insane! How is anyone safe during the games?!

Well, here’s where I point out that it’s probably not as bad as you’d think.

Wait what

Hold on. First of all, it is not in the gangs’ interest to attract international attention. They already have full control over the city, the police, etc. It’s in their best interest to wait the games out and then continue with business as usual. I doubt there will be problems with the drug traffic.

Second, there will be 50,000 security personnel there. FIFTY THOUSAND. And again, it’s in the powers that be’s interests that foreigners have a good time there. It will suck for people from Rio who will be hounded by the police and the army, though.

Just a couple of weeks ago the Brazilian Congress passed a special law granting de facto immunity to members of security forces who happen to commit crimes against civilians during the games. It’s going to be fun.

Wait what? Immunity

De facto. What the law does is transfer the authority of judging these cases to militaty justice. In practice, it means immunity. And the reason for the law was exactly to allow the police and the army to trump people’s rights in order to keep the peace. It’s so very Rio.

And terrorism?

Yeah, I don’t know. As we’ve seen these past weeks, you don’t need much to kill people. A rental truck is enough. So yes, there might be something. Then again, 50,000 security personnel. I’m guessing there might be easier targets out there. In short, I don’t know but I don’t think the risk is high enough to worry about it.

What will be horrible is already happening and mostly hidden from foreigners. It’s the human rights abuses against the poor. That to is very Rio. They’re make every effort to hide the poor and prevent them from being seen, no matter the cost. Thousands have been forcebly relocated already.

And in the end, what for? The city (and its people) won’t come out better after the games than before.

It’s depressing

Indeed.