Namespace, template typedef and operator overloads – The Evil trio

What an unconfortable situation ? I had the following code which would not compile. // Range.h #include <boost/numeric/interval.hpp> #include <iostream> namespace App { template <typename T> using Range = boost::numeric::interval<T>; template <typename T> std::ostream& operator<<(std::ostream &os, const Range<T> &r) { … } } // namespace App // Filter.cpp #include "Range.h" #include <iostream> namespace App { […]

Pas de commentaire

Correctly handling attached files with Poco::Net::HTMLForm

I recently had to develop an visualisation application. To make it easier to deploy, I chose to make it a C++ application with embedded web server. In that application, there is a need for the user to submit some data to be analyzed. Users have the choice to submit text directly (filling in a textarea) […]

, , , ,

Pas de commentaire

Moving an object that wraps a vector and an iterator on that vector

I recently stumbled upon code that looked very suspicious to me. Basically, it was a class which amongst other things held a vector and some iterators from that vector. Something like this: struct Wrapper {     typedef std::vector<int> Data;     Data data;     Data::iterator active;     Wrapper() :         data(),         active(data.end())     { } […]

, ,

Pas de commentaire

Poireaux à la crème

Ingrédients 800 g de blancs de poireaux 3 jaunes d’oeufs 20 g de farine 20 g de crème fraiche 4 c. à soupe de jus de citron 4 brins de persil 50 g de beurre sel, poivre Préparation Nettoyez les poireaux, coupez-les en deux dans la longueur puis posez en botte sur une planche et […]

Pas de commentaire

Rôti de dindonneau au boursin et poires caramélisées

Ingrédients 1 rôti de dindonneau (ou de dinde) de 1,2 kilo 3 boursins au poivre herbes de Provence 3 cuillères à soupe de crème fraiche épaisse 1 grosse brique de crème entière (33cl) 2 cuillères à soupe de fond de veau 1 boîte de poires William au sirop sucre beurre Préparation Cuire le rôti au […]

, , , ,

Pas de commentaire

C++ Thread synchronization pitfall: using a barrier to synchronize a thread start

The context: You want to create a worker thread. Before the main thread goes on, you want to ensure that the worker thread starts. Using a boost::barrier seems like a good idea.

,

Pas de commentaire

Installing Google Play enabled firmware on Arnova 7b G3

Some time ago, our daughter bought an Arnova 7b G3 tablet. Although the device is very well done, its primary disadvantage is that it does not include Google Play. As a consequence, it is only possible to install new applications from the rather limited AppsLib. What she wanted was to be able to install applications […]

, , , , ,

Pas de commentaire

std::unique_ptr, virtual and missing virtual destructor = major pitfall

In our company, the build infrastructure runs unit tests in a valgrind shell, trying to detect memory leaks at the time the unit tests are executed. And every now and then, although our memory allocations are mostly handled through std::unique_ptr or std::shared_ptr, a leak pops up on the radar. And usually with the most useless […]

, ,

Pas de commentaire

Installing Skype 4 on a 64b Linux

It’s so easy they say on the website… Download the .deb and install. But problem: the .deb won’t install since it is meant for i386, not for x64.

, ,

Pas de commentaire

Rôti de porc au miel et à la moutarde

Ingrédients Pour 6 personnes 1,5 kg de jarret de porc désossé 6 cuillères à soupe de miel 4 cuillères à soupe de moutarde de Dijon 2 cuillères à soupe de vinaigre de cidre 3 cuillères à soupe de sauce de soja Sel et poivre Préparation Préchauffer le four à 180°C (thermostat 6). Mélanger dans un […]

, , ,

Pas de commentaire