Java – XMLGregorianCalendar to Date

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

public class Test {

	public static void main(String[] args)
			throws DatatypeConfigurationException {

	public static void dateFromXMLGregorianCalendar()
			throws DatatypeConfigurationException {

		GregorianCalendar gcal = new GregorianCalendar();
		XMLGregorianCalendar xmlGregorianCalendar = null;
		xmlGregorianCalendar = DatatypeFactory.newInstance()

		Calendar calendar = xmlGregorianCalendar.toGregorianCalendar();
		SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm");

		Date date = calendar.getTime();
		String dateString = formatter.format(date);


Node.js blocked by firewall – a workaround.

I had recently installed node.js on my work machine – windows  7 64 bit but I could not run node.js commands  via command prompt.  As shown below, prompting for the version of node never returned anything apart from a separate terminal window that only flashed (opened and closed immediately). However, npm (Nodejs Package Manager) version printed successfully. After researching into this, I noticed that my firewall restrictions were most likely blocking node.js from opening ports. I was therefore unable to run the test program which creates a simple web server. The javascript code shown below was saved in a file called test.js.

Fumba Chibaka Node.js 3

var http = require('http');
http.createServer(function (req, res) {
 res.writeHead(200, {'Content-Type': 'text/plain'});
 res.end('Hello World\n');
}).listen(1337, '');
console.log('Server running at');

As a workaround to this, I directly ran node.js terminal through node.exe. In my case, node.exe was located in C:\Program Files\nodejs\

The JavaScript file can be loaded by using the .load REPL command.  The web server was successfully created this time.

Fumba Chibaka Node.js 1

Fumba Chibaka Node.js 4

Deploying an apache tomcat/axis webservice on Amazon AWS using Elastic Beanstalk

This previous post shows how you can create a simple web service in apache tomcat using eclipse.

For this tutorial, you will need to have an amazon AWS account and  SOAP UI (or any client that would allow you to access a SOAP web service) .

The first step would be to export the web service from eclipse as a jar file. You can use a sample simple web service implementation , TestWebService, whose source code can be found on

To export the dynamic java project as a web archive (WAR) file, right click on the project and navigate to export and then click on WAR.

fumba chibaka deploy webservice to AWS 1


Next provide a name to be used for your WAR file and the location on which you wish for the file to be saved and hit Finish.

fumba chibaka deploy webservice to AWS 2

You will then need to log into your AWS Console and navigate to Elastic Beanstalk service.

fumba chibaka deploy webservice to AWS 3

Create a new application a provide a name for it. Hit Next.fumba chibaka deploy webservice to AWS 4


Click on Create New Server.

fumba chibaka deploy webservice to AWS 5

Leave the profile name as default and click NEXT

fumba chibaka deploy webservice to AWS 6


Select Tomcat as the Predefined Configuration platform and hit NEXT.







fumba chibaka deploy webservice to AWS 7

On the next screen, select “upload your own” for the source and point to the location on which you saved the WAR file.

fumba chibaka deploy webservice to AWS 8

From this point, you will be prompted to provide a name for your environment, after that – keep hitting next until the WAR file is deployed onto your server instance.

Once the application is published, you can access your web service, TestWebService using the application URL that is provided by AWS.

Type in the following URL in your browser to access the WSDL for the service:

http://[  Your Environment name ]

fumba chibaka deploy webservice to AWS 9

Open SOAP UI and hit File > New SOAP Project. Provide a name for the project and WSDL URL as shown below:

fumba chibaka deploy webservice to AWS 10

Hit OK and the following structure will be created in the project navigator view:

fumba chibaka deploy webservice to AWS 11


Double click on Request 1 and the following view will open. You can provide a name for the request and a response will be displayed.

fumba chibaka deploy webservice to AWS 12

Creating a Simple Web Service on Apache Tomcat using Eclipse

For this tutorial you will need to download:

Open Eclipse and add an instance tomcat apache to the workspace.

Create a new dynamic web project and provide the project name: File > New > Dynamic Web Project. Hit Finish and the project will be created.

sample web service fumbani chibaka 1



Access the src folder and create a new class as shown below:

sample web service fumbani chibaka 2



sample web service fumbani chibaka 3


Hit Finish after providing the package name and the name of the Java class.  Implement TestWebService as follows. Through the function, retrieveCurrentDate, this service will ask the user for their name and will in return greet them and tell them what today’s date is.

 package me.fumba;</pre>
 import java.util.Calendar;</pre>
 * @author Fumba Chibaka
 public class TestWebService {</pre>
 * Provides the current date in format dow mon dd hh:mm:ss zzz yyyy
 * @return
 public String retrieveCurrentDate(String username) {
 Calendar calendar = Calendar.getInstance();
 return "Hallo, " + username + " Date: " + calendar.getTime().toString();


Right click TestWebService > Web services > Create Web Service.
sample web service fumbani chibaka 4



Set up the dialog box as shown below. Note that the bottom slider allows us to create a test client for this web service.

sample web service fumbani chibaka 5


Click Finish and a test client project will be created and will appear in the Package Explorer. Eclipse will open a tab with the methods available in the published web service. Our method, retrieveCurrentDate can also be tested from this view as shown below.


sample web service fumbani chibaka 6


This web service can be deployed and tested as described in this post.

The source code for this tutorial can be found on github – fumbaa/java-webservice-test-apache-axis

Free Bawo Game App release Delayed

It was originally announced on that Fumba Game Lab (FGL) will launch the free downloadable bawo app on the 8th of August, but due to  a technical malfunction FGL will be releasing this traditional African bawo game application a couple of days after its originally scheduled release date.
With help and advice from game testers and professional programmers, FGL is optimizing its bawo app which will be playable on both Windows and Mac OS X platforms. This announcement comes after active bugs had been identified in the application which FGL had packaged for distribution. The application will be optimized promptly rather than being deployed in its current state at the expense of quality. 

Free Bawo / Bao / Omweso African Mancala Game on

logogameFumba Game Labs™ will be officially releasing its first version of the traditional African mancala game on the 8th of August, 2010. Bawo ( Bao, Omweso ) is played is several countries of Eastern Africa (including Tanzania, Kenya, Malawi and eastern Congo) but it is most popular among Swahili people of Tanzania and Kenya. [ref: Wiki].

Fumba Game Labs™ Bawo Version 1 will be available for free download at . The bawo game will be compatible with all Windows Operating Systems (XP, Vista and 7), Macintosh OS and Mobile Devices that support Adobe Flash Player. The game will also be playable on Apple iPhone and iPad.

The first version of FGL™ Bawo Game will be available as a standalone application which will not require any installation. It will also be playable online from any browser with the Adobe Flash player plugin.

Fumba Chibaka
Game Designer, Fumba Game Labs™.


How to pause Code Execution in Adobe Flash Actionscript3 (as3)

I wish as3 had a method .pause() to perform this function. Unfortunately it doesnt so this is how I achieved pausing during code execution. Any clever ideas- anyone?
In the .as file package,

import flash.utils.Timer;

//create a timer instance that shoots every 0.1 sec (100ms) – infinity
// in this case, code execution will pause up until the value of playBoolean == true

var pauseTimer:Timer = new Timer(100, 0);
//add a listener for the timer (executes the function “startAction” once frame is loaded)
pauseTimer.addEventListener(TimerEvent.TIMER, startAction);
function startAction(evt:Event){
        if (playBoolean == true){
                      //put code that needs to be delayed here