Building Apache Mesos on Mac OS X Mavericks

Below are step-by-step instructions for building Apache Mesos on Mac OS X Mavericks. I’ve tried this with Mesos 0.18.1 but it may also work with newer/older versions of Mac OS X/Mesos.

  • Download Apache Mesos 0.18.1 from
  • Extract the downloaded archive
  • Open a terminal
  • Go to the directory where you extracted Mesos
  • Accept the Xcode license: xcodebuild -license
  • Install Brew: ruby -e "$(curl -fsSL"
  • Install GCC: brew install gcc48 (this can take for ever i.e. > 30 minutes)
  • Install Maven: brew install maven
  • Create the build directory: mkdir build
  • Go to the build directory: cd build
  • Run the configure script: ../configure
  • Build: make (this can also take a long time)
  • Run test suite: make check (go make another cup of coffee)
  • Start Mesos server: ./bin/ --ip=
  • Start Mesos slave: ./bin/ --master=
  • Open the Mesos web page:

Publishing Wink screencasts on YouTube

Wink is a great freeware for capturing and editing screencasts on Windows/Linux. Unfortunately, it only supports exporting screencasts as Flash (.swf) videos, which cannot be directly uploaded on YouTube. Here is a quick way to convert Wink screencasts into videos you can upload on YouTube using Windows Movie Maker (free).

  • Open your screencast file (.wnk) with Wink
  • Export the captured images as HTML (File -> Export as HTML)
  • Open Windows Movie Maker
  • Drag and drop all the images in the exported HTML’s image directory into Movie Maker
  • Select all images, go to the Edit tab and set the duration to 0.3 seconds
  • Export as a video in the format of your choice (.wmv works fine with YouTube)

Single-file Database Management Systems

Below is a list of DBMSs (both relational and NoSQL) that support storing each database as a single, self-contained file.

Below is a list of DBMSs that looked promising but after closer inspection seem to be needing more than one file per database.

  • MapDB (Key-value – Apache License)

If you are aware of any other single-file DBMS please leave a comment below.

Escaping XML special characters in Java

If you do not wish to bring in an additional dependency, you can use the following function, which makes use of the built-in W3C XML API, to escape XML special characters in your Java program.

public String escapeXml(String target) throws Exception {
	Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
	Text text = document.createTextNode(target);
	Transformer transformer = TransformerFactory.newInstance().newTransformer();
	DOMSource source = new DOMSource(text);
	StringWriter writer = new StringWriter();
	StreamResult result = new StreamResult(writer);
	transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
	transformer.transform(source, result);
	return writer.toString();

Basic username/password authentication for ksoap2 on Android

The built-in HttpTransportBasicAuth class provided by ksoap2 doesn’t seem to be part of the ksoap2 Android assembly. The following class (adapted from here) works fine for me.


import org.kobjects.base64.Base64;
import org.ksoap2.transport.HttpTransportSE;
import org.ksoap2.transport.ServiceConnection;

public class HttpTransportBasicAuth extends HttpTransportSE {

  private String username;
  private String password;

  public HttpTransportBasicAuth(String url, String username, String password) {
    this.username = username;
    this.password = password;

  public ServiceConnection getServiceConnection() throws IOException {
    ServiceConnection serviceConnection = super.getServiceConnection();
    return serviceConnection;

  protected void addBasicAuthentication(ServiceConnection serviceConnection) 
      throws IOException {
    if (username != null && password != null) {
      StringBuffer buffer = new StringBuffer(username);
      byte[] bytes = buffer.toString().getBytes();
      buffer.append("Basic ");
      Base64.encode(bytes, 0, bytes.length, buffer);
        ("Authorization", buffer.toString());