Thursday, June 9, 2016
Wednesday, March 9, 2016
Survival tips for the solo-parenting dad, part 1 of N.
Luckily, his dad is an optimist and decided to cook hamburgers with potatoes and some carrots... a typical Belgian dish that is. I peeled and cut the potatoes while Jenne, my son, cut the carrots in thousand pieces (actually, according to him, there were a million pieces, but that was just him eggagerating...) Once that was finished, I decided it was time to put both items on the stove, make the potatoes boil like hell and stew the carrots like i never stewed before. Somewhere in between, I also fried my hamburgers: one with and without cheese for me, one without cheese for Jenne (the 6-year-old kiddo having the flu and missing his friends).
It was plain fun. Jenne even forgot about the flu and his friends. He looked happier than ever before, having cut and peeled his own carrots in more than a million pieces... the carrots he was going to eat within a few minutes. His own, very own carrots!
But then... the unexpected happened... While I started to pound on my potatoes to turn them into a nice and cosy purée, I somehow noticed the smell of burnt food. A quick glance at my stove revealed that my carrots were almost on fire! All the water I've put in the cooking pot was completely evaporated... gone... farewell! I ended up with nice carrots, but the bottom of my cooking pot had suffered quite a bit, as can be seen in the following picture:

Luckily, I'm an optimist. I never give up. This stupid cooking pot wasn't going to ruin my day, oh no it wasn't! Having just lost the plot, I ended up Googling for "How to clean burnt cooking pot" (djee, how did I make that up?), and the Google search resulted in quite some grandma's tips and tricks with soda, coca-cola, vinegar and other kitchen-chemicals... quite overwhelming when you read that for the first time, I must admit.
I stayed focused. As I didn't have soda nor coca-cola in the house, the chemist in me (seriously, I am joking am i?) decided to go for the vinegar solution:
Having a PhD-level scientist background, I had quite some difficulties believing that this fluid, of which I only knew some culinary properties, was going to solve all my burnt-cooking-pot problems. But hey,... the optimist in me wanted to give it a try anyway! I never give up, remember!? So I started the procedure:
- Take the bottle with vinegar from your fridge.
- Open bottle.
- Pour vinegar into the burnt-like-hell cooking pot.
- Put cooking pot aside and pray for the best.
But hey, I'm an optimist, so the next day I checked my cooking pot. While I was affectionately holding it in my hands, carefully checking its burns, I noticed that the layer at the bottom started to move! I got excited! It looked as if there was a burnt pancake wandering around in my cooking pot!
Having noticed that, and being in an adventurous mood, I decided to checkout the pancake for myself with my bare hands. What I noticed then was above all my expectations: I was able to take out the one-hell-of-a-burnt-pancake-of-dirt from my cooking pot, and I was left with an almost clean cooking pot! Look mom, no scrubbing nor scraping involved!
For the sake of science, this was unbelievable! Do you notice the pancake in the above picture? Do you notice how clean the bottom of my cooking pot is? There is no trickery involved here! I am not using Photoshop, The Gimp or any other image manipulation software to turn my cooking pot into one hell of a clean cooking pot! What you see is what I experienced, no more, no less. Needless to say I was very happy about the way things turned out. I almost didn't have to rince my cooking pot, I lost some vinegar and above all: I had my cooking pot back with an almost-zero effort!
What I conclude from this is the following:
- Being a solo-parenting dad can be challenging at times.
- Chemistry in the kitchen is like sex: sure, it may give some practical results, but that's not why we do it (© R. Feynman).
- Even when things look bad, really really bad... Never give up!
Bart
Sunday, December 13, 2015
On faking QObject-derived classes (part 1)
Introduction
After reading Michael Feathers' book Working Effectively with Legacy Code, I recently got interested in techniques for making code more testable. One of these techniques is Extract Interface, which can be used to replace objects of a certain class with fake versions. While trying to apply this to some legacy code, I stumbled upon a problem. This post describes that problem and how I solved it. However, I do have my doubts concerning the elegance of my solution. So therefore: feel free to comment and share alternative solutions!Starting point
Our starting point is a class derived from QObject:
Because this is a QObject
-derived class, it can use methods like setObjectName
and objectName
, but it can of course also have its own member functions like doFooStuff
. Our purpose now is to extract an interface for the Foo
class, so we can create a FakeFoo
class as a replacement for Foo
.
Extracting the interface
Faking the Foo
class seems easy at first sight: following Feathers' advice, all I should do is extract a FooInterface
and let my Foo
and FakeFoo
implement it. My first attempt in doing this, looked as follows:
Unfortunately, this resulted in the following compiler errors using g++ 4.9.2:
failed_attempt.cpp: In function ‘int main()’:
failed_attempt.cpp:29:14: error: ‘class FooInterface’ has no member named ‘setObjectName’
fakeFoo->setObjectName("fake foo");
^
failed_attempt.cpp:30:27: error: ‘class FooInterface’ has no member named ‘objectName’
std::cout << fakeFoo->objectName().toStdString() << std::endl;
^
failed_attempt.cpp:34:14: error: ‘class FooInterface’ has no member named ‘setObjectName’
realFoo->setObjectName("real foo");
^
failed_attempt.cpp:35:27: error: ‘class FooInterface’ has no member named ‘objectName’
std::cout << realFoo->objectName().toStdString() << std::endl;
Needless to say I was a bit disappointed in realizing that FooInterface
indeed did not have a setObjectName
or objectName
function. Inspired by the section The Case of the Onion Parameter and The Case of the Aliased Parameter in Feathers' book, my current best attempt so far in solving this issue consists of creating a QObjectInterface
with these methods and letting FooInterface
derive from that:
This works, as is visible in the output of the program:
fake foo
Foo::doFakeFooStuff()
real foo
Foo::doFooStuff()
But my current solution has several drawbacks:
- I need to add every
QObject
member function that I use, to myQObjectInterface
. - If I want
QObjectInterface
andFooInterface
to be real interfaces, that forces me to do the implementations of everyQObject
member function that I use in both myFoo
andFakeFoo
class. These implementations are just forwardings of method calls to theQObject
class. That is quite mechanical, cumbersome and errorprone. I don't like that.
Conclusion
I did find a way to fakeQObject
-derived classes, but my solution requires quite some brain-dead QObject
-method implementing in the original class and its fake version. I am open for more elegant designs. Please enlighten me! All code in this blog post is available in a public Gist.
Sunday, November 22, 2015
Testing GitHub gists
Occasionally, i day-dream about sharing some random thoughts about certain aspects of software development. An important practical tool needed for this kind of idea-sharing, is being able to nicely embed code-snippets in my blog posts. Googling around for solutions, I came across GitHub gists. This is my first test to embed small pieces of code into my blog posts. If you see a "Hello world!" program below this paragraph, it means my test succeeded...
If you also see a "Hello people!" program below this second paragraph, then it means I'm able to display several different pieces of code into my blog posts.
If you think you know better solutions for embedding code-snippets into Blogger articles, do not hesitate to post a comment!
Wednesday, August 12, 2015
Show your Google Contacts on a map using Google Fusion Tables
Step 1: export your Google contacts
- Surf to http://contacts.google.com
- In the left menu-bar, under More, find Export and go to the old Google Contacts (because the new Google Contacts doesn't allow you to export your contacts yet).
- In the old Google Contacts, select More followed by Export and export your contacts in Outlook CSV format (the Google CSV format didn't work for me):
Step 2: import your CSV file in Google Fusion tables
- Surf to http://drive.google.com
- Check if you have Google Fusion Tables available under New / More. If you don't have it yet, install the Google Fusion Tables app.
- Create a new Google Fusion Table using New / More / Google Fusion Tables.
- Under Import new table use From this computer and select and upload your contacts.csv file. Use comma as separator character and select UTF-8 character encoding:
Step 3: select the column to use as a location
- First, you can remove some unnecessary columns using the Select Columns menu item from the Rows 1 tab.
- Then, pick the column you want to use as your location column (e.g. Home Address), and change its type to Location.
- Now go to the tab called Map of Home Address and select Home Address as Location column:
- Press Begin geocoding and once that's finished, you should see a nice map of all your contacts.
Step 4: finetune
To change several map feature styles and the content of the info window that appears when you click on a contact from the map, go to the tab of the map and select Change map. It is even possible to display your contacts in a heat map. My map finally looks like this:Conclusion
If you keep all your contacts centralized in Google contacts, then visualizing for example their home and work address on a map is rather easy using Google Fusion Tables. I use these kind of maps a lot when I go somewhere and want to say hi to friends that I haven't seen in a while.Comments and suggestions on this article are more than welcome!
Friday, August 2, 2013
Kleuterfilosofie... of hoe een kind probeert de wereld te snappen.
02/08/2013: "Papa, een éénwieler, wat is dat eigenlijk? Is dat een voorwiel of een achterwiel?"
02/08/2013: "Papa, waarom staat dat standbeeld hier?" (nabij het Leiemonument in het Koning Albertpark te Kortrijk).
Sunday, October 21, 2012
Godverdomme! Mijn Brompton plooifiets is gestolen!
Aan de oneerlijke stelers: GROTE KLOOTZAKKEN ZIJN JULLIE! Ik hoop uit het diepste van mijn hart dat jullie branden in de hel!
Bij deze geef ik hieronder alle informatie ivm de diefstal, in de hoop dat het iets oplevert...
Tijdstip diefstal
Zaterdag 20 oktober 2012 tussen 18u45 en 21u45.Plaats van de diefstal
Vlakbij het adres 'De Keyserlei 56B, 2000 Antwerpen', ergens tussen Juwelier Slaetsen M&G Diamonds (coördinaten: 51,217442 N 4,419108 E). De fiets was met een kabelslot (zie foto) vastgemaakt aan een andere damesfiets en een verlichtingspaal. Hoewel er veel andere fietsen naast stonden en er die avond op De Keyserlei veel volk was, werd het kabelslot toch doorgeknipt (zie foto).
Type fiets
Zwarte Brompton plooifiets (nieuw van maart 2012)Brompton RN-versie (S6RN)
6 versnellingen (2 links, 3 rechts)
Typische herkenningspunten
- S-Type stuur (dit is een T-vormig sport stuur)
(Merk op dat de meeste andere Brompton fietsen een U-vormig stuur hebben, dus het stuur van mijn fiets zou moeten opvallen tussen de traditionele Bromptons). - Witte sticker 1 (zie foto):
Serial No: 1201194029
- Witte sticker 2 (zie foto):
BS 6102-1:1992
EN 14764:2005
- Ingegraveerd frame-nummer: 324088
- Naamsticker van 'Vlerick Fietsen' bevindt zich bovenaan op de bovenbuis.
- Helaas had ik deze fiets nog niet laten merken bij de politie :-(
Contact
Indien je mijn fiets toevallig vindt, te koop aangeboden krijgt of op een tweedehands website ziet, gelieve mij dan te contacteren via het emailadres Bart.Vandewoestyne@telenet.be of via mijn GSM-nummer +32 478 397 697.Alle tips zijn meer dan welkom!