Skip to content

Latest commit

 

History

History
89 lines (58 loc) · 4.7 KB

README.md

File metadata and controls

89 lines (58 loc) · 4.7 KB

Drawing Side by Side

This is repo contains demo sketches for Processing, implemented in different languages. The primary intent is to show how different programming languages lend themselves to different approaches to solving similar problems. Secondarily, it is intended to demonstrate how to program in Clojure, via comparisons to other languages.

PREREQUISITES

Here's how to get yourself setup to draw. Get Quil working for the Clojure side, and Ruby-Processing for the Ruby side. The instructions below are "editor agnostic." I use Sublime and Emacs, but you can use whatever you like. These setup instructions leave you free to use the editor of your choice.

If all else fails, just read the docs appropriate for your installation. I'm just summarizing the official materials.

CLOJURE/QUIL

Be sure to install the latest Oracle JVM (1.8 at the time of this writing).

For Clojure / Quil, I follow the following (if possible), before showing up:

For Clojure / Quil, I recommend attempting to understand this approach if you're interested in Functional Programming:

RUBY-PROCESSING

The instructions for installing Ruby-Processing can get a little complicated. But, only because the process differs based on what system you have (Mac, Windows, Linux, Vax, etc.).

For the confident, check out the official install directions: https://github.com/jashkenas/ruby-processing#installation

On Arch-Linux

  • Install rbenv
  • See what the latest jruby is: rbenv install --list
  • Install the latest jruby via rbenv rbenv install jruby-<version> (version = 1.7.16.1 at time of writing)
  • Install the ruby-processing gem vai jruby: jruby -S gem install ruby-processing
  • Download the latest Processing (2.2 at time of writing) and put it somewhere.
  • Untar it and note the location of the processing- directory.
  • Add PROCESSING_ROOT: "/home/<your user>/path/to/processing-<version>" to a ~/.rp5rc file. This tells Ruby-Processing's rp5 command where to find your Processing install.

For Mac

You can try to install it with these instructions (or, see below): https://github.com/jashkenas/ruby-processing/wiki/Installing-ruby-processing-on-the-mac

For Mac: Alternatively, here’s what I did on my Mac:

  • I had already installed Processing 2.2 from Processing.org: https://processing.org/download/?processing
  • (You need to do this if you don't have that already.)
  • After you do this, you need to set up a ~/.rp5rc file with the following line in it: PROCESSING_ROOT: "/Applications/Processing.app/Contents/Java"
  • mkdir my_project
  • cd my_project
  • install rbenv, I used Homebrew (https://github.com/sstephenson/rbenv)
  • rbenv install jruby-1.7.16
  • rbenv local jruby-1.7.16
  • jruby -S gem install ruby-processing

Testing Your ruby setup

  • cd SideBySide/Ruby/
  • rp5 run simple.rb

You should see something like: Screenshot

DATA

Since there's a bike-share effort on the move in Honolulu. Let's get warmed up for bike data by borrowing some from San Francisco. They recently had an event to promote working with their data. You can download it and get a head start. We'll play around with this a bit during the workshop as time allows.

CODA

If Ruby's not your thing, Kevin just sent over this quite thorough comparison of Python and Clojure.

Also, here's Processing in other languages:

Processing's Drawing API

Each install section has some sample demos you can try out. Feel free to explore on your own.

The Processing API is wrapped by both Clojure (in Quil) and Ruby (in Ruby-Processing). This is where you'll find the functions you'll use to complete your drawings.

Quil's API is here: http://quil.info/api

For Ruby-Processing the Processing API is available, but with Ruby syntax (which is a good thing): https://processing.org/reference/

For more on using the API from Ruby, read this: https://github.com/jashkenas/ruby-processing/wiki/Using-the-Processing-API