Open Live Writer

Just downloaded and installed and posting this via Open Live Writer. Remember the lovely (but dead) Windows Live Writer from Microsoft? Well this is a forked version of that which is open source, based on MIT license.

The editor is offline and is very similar to word and can support a number of blogging platforms – including the common ones as you would expect. You can muck around the code (zip) or check it out on GIT. It is still work in progress of course (e.g. Plugin’s are not implemented yet). Irrespective, hugely grateful to Scott (Hanselman) to get this going.

Securing you DokuWiki

After my WHS died and I moved to a Synology DS413 and using that as a ‘home server’ and have been extremely happy with it! The only thing I miss is backing up the Windows machines automatically (as WHS did), but overall I think this is better, flexible and more powerful compared to WHS.

I needed to look for a new wiki software. I recently moved from ScrewTurn Wiki (which was great BTW, but then is a dead project now) to DokuWiki which is perfect for my needs. I run two wiki’s at home and has much of our day-to-day things we as a family need. There are some sections of the Wiki, which are sensitive and I don’t want anyone one the network getting to it. I wanted to authenticate the user and once they login only then get to that.

As it turns out, securing your DokuWiki is quite simple. If you are interested in a similar setup then here is what you need to do:

  1. Disable the registration option on Configuration settings. Some details on this can be found here.
  2. Update the ACL (more of that here), there is a user group called ‘ALL’; set the permision for this group to “None”.
  3. For the user group “User”, change the permisions to Edit.

Securing DocuWiki

This will ensure only logged in (and of course authenticated users) can read and edit and a anonymous user cannot see anything.

The only catch in this is that you need to manually maintain the users (e.g. add new users); my userbase is very small at home, so this is not a challenge at all.

Adding an user in Ubuntu – Why is it so difficult?

I installed the latest version of Ubuntu (13.04, Raring Tail) on a machine at home to check it out (it was running CentOS 6.4 before that). Setting it up was quite simple, but I am not sure if I like the too simple UI. I don’t want an uber-geek only-shell mode, but the CentOS I thought was the right balance.

Anyways, when I first added a new user, there was no way I could set a password which was very weird – not a permanent or temporary one! And there is no way one can then login. I don’t think this is user error, but then if it is a bug, it seems like a big one!

So I had to deleted the user and then added them back (via the shell sudo adduser user-name-you-want command) and then set the password. If you want to change the password, you can also use passwd user-name-you-want in a shell).

But the most irritating part of this was adding the new user to have root access. It took me a little time to figure out. But in the end it turns our the root (or su) group is called “sudo” and it is part of this group that the new user needs to be in if they need root access.

To modify an existing user, you use the following command in the shell sudo usermod -g sudo user-name-you-want where of course sudo is the group name.

Now, we got there in the end, but why does it have to be so painful like pulling teeth! If this is supposed to be easy for the average user, surely they are missing a trick.

Redis on Windows 8 and VS 2012 RC?

I am trying to see if I can get Redis working on Windows 8 using Visual Studio 2012 RC bits – I have not had much success, but then I have not had much time to invest to try this out.

I am wanting to give a demo tomorrow and would be good to see if I can get this working. Curious to know if anyone else has got this?

If not Redis, then have you got some other implementation working on Windows 8? I was thinking of RavenDB.

Less than Symbol in Latex

If you want to show a simple less than symbol (i.e. <) in Latex, you are in for a surprise as you cannot use that character as is. If you are in math mode and writing this part of a formula then you might be still OK, but if you are in text mode then it is quite difficult.

Surprisingly, searching for this online also did not provide any obvious answers (perhaps I was searching for the wrong thing).

Anyways, I did figure it out in the end, and I needed to use the \textless directive for latex. I also found a few more symbols and have them listed below in case they are helpful for anyone else.

Symbol Latex Command
^ \textasciicircum
< \textless
> \textgreater
~ \textasciitilde
ª \textordfeminine
* \textasteriskcentered
º \textordmasculine
\ \textbackslash
| \textbar
· \textperiodcentered
{ \textbraceleft
} \textbraceright
¿ \textquestiondown
© \textcopyright
® \textregistered
$ \textdollar
§ \textsection
. . . \textellipsis
£ \textsterling
_ \textunderscore
¡ \textexclamdown

Hadoop in Azure

My dear friend Mario has finally got around to blogging and one of his latest posts shows, it is possible to run Hadoop (which if you are not familiar with, can be thought of as an open source version of Google’s MapReduce) in Azure. You need to setup a typical configuration of nodes (Name Nodes, Tracker and Slaves).

Sure, there are a number of dependencies some you would expect, others not (e.g. Cygwin – cringe!; but hopefully that will go away with Hadoop 0.22). I wonder what overheard the Cygwin runtime has?

It would be interesting to know if someone is (or planning) to use this at work.

Twitter Trends

I was excited to find that Twitter had a JSON (Javascript Object Notation) endpoint for the current trending topics and decided to write a simple consumer which can read this and then spit it out in a simple console. And JSON being so simple and more or less “universal” meant that there are multiple implementations for .NET. Of course if you got lots of bandwidth you can roll out your own parser.

I ended up using Json.NET, which in addition to being OpenSource is also one of the most robust utilities which makes working with JSON formatted data dead simple.

The code for the console app is quite straightforward. The static function ReadTrends() retrieves the JSON string from twitter which is then consumed and extracted. The only tricky part was using a constant key; the easiest way I could think of doing this was to replace the date-time stamp with a literal and then use that literal.

Of course this will fail if you the function ReadTrends() is called at (or just before midnight) on Dec 31st and the code returns to the main() function in the new year. I don’t think this is something I am going to put in production and am not going to be too worried about this behaviour.

At the time of writing this, the twitter trends (in JSON) are:

{“trends”:{“2011-03-04 17:18:01”:[{“name”:”#coisasderetiro”,”events”:null,”query”:”#coisasderetiro”,”promoted_content”:null},
{“name”:”Frying Nemo”,”events”:null,”query”:”Frying Nemo”,”promoted_content”:null},
{“name”:”Acoustic Aftermath”,”events”:null,”query”:”Acoustic Aftermath”,”promoted_content”:null},
{“name”:”Blade Runner”,”events”:null,”query”:”Blade Runner”,”promoted_content”:null},
{“name”:”Fun Race”,”events”:null,”query”:”Fun Race”,”promoted_content”:null},
{“name”:”Mike Huckabee”,”events”:null,”query”:”Mike Huckabee”,”promoted_content”:null},
{“name”:”Arctic Monkeys”,”events”:null,”query”:”Arctic Monkeys”,”promoted_content”:null}]},”as_of”:1299259081}

And here is the output in the console. I can see Charlie Sheen’s #tigerblood is still trending; and wonder what Artic Monkeys are upto – is there new album out or something?

Frying Nemo
Acoustic Aftermath
Blade Runner
Fun Race
Mike Huckabee
Arctic Monkeys
All done. Press any key to continue…

And finally here is the code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
using System.Net;
using System.IO;

namespace TwitterTrends
    class Program
        static void Main(string[] args)
                //get the trends
                string temp = ReadTrends();

                //as the key is a datetime stamp (which is constantly moving), need something constant to interrogate.
                //simplest way is to find out the year and then take 19 characters from that which is the datetime stamp
                //replace that with a literal (DESIGEEK.COM in my case) and then use the literal. I don't think I will
                //be trending on Twitter; but if you are worried then you can use something like a GUID.
                // For example at the time of writing this the datetime stamp was: "2011-03-02 14:20:00"
                string theDate = temp.Substring(temp.IndexOf(DateTime.Now.Year.ToString()), 19);
                temp = temp.Replace(theDate, "DESIGEEK.COM");

                //parse the string for the literal
                JObject trends = JObject.Parse(temp);
                var twitterTrends = from t in trends["trends"]["DESIGEEK.COM"]
                                    select t.Value<string>("name");

                //iterate through
                foreach (var item in twitterTrends)

            catch (Exception ex)
                Console.WriteLine("Following error occured:\n" + ex.ToString());
            Console.WriteLine("\nAll done. Press any key to continue...");

        private static string ReadTrends()
            //talk to twitter
            WebRequest theRequest = HttpWebRequest.Create("");
            HttpWebResponse theResponse = (HttpWebResponse)theRequest.GetResponse();

            //extract the data
            Stream stream = theResponse.GetResponseStream();
            StreamReader reader = new StreamReader(stream);
            string temp = reader.ReadToEnd();

            //clean up

            return temp;


Opensource ZigBee stack?

I was planning on getting the Telegesis ETRX2USB and wanted to know if there are any open source (or shareware) open source ZigBee stacks that I can use with that?

I also wanted to know if there is any opensource (or not too expensive), network management or network analyser for a ZigBee network? Essentially I want to be able to programatically view network and node information on the ZigBee network (e.g. S/N ratio, signal strength, etc.) – something similar to Ember’s Insight Desktop which shows the details I am interested in. I could not find anything specific and would be interested in getting ideas.

Interesting WordPress Plugins

After upgrading to the latest WordPress (v3.0.4), I also decided to have a look at the various plugins I am running. As part of that I stumbled across Ultimate Collection of WordPress pluginswhich are very interesting. If you run WordPress (and if you don’t, why not :)), I would highly recommend to check them out. I already was running some of these and not heard of others which are great.

Here are some of my favourite ones (in no particular order) and those with keen eyes would notice a few of these already.

  •  AddToAny: Share/Bookmark/Email Button – Help people share, bookmark, and email your posts & pages using any service, such as Facebook, Twitter, Google Buzz, Digg, etc.
  • Akismet – this is for comment spam control and is used by millions! Excellent!
  • WP FollowMe – allows you to add a twitter Follow me badge on your wordpress blog.
  • Google Analyticator – name says it all I think.
  • Google XML Sitemaps – same as above.
  • Lightbox 2 – Used to overlay images on the current page.
  • My Page Order – allows you to set the order of pages through a drag and drop interface.
  • Really Simple CAPTCHA – CAPTCHA module intended to be called from other plugins; really works too!
  • Search Everything – Adds search functionality and includes search highlight, search pages, excerpts, attachments, drafts, comments, tags and custom fields (metadata). It can also exclude specific pages and posts. It does not search password-protected content.
  • Shockingly Big IE6 Warning – doesn’t the name say it all?
  • Simple Tags – Excellent plugins, to manage your tags. Includes, suggested Tags, Mass edit tags, Autocompletion, Tag Cloud Widgets, Related Posts, Related Tags, etc
  • StatPress Reloaded – real time stats for the blog
  • SyntaxHighlighter Evolved – code to your site without having to modify the code at all; you cannot use the Visual editor with this.
  • TinyMCE Advanced – Enables advanced features and plugins for the visual editor
  • Twitter for WordPress – displays your last few tweets
  • WP-Cumulus – Flash based Tag Cloud for WordPress
  • WP-DBManager – Excellent plugin, that manages your WordPress including optimize database, repair database, backup database, restore database, etc. I use to exclusively for the automatic scheduling of backing up and optimizing of the database.
  • WP-SmugMug – I use SmugMug for my photos online; this plugin integrates the SmugMug galleries into the blog.

I would highly recommend the above and suggest you play with them. 

These plugins I have only recently installed and they seem interesting, but I have not used them enough to have the confidence to highly recommend them – yet.

  • WordPress Backup (by BTE) – Backup the upload directory (images), current theme directory, and plugins directory to a zip file. I have only recently installed this plugin, and not used it enough to say how useful it is at this point.
  • Automatic WordPress Backup – Automatically upload backups of important parts of your blog to Amazon S3. I am a huge S3 fan, and this seems very promising. Hopefully I can come back in a few days and weeks and blog about it.

Finally, when using plugins I would recommend the following:

  • Search and install from these via the “Plugins” menu which you see when log into your WordPress dashboard. Don’t download the code manually and then try and upload it to your site. That is a more painful process.
  • Try and have a test blog running – seperately from your main blog where you can test different permutations and configurations. In case something goes wrong, you won’t have your main blog go down. Of course needless to say, you should keep both your test and main blog on the same version.
  • It is not a good idea to install all of the plugin’s all at the same time as you never never which plugin can cause conflict with another. Well, you can install all the plugins at the same time, just activate them one at a time and test that your blog is still running as expected after you have activated each plugin.
  • Before you upgrade the version of WordPress – irrespective of how big or small the upgrade is always backup your database and files first. This would allow you to revert back to a “clean slate” in case something goes wrong.

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.


I don’t think many people have heard of MOOS (which stands of Mission Oriented Operating Suite); I have been working with it for the past few months as part of my dissertation. And I must admit, the more I play with it, the more impressed I am. It is quite simple and yet powerful.

Whilst MOOS’s roots are in robotics (MRG) and embedded systems, I wonder if I can extend it to use it some of the grid computing scenarios. Maybe implement a pMapReduce or pHadoop? Or perhaps a .NET implementation. Hmm, just need some time. If you need a robust, cross platform communication layer then check out MOOS.

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

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.

Deleting folder on Linux

If you are a newbie to Ubuntu like me (or any other Unix distro) and you tried deleting a folder which is not empty contains files or subdirectories then you get the annoying error “Directory not empty”.

To delete such a folder (from a terminal) use the rm -rf command. For example to delete a folder called amitbahree run the following:

rm -rf amitbahree/

RDP from Ubuntu

I did not know until today that there is something called gnome-rdp using which one can RDP to Windows machines from Ubuntu (or any other linux flavour I imagine). Installation is simple on Ubuntu, with it available in Synaptic Package Manager. To start it you can type in gnome-rdp in a console or go to Applications -> Internet -> Gnome-RDP. Once it has started, usage is quite simple – though you might want to change the remote desktop size and colours. Interestingly this also supports VNC and SSH.

Finding out which version of Ubuntu you are running

If you ever need to find out which version of Ubuntu you are running (if you have a few machines it is quite easy to forget what is running where), the easiest way is to run the following command in a terminal:

cat /etc/issue

For example here is the output from the machine I am on now:

amit@xps:~$ cat /etc/issue
Ubuntu 9.04 \n \l

Printing code and making it look pretty

If you are on Linux and want to print some code and also make it look pretty then check out a2ps (Any to postscript filter). Of course if you can avoid printing in the first place and saving paper and trees and make it greener that is ideal – however there are times that is not possible. I tried printing from CDT, but the printing options from CDT just looks plain ugly and big fonts and can spread over 10 pages for a simple code file (spanning 293 lines). Sure I can tweak the font in CDT, but that is the only option available – enter a2ps. It seems to have more options, but I have not had a chance to play with those.

For example if I wanted a C++ code file called MOOSSniffer.cpp and “print it” out as PDF then use the command shown below. Here “-E” is the option to make the code look pretty and the “-P pdf” is the option for printing to PDF. Next comes the source file (you can also provide multiple files such as *.cpp) and finally the -o option is for the output filename. Of course you will need to install a2ps, which you can do via System -> Admin -> Synaptic Package Manager

a2ps -E -P pdf MOOSSniffer.cpp -o MOOSSniffer.pdf

Now, for some reason the resulting PDF could not be opened in Acrobat Reader, but on my Ubuntu machine, I could open it using the “Document Viewer” and print it using that. And in case you were curious, the pretty page option came to 3 pages instead of the original 10.

Also no trees were harmed in the making of this post – my printouts were all to PDF and not real paper – but in the end I did print out the 3 page version. 🙂