I got wind of a very nice new tool out there recently.
It is called the Mongo MapReduce WebBrowser and can its Github repository can be found here: https://github.com/angelozerr/mongo-mapreduce-webbrowser.
Why is this tool so great? It actually allows you to debug your custom-made map reduces within a JQuery environment in your own browser.
Now I have only been playing with this tool for a while now I have only made some basic tests with all of them being done on Firefox. Even though this program looks like it is a bit bare with documentation in the readme it in fact isn’t. This program is so simple that the couple of screenshots provided was all I needed to start debugging my map reduce. So already this program is simple and easy to learn.
I have tested this program with:
- Internet Explorer
I have found that in versions of Opera just before the latest (maybe 6 months ago) you just get a white screen saying “ACTIVATING…” and nothing else, updating Opera solved this problem.
On Internet Explorer I cannot seem to find the dynamic script entry within the scripts tab for the script but it wasn’t there. I believe this is because IE does not reload this tab for dynamically added scripts, so I would stay away from using IE with this program for the time being; things may have changed on IE 10 and it may be up to scratch with the other browsers but I wouldn’t bet on it (IE, the most popular browser to get another browser).
On Safari, a note about it on Windows, it contains no developer tools by default! This means that actually this program, to no fault of its own, it useless on this browser unless you download a Firebug type program. I did not do this since I don’t like Apple made products so I just quickly tested and left it alone.
Apart from these few problems the program works a treat in all other conditions, however, my recommendation of browsers to use for this program are:
- Chrome (latest)
- Firefox (latest)
So with the compatibility aside lets look at actually using this, shall we?
I have found out the online version is not great for testing this program. It does not seem to refresh the input document of the Map Reduce on each run.
When downloading this program yourself there is no documentation or pointer for non-Java individuals on how to get this running. This means that you will need to understand something about how to get this running for the time being.
Unfortunately if you intend to get this program running on the small knowledge you have of Java by installing a JRE and then accessing the StartServer.java file (which starts a jetty server) you will be hit with:
$ java StartServer.java Exception in thread "main" java.lang.NoClassDefFoundError: StartServer/java Caused by: java.lang.ClassNotFoundException: StartServer.java at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) Could not find the main class: StartServer.java. Program will exit.
I tried to be a sneaky little bastard about this and actually access the webapp directly from a browser. It kind of worked however without the jetty server running it gave a 404 error about the jaxrs folder.
That being said the author of this program has intentions of making the program bieng able to dynamically save map reduces to MongoDB and other such integrations which means that in time the web server will undoubtly be required. I am personally used to using programs such as Solr so this is no biggy for me .
So I have only used the online edition of this program since my knowledge of Java (now-a-days) is a little too rusty to work through the Java scripts, debugging them.
So, with that aside, first off this program, being brand new, does output a lot of debug info to the console:
In fact enough to fill you screen a couple of times, not only that but it does have a deprecation error: JQMIGRATE: jQuery.browser is deprecated, however this does not seem to effect the overall running of the program and I can still easily debug with it.
However, once you have got past this and onto the Map Reduce script, adding break points, it easily debugs the three functions with whatever stepping tools your browser console has.
My end verdict is that this program has undeniable potential but at the moment there is just too many teething problems to really test any Map Reduces correctly.
You should try the online version for yourself here: http://mongo-mapreduce-webbrowser.opensagres.cloudbees.net/ and if you know Java and are willing to contribute it would be so good to have a program like this running and maintained.