How to use Git in a project ?

I had the opportunity to prepare a presentation of Git and thought it would be great to share it to whoever wants to use it in a project.

It targets beginners (no knowledge is required). It explains the process pipeline, and how to use Gitkraken as a graphic client. The presentation goes through the following subjects:

  1. What is Git exactly ?
  2. Git clients
  3. Gitkraken in depth
  4. Good practices
  5. Keeping problems away (tentative)
  6. Resources

It is available here :

https://drive.google.com/open?id=1X-2pQT_sYhbLeri8t3F4NMjss9EBX1vVs1VrFh7Tm2U

I hated Git - Now I hate it less

Loading of a C++ class from a shared library (Modern C++)

Dynamic Loading cover

There is already a lot of stuff on internet, related to dynamic loading of classes from a shared library. However I couldn’t find a simple example and explanation on how to do it with the following conditions :

– Modern C++ (from c++11 to 17) : Use of smart pointers to store the classes from the libraries

– Cross-platform : Works on Linux & Windows.

– Generic enough to be used by a wide range of programs.

Introduction

One of the best ways to make your C++ program accept plugins is to use dynamic loading of a class from a library. According to Wikipedia, dynamic loading is the process that allows you to retrieve functions and variables into the library. That’s very powerful, for multiple reasons :

– It requires no restart when you “load” or “unload” a shared library from an executable, because it isn’t statically linked.

– The library’s content is not included in the binary, and therefore the developer doesn’t have to compile it each time he wants to update the binary.

– The developer is able to push further the separation between non-related parts of his program, and to reuse them easier.

Imagine for example, programming an HTTP server. It must ideally have several modules, with different goals for each (SSL, PHP…). Instead of including all of them in one binary, why not make them shared libraries, and use them with dynamic loading ?

In this article, I’ll do my best to explain and show you a simple method to load classes from shared libraries, taking care of the conditions listed at the top.

What we’ll be building

A simple C++ program, running both on Linux and Windows. It will have a Core part (the executable), responsible for checking the libraries existence, and then to load, use and unload them. The libraries are classes that greet the user from the different Star Wars planets. They share a common interface, which is IPlanet, and is also known by the Core.

Here is a basic diagram to show how it works.

Dynamic Loading Diagram

Note that my goal is to show a simple implementation of all of this, therefore adding error handling and/or some optimizations might be good once you get the concept.

Let’s get started !

The interface (API)

All the classes coming from the shared libraries will inherit from this interface. Having an interface is useful when you have multiple libraries, and the core won’t know every concrete class. The core is then able to manipulate each class through the interface.

#pragma once
 
class IPlanet
{
 
public:
	virtual ~IPlanet() = default;
 
	virtual void greet() = 0;
};

Both the core AND the libraries must be aware of this class. Therefore it can be useful to keep it clearly separated from the rest.

The shared libraries

A long time ago, in a galaxy far, far away… Was Tatooine. The Tatooine header, in its simpliest form, is as follow :

#pragma once
 
#include 
#include "IPlanet.h"
 
class Tatooine : public IPlanet
{
public:
	Tatooine() = default;
	~Tatooine() = default;
 
	void greet() override;
};

There’s not a lot of things to say about it, but the interesting stuff is in its .cpp file.

#include "Tatooine.h"
 
#ifdef __linux__
extern "C"
{
	Tatooine *allocator()
	{
		return new Tatooine();
	}
 
	void deleter(Tatooine *ptr)
	{
		delete ptr;
	}
}
#endif
 
#ifdef WIN32
extern "C"
{
	__declspec (dllexport) Tatooine *allocator()
	{
		return new Tatooine();
	}
 
	__declspec (dllexport) void deleter(Tatooine *ptr)
	{
		delete ptr;
	}
}
#endif
 
void Tatooine::greet()
{
	std::cout << "Greetings from Tatooine !" << std::endl;
}

A few things here :

– We use a conditional preprocessor macro : #ifdef to enter the condition only if we are compiling on a specific platform. Here it may be Windows (WIN32) or Linux (__linux__). We can’t use exactly the same code for both platforms because of the next point.

– Note that for Windows we have to include __declspec (dllexport) before the function prototype. More info on this here.

– There is this extern "C" line, wrapping some C-like functions. It is in this part that we will set our entry points to load and unload the library class right into and from our “core” program. To know why we need it, we must understand how dynamic loading works.

Note on dynamic loading process

To load something from a shared library, we need to know where to look at in the assembly file. That’s where symbols are useful. Symbols can be anything, like a function, or a variable, and, in our example, classes (remember Tatooine ?). As long as we know the name of the symbol we need, we can use a set of low-level functions : dlopen(), dlsym() and dlclose() for linux, LoadLibrary(), GetProcAdress() and FreeLibrary for Windows. These functions allow us to load the shared library into the memory, then to retrieve the symbol, to get the class from it and to unload the library.

All of this could work in C for example, where there is no (or little) “name mangling“. As said by Wikipedia, name mangling is the modification of variables names into the assembly file. It is required in languages implementing features like parametric polymorphism, templates, or namespaces. Like in C++ !

Indeed, if several functions share the same name but with a different signature, the compiler must clearly differenciate them in the final assembly. Mangling is made by the compiler.

Name Mangling

By wrapping our “entry code” with extern "C", we ensure that no name mangling will be done by the compiler. The symbols in the assembly file will be exactly the same as the ones in our source code. Therefore we’ll be able to retrieve them easier. Simply by using their names !

So there are two entry points (symbols) for our class : allocator and deleter.

Allocator

We will get an instance of the library class through it. However we can’t return a smart pointer, because it isn’t valid C. We just return a C pointer, and we’ll transform it on the dlloader-side.

Deleter

This one will be called when we’ll need to destroy our class. It is important to have a destructor directly in the dynamic library, to ensure that the memory management will happen in it.

Well, that’s about it for the libraries ! I just included one library here, but the principle is the same for another library, as long as it obeys to the IPlanet interface.

The Dynamic Library Loader (DLLoader)

Hold on, this is quite a long tutorial, but it is worth it (I hope) ! Now is another interesting part : the dynamic library loader, which is included in your core.

First, let’s resume the process. Here are the steps we need to have it all working smoothly :

DLLoader Steps Diagram

Note on the compilation

Alright, now remember that our code must run on Linux as well as on Windows. We will use the same concept of separated compilation, with OS macros, but in the CMakeLists this time.

if (WIN32)
set(DLLOADER_SRC Core/DLLoader/Windows/DLLoader.h)
include_directories(Core/DLLoader/Windows/)
endif(WIN32)

if(UNIX)
set(DLLOADER_SRC Core/DLLoader/Unix/DLLoader.h)
include_directories(Core/DLLoader/Unix/)
endif(UNIX)

Therefore we need two different source file, because the code to interact with shared libraries is very low level and OS-specific. One for Linux, and one for Windows. Here though, it won’t be .cpp files, but .h files. It will be easier to put everything in the header because the class is templated.

First, we need to create an interface for the DLLoader. Both Linux’s concrete DLLoader and Windows’ one will inherit from it.

The IDLLoader interface

#pragma once
 
#include 
#include 
 
namespace dlloader
{
	template 
	class IDLLoader
	{
	public:
		virtual ~IDLLoader() = default;
 
		/*
		** Load the library and map it in memory.
		*/
		virtual void DLOpenLib() = 0;
 
		/*
		** Return a shared pointer on an instance of class loaded through
		** a dynamic library.
		*/
		virtual std::shared_ptr	DLGetInstance() = 0;
 
		/*
		** Unload the library.
		*/
		virtual void DLCloseLib() = 0;
	};
}

The comments in the code are sufficient I hope.

Linux’s DLLoader class

#pragma once
 
#include 
#include 
#include "IDLLoader.h"
 
namespace dlloader
{
	template 
	class DLLoader : public IDLLoader
	{
	private:
		void			*_handle;
		std::string		_pathToLib;
		std::string		_allocClassSymbol;
		std::string		_deleteClassSymbol;
 
	public:
		DLLoader(std::string const &pathToLib,
			std::string const &allocClassSymbol = "allocator",
			std::string const &deleteClassSymbol = "deleter") :
			_handle(nullptr), _pathToLib(pathToLib),
			_allocClassSymbol(allocClassSymbol), _deleteClassSymbol(deleteClassSymbol)
		{
		}
 
		~DLLoader() = default;
 
		void DLOpenLib()
		{
			if (!(_handle = dlopen(_pathToLib.c_str(), RTLD_NOW | RTLD_LAZY))) {
				std::cerr << dlerror() << std::endl;
			}
		}
 
		void DLCloseLib() override
		{
			if (dlclose(_handle) != 0) {
				std::cerr << dlerror() << std::endl;
			}
		}
	};
}

As said before, we need a handle to store the shared library in memory once it is loaded from its file. We also need two symbol holders : allocClassSymbol and deleteClassSymbol.

The DLOpenLib() function is quite simple, it is calling dlopen() to load the library in memory. The DLCloseLib() function is calling dlclose() to unload it.

The interesting stuff is below :

std::shared_ptr DLGetInstance() override
{
	using allocClass = T *(*)();
	using deleteClass = void (*)(T *);
 
	auto allocFunc = reinterpret_cast(
			dlsym(_handle, _allocClassSymbol.c_str()));
	auto deleteFunc = reinterpret_cast(
			dlsym(_handle, _deleteClassSymbol.c_str()));
 
	if (!allocFunc || !deleteFunc) {
		DLCloseLib();
		std::cerr << dlerror() << std::endl;
	}
 
	return std::shared_ptr(
			allocFunc(),
			[deleteFunc](T *p){ deleteFunc(p); });
}

We use the return of dlsym() to get each symbol we need.
This variable is then casted to a function pointer, to make it exploitable.

So we have :
– Allocator entry point : function pointer of type allocClass & held by the variable allocFunc.
– Deleter entry point : function pointer of type deleteClass & held by the variable deleteFunc.

Finally, remember that we wanted to use smart pointers ? We shouldn’t use raw pointer anymore. That’s why we build it directly in this function, with the allocator and the deleter. Take a look at the overloads of std::shared_ptr’s constructor. Note that we call the deleter through a lambda, to pass it the raw pointer that we have to delete.

Windows’ DLLoader class

That’s basically the same principle. However the system calls are not the same, so don’t forget to change them. Here is the entire source code for this class.

#pragma once
 
#include 
#include "Windows.h"
#include "IDLLoader.h"
 
namespace dlloader
{
	template 
	class DLLoader : public IDLLoader
	{
	private:
		HMODULE			_handle;
		std::string		_pathToLib;
		std::string		_allocClassSymbol;
		std::string		_deleteClassSymbol;
 
	public:
		DLLoader(std::string const &pathToLib,
			std::string const &allocClassSymbol = "allocator",
			std::string const &deleteClassSymbol = "deleter") :
			_handle(nullptr), _pathToLib(pathToLib),
			_allocClassSymbol(allocClassSymbol), _deleteClassSymbol(deleteClassSymbol)
		{}
 
		~DLLoader() = default;
 
		void DLOpenLib() override
		{
			if (!(_handle = LoadLibrary(_pathToLib.c_str()))) {
				std::cerr << "Can't open and load " << _pathToLib << std::endl;
			}
		}
 
		std::shared_ptr DLGetInstance() override
		{
			using allocClass = T * (*)();
			using deleteClass = void(*)(T *);
 
			auto allocFunc = reinterpret_cast(
				GetProcAddress(_handle, _allocClassSymbol.c_str()));
			auto deleteFunc = reinterpret_cast(
				GetProcAddress(_handle, _deleteClassSymbol.c_str()));
 
			if (!allocFunc || !deleteFunc) {
				DLCloseLib();
				std::cerr << "Can't find allocator or deleter symbol in " << _pathToLib << std::endl;
			}
 
			return std::shared_ptr(
				allocFunc(),
				[deleteFunc](T *p) { deleteFunc(p); });
		}
 
		void DLCloseLib() override
		{
			if (FreeLibrary(_handle) == 0) {
				std::cerr << "Can't close " << _pathToLib << std::endl;
			}
		}
	};
}

The last part that we need is the core, to link all of this !

The Core

#include 
#include 
#include 
#include "DLLoader.h"
#include "IPlanet.h"
 
using namespace std; 
 
#ifdef WIN32
static const std::string bespinLibPath = "Bespin.dll";
static const std::string tatooineLibPath = "Tatooine.dll";
#endif
#ifdef __linux__
static const std::string bespinLibPath = "./libBespin.so";
static const std::string tatooineLibPath = "./libTatooine.so";
#endif

For the sake of the example, the shared libraries paths are hard-coded. Don’t forget to compile the libraries individually, and put them in the executable’s folder.

void greetFromAPlanet(dlloader::DLLoader& dlloader)
{
	std::shared_ptr<IPlanet> planet = dlloader.DLGetInstance();
 
	planet->greet();
}
 
void greet(const std::string& path)
{
	dlloader::DLLoader dlloader(path);
 
	std::cout << "Loading " << path << std::endl;
	dlloader.DLOpenLib();
 
	greetFromAPlanet(dlloader);
 
	std::cout << "Unloading " << path << std::endl;
	dlloader.DLCloseLib();
}
 
int main()
{
	greet(tatooineLibPath);
	greet(bespinLibPath);
 
	return 0;
}

In greet() and greetFromAPlanet() we use everything we just coded. As you see, we’re using shared pointers. Also, the core doesn’t know anything about either the Tatooine library, or the Bespin library. All it knows is the IPlanet interface.

Greetings

That’s it, I hope you enjoyed learning this stuff as much as I did ! Don’t hesitate to send me remarks, or comments, I’ll be pleased to answer them.

Don’t forget to checkout the code hosted on Github for this tutorial as well, and may the force be with you.

La Guerre des Intelligences : Intelligence Artificielle VS Intelligence Humaine






La Guerre des Intelligences Book Cover




La Guerre des Intelligences





Dr. Laurent Alexandre





Essai philosophique




JC Lattès




2017



Une lecture quelque peu alarmiste, qui fait prendre conscience que l'évolution de l'intelligence artificielle est loin d'être correctement considérée par la société dans son ensemble, de l'école aux politiques. Pour éviter tout pessimisme latent à l'idée d'une IA dangereuse, qui volerait le travail humain, voire pire, d'une IA à la Terminator, il est essentiel de se battre sur plusieurs fronts dans les prochaines années : - Réformation de l'école, inadaptée aux besoins du XXIème siècle - Etude politique et éthique approfondie des usages de l'IA Une lecture très intéressante, nourrissante sur le plan personnel ("Quelles seront les qualités et compétences à avoir dans un monde dominé par l'IA ?") et sociétal.

Has Paris found its new main Tech event in VivaTechnology ?

VivaTechnology's poster

It’s been 3 months since I went to the VivaTechnology event, but I was very busy these last weeks, and couldn’t find any time to write down my feelings about it…

VivaTechnology is an event that takes place in Paris, every year in June, since 2016. Its main goal is to bring together the players in the Tech ecosystem. It concerns big groups – Orange, Airbus, Google, Microsoft, IBM and many more – as well as startups, contractors, and investors. There’s even a day where the public is welcomed. An opportunity for everyone to discover the latest innovations in multiple fields : energy, luxury, food, transports…

Vivatech alleys

Business…

The event was organized in a way that let people exchange very easily. My main goal, along with taking a pulse of the next tendencies in tech, was to find a part-time for the fall. It was very easy to talk with a lot of interesting people at stands, and I left with a lot of business cards, acquired in just a few hours. Special thanks to the mobile app developed for the event, and which was almost a social network on its own. It allowed the participants to “connect” while they met (and exchange later), and to be informed of the hours, location, topics of events.

These events were in majority talks, on interesting topics and with well-known speakers (Eric Schmidt for Alphabet, Bernard Arnault for LVMH, Daniel Zhang for Alibaba, …).

… And tech

Furthermore the event hosted a hackathon, with four challenges sponsored by big groups (Axa, Cisco, Microsoft and Sodexo). The participants had to build a team of speakers, developers and designers. Then they had to come with a solution for a given problem, all of this in less than 24 hours. I had the opportunity to win the 1st prize of the Microsoft’s challenge, with my team ! We prototyped a chatbot, called Angela, to improve the relations between co-workers, and unite them around their shared hobbies. It was my first experience of hackathons, and a great one ! We didn’t sleep, so it was very exhausting at the end, but we never gave up, and kept working as a team. I really hope to participate in other challenges like this one.

Angela Team

The Angela team, tired after 24 hours of work but very happy !

Anyway I really enjoyed the time spent at this event, and think my friends did too. Vivatechnology keeps getting bigger each year, and there was a lot more communication on it in 2017. It gathers a lot of different people, coming from different horizons, and having different goals. Bringing these people together is a great alternative to Las Vegas’s CES, or Barcelone’s MWC, which only focus on hardware/software.

So yeah, Paris has found its main tech event, in the way that it allows people to meet !

Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future






Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future Book Cover




Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future





Ashley Vance





Biography




Ecco




2015



"Elon came to the conclusion early in his career that life is short", Straubel said. "If you really embrace this, it leaves you with the obvious conclusion that you should be working as hard as you can."

You can love or hate the Elon Musk's personality, I can't imagine how it is possible not to have respect for him after having read this book. My biggest learning from this book is to never give up on your work when you're passionate about it, no matter what happens. Very inspiring.

Que vaut Deepin Desktop Environment (15.4) ?

Deepin Desktop Environment screenshot

Après 2 ans de vie commune avec Linux, je commençais à désespérer de trouver un environnement graphique un minimum “sexy”. J’avais plus ou moins réussi à rendre attrayant XFCE, mais j’ai depuis entendu parler de Deepin Desktop Environment (DDE pour les intimes). Je me suis donc lancé dans son installation, sur une base Arch linux.

Mes impressions après 2 mois de test : C’est beau ! Il faut avouer que les interfaces graphiques de Linux ne font pas le poids face à la cohérence de MacOS ou Windows. DDE a donc fait  le pari de s’inspirer de ces deux designs, et il en ressort un environnement très moderne ! En 2017, le flat design s’est imposé depuis un petit bout de temps sur tous les sytèmes, même les mobiles. Ca fait plaisir de le retrouver sur Linux, et autrement qu’avec des thèmes KDE, Gnome ou Unity. Il reste possible de customiser le rendu des fenêtres, les polices, et le thème des icônes grâce à des thèmes personnels, bien sûr.

Le dock

Premier atout, et même atout majeur à mes yeux, DDE permet de choisir entre un dock “MacOS-like”, ou un dock “Windows-like”.

Le dock "MacOS-like"

Le dock “MacOS-like”

Le dock "Windows-like"

Le dock “Windows-like”

Je trouve l’idée superbe, cela permet de changer en un clic le look du bureau, selon l’humeur du jour. L’ordonnancement des items du dock, ainsi que leur taille est bien sûr modifiable. Il en est de même pour la position du dock, ou bien son statut : toujours caché, révélé au survol de la souris, ou bien toujours révélé. Le launcher tout à gauche permet d’accéder à l’intégralité des programmes.

Le lock-screen

Au niveau de l’écran de veille, assez similairement à celui de Gnome ou KDE, on retrouve les fonctionnalités de base : changer d’interface graphique quand on démarre, ou bien les contrôles de la musique quand on verrouille. A noter que DDE permet de customiser chaque compte utilisateur, avec un avatar, visible sur cet écran.

Le lockscreen de DDE

 

Le centre de contrôle

Histoire d’adopter un côté un peu «hype», pas de paramètres pour DDE, mais un «Centre de contrôle». Il ne se déploie pas dans une nouvelle fenêtre, mais sur le côté droit de l’écran. Si la praticité est un peu sacrifiée (pas beaucoup de largeur, car il occupe seulement un petit cinquième de l’écran), ce centre de contrôle a le mérite de se démarquer des réglages des autres environnements. On aime ou on Le centre de contrôle de DDEaime pas. Il ressemble beaucoup, dans son design, au centre de contrôle d’IOS sur iPhone.

On trouve donc au 1er clic, un accès rapide aux contrôles de musique, ainsi qu’au réglage de la luminosité. Le wifi, Bluetooth, et l’accès aux réglages de dual-screen sont présents. Je n’ai encore eu aucun souci avec le gestionnaire de wifi Deepin. En revanche, le Bluetooth est un peu plus instable j’ai l’impression. Il vaut parfois mieux passer par un autre gestionnaire, comme Blueman. De manière générale, à mon avis, le Bluetooth est capricieux sur Linux 😉 .

Il y a dans la partie supérieure 3 panels :

  • Raccourcis vers tous les paramètres du système
  • Météo
  • Notifications du système, plutôt exhaustives (presque trop), elles listent les changements de musique, les messages reçus, etc. Ces notifications s’affichent également dans des petites pop-up assez bien finies, dans le coin supérieur droit.

Les «hot-corners»

Comme chez MacOs (oui, il faut bien avouer que DDE en est quasiment une copie, mais ce n’est pas forcement un inconvénient pour moi… 🙂 ), DDE propose d’affecter une action particulière au survol de chaque coin de l’écran par la souris. Pas d’action customisable malheureusement, comme le lancement d’une application particulière. On y retrouve tout de même un accès rapide au Centre de Contrôle, ou à une vue multi-fenêtres, entre autres. Fonctionnalité bien sympathique encore une fois, bien qu’il manque pour moi le raccourci le plus important, qui est de pouvoir changer de bureau en utilisant uniquement la souris, et non pas un raccourci clavier.

Le multi-bureaux

Comme la majorité des environnements graphiques Linux, DDE permet à l’utilisateur de travailler sur plusieurs bureaux (jusqu’à 7). Comme je viens de le dire, il n’est malheureusement pas (encore ?) possible d’en changer assez rapidement grâce à un hot-corner, ou à un glissement de deux doigts simultanément sur le pavé tactile, comme sur les Mac. On est obligé d’utiliser un raccourci clavier pour changer rapidement de bureau, ou de cliquer sur l’icône “Multi-bureaux” pour passer sur cette vue, ce qui manque cruellement d’ergonomie…

Multi-bureaux DDEE

Pour ce qui est des fonds d’écran, la galerie Deepin est plutôt bien fournie en belles photographies de paysages, ou abstraites.

Stabilité

Pour moi, un des principes fondamentaux pour pouvoir utiliser tous les jours un environnement graphique est sa stabilité. DDE 15.4 était en version Beta, puis RC (Release Candidate) en février et mars. Ce qui semble être la version finale est sortie il y a quelques jours, le 19 avril. La majorité des problèmes graphiques que j’ai pu relever ont été corrigés au cours de ces 2 mois. DDE est effectivement très dynamique, ses développeurs arrivant à proposer des mises à jour de ses paquets assez régulièrement (tous les 7 à 10 jours). Plus de problème majeur de stabilité pour cette version 15.4 donc.

Un petit bémol cependant pour l’activation du gestionnaire de login, au démarrage. Je n’ai pas réussi à l’activer, sans que le démarrage de DDE derrière ne soit buggué (bandes noires à l’écran, pas possible de lancer d’applications… Je tourne donc pour l’instant avec Gdm, (Gnome Manager). Dommage quand on pourrait démarrer directement sur l’écran de DDE… A voir cependant si je n’ai pas raté quelque chose dans l’installation et la configuration sur Arch, et également sinon, si ce problème a été corrigé depuis la sortie de la version finale 15.4. Au rayon des bugs mineurs, certaines icônes du dock disparaissent après les mises à jour, il faut les remettre manuellement. Rien de bien problématique.

Conclusion : Deepin, une interface utilisable au quotidien ?

DDE est pour l’instant mon environnement graphique Linux favori. Pour moi, c’est presque l’environnement parfait pour ceux qui aiment changer des traditionnels Gnome, KDE ou Unity. Il répond parfaitement à mes critères, à savoir la sobriété, et le modernisme. Il est dynamique, les corrections de bugs ainsi que l’apparition de nouvelles fonctionnalités sont plutôt rapides. Plus que tout, il a su corriger ses derniers problèmes de stabilité, en en faisant un environnement utilisable tous les jours. Je l’utilise aussi bien pour le travail que pour le repos.

Il est certes moins personnalisable jusqu’au bout qu’un XFCE, mais a le mérite de rafraîchir un peu le monde Linux en 2017. Certains diront que DDE n’est qu’une pâle copie du design d’Apple, et ils n’auront pas complètement tort. Seulement, le design de Deepin ne coûte pas le même prix que celui de MacOS. 😉

L’homme Nu – La dictature invisible du numérique






L’homme Nu - La dictature invisible du numérique Book Cover




L’homme Nu - La dictature invisible du numérique





Marc Dugain, Christophe Labbé





Tech




Editions PLON



Un livre un poil flippant qui détaille les pratiques des géants du Numérique, les GAFA (Google, Amazon, Facebook, Apple), «alliés» aux services de renseignements américains. Loin d’être caricaturaux, les auteurs nous rappellent qu’en bien des aspects, notre monde actuel ressemble, et surpasse parfois celui imaginé par George Orwell dans 1984. Il semble aujourd’hui très logique de privilégier la sécurité, la productivité et le confort offerts par les GAFA, aux dépens du droit à la vie privée et de la liberté. L’Homme Nu nous interroge sur le bien-fondé des raisons de ce choix. Il aura eu le mérite de me faire (un peu) décrocher des réseaux sociaux, véritables mangeurs de temps de vie, et de me faire nettoyer ma présence sur internet. Très bonne lecture pour déclencher une réflexion qui me semble importante en 2017, donc.

The Pragmatic Programmer – From Journeyman to Master






The Pragmatic Programmer - From Journeyman to Master Book Cover




The Pragmatic Programmer - From Journeyman to Master





Andrew Hunt, David Thomas





Tech




Addison-Wesley Professional




1999



 “A pragmatic programmer knows to take some time to read books.”

That’s one of the many advises this book offers to those who want to improve their productivity as a developer, and a collaborator. It isn’t related to any programming language, that’s why everyone can read it. It helped me build better softwares in terms of maintainability, clarity, and also to improve my team-work. It describes simple and clear methods and architectures that you can use in your everyday projects. One of the most useful readings of this year.

A modern and lightweight Arch-Linux (xfce) configuration

Arc-Dark

What a better way to get in touch than to talk about our everyday configuration ? I’m currently working on an Arch Linux distribution. What I love about it is the huge amount of Sys Admin stuff I learned while installing it again and again, each time faster than before, and with a better knowledge of what I was doing. I’m not going to give you explanations on how to install it, but rather present you some packages I use to customize the default system. In my daily life I like to use XFCE.

System utilities

First, there’s a few packages not available through pacman or yaourt (the Arch Linux package managers). You’ll have to manually install them (by that I mean going to their website, and downloading them directly) :

yaourt redshift oh-my-zsh
  • redshift allows you to change the temperature of your screen. It tires the eyes less than having a blue screen, especially during the night.
  • oh-my-zsh is a zsh plugin that easily lets you configure your zsh.

Then, with pacman (sudo pacman -S [packages]):

lxrandr xfce4-screenshooter xscreensaver
  • lxrandr is a small utility that lets you configure multiple screens. It is graphical, and very user-friendly.
  • The screenshooter is the official xfce – well, get ready – screenshooter. A cool shortcut to launch it at any time is [Windows] + [Screen] (in Settings > Keyboard > Application Shortcuts).
  • I like to use xscreensaver to lock my PC. It’s customizable and there are plenty themes available. I often even display a RSS flux. It starts with the xscreensaver-command --lock command. It can be configured through xscreensaver-command --demo.

Xfce is faaaast.

I didn’t have the opportunity to test in depth a lot of graphical interfaces. Yet, it’s because xfce remains my favorite, and I don’t feel like testing other GUI, as this one entirely supplies my needs. It’s very fast, and highly customizable. During summer, I ended up having this ChromeOS like desktop, on xfce. Now I went back to more classical stuff :

Autostart xfce at login

Simply add this line to your zshrc config file, if this is the shell you’re using :

startxfce4

I’m not found of login managers, as they tend to slow down the boot time. Xfce is my only graphical interface, so I neither need to switch between it and something else, nor to change the language, keyboard disposition or brightness each time I log in. That’s why a simple console login is entirely sufficient for me.

A beautiful xfce interface

Here’s a beautiful theme, for afficionados of flat and sober themes like me. Its creator also made a great theme for firefox/chrome. The rendering is beautiful, and without any noticed bug so far.

Arc-Dark

It has several levels of configuration, from light to dark, all very well explained on the github page. It works well with this icon theme, and this cursor theme.

What you need to do if you want your main folders to always have a logo on them when displayed in thunar (the default GUI file viewer), is to add these lines to a file called ~/.config/user-dirs.dirs :

XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_TEMPLATES_DIR="$HOME/.Templates"
XDG_VIDEOS_DIR="$HOME/Videos"

 

This looks like a completely different xfce now, doesn’t it ? Of course, don’t forget to customize the panels to fulfill your needs. I personally like to have a few launchers in a Windows-like style. The softwares icons you’ll need can be downloaded on Google and then added to the /usr/share/icons folder.

Conky

Conky is a little tool that allows you to display system informations directly on your desktop. You can set the refreshing rate, and choose between a lot of informations to display (list of available variables). I like to keep it simple, and to only display time and date. Here’s what my ~/.conkyrc file looks like :

#############################
# Conky settings
update_interval 10
total_run_times 0
double_buffer yes
no_buffers yes
#############################
# Text settings
use_xft yes
xftfont Ubuntu
#############################
# Window specifications
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
gap_x 90
gap_y 800
#############################
# Graphics settings
draw_shades no
default_color ffffff
#############################
TEXT
${font Open Sans Light:pixelsize=80}${time %H:%M}${font}
${alignc} ${font Open Sans Light:pixelsize=30}${time %d %b %Y}${font}

There are plenty ways to configure the date and time format, listed here.

That’s it for my Arch configuration. I mainly talked about the graphical customization, because I like to interact with my OS through the GUI as well as through the command line. When the system is freshly installed, you already have almost every console tool you need, but, unlike Windows (already good-looking when installed), if you want your GUI (xfce) to look modern, you have to accept to take some time to customize it. Yes, I think xfce is a great GUI as it is fast and customizable, but, by default, it’s also very old-fashioned !

Si vous êtes francophone, n’hésitez pas à lire ma revue de l’interface graphique de Deepin, un outsider dans le monde de linux bien sympathique !