C++ Message queuing options?

I am thinking of implementing a queue in one of the projects I am working on right now (sorry cannot go into more details until it gets published – hopefully in a few months). Anywyas, this is in C++ which needs to run on Ubuntu and my queueing experience (with C++ or otherwise) is only with MSMQ which is brilliant, but does not help me here as that run only on Windows. I also cannot use something like STL Queue as this will need to run across a number of machines and trying to sync between them would a royal pain. In other words, this needs to be distributed and async “loose” messaging. 🙂

I am already using MOOS, so one option is for me to continue to use that – however this is for another part of the application and it might be easier for me to use something else (still need to think it through a little more).

These are the requirements (these are must haves!). Also if it makes a difference I am using CDT for this project.

  • Needs to be able to run on Ubuntu 9.04 (and higher)
  • Needs to be Open Source (cannot be commercial)
  • Needs to be able to store messages “offline”
  • Needs to be able to run on TCP with minimal dependencies. It would be nice not to have a whole bunch of underlying dependencies.
  • Preferably be easy to use (as a consumer) – I don’t have much time to read through loads of documentation just to get my head around the underlying object model and how to use it.
  • C++ support (if it was not obvious until now)

I did a little research online and came across the following, and wanted to get some feedback:

  • ActiveMQ – seems like it has good C++ support via CMS (C++ Messaging Service).
  • Amazon SQS –  not sure how good the C++ support is. If there is no library per se that I can use, then writing things around REST APIs might be more painful. Also I suddenly have a dependency to be able to go to the public internet. Also it is not free (though there is a free 100K messages / month).
  • MQ4CPP – seems quite amateurish (kudos to the guy writing it though – seems like an interesting project to pick up when once has time).
  • RabbitMQ – I know some guys used this at work (though that was using it in .NET); nothing for C++, but there some C experimental code; overall does not inspire confidence (in the context of C++).
  • OpenAMQ – seems quite interesting and also has a C++ API based on its WireAPI.
  • Anything else??

At face value it seems like this is down to ActiveMQ and OpenAMQ. Just looking at the quick samples between the two ActiveMQ seems like more C++ friendly and easier to use compared to OpenAMQ. Of course this is just the first impression and I could be completely wrong – it is not like I have had a chance to play with this (yet anyways).

Does anyone have any experience and feedback on this matter? Feel free to comment on this post, or tweet me.

Changed Themes

Was getting a little bored with the previous WP theme  and changed to this one. It does have a lot of defaults in the footer and not had a chance to figure out how to turn it off or customize it. If anyone has any ideas on how to do it then let me know. Also, if you have any suggestions for free and cool WP themes then let me know.

Aubergine with herbs

This is Ottolenghi’s recipe as it was published in the Guardian.

Ingredients:

  • Aubergines (about 1.2 kgs)
  • Salt (1 teaspoon)
  • Freshly ground black pepper (1 pinch)
  • Sunflower Oil (120 ml)
  • Olive Oil (100 ml)
  • Medium-hot Green Chillies (2, thinly sliced)
  • Garlic (10 cloves, thinly sliced)
  • White-wine Vinegar (1½ tablespoon)
  • Basil (20 gm, shredded)
  • Coriander (20 gm)
  • Mint (20 gm)
  • Dill (20 gm)

Steps to cook the aubergines:

  1. Heat the oven to 210C/410F/gas mark 6½.
  2. Cut the aubergines into roughly 3cm squarish chunks.
  3. Put in a large mixing bowl and add the salt, some black pepper, sunflower oil and most of the olive oil (save about 3 tbsp for frying the chilli and garlic).
  4. Toss and spread over two large baking sheets lined with non-stick baking parchment.
  5. Roast for about 30 minutes – it’s important that the aubergines turn a good golden-brown colour.
  6. Remove from the oven and leave to cool down.

While the aubergines are cooking:

  1. Heat the reserved olive oil in a small saucepan and fry the chilli and garlic for about a minute, until the garlic turns a pale golden – watch out that you don’t cook it further, or it may burn and go bitter.
  2. Transfer the chilli, garlic and oil to a large mixing bowl and add the cooked aubergine.
  3. Add the vinegar and herbs, mix, taste and adjust the seasoning as necessary.
  4. Serve warm or at room temperature.

Blast from the Past

We were cleaning up the house – sort of like spring cleaning, except in Autumn and in old boxes came across a whole bunch of old stuff, which for me was a blast from the past and each with fond memories. Before I recycled/donated/threw it, took a few photos (click on them to see them in the original size).

Numega debugger

Compuware, the best debuggers in town.

Palm Cradle

Anyone remember a Palm Vx?

Discmans'

Don’t miss the Joggable one 🙂

Network Adapters

3Com PCMCIA adapters.

ATL Server

ATL Server anyone?

Netgear Print Server

Netgear Print Server

Zip drives

Zip drives anyone?

More zip drives

More zip drives

Nokia phone

Nokia – do they still make phones?

Dell Axim

Dell Axim – I had forgotten I had one of these.

Upgrading to WordPress 3.0.3?

The latest version of WordPress 3.0.3 and the Redirection plugin (v 2.2.3) don’t play nice together. If you upgraded to the latest version of WordPress the redirection plugin will always show only your last post on your blog’s homepage. Until the plugin is fixed, the only way around this is either not to upgrade to the latest version of WordPress (not recommended), or to disable the Redirection plugin.

SQL Syntax Error (with MySQL)

Say you are writing a new stored procedure (for MySQL) and when you execute it, you get an error something like shown below – as you probably figured out all it means is that there is a syntax error with in the SQL. Often the error is misleading especially if it is a complicated query. One easy way to help narrow down the issue is to run it in a SQL Console which usually provides a better clue that can be your pointer to fixing the issue.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for 
the right syntax to use near 'END' at line 17 (errno: 1064). Click 'Ignore' if you'd like to have this 
error ignored until the end of the script.

If you run this script you will get the above error:

<br />
DELIMITER $$</p>
<p>DROP PROCEDURE IF EXISTS `someSchema`.`sp_someSP`$$<br />
CREATE  DEFINER=`someUser`@`someServer` PROCEDURE `someSchema`.`sp_someSP` (<br />
	in uavname varchar(20)<br />
)<br />
BEGIN<br />
SELECT u.id, i.*, ll.*, g.*, c.*<br />
FROM 	uav as u,<br />
	imu as i,<br />
        uav_ll as ll,<br />
        gps as g,<br />
        uav_controller as c<br />
WHERE<br />
	u.name = uavname and<br />
        u.id = i.uav_id and<br />
        u.id = ll.uav_id and<br />
        u.id = g.uav_id and<br />
        u.id = c.uav_id<br />
END$$</p>
<p>DELIMITER ;<br />

The main issue in my example above was that a delimiter (semi-colon in this case) was missing where the SQL statement finishes i.e. in the last WHERE condition. Here is a snippet of what the updated WHERE clause should look like.

<br />
WHERE<br />
	u.name = uavname and<br />
        u.id = i.uav_id and<br />
        u.id = ll.uav_id and<br />
        u.id = g.uav_id and<br />
        u.id = c.uav_id ; -- semicolon added here<br />
END$$<br />