From charlesreid1

Beaker Notebook

What is it

Beaker notebook is a cloud-based notebook service that can handle a huge variety of different languages: https://pub.beakernotebook.com/

It is of interest to us because we can run Java code in a notebook - perfect for lecture notes.

Finding out about it

Found out about the Beaker notebook at a link [1] talking about various notebook software

  • Jupyter Notebook
  • Apache Zepplin
  • Beaker Notebook

The thing that caught my eye was that it can run Java.

(Zepplin is IMPLEMENTED in Java, but (incredibly) there was no actual explicit statement that you could run Java code in Zeplin.)

Running

Notes on Installing and Running Beaker Notebooks

Building Beaker Notebook requires a few prereqs. Instructions for installing are on the Beaker Notebook wiki:

Can also be installed with Docker: https://github.com/twosigma/beaker-notebook/blob/master/Dockerfile

Beaker Notebook is open source and available on Github: https://github.com/twosigma/beaker-notebook

Installing and Running Java in Beaker Notebooks

Here's how to implement Java in a Beaker Notebook: https://lab.beakernotebook.com/publications/7605e53c-fb84-11e5-97c2-4fe48981c03f

first define some classes

package test.beaker;

import java.util.Date;

public class BeakerTest {
  private Date _date;

  public BeakerTest() {
    _date = new Date();
  }

  public String getDateTxt() {
    return _date.toString();
  }

  public String getDateUpperCaseTxt() {
    return _date.toString().toUpperCase();
  }

}

then some interactive code

package test.beaker;

BeakerTest bt = new BeakerTest();
return bt.getDateTxt();

and heck, draw a graph:

import java.util.List;
import java.util.ArrayList;

Plot p = new Plot();

p.setTitle("this is a Java plot");

Bars b = new Bars();

List<Number> yList = new ArrayList<Number>();
yList.add(2);
yList.add(5);
yList.add(4);
yList.add(8);

b.setY(yList);
b.setColori(Color.orange);
b.setWidth(0.5);

p.add(b);
  
return p;


Flags