gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_PDF_file.pdf input_PDF_file.pdf
Par ordre décroissant de qualité : /prepress, /ebook ou /screen
Insert in place with regex:
sed -e -i '/pattern/r file.txt' input.txt
1h;1!H;${;g;s/<h2.*</h2>/No title here/g;p;}
Adopt DevOps (https://about.gitlab.com/2017/03/06/introduce-continuous-workflows)!L'idée c'est d'améliorer la productivité et la qualité d'une équipe de développement en améliorant la communication au sein de l'équipe. Donc :
Le dernier point rejoint cet article : https://about.gitlab.com/2017/04/27/why-code-is-released-too-early
Pour 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...
Cette bibliothèque Javascript pour faire des graphes semble bien complète.
Oui, un framework Web en Qt.
Pour éviter la fameuse erreur E200009 de la ligne de commande SVN quand je fais un "svn add" sur un dossier avec des choses déjà indexé, j'ai ajouté cet alias à mon ~/.bashrc
'''
alias svnadd="svn st | grep ? | tr -s ' ' | sed 's/^..//g' | sed 's/ /\ /g' | xargs svn add"
'''
Désormais "svnadd" va indexer tous les fichiers du dossier actuel qui ne sont pas encore indexer.
Git me manque. Surtout "git gui"...
Bibliothèques Javascript pour faire des graphes avec des contraintes au niveau du rendu (certains points fixes, d'autres non, organisation pour l'affichage d'une molécule, groupe, ...).
Quelqu'un a testé ?
(via je ne sais plus qui)
Je n'ai pas encore Shaarlier ce super article ? Mince...
Web-based authentication form : beaucoup, beaucoup de choses à avoir en tête avant de faire quoi que ce soit :-)
Ce topic est à lire en détail ! C'est un sujet qui m'intéresse et me passionne tout à la fois en ce moment. Mais le plus frustrant c'est qu'il est particulièrement difficile d'atteindre le système fiable et sûre à 99%. J'aimerai le créer au moins une fois, quit à le rendre non user-friendly, histoire de pouvoir faire correctement ma sauce dans de vrais projets.
Silex - The PHP micro-framework based on Symfony2 Components