Posts Tagged framework

Simple JSON-RPC updated to 1.0.0

Simple JSON-RPC has been updated to 1.0.0. This new version includes a brand new event messaging system making it possible for classes to react to events generated by the Simple JSON-RPC framework.

Through simple event messaging, your RPC classes are now able to react to and even interact with servlet configuration, context, request, and response objects. To use this facility your class needs to extend the new JSONRPCEventListener interface and implement the messageReceived method, accepting one argument of the JSONRPCMessageEvent type.

Here is an example of how a class could implement a Simple JSON-RPC event listener:

public void messageReceived(JSONRPCMessageEvent me) {
	switch(me.message().getCode()) {
		case JSONRPCMessage.INIT:
			config = me.message().getServletConfig();
			request = me.message().getRequest();
			session = request.getSession(true);
			response = me.message().getHttpResponse();
			lastresponse = me.message().getRPCResponse();

This new feature should also make it easier to implement solutions that use sessions. This should also make it possible for classes to react to the output of other classes, including errors.


Tags: , , , ,

A Cascading Style Sheets (CSS) Beginner’s Tutorial

Learning CSS can be a bit daunting if you’ve never encountered it before. Likewise, if you’ve only had limited exposure to CSS, the various ways browsers implement various aspects of the CSS standard (or make up their own) can leave you with the impression that it is all a giant hairy mess. So to help out, I’ve compiled a list of resources to make the learning curve not quite as steep for beginners and to hopefully help tame the CSS wilderness for novices.

First, here is a pretty good and in-depth video on HTML and CSS basics:

Next we have several handy beginner’s tutorial sites:

Finally, here are a few CSS frameworks designed to help make CSS a lot easier by providing a standard system that takes care of much of the common ugly quirks found in CSS:

As a bonus, here are a few inspirational sites to help give you an idea of what CSS can do if applied properly:

Tags: , , ,

Simple JSON-RPC updated to 0.9.7

Simple JSON-RPC has been updated to 0.9.7. This new version includes the ability to enable using full class names rather than simple method names. This makes using multiple classes with the same public method names possible.

To enable this functionality simply add an init-param to your web.xml file like:


With this feature enabled, you then call methods via their full classname + method name separated by a dot (this nomenclature is for both static as well as non-static methods, the framework handles the particulars in the back-end).

Special thanks to Stephan of Cross Pollinate for suggesting this improvement!

Tags: , , ,

Using Python with Hadoop

First, some review

Hadoop is a very powerful MapReduce framework based on a white paper released by Google documenting how they have successfully tackled the issue of processing large amounts of data (on the scale of petabytes in many cases) using their proprietary distributed filesystem, GFS. Hadoop is the open source version of this distributed file system1, heavily supported by companies like Yahoo, Google, Amazon, Adobe, Facebook, Hulu, IBM, RackSpace, etc. and and has a growing number of related projects hosted by the Apache Foundation.

Why we need to learn “yet another language”

Yet, even with all of the buzz and hoopla many people find it difficult to setup and start writing applications capable of levreging the awesome power of an Hadoop cluster, many find the learning curve of Java and the Hadoop APIs very steep.

Fortunately one of the features available in Hadoop is HadoopStreaming which allows programmers to specify any program (or script) as a mapper and/or reducer. Consequently, one of the most popular scripting languages to use alongside Hadoop is Python2.

One of the reasons Python is well suited to this type of work is it’s ability to be functional provided you are careful how you write it. This makes chopping well-written Python map/reduce scripts up into distributable units much easier.

There’s a framework for that

While it is possible to write plain Python scripts, the folks at have helped create an excellent Python framework for Hadoop called Dumbo to help streamline the process of writing MapReduce jobs in Python. Dumbo seems to be a fairly simple framework with plenty of examples you can adapt to your particular needs.

There’s a framework for that too

Hadoop has many sub-projects, and one that is fairly popular is called HBase which allows a more structured, database-like, approach to storing and retrieving data. An excellent Python framework for quickly parsing data into HBase tables is Zohmg. This framework allows programmers to define tables in a YAML configuration file and corresponding mappers as simple Python scripts.

Bringing it back home

One of the biggest drawbacks to using HadoopStreaming is that it is inherently less optimal than writing MapReduce jobs in Java since the target script or application has to be initialized, the data then has to be serialized, sent to the target application/script, processed, and then sent back (if there are any reducers). All this context switching adds overhead that wouldn’t exist if the MapReduce job were kept in the JVM where Hadoop runs.

Jython is a viable answer for converting existing Python applications into Java bytecode to prevent incurring as much of a performance penalty. This utility can come in handy if you decide that your “quick and dirty” Python script needs to be moved into a production environment.

  1. Technically Hadoop is an umbrella name whereas HDFS is the technical name for the GFS alternative. []
  2. If you aren’t familiar with Python and want to learn, here is an excellent site for diving into the language and here is an excellent video series walking you through the basics. []

Tags: , , , , , , ,