Configuring the Java editor in Eclipse to use spaces in place of tabs

I was attempting to switch my use of tabs (in Eclipse Juno) to pure spaces. The problem was, even though the Text Editor configuration within Eclipse was set to use “Insert spaces for tabs”, this was not having any effect on my Java code.

Solution: the Java editor is using an Eclipse editor “profile” which is overriding the default Text Editor configuration parameters; thus, you need to customize the Java editor profile.

  1. Open up Eclipse preferences (Mac: Eclipse->Preferences)
  2. Navigate to Java->Editor->Formatter
  3. Create a new ‘Active Profile’, and call it whatever you like
  4. Edit the newly created profile (click Edit)
  5. Next to the ‘Tab policy’ item, select ‘Spaces only’ under the drop-down menuImage
  6. Click OK and make sure you use this profile
  7. (optional) for exiting code, you can convert source code to use the new tab policy by highlighting all the code, and right-clicking to select: Source->Correct Indentation

Getting OPSUI 0.6-SNAPSHOT working with OODT WM 0.3

Getting OODT OPSUI 0.6-SNAPSHOT working with OODT Workflow Manager 0.3 should more or less work out of the box.

Please make sure to modify the following though:

  1. Edit your opsui webapp’s context.xml to use the old workflow-lifecycle file.
    1. cd opsui/
    2. vim src/main/webapp/META-INF/context.xml
    3. Change: “[WORKFLOW_HOME]/policy/wengine/wengine-lifecycle.xml” to “[WORKFLOW_HOME]/policy/workflow-lifecycle.xml

Accessing data from Amazon S3

The following quick tutorial guides you in how to download and access S3 data from the command-line (on *nix) machines.


  1. An AWS S3 storage account already set up
  2. An AWS Access Key
  3. An AWS Private Key
  4. s3cmd (


  1. Download s3cmd
    1. Mac (using homebrew): brew install s3cmd
    2. Ubuntu: sudo apt-get install s3cmd
  2. Initialize your s3cmd to communicate with your S3 server
    1. s3cmd --configure
    2. Enter your AWS Access key
    3. Enter your AWS Private key
    4. (optional) enter encryption key or other paramters, otherwise just hit ‘enter’ for defaults
  3. s3cmd will test to see if it can connect – look for this
  4. View/download files
    1. e.g. s3cmd ls
    2. s3cmd get ...

Compiling and executing a Processing sketch as a Java class

Processing sketches (PDEs) are translated from the processing syntax to pure Java and are compiled and packaged into executable JARs. Is it possible to by pass the packaging step and go straight from the Java code to your own compiled class? Yes it is!

NOTE: Apart from your source and compiled class file, you will need the Processing “core.jar” binary to compile the class as well as run it.


  1. Use Processing to create a sketch file (.pde) and use the “Export” capability to export it to your native enviornment
  2. Open the generated export folder and navigate to the “source” directory. Inside here you will find the Java source file
  3. Compile the Java source file via: javac -cp "core.jar"
  4. Run the compiled class via the following command: java -cp "core.jar:." CLASS_FILE

Using a servlet config file with a CXF JAX-RS web-service

I spent some time searching for how to do this, so thought I’d share my findings.


I created an Apache CXF JAX-RS web-service using the Maven2 archetype “cxf-jaxrs-service (Simple CXF JAX-RS webapp service using Spring configuration)”. Using this as a boiler-plate, I then created my own RESTful web-service endpoint.

The problem was, without having my class extend HttpServlet, how would I get a hold of configuration parameters specified in a servlet configuration file? For example, within Tomcat’s META-INF/context.xml?


It’s as simple as just utilizing the @Servlet context variable.

First, ensure you have the following Maven dependency included in your project’s pom.xml:







Second, define a variable within your REST resource class as such:

@Context private ServletContext context;

Finally, read parameters from the context variable via:


That’s it!

Enabling Ruby syntax highlighting and autocomplete using MacVim

mvim snapshot


  1. Download and use MacVim using Homebrew:
    1. brew install macvim
  2. (If above doesn’t work to highlight .rb files automatically or if you prefer using vim instead of macvim)
    1. Download vim-ruby zip from:
    2. Follow manual “Manually” instructions to install from a script file:
    3. Enable extensions within your ~/.vimrc
      1. set nocompatible " We're running Vim, not Vi!
        syntax on " Enable syntax highlighting
        filetype on " Enable filetype detection
        filetype indent on " Enable filetype-specific indenting
        filetype plugin on " Enable filetype-specific plugins
  3. (Optional: enable better tabbing)
    1. Edit your ~/.vimrc with the following contents
      1. set smartindent
        set tabstop=2
        set shiftwidth=2
        set expandtab


  • Open a file in the terminal using: mvim -v <FILE_NAME>
  • Initiate auto-complete prompt by hitting CTRL-X CTRL-O