Hier, j'ai releasé la v0.2.6 de Qompoter, a C++/Qt dependency manager. Outre les améliorations apportées au truc (recherche récursive des paquets, numéros de versions flous du genre v1.*, recherche des paquets dans Inqlude), cela m'a aussi permis de découvrir les scripts d'auto-complémetion Bash ! Et je surkiffe taper qompoter tab tab et voir la liste des actions possibles apparaître "install export inqlude jsong". C'est beau Linux.
Qompoter a atteint un niveau de maturité suffisant pour les petits projets, alors n'hésitez pas ! Vos retours sont les bienvenues.
-
-
https://github.com/Fylhan/qompotercurl -H 'PUT /api/charge/authentication HTTP/1.1' -H 'Host: localhost:15107' -H 'Accept: application/vnd.PCCom-v2.0+json' -H 'Content-Type: application/vnd.PCCom-v2.0+json' -X PUT -d '{"state":"AUTHENTICATION_NOT_REQUIRED"}' localhost:15107/api/charge/authentication
-
-
https://links.la-bnbox.fr/?bucxbw
-
-
http://www.projet-voltaire.fr/blog/regle-orthographe/%C2%AB-pallier-quelque-chose-%C2%BB-%C2%AB-pallier-a-quelque-chose-%C2%BBSomething wrong
git reflog
# you will see a list of every thing you've done in git, across all branches!
# each one has an index HEAD@{index}
# find the one before you broke everything
git reset HEAD@{index}
# magic time machine
I accidentally committed to the wrong branch!
# undo the last commit, but leave the changes available
git reset HEAD~ --soft
git stash
# move to the correct branch
git checkout name-of-the-correct-branch
git stash pop
git add . # or add individual files
git commit -m "your message here"
# now your changes are on the correct branch
Oui, quelqu'un paie un nom de domaine chaque année pour ça. Merci quand même :-)
-
-
http://ohshitgit.com/Très pratique le fichier .qmake.conf.
-
-
https://wiki.qt.io/QMake-top-level-srcdir-and-builddirPour me rappeler, je m'essai aux résumés.
* RVO = return-value optimization
MyData myFunction() {
return MyData(); // Create and return unnamed obj
}
MyData abc = myFunction();
With RVO, the C++ standard allows the compiler to skip the creation of the temporary, treating both object instances—the one inside the function and the one assigned to the variable outside the function—as the same. This usually goes under the name of copy elision. But what is elided here is the temporary and the copy.
MyData myFunction() {
MyData result; // Declare return val in ONE place
if (doing_something) {
return result; // Return same val everywhere
}
// Doing something else
return result; // Return same val everywhere
}
MyData abc = myFunction();
Named Return Value Optimization is similar but it allows the compiler to eliminate not just rvalues (temporaries), but lvalues (local variables), too, under certain conditions.
But many compilers are actualy failing to apply NRVO with the following code:
MyData myFunction() {
if (doing_something)
return MyData(); // RVO expected
MyData result;
// ...
return result; // NRVO expected
}
MyData abc = myFunction();
So previous example has to be preferred.
Surprisingly, don’t use "out-parameters" but prefer "return-by-value", even if it implies creating a small struct in order to return multiple values. I will check that, because it seems strange to me.
“out” parameter pointers force a modern compiler to avoid certain optimisations when calling non-inlined functions.
Prefer:
struct fractional_parts {
int numerator;
int denominator;
};
fractional_parts convertToFraction(double val) {
int numerator = /*calculation */ ;
int denominator = /*calculation */ ;
return {numerator, denominator}; // C++11 braced initialisation -> RVO
}
auto parts = convertToFraction(val);
use(parts.nominator);
use(parts.denominator);
than:
void convertToFraction(double val, int &numerator, int &denominator) {
numerator = /*calculation */ ;
denominator = /*calculation */ ;
}
int numerator, denominator;
convertToFraction(val, numerator, denominator); // or was it "denominator, nominator"?
use(numerator);
use(denominator);
Prefer:
template <class T>
complex<T> &complex<T>;::operator*=(const complex<T> &a) {
T a_real = a.real, a_imag = a.imag;
T t_real = real, t_imag = imag; // t == this
real = t_real * a_real – t_imag * a_imag;
imag = t_real * a_imag + t_imag * a_real;
return *this;
}
than:
template <class T>
complex<T> &complex<T>;::operator*=(const complex<T> &a) {
real = real * a.real – imag * a.imag;
imag = real * a.imag + imag * a.real;
return *this;
}
It seems the example is too simple to really understand the benefits. I do not want to make my code more complex for such a simple case... I do not like this advice.
Due to the CPU caches mechanisms (blocks of 64-byte), it is propose to organise member variables in a class as follow:
Why not...
-
-
https://www.kdab.com/four-habit-forming-tips-faster-c/Dans le descriptif des nouveautés :
Le Tableau de bord de WordPress profite désormais de polices dont vous disposez déjà sur votre ordinateur, le rendant plus rapide et vous permettant de vous y retrouver plus naturellement, quel que soit le support.
Hein ? En gros ils fournissent une liste de polices dans le CSS jusqu'à en trouver une présente sur l'ordinateur, en utilisant que des polices classiques afin de ne pas avoir besoin de la télécharger... Comme depuis les premiers jours du couple HTML/CSS ! Je ne pensais pas que WordPress était à ce point dans le marketing...
-
-
https://links.la-bnbox.fr/?DgZsSQGah !
# !$ references the last argument of the previous command.
mate _posts/2011/2011-04-12-terminal-strings.mdown
git add !$
tumblr !$
# Now more complex, let's copy the second argument
# !! references the last command, and :2 the second arg.
echo foo bar baz
echo !!:2 # outputs "bar"
# Batshit crazy
# !?baz? references the last command containing baz, :0-1 grabs the two first args
echo !?baz?:0-1 # should output "echo foo"
-
-
https://seld.be/notes/terminal-arguments-tricksUn nouveau service de Fog Creek : HyperDev. Ils sont fous fous, et ils savent bien rendre utiles une idée balbutiante.
-
-
http://www.joelonsoftware.com/items/2016/05/30.htmlGénérateur (PHP) de site statique orienté documentation.
Le This is couscous. Couscous is good. me fait marrer.
-
-
https://github.com/CouscousPHP/Couscouscd : revenir dans le répertoire personnel
cd - : revenir dans le répertoire précédent (uniquement si vous avez exécuter un cd)
Ctrl+l : effacer l'écran
Ctrl+c : arrêt d'une commande
Ctrl+z : suspendre(mettre en pause) une commande
CTRL+t : corréction d'une erreur de frappe en inversant 2 lettres
Ctrl+a : aller au début de ligne
Ctrl+e : aller à la fin de ligne
Ctrl+s : interruption de la sortie de terminal (masquer la saisie)
Ctrl+q : annuler l'interruption de la sortie (afficher la saisie)
Ctrl+u : efface tout à gauche du curseur
Ctrl+w : efface le mot à gauche du curseur
Ctrl+k : efface le mot à droite du curseur
Ctrl+y : coller la saisie précédente
Ctrl+d : efface le caractère courant, si la ligne est vide deconnexion
Alt+b : se déplacer en avant, mot par mot dans la ligne de commande
Alt+f : se déplacer en arrière mot par mot dans la ligne de commande
Alt+d : efface le mot suivant
Alt+t : échange le mot courant avec le mot précédent
Alt+c : met en majuscule la lettre courante, tout le reste dut mot courant en minuscules, puis se deplace au mot suivant
Alt+l : met en majuscules à partir de la lettre courante jusqu'à la fin de mot, puis se deplace au mot suivant
Alt+u : met en minuscules à partir de la lettre courante jusqu'à la fin de mot, puis se deplace au mot suivant
Alt+Backspace : effacer le mot précédent (équivalent Ctrl+w)
-
-
http://www.commentcamarche.net/faq/4801-guide-d-utilisation-du-shell-pour-debutantTunnel SSH pour rediriger des ports, tout en passant par un proxy ><
-
-
http://aplawrence.com/Security/ssh_forwarding.htmlDe bons conseils pour les scripts bash.
-
-
http://www.kfirlavi.com/blog/2012/11/14/defensive-bash-programming/Le talk "The birth and Death of Javascript" de Gary Bernhardt est très open-minded à ce sujet : https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript
-
-
https://www.javapoly.com/Rah, ça m'arrive tout le temps ce problème !!!
-
-
http://oletange.blogspot.fr/2012/04/umount-device-is-busy-why.html