Impressed with Doxygen

I have recently started using Doxygen in anger and have been quite impressed with it. In addition to the documentation of code that you would expect, one of the most powerful and coolest features is the ability to create various types of diagrams showing various aspects of the application such as collaboration diagrams object and call graphs, etc.

The easiest way to configure your application  is to use Doxywizard. On Linux, if you do want the object and call graphs then you would need to choose to enable the DOT option. If you do that you will need to have Message Sequence Charts installed (typically found in /usr/bin/mscgen) and also Graphviz. DOT can typically be found in /usr/bin/dot.

If you are on Windows and use Visual Studio, then there are a few add-ins which will work – with VS.NET 2005, 2008 and 2010; more details here.

Below is a simple example of a collaboration diagram taken from VTK project. You can find more samples. When you do browse the code, click on the Classes link – that is where you can see the various diagrams.

Sample Collaboration Diagram


I had a need to dump some data I am getting from a real-time sensor network to a database and I choose MySQL – just because it is cheap and cheerful and will fit perfectly with what I am looking for. Now, I have never programmed for MySQL though I have used it in the past as a consumer (e.g. the backend of this blog). MySQL does expose a C API that one can use, but it seems quite arcane to use and does not quite conform to the C++ style (especially when using STL).

It is at that point that I stumbled across MySQL++ – something I had not heard of and of course not used until now. MySQL++ is just a simple C++ wrapper around the same MySQL C API, but it does follow the C++ STL principles and feels more ‘natural’ to use. I am still playing with it and getting to know it.

Below is a quick sample on how to connect to a database and retrieve all the records from a table called ‘stock’.

#include "cmdline.h"
#include "printdata.h"

#include <mysql++.h>

#include <iostream>
#include <iomanip>

using namespace std;

int main(int argc, char *argv[])
	// Get database access parameters from command line
        const char* db = 0, *server = 0, *user = 0, *pass = "";
	if (!parse_command_line(argc, argv, &db, &server, &user, &pass)) {
		return 1;

	// Connect to the sample database.
	mysqlpp::Connection conn(false);
	if (conn.connect(db, server, user, pass)) {
		// Retrieve the sample stock table set up by resetdb
		mysqlpp::Query query = conn.query("select * from stock");
		mysqlpp::StoreQueryResult res =;

		// Display results
		if (res) {
			// Display header
			cout << setw(31) << "Item" <<
					setw(10) << "Num" <<
					setw(10) << "Weight" <<
					setw(10) << "Price" <<
					"Date" << endl << endl;

			// Get each row in result set, and print its contents
			for (size_t i = 0; i < res.num_rows(); ++i) {
				cout << setw(30) << res[i]["item"] << ' ' <<
						setw(9) << res[i]["num"] << ' ' <<
						setw(9) << res[i]["weight"] << ' ' <<
						setw(9) << res[i]["price"] << ' ' <<
						setw(9) << res[i]["sdate"] <<
		else {
			cerr << "Failed to get stock table: " << query.error() << endl;
			return 1;

		return 0;
	else {
		cerr << "DB connection failed: " << conn.error() << endl;
		return 1;

Unlock button in Services is greyed out

If you are running Ubuntu and want to modify the services running on the OS using the GUI, the way to do this is via System → Administration → Services. This is all very good, but in my case on one machine the Unlock button on the Services window was greyed out. Sure, I could use the shell to modify this, but when this is something I use quite rarely I need to go and look up the exact command and it can get a pain. Plus, that is the whole point of running the GUI? 😉

One easy way to solve this is to to modify the /etc/PolicyKit/PolicyKit.conf file and add the following in the end:

<return result="yes"/>

You might not have privileges to edit the file and might need to do it as root; you can use the following command for that:

sudo gedit /etc/PolicyKit/PolicyKit.conf

Here is the output from my file:

<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->

<!DOCTYPE pkconfig PUBLIC "-//freedesktop//DTD PolicyKit Configuration 1.0//EN"


<!-- See the manual page PolicyKit.conf(5) for file format -->

<config version="0.1">
    <match user="root">
        <return result="yes"/>
    <define_admin_auth group="admin"/>
    <return result="yes"/>

One word of caution, this will by pass some of the built-in security and allow any logged on user to get access to the services. If you are the only one using your computer in an environment where someone else won’t be able to get their hands on it (e.g. at home and not at work or school or college) then you should be OK. But if you are not the sole user of the computer or will be in an environment where others can get their hands on it, then I won’t recommend you do this.

How to best use TFS?

So you have a team (somewhat like mine right now) which is inexperienced with TFS and not very sure about this whole branching, merging, shelveset thinggy and extremely nervous when using it.

So, what will you do? Well you might try and train them, show them how to use it, write documents showing how to use it, have processes in place, try and use some tools to help, etc.

But, what do they do? Well this seems to be along the lines …. 🙄

Being a coder - made easy

Techy Books on Kindle?

I was thinking of getting the latest version of the Kindle, but one of the factors in the decision will be the number of techy books available for the Kindle. Anyone owning one has any ideas? Are there far and few or is there a good selection with more being added? I do read novels, but not as many and if there are not enough techy books for the Kindle right now then that might be a deal breaker.


Happy that recently my running has been consistent and the weather has been helpful too. Last few days it has turned cold with the temperature down to 4 degrees C. It helps me relax and de-stress and clear my head. Smile

Below is a screenshot of the workout profile from this week thanks for iMapMyRun free app for my Android Wildfire (which is small and light enough for me to carry in my pocket when on my run). Still need to build more stamina.