From charlesreid1

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


=Running=
=Getting Up and Running=


==Mac==
==Mac==

Revision as of 01:06, 5 September 2016

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.)

Getting Up and Running

Mac

To get everything installed and up and running on the Mac:

Install Xcode

Install Java JDK 8

Install Homebrew

Gradle, NPM, Sass, and Nginx:

brew install gradle npm
brew install --build-bottle nginx --with-debug
sudo gem install sass

clone Beaker notebook repo:

git clone https://github.com/twosigma/beaker-notebook.git

Build everything and run it:

cd beaker-notebook
gradle run

This will take a couple of minutes the first time you do it, since it will compile a bunch of stuff. Eventually your browser will open to the Beaker Notebook web interface:

BeakerNotebookInterface.png

Notes

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

Notes on 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