start factoring out the replication protocol client.

Also, some usable comments.
Factor HDRJ parsing.
Debugging script for figuring out why running replicate.pysql under postgres on OS X is failing

Somehow some dynload modules seem to be unavailable, but *only* when under postgres.
Disambiguate HRDJ event names.

insert/update/delete are now reserved for events coming off the stream
change is reserved for client code that just wants a hook for re-rendering.
Disambiguate HDRJ event names.

insert/update/delete are now reserved for events coming off the stream
change is reserved for client code that just wants a hook for re-rendering.
Prototype of CacheSet

CacheSet is an in-javascript database system that I'm hacking together because
none of the others I considered feature edge-triggered processing.

The other JS DB options are:
{Crossfilter,PourOver} -- which only provide *one* view of a dataset at a time, and I need *many*.
PouchDB -- which might actually serve, I haven't tried it
{WebSQL,IndexedDB,DOM Storage} -- which don't provide event triggers, so rerendering requires polling (ie getting the browser to recompute a slice);
  anyway, the killer feature of these is in-browser persistence which we don't even want for our application.

PourOver promised edge-triggering, but its views provide only "update" which it
triggers whenever anything *might* change the view, not whenever something *does*
change the view, and "collection-change" which triggers on writes to the parent.
Plus, its views are tied too tightly to each other; a view in PourOver consists
of boolean operations performed on the MatchSets that are cached on each Filter.
Since MatchSets are cached once per *filter*, in order to make multiple views
of the same dataset you need to make multiple sets of "filter" objects, unless
you desire coordinated views (which was the PourOver author's use case).
Coordinated views are useful, but trapping us to them is painful.

CacheSet is largely inspired by PourOver's MatchSets, but fills in exactly the features I need.
Maybe it can be rolled into PourOver some day, or a joint PourOver-Crossfilter-
TODOs/comments
Start of And and Or CacheSet operators.

They set themselves up properly, but do not update yet.

Also, small typo (forget-o?) fixes
Add reactivity to And, and create Map, Select, and Scalar op-types
Plug HDRJ into CacheSet, i.e. allow

Milestone! The webbrowser can now watch a *live* simulation
(try it, run ./eutopia.py postgresql://localhost/postgres) at almost
no CPU cost (beyond what has to be spent for doing rendering).
Simplify HDRJCacheSet so that it *is* a CacheSet, and we don't have the awkwardness of needing to dig two layers deep to extract values.

To match this simplification, rename "change" to "rerender" and make the CacheSet fire it itself.

It would be nice if CacheSet itself was arrayish, so that you could just say set[0] and set.indexOf(e) and set.filter and pass it directly into D3 and whatnot. Oh well.

Also make copious comments about the available operators.
Merge branch 'databased' of https://github.com/kousu/modex into databased
Merge branch 'databased' of github.com:kousu/modex into databased

This probably doesn't actually fix things.

Conflicts:
	src/frontend/pourgraph.html
Merge branch 'databased' of https://github.com/kousu/modex into databased
OS X fixes (-Nick)

These fixes assume you are using Postgres via Postgres.app
Also, the current version (9.3) is hardcoded in this code, which is less than stellar.

The fixes point the postgres server to the Apple-python (since that's what Postgres.app builds against)
and point the client to use the more updated .dylibs that are shipped with Postgres.app