Separate containers and relators, remove 'contains' predicate

--- src/databinder/core.clj
+++ src/databinder/core.clj
@@ -28,9 +28,37 @@

 ;; For now, we'll just be building an rdf model out of turtle-data, so this thing is simple and dumb. Later it should go to a url and get arbitrary RDF.

+(defn skolemize [model bnode]
+
+  (let [id (res (uuid))]
+    (doseq [statement (doall (iterator-seq (.listStatements model nil nil bnode)))]
+      (let [s (.getSubject statement)
+            p (.getPredicate statement)]
+        (.remove model statement)
+        (.add model (.createStatement model s p id))))
+    (doseq [statement (doall (iterator-seq (.listStatements model bnode nil nil)))]
+      (let [p (.getPredicate statement)
+            o (.getObject statement)]
+        (.remove model statement)
+        (.add model (.createStatement model id p o))))))
+
+(defn skolemize-model [model]
+  (let [statements (doall (iterator-seq (.listStatements model)))]
+    (doseq [statement statements]
+      (let [s (.getSubject statement)
+            o (.getObject statement)]
+        (if (and (.isResource s) (not (.getURI s)))
+          (skolemize model s))
+        (if (and (.isResource o) (not (.getURI o)))
+          (skolemize model o))))
+    ))
+
+
+
 (defn to-model [string-data]
   (let [model (. ModelFactory createDefaultModel)]
     (.read model (new ByteArrayInputStream (.getBytes string-data "UTF-8")) "http://localhost:3000" "TURTLE")
+    (skolemize-model model)
     model))

 ;; To serialize relational data based on relational data, we first make a serializing function out of some relational data. For now, we'll cheat and pass in the function bindings as part of the serializer. We'll also ditch ordering for now. Also, the view-data is assumed to just be a string of turtle for now.
@@ -51,7 +79,7 @@

 (defn uuid [] (str "urn:uuid:" (java.util.UUID/randomUUID)))

-(def bind (uris "http://logangilmour.com/data-binder#" :rank :root :subject :object  :child :container :relator :contains :projection :path))
+(def bind (uris "http://logangilmour.com/data-binder#" :rank :root :subject :object :child :container :projection :path))

 (def funcs
   {:projector
@@ -144,14 +172,16 @@
     (.getString (.asLiteral res))
     (.toString res)))

-(def dc (uris "http://purl.org/dc/elements/1.1/" :title :description))
+(def dc (uris "http://purl.org/dc/elements/1.1/" :title))

 (defn get-meta-data [resource model]
-  (apply assoc {} (flatten (map (fn [local]
-                                  (let [p (.getProperty model resource (prop (dc local)))]
-                                    (if p
-                                      [local (.asLiteral (.getObject p))])))
-                                (keys dc)))))
+  (comment (apply assoc {} (flatten (map (fn [local]
+                                    (let [p (.getProperty model resource (prop (dc local)))]
+                                      (if p
+                                        [local (.asLiteral (.getObject p))]
+                                        "fuck")))
+                                  (keys dc)))))
+  {"http://purl.org/dc/elements/1.1/title" "broken"})

 (defn get-bound [binding model]
   (or  (.getProperty model binding (prop (bind :object)))
@@ -170,6 +200,14 @@
     (if (empty? parts)
      {}
      (apply assoc {} parts))))
+
+
+(defn types [model binding] (set (map #(.toString %) (relate-right model (prop "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") binding))))
+
+(defn get-subs [model binding] ;;TODO make this deep.
+  (filter #(not (contains? (types model %) (bind :container))) (relate-right model (prop (bind :child)) binding)))
+
+

 (defn s-rec [binding model url-parts]

@@ -178,18 +216,15 @@
                               (if p
                                 (.getString (.asLiteral (.getObject p)))
                                 "")))
-                          (concat
-                           (relate-right model (prop (bind :contains)) binding)
-                           (relate-right model (prop (bind :child)) binding)))
+                          (relate-right model (prop (bind :child)) binding))
+        bindings (clojure.string/join ", "
+                                      (map #(.getURI %)
+                                           (get-subs model binding)))

         projector (first (relate-left model (prop (bind :projection)) binding)) ;;TODO only works for container pointed at by projector for now.
         path (if projector (first (relate-right model (prop (bind :path)) projector)))

-        bindable (first (relate-right model (prop "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") binding))
-
-        types (set (map #(.toString %) (relate-right model (prop "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") binding)))
-
-        func (reduce (fn [accum val] (or accum (get functions val))) nil types)
+        types (types model binding)

         new-url-parts (if path
                   (conj url-parts (.getString (.asLiteral path)))
@@ -197,43 +232,45 @@

         sub-calls (map (fn [child] (s-rec child model url-parts)) children) ;; make the next part of the tree
         meta-data (get-meta-data binding model)
+
         myp (first (relate-right model (prop (bind :path)) binding))
         mypath (if myp (.getString (.asLiteral myp)))]

     (cond
      (contains? types (bind :container))
      (fn [data child resource url built-url]
-            (let [ppath (if path (.getString (.asLiteral path)))
-                  p (get (parse-uri url) ppath)
-                  projected (if (and p (res p))
-                              (if (.containsResource data (res p))
-                                (res p)))
-
-                  current (if mypath (get (parse-uri url) mypath))
-
-                  active (if mypath (= current (.getURI resource)))
-                  built-url (or (if mypath (str built-url mypath "/" (.getURI resource) "/")) built-url)]
-
-              (if ppath
-                (if projected
-                  (func
-                   (.getURI resource)
-                   (.getURI binding)
-                   active
-                   built-url
-                   meta-data
-                   (map (fn [sub-call] (sub-call data nil projected url (str built-url ppath "/" (.getURI resource) "/"))) sub-calls))
-                  "")
-                (func
-                 (.getURI resource)
-                 (.getURI binding)
-                 active
-                 built-url
-                 meta-data
-                 (map (fn [sub-call] (sub-call data nil resource url built-url)) sub-calls))
-                )))
-     (contains? types (bind :relator))
-
+       (let [ppath (if path (.getString (.asLiteral path)))
+             func (reduce (fn [accum val] (or accum (get functions val))) nil types)
+             p (get (parse-uri url) ppath)
+             projected (if (and p (res p))
+                         (if (.containsResource data (res p))
+                           (res p)))
+
+             current (if mypath (get (parse-uri url) mypath))
+
+             active (if mypath (= current (.getURI resource)))
+             built-url (or (if mypath (str built-url mypath "/" (.getURI resource) "/")) built-url)]
+
+         (if ppath
+           (if projected
+             (func
+              (.getURI resource)
+              bindings ;;(.getURI binding)
+              active
+              built-url
+              meta-data
+              (map (fn [sub-call] (sub-call data nil projected url (str built-url ppath "/" (.getURI resource) "/"))) sub-calls))
+             "")
+           (func
+            (.getURI resource)
+            bindings ;;(.getURI binding)
+            active
+            built-url
+            meta-data
+            (map (fn [sub-call] (sub-call data nil resource url built-url)) sub-calls))
+           )))
+
+     :default
      (let [statement (get-bound binding model) ;; fuckery for binding
            relation-getter (fn [data resource] (relator statement data resource))]
        (fn [data child resource url built-url]
@@ -251,14 +288,7 @@
                                                       (fn [val] (sub-call data nil val url built-url))
                                                       related))
                                                    sub-calls))))]
-           (if child
-             (hic/html vals) ;;TODO extract this business... maybe?
-             (func (.getURI resource) ;; apply the bound function to the thing, the binding that points at the funtion, meta-data, and the finished children (should be ordered by now).
-                   (.getURI binding)
-                   active
-                   built-url
-                   meta-data
-                   vals)))))
+           (hic/html vals))))

           )))

@@ -287,7 +317,7 @@

 (defn qb [binding model uri] ;; TODO come up with a nice URI aliasing thing
   (let [children (concat
-                  (relate-right model (prop (bind :child)) binding)
+                  (filter (fn [b] (empty? (relate-left model (prop (bind :projection)) b))) (relate-right model (prop (bind :child)) binding))
                   (relate-right model (prop (bind :projection)) binding))

         projector (first (relate-left model (prop (bind :projection)) binding))
@@ -305,20 +335,16 @@
            '())
          (map (fn [child] (qb child model uri)) children))]

-    (cond (contains? types (bind :relator))
+    (cond
+     (contains? types (bind :container))
+     subs
+     :default
           (let [statement (get-bound binding model)
                 binder (.getURI (.getPredicate statement))
                 predicate (.asResource (.getObject statement)) ;;TODO handle type thing with path thing
                 reverse (= binder (bind :object))]

-            [{:pred (.getURI predicate) :rev reverse :path onpath} subs])
-
-          (contains? types (bind :container))
-
-          subs
-          )))
-
-
+            [{:pred (.getURI predicate) :rev reverse :path onpath} subs]))));;TODO this is almost certainly bad. Paths are not handled right I think.

@@ -556,8 +582,8 @@

-(def example-view
-  "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+(def example-view (to-model
+                   "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
 @prefix bind: <http://logangilmour.com/data-binder#> .
 @prefix ex: <http://logangilmour.com/example-view#> .
@@ -569,76 +595,58 @@

 ex:person-manager
   rdf:type w:row ;
-  dc:title \"The Application\" ;
-  dc:description \"Here we are\" ;
-  bind:child ex:person-list-container ;
-  bind:contains ex:person-container .
-
-ex:person-list-container
-  bind:child ex:person-list ;
-  rdf:type w:column4 ;
-  bind:rank 1 .
+  bind:child
+    [bind:child ex:person-list ;
+     rdf:type w:column4 ;
+     bind:rank 1] ;
+  bind:child ex:person-container .
+

 ex:person-list
+  dc:title \"List of People\" ;
   rdf:type w:list ;
-  bind:object rdf:type ;
-  dc:title \"List of People\" ;
-  dc:description \"A list of people contained within the application\" ;
-  bind:child ex:person-item .
-
-ex:person-item
-  rdf:type w:list-item ;
-  bind:path \"test\" ;
-  bind:child ex:person-projector ;
-  bind:projection ex:person-container .
-
-ex:person-projector
-  rdf:type w:projector ;
-  bind:subject ont:name ;
-  dc:title \"select\" ;
-  dc:description \"choose a person\" .
+  bind:child
+    [bind:object rdf:type ;
+     bind:child
+       [rdf:type w:list-item ;
+        bind:path \"test\" ;
+        bind:projection ex:person-container ;
+        bind:child
+          [rdf:type w:projector ;
+           bind:child [bind:subject ont:name]]]] .

 ex:person-container
+  dc:title \"Person\" ;
   rdf:type w:column8 ;
-  dc:title \"Person\" ;
-  dc:description \"A person\" ;
-  bind:rank 2 .
-
-ex:person-container bind:child ex:person-name-container , ex:person-age ,  ex:person-deleter .
-
-ex:person-deleter rdf:type w:deleter ;
-                  bind:subject rdf:type ;
-                  dc:title \"Remove\" ;
-                  bind:rank 3 ;
-                  dc:description \"Permanently delete a person from the database\" .
-
-ex:person-name-container
-  bind:child ex:person-name ;
-  dc:title \"thing\" ;
-  dc:description \"stuff\" ;
-  rdf:type w:h1 .
-
-ex:person-name rdf:type w:text-field ;
-               bind:rank 1 ;
-               bind:subject ont:name ;
-               dc:title \"Name\" ;
-               dc:description \"The name of a person\" .
-
-ex:person-age rdf:type w:text-field ;
-              bind:rank 2 ;
-              bind:subject ont:age ;
-              dc:title \"Age\" ;
-              dc:description \"The age of a person\".
-
-")
-
-(def widgets
-  "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+  bind:rank 2 ;
+  bind:child
+    [dc:title \"Name\" ;
+     rdf:type w:text-field ;
+     bind:rank 1 ;
+     bind:child [bind:subject ont:name]] ,
+
+    [dc:title \"Age\" ;
+     rdf:type w:text-field ;
+     bind:rank 2 ;
+     bind:child [bind:subject ont:age]] ,
+
+    [dc:title \"Remove\" ;
+     rdf:type w:deleter ;
+     bind:rank 3 ;
+     bind:child [bind:subject rdf:type]] .
+
+"))
+
+(def widgets (to-model
+              "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
 @prefix bind: <http://logangilmour.com/data-binder#> .
 @prefix w: <http://logangilmour.com/bootstrap-widgets#> .
-
-w:projector rdfs:subClassOf bind:relator .
+@prefix dc: <http://purl.org/dc/elements/1.1/> .
+
+dc:title rdf:type bind:parameter .
+
+w:projector rdfs:subClassOf bind:container .

 w:column8 rdfs:subClassOf bind:container .

@@ -646,18 +654,18 @@

 w:row rdfs:subClassOf bind:container .

-w:list rdfs:subClassOf bind:relator .
+w:list rdfs:subClassOf bind:container .

 w:list-item rdfs:subClassOf bind:container .

-w:deleter rdfs:subClassOf bind:relator .
-
-w:paragraph rdfs:subClassOf bind:relator .
-
-w:text-field rdfs:subClassOf bind:relator .
+w:deleter rdfs:subClassOf bind:container .
+
+w:paragraph rdfs:subClassOf bind:container .
+
+w:text-field rdfs:subClassOf bind:container .

 w:h1 rdfs:subClassOf bind:container .
-")
+"))

 (defn page [body]
@@ -685,9 +693,11 @@

 ;;(def data-model (to-model data))

+
+
 (def broadcast-channel (permanent-channel))
-(def edit (editor (to-model example-view)))
-(def syn (syncer (to-model example-view) (to-model widgets)))
+(def edit (editor example-view))
+(def syn (syncer example-view widgets))

 (def channels (atom {}))
@@ -725,7 +735,7 @@
 (defroutes main-routes
   (GET "/async/*" [] (wrap-aleph-handler chat-handler))
   (GET "/view/*" [*]
-       (page ((serializer (to-model example-view) (to-model widgets)) (build-query (to-model example-view) (to-model widgets) *) (res "http://logangilmour.com/example-ontology#person") *)))
+       (page ((serializer example-view widgets) (build-query example-view widgets *) (res "http://logangilmour.com/example-ontology#person") *)))
   (route/resources "/")
   (route/not-found "Page not found"))


version-spec for retrieval complete

version-spec for retrieval complete

--- src/dependable/core.clj
+++ src/dependable/core.clj
@@ -1,5 +1,18 @@
 (ns dependable.core
   (:gen-class))
+
+
+(defn spec-call [f v]
+  (f v))
+
+(def safe-spec-call
+  (fnil spec-call (fn [v] true)))
+
+(defn- find-candidate [candidates nm spec]
+  (first
+    (filter
+      #(safe-spec-call spec (:version %))
+      candidates)))

 (defn resolve-dependencies
   [names
@@ -16,25 +29,30 @@
       result
       (let [pkg (first remaining)
             r (rest remaining)
-            pname (:name pkg)]
+            pname (:name pkg)
+            pspec (:version-spec pkg)]
         (cond (contains? installed pname)
               (recur r installed conflict result)
               (contains? conflict pname)
               [:unsatisfiable pname]
               :else
-              (let [response (query pname)]
-                (if (empty? response)
+              (let [response (query pname)
+                    chosen (first
+                             (filter
+                               #(safe-spec-call pspec (:version %))
+                               response))
+                    chosen-conflicts (:conflicts chosen)]
+                (if (nil? chosen)
                   [:unsatisfiable pname]
-                  (let [chosen (first response)
-                        chosen-conflicts (:conflicts chosen)]
-                    (recur r (assoc
-                               installed
-                               (:name chosen)
-                               (:version chosen))
-                           (into
-                             conflict
-                             chosen-conflicts)
-                           (conj result chosen))))))))))
+
+                  (recur r (assoc
+                             installed
+                             (:name chosen)
+                             (:version chosen))
+                         (into
+                           conflict
+                           chosen-conflicts)
+                         (conj result chosen)))))))))

 #_(defn -main
   "I don't do a whole lot ... yet."


updated all the functions in tabular using make-dataset - still need to be tested

--- src/grafter/tabular.clj
+++ src/grafter/tabular.clj
@@ -137,8 +137,8 @@
 (defn rows [dataset row-numbers & {:as opts}]
   (let [rows (indexed (inc/to-list dataset))
         filtered-rows (select-indexed rows row-numbers)]
-    (make-dataset (column-names dataset)
-                  filtered-rows)))
+    (make-dataset filtered-rows
+                  (column-names dataset))))

 (defn- col-position [column-names col]
   (if-let [canonical-col (resolve-col-id col column-names ::not-found)]
@@ -169,8 +169,8 @@
   "Maps the function f over the dataset and returns a new dataset.
   This is really just map/fmap defined on dataset data."
   [dataset f]
-  (make-dataset (column-names dataset)
-                (->> dataset inc/to-list f)))
+  (make-dataset (->> dataset inc/to-list f)
+                (column-names dataset)))

 (defn- map-keys [f hash]
   "Apply f to the keys in the supplied hashmap and return a new
@@ -192,8 +192,8 @@
                         (inc/to-list dataset))
           new-columns (map col-map-or-fn
                            (column-names dataset))]
-      (make-dataset new-columns
-                    new-data))))
+      (make-dataset new-data
+                    new-columns))))

 (defn drop-rows [dataset n]
   "Drops the first n rows from the CSV."
@@ -218,8 +218,8 @@

 (defn- grep-row [dataset f]
   (let [filtered-data (filter f (:rows dataset))]
-    (make-dataset (column-names dataset)
-                  filtered-data)))
+    (make-dataset filtered-data
+                  (column-names dataset))))

 (defmulti grep
   "Filters rows in the table for matches.  This is multi-method
@@ -247,11 +247,11 @@
                  (first cols))
         col-set (into #{} cols)]

-     (make-dataset (column-names dataset)
-                   (->> data
+     (make-dataset (->> data
                        (filter (fn [row]
                                  (some f
-                                       (cells-from-columns col-set row))))))))
+                                       (cells-from-columns col-set row)))))
+                   (column-names dataset))))

 (defmethod grep java.lang.String [dataset s & cols]
   (apply grep dataset #(.contains % s) cols))
@@ -278,12 +278,13 @@
                                                         (set (keys fs-hash))))
                            (cycle [identity]))
         functions (conj fs-hash other-hash)]
-   (->> dataset
-        (:rows)
-        (map (fn [row]
-               (apply merge (map #(hash-map % ((functions %) (row %)))
-                    (keys row)))))
-        (make-dataset (column-names dataset)))))
+
+    (make-dataset (->> dataset
+                       (:rows)
+                       (map (fn [row]
+                              (apply merge (map #(hash-map % ((functions %) (row %)))
+                                                (keys row))))))
+                  (column-names dataset))))

 (defn swap
@@ -296,10 +297,10 @@
                    (-> v
                        (assoc i (v j))
                        (assoc j (v i))))]
-     (-> header
-         (swapper (col-position header first-col)
-                  (col-position header second-col))
-         (make-dataset data))))
+     (make-dataset data
+                   (-> header
+                       (swapper (col-position header first-col)
+                                (col-position header second-col))))))
   ([dataset first-col second-col & more]
    (if (even? (count more))
      (if (seq more)


Support parsing arbitrary Things

Support parsing arbitrary Things

--- src/grimoire/things.clj
+++ src/grimoire/things.clj
@@ -70,7 +70,10 @@

 (defn path->thing [path]
   (->> (string/split path #"/")
-       (apply ->Def)))
+       (map vector [:group :artifact :version :namespace :def])
+       (reduce (fn [acc [t v]]
+                 (if v (->T t acc v) acc))
+               nil)))

 ;; Manipulating things
 ;;--------------------------------------------------------------------


update reference to renamed function

update reference to renamed function

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@13670 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- acqEngine/src/org/micromanager/mm.clj
+++ acqEngine/src/org/micromanager/mm.clj
@@ -114,9 +114,8 @@
                       item
                       (form-to-log-string item)))]
     (->> converted
-         (interpose " ")
-         (apply str)
-         handle-multiline
+         (join-string " ")
+         cleanup-multiline
          send-to-log)))

 (defmacro log-cmd


Updated server module to support groups-per-chapter structure

--- src/hurvinek/server.clj
+++ src/hurvinek/server.clj
@@ -78,8 +78,9 @@
     (let [params         (:params request)
           product-id     (get params "product-id")
           product-name   (db-interface/read-product-name product-id)
-          chapter-list   (db-interface/read-chapters product-id)]
-          (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list)))
+          chapter-list   (db-interface/read-chapters product-id)
+          groups-per-chapter (db-interface/read-groups-per-chapter product-id chapter-list)]
+          (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list groups-per-chapter)))

 (defn process-add-new-product-page
     [request title]
@@ -102,13 +103,14 @@
           chapter-name   (get params "chapter-name")
           product-name   (db-interface/read-product-name product-id)
           insert-result  (db-interface/add-new-chapter product-id chapter-name)
-          chapter-list   (db-interface/read-chapters product-id)]
+          chapter-list   (db-interface/read-chapters product-id)
+          groups-per-chapter (db-interface/read-groups-per-chapter product-id chapter-list)]
           (if (not chapter-name)
-              (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list)
+              (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list groups-per-chapter)
               (cond
-                  (empty? chapter-name) (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list "danger" "Chapter name is not specified")
-                  insert-result         (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list "danger" (.getMessage insert-result))
-                  :else                 (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list "info"   (str "Chapter " chapter-name " has been added into the database"))
+                  (empty? chapter-name) (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list groups-per-chapter "danger" "Chapter name is not specified")
+                  insert-result         (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list groups-per-chapter "danger" (.getMessage insert-result))
+                  :else                 (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list groups-per-chapter "info"   (str "Chapter " chapter-name " has been added into the database"))
               ))))

 (defn process-add-new-group-page


copy directories for production tree

copy directories for production tree

--- src/me/panzoo/story.clj
+++ src/me/panzoo/story.clj
@@ -822,7 +822,9 @@
                   line)

                 (m required)
-                (do (io/copy text (io/file outdir text))
+                (do (if (fs/directory? text)
+                      (fs/copy-tree text (io/file outdir text))
+                      (fs/copy+ text (io/file outdir text)))
                   line)

                 :else line))))))))


More code cleanup.

More code cleanup.

--- test/metabase/driver/query_processor_test.clj
+++ test/metabase/driver/query_processor_test.clj
@@ -9,22 +9,30 @@

 ;; ## Functionality for writing driver-independent tests

-(def ^:dynamic *db* "Bound to `Database` for the current driver inside body of `with-driver`.")
-(def ^:dynamic *db-id* "Bound to ID of `Database` for the current driver inside body of `with-driver`.")
+(def ^:dynamic *db*
+  "Bound to `Database` for the current driver inside body of `with-driver`.")
+(def ^:dynamic *db-id*
+  "Bound to ID of `Database` for the current driver inside body of `with-driver`.")
 (def ^:dynamic *driver-dataset*)

-(defprotocol DriverData
+(defprotocol IDriverDataset
+  "Functions needed to fetch test data for various drivers."
   (db [this]
     "Return `Database` containing test data for this driver.")
   (table-name->table [this table-name]
     "Given a TABLE-NAME keyword like `:venues`, *fetch* the corresponding `Table`.")
-  (field-name->id [this table-name field-name])
-  (fks-supported? [this])
-  (format-name [this table-or-field-name])
-  (id-field-type [this]))
+  (field-name->id [this table-name field-name]
+    "Given keyword TABLE-NAME and FIELD-NAME, return the corresponding `Field` ID.")
+  (fks-supported? [this]
+    "Does this driver support Foreign Keys?")
+  (format-name [this table-or-field-name]
+    "Transform a lowercase string `Table` or `Field` name in a way appropriate for this dataset
+     (e.g., `h2` would want to upcase these names; `mongo` would want to use `\"_id\"` in place of `\"id\"`.")
+  (id-field-type [this]
+    "Return the `base_type` of the `id` `Field` (e.g. `:IntegerField` or `:BigIntegerField`)."))

 (deftype MongoDriverData []
-  DriverData
+  IDriverDataset
   (db [_]
     @mongo-data/mongo-test-db)
   (table-name->table [_ table-name]
@@ -42,7 +50,7 @@
     :IntegerField))

 (deftype GenericSqlDriverData []
-  DriverData
+  IDriverDataset
   (db [_]
     @generic-sql-data/test-db)
   (table-name->table [_ table-name]
@@ -57,9 +65,13 @@
     :BigIntegerField))

 (def driver-name->driver-dataset
+  "Map of driver keyword name -> dataset instance (i.e., an object that implements `IDriverDataset`)."
   {:mongo       (MongoDriverData.)
    :generic-sql (GenericSqlDriverData.)})
-(def valid-driver-names (set (keys driver-name->driver-dataset)))
+
+(def valid-driver-names
+  "Set of valid driver name keywords."
+  (set (keys driver-name->driver-dataset)))

 (defmacro with-driver
   "Execute BODY with `*db*` and `*db-id*` bound to appropriate places for "
@@ -133,11 +145,17 @@
         names))

 ;; ### Predefinied Column Fns
+;; These are meant for inclusion in the expected output of the QP tests, to save us from writing the same results several times
+
 ;; #### venues
-(defn venues-columns []
+(defn venues-columns
+  "Names of all columns for the `venues` table."
+  []
   (->columns "id" "category_id" "price" "longitude" "latitude" "name"))

-(defn venue-col [col]
+(defn venue-col
+  "Return column information for the `venues` column named by keyword COL."
+  [col]
   (case col
     :id          {:extra_info {}
                   :special_type :id
@@ -184,11 +202,15 @@
                   :table_id (id :venues)
                   :id (id :venues :name)}))

-(defn venues-cols []
+(defn venues-cols
+  "`cols` information for all the columns in `venues`."
+  []
   (mapv venue-col [:id :category_id :price :longitude :latitude :name]))

 ;; #### categories
-(defn categories-col [col]
+(defn categories-col
+  "Return column information for the `categories` column named by keyword COL."
+  [col]
   (case col
     :id   {:extra_info {} :special_type :id, :base_type (id-field-type *driver-dataset*), :description nil, :name (format-name *driver-dataset* "id")
            :table_id (id :categories), :id (id :categories :id)}
@@ -196,7 +218,9 @@
            :table_id (id :categories), :id (id :categories :name)}))

 ;; #### checkins
-(defn checkins-col [col]
+(defn checkins-col
+  "Return column information for the `checkins` column named by keyword COL."
+  [col]
   (case col
     :id       {:extra_info {}
                :special_type :id
@@ -226,7 +250,9 @@

 ;; #### users
-(defn users-col [col]
+(defn users-col
+  "Return column information for the `users` column named by keyword COL."
+  [col]
   (case col
     :id         {:extra_info {}
                  :special_type :id
@@ -250,6 +276,7 @@
                  :table_id (id :users)
                  :id (id :users :last_login)}))

+
 ;; # THE TESTS THEMSELVES (!)

 ;; ### "COUNT" AGGREGATION


* benchmark/cljs/benchmark_runner.cljs: benchmark vector construction

--- benchmark/cljs/benchmark_runner.cljs
+++ benchmark/cljs/benchmark_runner.cljs
@@ -37,6 +37,7 @@
 (println)

 (println ";;; vector ops")
+(simple-benchmark [] [1 2 3] 1000000)
 (simple-benchmark [coll [1 2 3]] (conj coll 4) 1000000)
 (simple-benchmark [coll [1 2 3]] (-conj coll 4) 1000000)
 (simple-benchmark [coll [1 2 3]] (seq coll) 1000000)


add task to add resource files to fileset (add-dir)

--- boot/core/src/boot/task/built_in.clj
+++ boot/core/src/boot/task/built_in.clj
@@ -203,6 +203,15 @@
           (pod/call-worker
             `(boot.pom/spit-pom! ~(.getPath xmlfile) ~(.getPath propfile) ~opts)))))))

+(core/deftask add-dir
+  "Add files in resource directories to fileset."
+
+  [d dirs PATH #{str} "The set of resource directories."]
+
+  (let [tgt (core/mktgtdir! ::add-dir-tgt)]
+    (core/with-pre-wrap
+      (apply file/sync :time tgt dirs))))
+
 (core/deftask add-src
   "Add source files to fileset."
   []


Refactor data flow to on-key-down handler

--- src/reabledit/core.cljs
+++ src/reabledit/core.cljs
@@ -28,26 +28,28 @@
     nil))

 (defn handle-selection-mode-key-down
-  [e rows cols state]
+  [e headers data state]
   (.preventDefault e)
   (let [keycode (.-keyCode e)
-        current-row (first (:selected @state))
-        current-col (second (:selected @state))
+        current-row (-> @state :selected first)
+        current-col (-> @state :selected second)
+        rows (-> data count dec)
+        cols (-> headers count dec)
         f (partial set-selected! state)]
     (condp = keycode
       37 (f current-row (max 0 (dec current-col)))
       38 (f (max 0 (dec current-row)) current-col)
-      39 (f current-row (min (dec cols) (inc current-col)))
-      40 (f (min (dec rows) (inc current-row)) current-col)
-      9 (f current-row (min (dec cols) (inc current-col)))
+      39 (f current-row (min cols (inc current-col)))
+      40 (f (min rows (inc current-row)) current-col)
+      9 (f current-row (min cols (inc current-col)))
       13 (enable-edit-mode! state current-row current-col)
       nil)))

 (defn handle-key-down
-  [e rows cols state id]
+  [e headers data state id]
   (if (:edit-mode @state)
     (handle-editing-mode-key-down e state id)
-    (handle-selection-mode-key-down e rows cols state)))
+    (handle-selection-mode-key-down e headers data state)))

 ;;
 ;; Components
@@ -88,11 +90,7 @@
       [:div.reabledit
        {:id id
         :tabIndex 0
-        :on-key-down #(handle-key-down %
-                                       (count data)
-                                       (count headers)
-                                       state
-                                       id)}
+        :on-key-down #(handle-key-down % headers data state id)}
        [:table
         [data-table-headers headers]
         [:tbody


Adjust threadpoolservice queue/pool parameters.

Experimentation with async-queue suggests these will better meet the
default needs of users for IO-bound pools.

--- src/riemann/service.clj
+++ src/riemann/service.clj
@@ -293,10 +293,10 @@
                  keep-alive-unit
                  queue-size]
           :as opts
-          :or {core-pool-size 0
-               max-pool-size 4
-               keep-alive-time 5
-               keep-alive-unit TimeUnit/SECONDS
+          :or {core-pool-size 1
+               max-pool-size 128
+               keep-alive-time 10
+               keep-alive-unit TimeUnit/MILLISECONDS
                queue-size 1000}}]
    (executor-service
      name


don't log exceptions if in exception-stream

--- src/riemann/streams.clj
+++ src/riemann/streams.clj
@@ -68,9 +68,9 @@
        (try
          (child# ~event)
          (catch Throwable e#
-           (warn e# (str child# " threw"))
            (if-let [ex-stream# *exception-stream*]
-             (ex-stream# (exception->event e# ~event))))))
+             (ex-stream# (exception->event e# ~event))
+             (warn e# (str child# " threw"))))))
      ; TODO: Why return true?
      true))


Add will to live increase for resting near fires

--- src/robinson/update.clj
+++ src/robinson/update.clj
@@ -879,9 +879,20 @@
   "NOP action. Player's hp increases a little."
   [state]
   (-> state
+    ;; rest better then in shelter
     (arg-when-> [state] (let [[cell _ _] (player-cellxy state)]
                           (type->shelter? (get cell :type)))
       (update-in [:world :player :will-to-live]
+        (fn [will-to-live] (+ 0.05 will-to-live))))
+    ;; rest better when near a fire
+    (arg-when-> [state] (let [fire-distances (->> (current-place state)
+                                                  (with-xy)
+                                                  (filter (fn [[cell x y]] (contains? #{:fire :campfire}
+                                                                                (get cell :type))))
+                                                  (map (fn [cell x y] (distance-from-player state (xy->pos x y)))))]
+                         (and (seq fire-distances)
+                              (< 2 (first (sort (fire-distances))))))
+      (update-in state [:world :player :will-to-live]
         (fn [will-to-live] (+ 0.05 will-to-live))))
     (update-in [:world :player]
                (fn [player] (if (< (int (player :hp)) (player :max-hp))


Exercise 2.17, 2.18

Exercise 2.17, 2.18

--- src/sicp/chapter2_2.clj
+++ src/sicp/chapter2_2.clj
@@ -3,6 +3,38 @@
 ;;;; 2.2  Hierarchical Data and the Closure Property

 ;;; 2.2.1  Representing Sequences
+
+;; Exercise 2.17
+(defn last-pair [coll]
+  (if-let [r (next coll)]
+    (recur r)
+    (first coll)))
+
+(last-pair (list 23 72 149 34))
+
+;; Exercise 2.18
+(defn reverse' [coll]
+  (letfn [(rev [coll acc]
+            (if (empty? coll)
+              acc
+              (recur (rest coll)
+                     (cons (first coll) acc))))]
+    (rev coll [])))
+
+(reverse' (list 1 4 9 16 25))
+
+;; Exercise 2.19
+(def us-coins (list 50 25 10 5 1))
+(def uk-coins (list 100 50 20 10 5 2 1 0.5))
+
+
+;; Exercise 2.20
+
+;; Exercise 2.21
+
+;; Exercise 2.22
+
+;; Exercise 2.23

 ;;; 2.2.2  Hierarchical Structures

@@ -31,14 +63,6 @@
 ;=> ((1 2 3) (4 5 6))

 ;; Exercise 2.27
-(defn reverse' [coll]
-  (letfn [(rev [coll acc]
-            (if (empty? coll)
-              acc
-              (recur (rest coll)
-                     (cons (first coll) acc))))]
-    (rev coll [])))
-
 (defn deep-reverse [coll]
   (letfn [(rev [coll acc]
             (cond


immutable, reloaded

immutable, reloaded

--- src/syncserver/core.clj
+++ src/syncserver/core.clj
@@ -99,9 +99,11 @@

 (defn immutable [b]
   (cond
-   (map? b) (into {} b)
-   (or  (seq? b)
-        (primitive-array? b)) (into [] b)
+   (or (instance? java.util.Map b)
+       (map? b)) (into {} b)
+   (or  (instance? java.util.List b)
+        (primitive-array? b)
+        (coll? b)) (into [] b)
    :otherwise b))


Revised action handling and app model layout.

--- src/fm/simrunner/app.clj
+++ src/fm/simrunner/app.clj
@@ -5,23 +5,54 @@

     :author "Frank Mosebach"}
   (:require
+    [fm.simrunner (config :as config)]
     [fm.simrunner.gui (core :as gui)
                       (view :as view)
                       (wiring :as wiring)]))

+(defn- lock [app-state]
+  (update-in app-state [:ui :model :locked] inc))
+
+(defn- lock! [{app-state :state}]
+  (when (-> @app-state :ui :model :locked zero?)
+    (swap! app-state lock)))
+
+(defn- unlock [app-state]
+  (update-in app-state [:ui :model :locked] #(max 0 (dec %))))
+
+(defn- unlock! [{app-state :state}]
+  (swap! app-state unlock))
+
 (defmulti on-action {:private true} (fn [action & _] action))

+(defn- run-task [{worker :worker :as app} task & args]
+  (send-off worker
+            (fn [_ &]
+              (try
+                (apply task app args)
+                nil
+                (finally (unlock! app))))))
+
+(defn- open-config [app file]
+  (println (config/read-config-file file)))
+
 (defmethod on-action :open-config [_ app & args]
-  (println (format "open-config{args: %s}" args))
-  (gui/choose-file (-> args first :widget) :title "Open Config"))
+  (if-let [file (gui/choose-file (-> args first :widget) :title "Open Config")]
+    (run-task app open-config file)
+    (unlock! app)))

 (defmethod on-action :default [action app & args]
-  (println (format "on-action{action: %s args: %s}" action args)))
+  (println (format "on-action{action: %s args: %s}" action args))
+  (unlock! app))

 (defmulti on-event {:private true} (fn [_ event-id & _] event-id))

+(defn- dispatch-action [action app args]
+  (when (lock! app)
+    (apply on-action action app args)))
+
 (defmethod on-event :action-performed [app _ & args]
-  (on-action (-> args first meta :action) app args))
+  (dispatch-action (-> args first meta :action) app args))

 (defmethod on-event :default [app event-id & args]
   (println (format "on-event{id: %s args: %s}" event-id args)))
@@ -29,19 +60,16 @@
 (defn- app [config view]
   {:config config
    :worker (agent nil)
-   :state  (atom {:ui    {:view       view
-                          :model      {}
-                          :dirty?     false
-                          :rendering? false}
+   :state  (atom {:ui    {:view  view
+                          :model {:inputs     {}
+                                  :dirty?     false
+                                  :locked     0
+                                  :rendering? false}}
                   :model {}})})
-
-(defn- rendering? [app]
-  (-> app :state deref :ui :rendering?))

 (defn- event-handler [app]
   (fn [& args]
-    (when-not (rendering? app)
-      (apply on-event app args))))
+    (apply on-event app args)))

 (defn start [config]
   @(gui/gui-do
@@ -53,22 +81,27 @@
       (.setTitle frame "SimRunner (c) 2014 DEINC")
       (.show frame))))

-(defn- start-rendering! [app-state]
-  (when (-> @app-state :ui :dirty?)
-    (swap! app-state #(assoc-in % [:ui :rendering?] true))))
+(defn- start-rendering [app-state]
+  (assoc-in app-state [:ui :model :rendering?] true))

-(defn- stop-rendering! [app-state]
-  (when (-> @app-state :ui :rendering?)
-    (swap! app-state #(-> %
-                          (assoc-in [:ui :rendering?] false)
-                          (assoc-in [:ui :dirty?] false)))))
+(defn- start-rendering! [{app-state :state}]
+  (when (-> @app-state :ui :model :dirty?)
+    (swap! app-state start-rendering)))

-(defn render [{:keys [state] :as app}]
+(defn- stop-rendering [app-state]
+  (-> app-state
+      (assoc-in [:ui :model :rendering?] false)
+      (assoc-in [:ui :model :dirty?] false)))
+
+(defn- stop-rendering! [{app-state :state}]
+  (when (-> @app-state :ui :model :rendering?)
+    (swap! app-state stop-rendering)))
+
+(defn render [app]
   (gui/gui-do
-    (when (start-rendering! state)
+    (when (start-rendering! app)
       (try
-        ;; TODO: render the view model!
         (io! "Do not update the ui in a transaction!")
         (finally
-          (stop-rendering! state))))))
+          (stop-rendering! app))))))


Small simplifications on the code for Triangle from Exercism in the Clojure Track

--- exercism/clojure/triangle/src/triangle.clj
+++ exercism/clojure/triangle/src/triangle.clj
@@ -1,19 +1,14 @@
 (ns triangle)

-(defn type [side1 side2 side3]
+(defn type [side1 side2 side3]
   (cond
-    (or
-     (or (<= (+ side2 side3) side1)
-         (<= (+ side1 side3) side2)
-         (<= (+ side1 side2) side3))
-     (or (= 0 side1)
-         (= 0 side2)
-         (= 0 side3))) :illogical
-    (and (= side1 side2)
-         (= side2 side3)) :equilateral
-    (or (= side1 side2)
-        (= side1 side3)
+    (or
+     (or (<= (+ side2 side3) side1)
+         (<= (+ side1 side3) side2)
+         (<= (+ side1 side2) side3))
+     (= 0 side1 side2 side3)) :illogical
+    (= side1 side2 side3) :equilateral
+    (or (= side1 side2)
+        (= side1 side3)
         (= side2 side3)) :isosceles
-    :else :scalene
-    )
-  )
+    :else :scalene))


Better sanitization of tags and social data

--- frontend/src/faceboard/helpers/person.cljs
+++ frontend/src/faceboard/helpers/person.cljs
@@ -70,7 +70,7 @@
   (s (get-in person [:bio :about])))

 (defn tags [person]
-  (get-in person [:tags] []))
+  (distinct (remove empty? (get-in person [:tags] []))))

 (defn socials [person]
-  (get-in person [:social] []))+  (distinct (remove empty? (get-in person [:social] []))))


CMR-1852-2: Added some comments to expected conversion.

--- umm-spec-lib/src/cmr/umm_spec/test/expected_conversion.clj
+++ umm-spec-lib/src/cmr/umm_spec/test/expected_conversion.clj
@@ -284,6 +284,7 @@
 (defmethod convert-internal :echo10
   [umm-coll _]
   (-> umm-coll
+      ;; ProviderId is not used and will be removed from the UMM metadata associations.
       (update-in-each [:MetadataAssociations] assoc :ProviderId nil)
       (assoc :TilingIdentificationSystem nil) ;; TODO Implement this as part of CMR-1862
       (assoc :Personnel nil) ;; TODO Implement this as part of CMR-1841
@@ -359,6 +360,7 @@
 (defmethod convert-internal :dif
   [umm-coll _]
   (-> umm-coll
+      ;; DIF 9 only supports entry-id in metadata associations
       (update-in-each [:MetadataAssociations]
                       assoc :Type nil :Description nil :Version nil :ProviderId nil)
       (assoc :TilingIdentificationSystem nil) ;; TODO Implement this as part of CMR-1862


colors...

colors...

--- generateme/colors.clj
+++ generateme/colors.clj
@@ -33,6 +33,6 @@

 (save (:buffer (u/show-gradient (c/gradient :LAB :cubic-spline (c/reduce-colors :LAB (resize (p/load-pixels "b5.jpg") 600 600) 5)))) "b5grad.jpg")

-(u/show-gradient (c/gradient :LAB :cubic-spline (c/reduce-colors :LUV (resize (p/load-pixels "bbb1.jpg") 600 600) 4)))
+(u/show-gradient (c/gradient :LAB :cubic-spline (c/reduce-colors :LAB (resize (p/load-pixels "cc.jpg") 600 600) 5)))

 ;;


Enhance MIDI Sync support.

Enhance MIDI Sync support.

Provide a general helper for letting the user choose a MIDI sync source.
Deal with the fact that Traktor's virtual output port was not being made
available by MMJ; now we filter out only the standard MIDI ports which
do have MMJ alternatives.

--- src/afterglow/midi.clj
+++ src/afterglow/midi.clj
@@ -117,11 +117,18 @@
 (defn create-midi-port-filter
   "Return a filter which selects midi inputs and outputs we actually
   want to use. If this is a Mac, and the Humatic MIDI extension has
-  been installed, create a filter which will accept only its ports.
-  Otherwise, return a filter which accepts all ports."
+  been installed, create a filter which will accept only its versions
+  of ports which it offers in parallel with the standard
+  implementation. Otherwise, return a filter which accepts all ports."
   []
   (if (and (mac?) (mmj-installed?))
-    mmj-device?
+    (fn [device]
+      (let [mmj-descriptions (set (map :description (filter #(mmj-device? %)
+                                                            (overtone.midi/midi-sources))))]
+        (or (mmj-device? device)
+            ;; MMJ returns devices whose descriptions match the names of the
+            ;; broken devices returned by the broken Java MIDI implementation.
+            (not (mmj-descriptions (:name device))))))
     identity))

 ;; TODO: This and open-outputs will have to change once hot-plugging works.
@@ -208,7 +215,14 @@
   started and stopped, and the status checked."
       (sync-start [this] "Start synchronizing your metronome.")
       (sync-stop [this] "Stop synchronizing your metronome.")
-      (sync-status [this] "Report on how well synchronization is working."))))
+      (sync-status [this] "Report on how well synchronization is working."))
+
+    (defprotocol IClockFinder
+  "Allows a list of available MIDI clock sources to be gathered, for
+  presentation in a user interface, by monitoring for clock pulses on
+  all ports."
+  (finder-current-sources [this] "Return the set of sources seen so far.")
+  (finder-finished [this] "Stop listening for clock pulses and clean up."))))

 (defn- sync-handler
   "Called whenever a MIDI message is received for a synced metronome.
@@ -248,7 +262,8 @@
         {:type :midi,
          :status (cond
                    (empty? @buffer)           "Inactive, no clock pulses have been received."
-                   (< n  max-clock-intervals) (str "Stalled? Clock pulse buffer has " n " of " max-clock-intervals " pulses in it.")
+                   (< n  max-clock-intervals) (str "Stalled? Clock pulse buffer has " n " of "
+                                                   max-clock-intervals " pulses in it.")
                    :else                      "Running, clock pulse buffer is full.")})))

 (defn- describe-name-filter
@@ -269,6 +284,27 @@
       (filter #(or (re-find pattern (:name %1))
                    (re-find pattern (:description %1)))
               devices))))
+
+;; A simple object to help provide a user interface for selecting between available MIDI
+;; clock sync sources
+(defrecord ClockFinder [listener results]
+  IClockFinder
+  (finder-current-sources [this] @results)
+  (finder-finished [this]
+    (remove-global-handler! listener)
+    (reset! results nil)))
+
+(defn watch-for-clock-sources
+  "Returns a clock finder that will watch for sources of MIDI clock
+  pulses until you tell it to stop."
+  []
+  (open-inputs-if-needed!)
+  (let [clock-sources (atom #{})
+        clock-listener (fn [msg]
+                         (when (= (:status msg) :timing-clock)
+                           (swap! clock-sources conj (:device msg))))]
+    (add-global-handler! clock-listener)
+    (ClockFinder. clock-listener clock-sources)))

 (defn sync-to-midi-clock
   "Returns a sync function that will cause the beats-per-minute
@@ -285,15 +321,10 @@
   ([]
    (sync-to-midi-clock nil))
   ([name-filter]
-   (open-inputs-if-needed!)
-   (let [clock-sources (atom #{})
-         clock-finder (fn [msg]
-                        (when (= (:status msg) :timing-clock)
-                          (swap! clock-sources conj (:device msg))))]
-     (add-global-handler! clock-finder)
+   (let [clock-finder (watch-for-clock-sources)]
      (Thread/sleep 300)
-     (remove-global-handler! clock-finder)
-     (let [result (filter-devices @clock-sources name-filter)]
+     (let [result (filter-devices (finder-current-sources clock-finder) name-filter)]
+       (finder-finished clock-finder)
        (case (count result)
          0 (throw (IllegalArgumentException. (str "No MIDI clock sources " (describe-name-filter name-filter)
                                                   "were found.")))
@@ -304,6 +335,8 @@

          (throw (IllegalArgumentException. (str "More than one MIDI clock source " (describe-name-filter name-filter)
                                                 "was found."))))))))
+
+

 (defn identify-mapping
   "Report on the next MIDI control or note message received, to aid in


typo fix

typo fix

--- src/tweetiment/core.clj
+++ src/tweetiment/core.clj
@@ -7,7 +7,7 @@
             [tweetiment.twitter :as tw]))

 (defn words
-  "takes a tweet and returns lower case words ass a seq"
+  "takes a tweet and returns lower case words as a seq"
   [tweet]
   (map s/lower-case (re-seq #"[a-zA-Z]+" tweet)))


clarify a bit of what the handlers do

clarify a bit of what the handlers do

--- src/vigil/web/start.clj
+++ src/vigil/web/start.clj
@@ -11,16 +11,22 @@
             [vigil.web.pages.index :as index]
             [vigil.web.pages.game :as game]))

-(defn get-player-game [player-id]
-  (game/page (ops/load-player-game (Integer/parseInt player-id))))
-
 (defn new-game [player-name team-name sally-duration]
   (ring-response/redirect
    (format "/my-game/%s"
-           (:id (ops/new-game player-name team-name (Integer/parseInt sally-duration))))))
+           (:id (ops/new-game player-name
+                              team-name
+                              (Integer/parseInt sally-duration))))))

 (defn get-game [id]
+  "You don't have to be in a game to view its state."
   (game/page {:game (ops/get-full-game (Integer/parseInt id))}))
+
+(defn get-player-game [player-id]
+  "Show a player the state of their game, crucially including a check for
+  attackers. This handler is where the game is played."
+  (game/page (ops/load-player-game (Integer/parseInt player-id))))
+

 (defroutes app-routes
   (GET "/" [] (index/page))


Run Clojure server on port 4000 so it doesn't collide with Rails server

--- src/asciinema/main.clj
+++ src/asciinema/main.clj
@@ -27,7 +27,7 @@

 (defn -main [& args]
   (binding [y/*exception-notifier* (create-exception-notifier)]
-    (let [bindings {'http-port (Integer/parseInt (:port env "3000"))
+    (let [bindings {'http-port (Integer/parseInt (:port env "4000"))
                     'db-uri (:database-url env)
                     's3-bucket (:s3-bucket env)
                     's3-access-key (:s3-access-key env)


sort jobs by db id of the entity before turning to batches

--- src/wb_es/bulk/core.clj
+++ src/wb_es/bulk/core.clj
@@ -68,6 +68,10 @@
   ([eids] (make-batches 500 nil eids))
   ([batch-size order-info eids]
    (->> eids
+        (sort-by (fn [param]
+                   (if (sequential? param)
+                     (first param)
+                     (identity param))))
         (partition batch-size batch-size [])
         (map (fn [batch]
                (with-meta batch {:order order-info
@@ -304,7 +308,6 @@
                                  [?v :variation/gene ?gh]
                                  [?gh :variation.gene/gene ?g]]
                                db)
-                          (sort-by (fn [[v g]] v))
                           (map (fn [[v g]]
                                  [v gene/->Variation g]))
                           (make-batches 1000 :gene->variation))]


+require some useful diagnostic/exploratory functions

--- src/babel/english.cljc
+++ src/babel/english.cljc
@@ -1,14 +1,16 @@
 (ns babel.english
   (:refer-clojure :exclude [get-in])
   (:require
+   [dag_unify.core :refer (fail-path get-in unifyc)]
    [babel.engine :as engine]
    [babel.forest :as forest]
    [babel.english.grammar :refer [medium small-plus-vp-pronoun small-plus-plus-np]]
    [babel.english.morphology :as morph :refer [fo]]
+   [babel.over :refer [over]]
    [babel.parse :as parse]
    [clojure.repl :refer [doc]]
    [clojure.string :as string]
-   [dag_unify.core :refer [fail? get-in strip-refs]]))
+   [dag_unify.core :refer [fail? fail-path get-in strip-refs]]))

 (def lexicon (:lexicon medium))
 (def grammar (:grammar-map medium))


cleanup

cleanup

--- src/babel/espanol.cljc
+++ src/babel/espanol.cljc
@@ -48,7 +48,6 @@
             :or {max-total-depth generate/max-total-depth
                  truncate-children true}}]]
   (log/debug (str "generating with spec: " (strip-refs spec) " with max-total-depth: " max-total-depth))
-  (log/error (str "ESTRUNCO:" truncate-children))
   (let [model (if model model medium)]
     (let [result (engine/generate spec model
                                   :max-total-depth max-total-depth


s/english.writer/english.grammar/

s/english.writer/english.grammar/

--- src/babel/workbook.clj
+++ src/babel/workbook.clj
@@ -2,7 +2,7 @@
   (:refer-clojure :exclude [get-in merge resolve find parents])
   (:require
    [babel.engine :refer [generate]]
-   [babel.english.writer :as en]
+   [babel.english.grammar :as en]
    [babel.espanol.writer :as es]
    [babel.francais.grammar :as fr]
    [babel.italiano.writer :as it]


Improved header parsing on jwe with additional validations.

--- src/buddy/sign/jwe.clj
+++ src/buddy/sign/jwe.clj
@@ -161,16 +161,20 @@
         (codecs/str->bytes))))

 (defn- parse-header
-  [^String header]
-  (let [header (codecs/safebase64->str header)
-        {:keys [alg enc zip] :as header} (json/parse-string header true)]
-    (when (or (nil? alg) (nil? enc))
-      (throw+ {:type :parse :cause :header :message "Missing `alg` or `enc` key in header."}))
-    (merge {:alg (keyword (str/lower-case alg))
-            :enc (keyword (str/lower-case enc))}
-           (when zip
-             {:zip (keyword (str/lower-case zip))})
-           (dissoc header :alg :enc :zip))))
+  [^String headerdata {:keys [alg enc] :or {alg :dir enc :a128cbc-hs256}}]
+  (when (nil? alg)
+    (throw+ {:type :validation :cause :header :message "Missing `alg` parameter."}))
+  (when (nil? enc)
+    (throw+ {:type :validation :cause :header :message "Missing `enc` parameter."}))
+  (let [header (-> (codecs/safebase64->str headerdata)
+                   (json/parse-string true))]
+    (when (not= alg (keyword (str/lower-case (:alg header))))
+      (throw+ {:type :validation :cause :header
+               :message "The `alg` param mismatch with header value."}))
+    (when (not= enc (keyword (str/lower-case (:enc header))))
+      (throw+ {:type :validation :cause :header
+               :message "The `enc` param mismatch with header value."}))
+    (merge {:alg alg :enc enc} (dissoc header :alg :enc))))

 (defmulti generate-iv :enc)
 (defmethod generate-iv :a128cbc-hs256 [_] (nonce/random-bytes 16))


Fix for 1.9

Fix for 1.9

--- src/bukkure/player.clj
+++ src/bukkure/player.clj
@@ -33,7 +33,6 @@
 (event-player inventory.inventory-click)
 (event-player inventory.inventory-close)
 (event-player inventory.inventory-open)
-(event-player painting.painting-place)
 (event-player player.player)

 (extend-type org.bukkit.inventory.InventoryView


Added actx-agw helper func.

Added actx-agw helper func.

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -16,6 +16,8 @@
             [cbfg.world.lane]
             [cbfg.world.base :refer [world-cmd-loop]]))

+(defn actx-agw [actx] ((:get-agw (first actx))))
+
 (def prog-base    (atom {}))  ; Stable parts of prog, even during time-travel.
 (def prog-curr    (atom {}))  ; The current prog-frame.
 (def prog-hover   (atom nil)) ; A past prog-frame while hovering over prog-history.
@@ -37,7 +39,7 @@
   (let [prog-next (swap! prog-curr prog-frame-fn)
         ts (count @prog-history)]
     (swap! prog-history #(conj % [ts label prog-next]))
-    (swap! prog-ss #(assoc % ts (ago-snapshot ((:get-agw (first world))))))))
+    (swap! prog-ss #(assoc % ts (ago-snapshot (actx-agw world))))))

 ; -------------------------------------------------------------------

@@ -51,7 +53,7 @@
   (when-let [ago-ss (get @prog-ss ts)]
     (reset! prog-curr prog-frame)
     (swap! prog-history #(vec (take (+ ts 1) %)))
-    (ago-restore ((:get-agw (first (:world @prog-base)))) ago-ss)))
+    (ago-restore (actx-agw (:world @prog-base)) ago-ss)))

 (defn on-prog-frame-focus [ts label prog-frame]
   (reset! prog-hover prog-frame)


fixing deleted systems hostname save in jobs

--- src/celestial/jobs.clj
+++ src/celestial/jobs.clj
@@ -44,29 +44,29 @@

 (defn save-status
    "marks jobs as succesful"
-   [identity spec status]
-  (let [status-exp (* 1000 60 (or (job* :status-expiry) (* 24 60)))
-        hostname (get-in (s/get-system identity) [:machine :hostname])]
-    (es/put (merge spec {:hostname hostname :status status :end (System/currentTimeMillis)}) status-exp :flush? true)
+   [spec status]
+  (let [status-exp (* 1000 60 (or (job* :status-expiry) (* 24 60)))]
+    (es/put (merge spec {:status status :end (System/currentTimeMillis)}) status-exp :flush? true)
     (trace "saved status" (merge spec {:status status :end (System/currentTimeMillis)}))
     {:status status}))

 (defn job-exec [f  {:keys [message attempt]}]
   "Executes a job function tries to lock identity first (if used)"
-  (let [{:keys [identity args tid env user] :as spec} message
-        spec' (merge spec (meta f) {:start (System/currentTimeMillis)})]
+  (let [{:keys [identity args tid env user] :as spec} message]
     (set-user user
       (set-env env
         (set-tid tid
-           (let [{:keys [wait-time expiry]} (map-vals (or (job* :lock) defaults) #(* minute %) )]
+           (let [{:keys [wait-time expiry]} (map-vals (or (job* :lock) defaults) #(* minute %))
+                 hostname (when identity (get-in (s/get-system identity) [:machine :hostname]))
+                 spec' (merge spec (meta f) {:start (System/currentTimeMillis) :hostname hostname})]
             (try
               (if identity
                 (do (with-lock (server-conn) identity expiry wait-time (apply f args))
-                    (save-status identity spec' :success))
+                    (save-status spec' :success))
                 (do (apply f args)
-                    (save-status identity spec' :success)))
+                    (save-status spec' :success)))
               (catch Throwable e (error e)
-                (save-status identity spec' :error)))))))))
+                (save-status spec' :error)))))))))

 (defn jobs []
   {:post [(= (into #{} (keys %)) operations)]}


don't format nil numbers

don't format nil numbers

--- src/clj_money/util.clj
+++ src/clj_money/util.clj
@@ -13,8 +13,9 @@
   "Format a number with 2 decimal places and groups separated with commas"
   ([value] (format-number value {}))
   ([value options]
-   (.format (number-formats (or (:format options) :standard))
-            value)))
+   (when value
+     (.format (number-formats (or (:format options) :standard))
+              value))))

 (def DateFormat (DateTimeFormat/forPattern "M/d/y"))


Removed another function unnecessarily invoked twice

--- src/cloogling/core.clj
+++ src/cloogling/core.clj
@@ -30,9 +30,7 @@
   (
     [x]
     (remove nil? (map create-entry (try
-                                     (if (-> x
-                                             json/read-str
-                                             access-to-data-google)
+                                     (or
                                        (-> x
                                            json/read-str
                                            access-to-data-google)


removed halfway changes

removed halfway changes

--- src/jasons_game/core.clj
+++ src/jasons_game/core.clj
@@ -1,7 +1,6 @@
 (ns jasons_game.core
   (:require [clojure.string :refer [split]]
-            [clojure.pprint :refer [pprint]]
-            [clojure.walk :refer []))
+            [clojure.pprint :refer [pprint]]))

 ;; People

@@ -69,6 +68,6 @@
 (def env {:speaker jason
           :addressee daddy})

-(defn bind-to-env
-  [sentence env]
-  )+;(defn bind-to-env
+;  [sentence env]
+;  )


fix dumb typo: confused :ref and :top: somehow (:ref is meaningless btw)


version bump.

version bump.

--- storm-kafka/project.clj
+++ storm-kafka/project.clj
@@ -1,15 +1,14 @@
-(defproject storm/storm-kafka "0.9.0-wip3"
+(defproject storm/storm-kafka "0.8.0-wip2-scala292"
   :source-path "src/clj"
   :java-source-path "src/jvm"
   :javac-options {:debug "true" :fork "true"}
   :repositories {"releases" "http://artifactory.local.twitter.com/libs-releases-local"
                  "snapshots" "http://artifactory.local.twitter.com/libs-snapshots-local"}
-  :dependencies [[storm/kafka "0.7.0-incubating"
-                   :exclusions [org.apache.zookeeper/zookeeper
-                                log4j/log4j]]]
-  :dev-dependencies [[storm "0.9.0-wip3"]
+  :dependencies [[com.twitter/kafka_2.9.2 "0.7.0"
+                  :exclusions [org.apache.zookeeper/zookeeper
+                               log4j/log4j]]]
+  :dev-dependencies [[storm "0.8.2-wip19"]
                      [org.slf4j/log4j-over-slf4j "1.6.6"]
                      [ch.qos.logback/logback-classic "1.0.6"]
                      [org.clojure/clojure "1.4.0"]]
-  :jvm-opts ["-Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib"]
-)
+  :jvm-opts ["-Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib"])


Add control param support and other tweaks - first (seemingly) working version!

--- src/overtone/repl/graphviz.clj
+++ src/overtone/repl/graphviz.clj
@@ -18,14 +18,29 @@

 (defn- chop-last-char
   [s]
-  (subs s 0 (dec (count s))))
+  (if (empty? s)
+    s
+    (subs s 0 (dec (count s)))))
+
+(defn- generate-vec-arg-info
+  [in-name in-vals]
+  (chop-last-char
+   (with-out-str
+     (dorun (map (fn [idx v]
+                   (cond
+                    (associative? v) (print (str "<" (safe-name in-name) "___" (safe-name (:name v)) "___" idx ">"))
+                    (number? v) (print v)
+                    :else (println "Unkown Input Val"))
+                   (print "|"))
+                 (range)
+                 in-vals)))))

 (defn- generate-node-info
   [ugs]
   (with-out-str
     (doseq [ug ugs]
-      (if (= "control" (:name ug))
-        (println (str (:id ug) " [label = \"" "Control"  "\" shape=doubleoctagon ]; "))
+      (if (:control-param ug)
+        (println (str (:id ug) " [label = \"" (-> ug :name) "\n " (keyword (-> ug :control-param :name))  "\n default: " (-> ug :control-param :default) "\" shape=doubleoctagon ]; "))
         (println (str (:id ug)
                       (with-out-str
                         (print " [label = \"{{ ")
@@ -33,29 +48,35 @@
                          (chop-last-char
                           (with-out-str
                             (doseq [[in-name in-val] (reverse (:inputs ug))]
-                              (print (str "<"
-                                          (safe-name in-name)
-                                          "> "
+                              (print (str (if (vector? in-val)
+                                            "{{"
+                                            (str "<" (safe-name in-name) "> "))
                                           (cond
                                            (simple-ugen? ug) (if (number? in-val)
                                                                in-val
                                                                "")

                                            (number? in-val) (str (name in-name) " " in-val)
-
+                                           (vector? in-val) (generate-vec-arg-info in-name in-val)
                                            :else (name in-name))
+                                          (when (vector? in-val)
+                                            (str "}|" (name in-name) "}"))
                                           "|"))))))
                         (print "} |"))
                       (:name ug)

                       " }\" style=" (cond
-                                     (= :ar (:rate ug)) "rounded"
-                                     :else "solid") " shape=record rankdir=LR];"))))))
+                                     (= :ar (:rate ug)) "\"bold, rounded\""
+                                     :else "\"rounded\"") " shape=record rankdir=LR];"))))))

 (defn- print-connection
   [n input ug]
   (cond
-   (vector? input)      (doseq [i input] (print-connection n i ug))
+   (vector? input)      (dorun (map (fn [idx i]
+                                      (when (associative? i)
+                                        (println (str (:id i) " -> " (:id ug) ":" (safe-name n) "___" (safe-name (:name i)) "___" idx " ;"))))
+                                    (range)
+                                    input))
    (associative? input) (println (str (:id input) " -> " (:id ug) ":" (safe-name n) " ;"))))

 (defn- generate-node-connections


Use last clicked reference for new statement

--- src/discuss/views.cljs
+++ src/discuss/views.cljs
@@ -145,7 +145,7 @@
 (defn- show-selection
   "Shows selected text from website if available."
   []
-  (let [selection (lib/get-selection)]
+  (let [selection (if (lib/get-selection) (lib/get-selection) (:text (discuss.references.lib/get-selected-reference)))]
     (if (> (count selection) 1)
       (dom/div #js {:className "input-group"}
                (dom/span #js {:className "input-group-addon"}


Refactor discuss.views

Refactor discuss.views

--- src/discuss/views.cljs
+++ src/discuss/views.cljs
@@ -1,9 +1,6 @@
 (ns discuss.views
-  (:require [om.core :as om :include-macros true]
-            [om.dom :as dom :include-macros true]
-            [om.next :as nom :refer-macros [defui]]
-            [clojure.string :as string]
-            [goog.dom :as gdom]
+  (:require [om.dom :as dom :include-macros true]
+            [om.next :as om :refer-macros [defui]]
             [sablono.core :as html :refer-macros [html]]
             [discuss.components.bubbles :as bubbles]
             [discuss.components.clipboard :as clipboard]
@@ -14,7 +11,6 @@
             [discuss.communication.auth :as auth]
             [discuss.communication.main :as com]
             [discuss.communication.lib :as comlib]
-            [discuss.history :as history]
             [discuss.references.lib :as rlib]
             [discuss.translations :refer [translate] :rename {translate t}]
             [discuss.utils.bootstrap :as bs]
@@ -33,50 +29,6 @@

 ;;;; Elements
-(defn error-view
-  "Display error message if there are errors."
-  [data owner]
-  (reify
-    om/IRender
-    (render [_]
-      (when (lib/error?)
-        (dom/div #js {:className "alert alert-info alert-dismissable"
-                      :role      "alert"}
-                 (dom/button #js {:className    "close"
-                                  :data-dismiss "alert"
-                                  :aria-label   "Close"}
-                             (dom/span #js {:aria-hidden "true"}
-                                       (vlib/safe-html "×")))
-                 (lib/get-error))))))
-
-(defn control-elements
-  {:deprecated 0.4}
-  []
-  (reify
-    om/IRender
-    (render [_]
-      (dom/div nil
-               (dom/hr nil)
-               (dom/div #js {:className "row"}
-                        (dom/div #js {:className "col-md-offset-4 col-sm-offset-4 col-xs-offset-4 col-md-4 col-sm-4 col-xs-4 text-center"}
-                                 (dom/button #js {:className "btn btn-default btn-sm"
-                                                  :onClick   history/back!
-                                                  :disabled  (> 2 (count (re-seq #"/" (lib/get-last-api))))}
-                                             (vlib/fa-icon "fa-step-backward")
-                                             (t :common :back :space)))
-                        (dom/div #js {:className "col-md-4 col-sm-4 col-xs-4 text-right"}
-                                 (bs/button-default-sm comlib/init! (vlib/fa-icon "fa-refresh") (t :discussion :restart :space))))))))
-
-(defn close-button
-  {:deprecated 0.4}
-  []
-  (reify om/IRender
-    (render [_]
-      (dom/div nil
-               (dom/hr nil)
-               (dom/div #js {:className "text-center"}
-                        (bs/button-default-sm lib/change-to-next-view! (vlib/fa-icon "fa-times") (t :common :close :space)))))))
-
 (defn avatar-view
   "Get the user's avatar and add login + logout functions to it."
   []
@@ -87,89 +39,6 @@
                                     :className "discuss-avatar-main img-responsive img-circle"})
                       (dom/span nil (str (t :common :hello) " " (lib/get-nickname) "!"))))))

-(defn login-form
-  {:deprecated 0.4}
-  [_ owner]
-  (reify
-    om/IInitState
-    (init-state [_]
-      {:nickname ""
-       :password ""})
-    om/IRenderState
-    (render-state [_ {:keys [nickname password]}]
-      (dom/div nil
-               (om/build error-view {})
-               (vlib/view-header (t :common :login))
-               (dom/p #js {:className "text-center"} (t :login :hhu-ldap))
-               (dom/div #js {:className "input-group"}
-                        (dom/span #js {:className "input-group-addon"}
-                                  (vlib/fa-icon "fa-user fa-fw"))
-                        (dom/input #js {:className   "form-control"
-                                        :onChange    #(vlib/commit-component-state :nickname % owner)
-                                        :value       nickname
-                                        :placeholder (t :login :nickname)}))
-               (dom/div #js {:className "input-group"}
-                        (dom/span #js {:className "input-group-addon"}
-                                  (vlib/fa-icon "fa-key fa-fw"))
-                        (dom/input #js {:className   "form-control"
-                                        :onChange    #(vlib/commit-component-state :password % owner)
-                                        :value       password
-                                        :type        "password"
-                                        :placeholder (t :login :password)}))
-               (dom/button #js {:className "btn btn-default"
-                                :onClick   #(auth/login nickname password)
-                                :disabled  (not (and (pos? (count nickname))
-                                                     (pos? (count password))))}
-                           (t :common :login))))))
-
-;; Views
-(defn item-view
-  {:deprecated 0.4}
-  [item _owner]
-  (reify
-    om/IDidUpdate
-    (did-update [_ _ _]
-      (let [radio (gdom/getElement (lib/prefix-name (str "item-list-radio-" (:id item))))]
-        (set! (.-checked radio) false)))                    ;; Uncheck radio button on reload
-    om/IRender
-    (render [_]
-      (dom/div #js {:className "radio"}
-               (dom/label #js {}
-                          (dom/input #js {:id        (lib/prefix-name (str "item-list-radio-" (:id item)))
-                                          :type      "radio"
-                                          :className (lib/prefix-name "dialog-items")
-                                          :name      (lib/prefix-name "dialog-items-group")
-                                          :onClick   #(com/item-click (:id item) (:url item))
-                                          :value     (:url item)})
-                          " "
-                          (vlib/safe-html (string/join (str " <i>" (t :common :and) "</i> ") (map :title (:premises item))))))))) ; get all premises of item and add an "and" between them
-
-(defn items-view
-  "Show discussion items."
-  {:deprecated 0.4}
-  [data]
-  (reify om/IRender
-    (render [_]
-      (dom/div nil
-               (apply dom/ul #js {:id (lib/prefix-name "items-main")}
-                      (map #(om/build item-view % (lib/unique-react-key-dict)) (get-in data [:items :elements])))))))
-
-
-(defn init-view
-  "Show button if discussion has not been initialized yet."
-  []
-  (dom/div #js {:key       (lib/get-unique-key)
-                :className "text-center"}
-           (bs/button-primary com/init-with-references! (t :common :start-discussion))))
-
-(defn discussion-elements
-  {:deprecated 0.4}
-  [data]
-  (if-not (empty? (:discussion @lib/app-state))
-    (dom/div #js {:key (lib/get-unique-key)}
-             (om/build bubbles/view data)
-             (om/build items-view data))
-    (init-view)))

 (defn- remove-selection-then-reference!
   "Remove selection on first click, then the reference if available."
@@ -208,12 +77,12 @@

 ;; -----------------------------------------------------------------------------
-;; om.next Views
+;; Views

 (defui ErrorAlert
   Object
   (render [this]
-          (let [{:keys [layout/error]} (nom/props this)]
+          (let [{:keys [layout/error]} (om/props this)]
             (when (seq error)
               (html
                [:div.alert.alert-info.alert-dismissable {:role "alert"}
@@ -222,7 +91,7 @@
                  [:span {:aria-hidden "true"}
                   (vlib/safe-html "×")]]
                 error])))))
-(def error-alert (nom/factory ErrorAlert))
+(def error-alert (om/factory ErrorAlert))

 ;; ----------

@@ -230,7 +99,7 @@
   "Form with nickname and password input."
   Object
   (render [this]
-          (let [st (nom/get-state this)
+          (let [st (om/get-state this)
                 nickname (or (:nickname st) "")
                 password (or (:password st) "")]
             (html [:div (vlib/view-header (t :common :login))
@@ -238,12 +107,12 @@
                    [:p.text-center (t :login :hhu-ldap)]
                    [:div.input-group
                     [:span.input-group-addon (vlib/fa-icon "fa-user fa-fw")]
-                    [:input.form-control {:onChange #(nom/update-state! this assoc :nickname (.. % -target -value))
+                    [:input.form-control {:onChange #(om/update-state! this assoc :nickname (.. % -target -value))
                                           :value nickname
                                           :placeholder (t :login :nickname)}]]
                    [:div.input-group
                     [:span.input-group-addon (vlib/fa-icon "fa-key fa-fw")]
-                    [:input.form-control {:onChange #(nom/update-state! this assoc :password (.. % -target -value))
+                    [:input.form-control {:onChange #(om/update-state! this assoc :password (.. % -target -value))
                                           :value password
                                           :type :password
                                           :placeholder (t :login :password)}]]
@@ -251,7 +120,7 @@
                                              :disabled (or (empty? nickname)
                                                            (empty? password))}
                     (t :common :login)]]))))
-(def login-form-next (nom/factory LoginForm))
+(def login-form (om/factory LoginForm))

 ;; ----------

@@ -274,21 +143,20 @@
            (bs/button-default-sm comlib/init! (vlib/fa-icon "fa-refresh") (t :discussion :restart :space))]]]))

 (defui AddElement
-  "Form to add new elements to the discussion.
-  TODO: Add onClick fns"
-  static nom/IQuery
+  "Form to add new elements to the discussion."
+  static om/IQuery
   (query [this] [:selection/current :site/origin])
   Object
   (render [this]
-          (let [statement (or (:statement (nom/get-state this)) "")
-                {current-selection :selection/current origin :site/origin} (nom/props this)]
+          (let [statement (or (:statement (om/get-state this)) "")
+                {current-selection :selection/current origin :site/origin} (om/props this)]
             (html [:div.panel.panel-default
                    {:onDragOver clipboard/allow-drop
                     :onDrop clipboard/update-reference-drop}
                    [:div.panel-body
                     [:h4.text-center (t :discussion :add-argument)]
                     [:h5.text-center (vlib/safe-html (lib/get-add-premise-text))]
-                    (error-alert (nom/props this))
+                    (error-alert (om/props this))
                     [:div.input-group
                      [:span.input-group-addon.input-group-addon-left
                       (str "... " (t :common :because))]
@@ -298,7 +166,7 @@
                         {:onChange (fn [e]
                                      (let [form-value (.. e -target -value)]
                                        (search/search form-value)
-                                       (nom/update-state! this assoc :statement form-value)))
+                                       (om/update-state! this assoc :statement form-value)))
                          :value statement}])]
                     (show-selection)
                     [:button.btn.btn-default
@@ -306,77 +174,77 @@
                                  statement current-selection origin)
                       :disabled (and (> 10 (count statement)) (empty? origin))}
                      (remaining-characters statement)]]]))))
-(def add-element-next (nom/factory AddElement))
+(def add-element-next (om/factory AddElement))

 (defui DiscussionElements
-  static nom/IQuery
-  (query [this] [{:discussion/items (nom/get-query items/Items)}
-                 {:discussion/bubbles (nom/get-query bubbles/BubblesView)}])
+  static om/IQuery
+  (query [this] [{:discussion/items (om/get-query items/Items)}
+                 {:discussion/bubbles (om/get-query bubbles/BubblesView)}])
   Object
   (render [this]
           (html [:div
-                 (bubbles/bubbles-view-next (nom/props this))
-                 (items/items (nom/props this))])))
-(def discussion-elements-next (nom/factory DiscussionElements))
+                 (bubbles/bubbles-view-next (om/props this))
+                 (items/items (om/props this))])))
+(def discussion-elements-next (om/factory DiscussionElements))

 (defui ViewDispatcher
-  static nom/IQuery
+  static om/IQuery
   (query [this] [:layout/view
-                 {:discussion/items (nom/get-query DiscussionElements)}
-                 {:discussion/bubbles (nom/get-query DiscussionElements)}])
-  Object
-  (render [this]
-          (let [{:keys [layout/view]} (nom/props this)]
+                 {:discussion/items (om/get-query DiscussionElements)}
+                 {:discussion/bubbles (om/get-query DiscussionElements)}])
+  Object
+  (render [this]
+          (let [{:keys [layout/view]} (om/props this)]
             (html [:div.panel.panel-default
                    [:div.panel-body
                     (case view
-                      :login (login-form-next)
+                      :login (login-form)
                       :options (options/options)
                       ;; TODO: :reference-usages (om/build ref/usages-view data)
                       ;; TODO: :reference-create-with-ref (om/build ref/create-with-reference-view data)
                       ;; TODO: :find (om/build find/view data)
-                      (discussion-elements-next (nom/props this)))
+                      (discussion-elements-next (om/props this)))
                     (if (some #{view} [:login :options :find :reference-usages])
                       close-button-next
                       control-elements-next)]]))))
-(def view-dispatcher-next (nom/factory ViewDispatcher))
+(def view-dispatcher-next (om/factory ViewDispatcher))

 (defui MainContentView
-  static nom/IQuery
+  static om/IQuery
   (query [this]
          [:layout/add? :issue/info
-          {:layout/view (nom/get-query ViewDispatcher)}
-          {:discussion/items (nom/get-query ViewDispatcher)}
-          {:discussion/bubbles (nom/get-query ViewDispatcher)}
-          {:clipboard/items (nom/get-query clipboard/Clipboard)}])
-  Object
-  (render [this]
-          (let [{:keys [issue/info layout/add?]} (nom/props this)]
+          {:layout/view (om/get-query ViewDispatcher)}
+          {:discussion/items (om/get-query ViewDispatcher)}
+          {:discussion/bubbles (om/get-query ViewDispatcher)}
+          {:clipboard/items (om/get-query clipboard/Clipboard)}])
+  Object
+  (render [this]
+          (let [{:keys [issue/info layout/add?]} (om/props this)]
             (html [:div
                    [:div.text-center
                     (t :discussion :current)
                     [:br]
                     [:strong info]]
-                   (view-dispatcher-next (nom/props this))
+                   (view-dispatcher-next (om/props this))
                    (when add?
-                     [:div (add-element-next (nom/props this))
-                      (search/results (nom/props this))])
+                     [:div (add-element-next (om/props this))
+                      (search/results (om/props this))])
                    (nav/nav)
                    [:br]
-                   (clipboard/clipboard (nom/props this))]))))
-(def main-content-view-next (nom/factory MainContentView))
+                   (clipboard/clipboard (om/props this))]))))
+(def main-content-view-next (om/factory MainContentView))

 (defui MainView
-  static nom/IQuery
+  static om/IQuery
   (query [this]
          [:layout/title
-          {:layout/view (nom/get-query MainContentView)}
-          {:discussion/items (nom/get-query MainContentView)}
-          {:discussion/bubbles (nom/get-query MainContentView)}
-          {:clipboard/items (nom/get-query MainContentView)}])
-  Object
-  (render [this]
-          (let [{:keys [layout/title]} (nom/props this)]
+          {:layout/view (om/get-query MainContentView)}
+          {:discussion/items (om/get-query MainContentView)}
+          {:discussion/bubbles (om/get-query MainContentView)}
+          {:clipboard/items (om/get-query MainContentView)}])
+  Object
+  (render [this]
+          (let [{:keys [layout/title]} (om/props this)]
             (html [:div#discuss-dialog-main
                    (avatar-view)
                    [:h4 (vlib/logo)
@@ -386,6 +254,6 @@
                                     :aria-expanded "true"
                                     :aria-controls (lib/prefix-name "dialog-collapse")}
                      title]]
-                   (main-content-view-next (nom/props this))]))))
-(def main-view-next (nom/factory MainView))
-
+                   (main-content-view-next (om/props this))]))))
+(def main-view-next (om/factory MainView))
+


Default some deployment parameters so people don't have to always provide them

--- src/exploud/asgard.clj
+++ src/exploud/asgard.clj
@@ -11,6 +11,34 @@

 (def asgard-date-formatter (fmt/formatter "YYYY-MM-dd_HH:mm:ss"))
 (def date-formatter (fmt/formatters :date-time))
+
+(def default-deploy-params
+  {"azRebalance" "enabled"
+   "canaryAssessmentDurationMinutes" 60
+   "canaryCapacity" 1
+   "canaryStartUpTimeoutMinutes" 30
+   "defaultCooldown" 10
+   "delayDurationMinutes" 0
+   "deletePreviousAsg" "Yes"
+   "desiredCapacity" 1
+   "desiredCapacityAssesmentDurationMinutes" 5
+   "desiredCapacityStartUpTimeoutMinutes" 5
+   "disablePreviousAsg" "Yes"
+   "doCanary" false
+   "fullTrafficAssessmentDurationMinutes" 5
+   "healthCheckGracePeriod" 600
+   "healthCheckType" "EC2"
+   "instanceType" "t1.micro"
+   "kernelId" ""
+   "keyName" "nprosser-key"
+   "max" 1
+   "min" 1
+   "noOptionalDefaults" true
+   "pricing" "ON_DEMAND"
+   "ramdiskId" ""
+   "scaleUp" "Yes"
+   "subnetPurpose" "internal"
+   "terminationPolicy" "Default"})

 (def asgard-url
   (env :service-asgard-url))
@@ -211,16 +239,22 @@
         required-params (select-keys params required-keys)]
     (merge additional-params required-params)))

+(defn- application-params [application-name]
+  {"clusterName" application-name
+   "iamInstanceProfile" application-name
+   "name" application-name})
+
 (defn manual-deploy
   "In the event that an application doesn't have an auto-scaling group for
   us to copy we use a manual creation of that ASG to get going."
   [region application-name params]
-  (log/info "Application" application-name "is being manually deployed in" region "with params" params)
-  (let [merged-params (create-manual-deploy-params params region application-name)]
-    (when-let [application (application region application-name)]
-      (let [{:keys [headers status]} (http/simple-post (auto-scaling-save-url region) {:form-params (create-asgard-params merged-params) :follow-redirects false :socket-timeout 30000})]
-        (when (= 302 status)
-          (log/info "Headers are" headers))))))
+  (let [all-params (merge default-deploy-params (application-params application-name) params)]
+    (log/info "Application" application-name "is being manually deployed in" region "with params" all-params)
+    (let [merged-params (create-manual-deploy-params all-params region application-name)]
+      (when-let [application (application region application-name)]
+        (let [{:keys [headers status]} (http/simple-post (auto-scaling-save-url region) {:form-params (create-asgard-params merged-params) :follow-redirects false :socket-timeout 30000})]
+          (when (= 302 status)
+            (log/info "Headers are" headers)))))))

 (defn auto-deploy
   "Kicks off an automated red/black deployment. If successful, the task
@@ -228,17 +262,18 @@
   returns a map containing the task information which can be used to
   retrieve the task and track the deployment."
   [region application-name params]
-  (log/info "Application" application-name "is being automatically deployed in" region "with params" params)
-  (when-let [application (application region application-name)]
-    (let [{:keys [headers status]} (http/simple-post (region-deploy-url region) {:form-params (create-asgard-params params) :follow-redirects false :socket-timeout 30000})]
-      (when (= 302 status)
-        (log/info "Headers are" headers)
-        (let [{:strs [location]} headers
-              task-info (task-info-from-url location)
-              {:keys [runId workflowId]} task-info
-              task-id (store/store-task {:region region :runId runId :workflowId workflowId})]
-          (schedule-track-task region runId workflowId (* 1 60 60))
-          {:taskId task-id})))))
+  (let [all-params (merge default-deploy-params (application-params application-name) params)]
+    (log/info "Application" application-name "is being automatically deployed in" region "with params" all-params)
+    (when-let [application (application region application-name)]
+      (let [{:keys [headers status]} (http/simple-post (region-deploy-url region) {:form-params (create-asgard-params all-params) :follow-redirects false :socket-timeout 30000})]
+        (when (= 302 status)
+          (log/info "Headers are" headers)
+          (let [{:strs [location]} headers
+                task-info (task-info-from-url location)
+                {:keys [runId workflowId]} task-info
+                task-id (store/store-task {:region region :runId runId :workflowId workflowId})]
+            (schedule-track-task region runId workflowId (* 1 60 60))
+            {:taskId task-id}))))))

 ;(task "eu-west-1" "120DqQWqEBYsOK5Vaj6sK8b4YErobn8sF61FcN7OA63t0=" "b7287ace-cfd3-41b6-9618-189534d9f207")
 ;(last-launch-configuration-name "eu-west-1" "skeleton")


removed old sequential download code

removed old sequential download code

--- src/frontend/core.cljs
+++ src/frontend/core.cljs
@@ -15,8 +15,7 @@
                           :is-file-downloading? false
                           :current-track-id nil
                           :current-sound nil
-                          :ball-being-dragged? false
-                          :num-of-queued-download-requests 0}))
+                          :ball-being-dragged? false}))

 (enable-console-print!)

@@ -150,26 +149,13 @@
 (.on socket "upload-complete"
   (fn [music-info]
     (swap! app-state assoc :music-info
-      (merge (:music-info @app-state) music-info))
-    (swap! app-state assoc :num-of-queued-download-requests
-      (+ 1 (:num-of-queued-download-requests @app-state)))))
-
-;    (if-not (:is-file-downloading? @app-state)
-;      (let [next-track-num (+ 1 (.-tracknum (nth (filter #(= (.-id %1)
-;                                                             (:current-track-id @app-state))
-;                                                  (:music-info @app-state)) 0)))]
-;        (if (< next-track-num (count (:music-info @app-state)))
-;          (.emit socket "file-download-request" (.-id (nth (:music-info @app-state)
-;                                                           next-track-num))))))))
+      (merge (:music-info @app-state) music-info))))

 (.on (new js/ss socket) "file-download"
   (fn [stream track-id file-size]
     (println "Download starting!")

     (swap! app-state assoc :is-file-downloading? true)
-    (if (> (:num-of-queued-download-requests @app-state) 0)
-      (swap! app-state assoc :num-of-queued-download-requests
-        (- 1 (:num-of-queued-download-requests @app-state))))

     (.on stream "data"
       (fn [data-chunk]


remove navigator worker dispatch fns

remove navigator worker dispatch fns

--- src/gangway/worker.clj
+++ src/gangway/worker.clj
@@ -9,10 +9,7 @@
   {:assert
    {:task           oarlock/task-in
     :perf-asmt      oarlock/perf-asmt-in
-    :user2perf-asmt oarlock/user2perf-asmt-in
-    :comp           navigator/comp-in
-    :comp-tag       navigator/comp-tag-in
-    :user2comp      navigator/user2comp-in}})
+    :user2perf-asmt oarlock/user2perf-asmt-in}})

 (defn get-worker-fn [message]
   (let [header (:header message)


add new navigator fns to worker-dispatch

--- src/gangway/worker.clj
+++ src/gangway/worker.clj
@@ -5,9 +5,12 @@

 (def worker-dispatch
   {:assert
-   {:task navigator/task-in
-   ;; :user2perf-asmt navigator/user2perf-asmt-in
-    }})
+   {:task           navigator/task-in
+    :comp           navigator/comp-in
+    :comp-tag       navigator/comp-tag-in
+    :perf-asmt      navigator/perf-asmt-in
+    :user2comp      navigator/user2comp-in
+    :user2perf-asmt navigator/user2perf-asmt-in}})

 (defn get-worker-fn [message]
   (let [header (:header message)


Add Summer 2017 schedule

Add Summer 2017 schedule


Add test for dangling ref issue

Add test for dangling ref issue

--- test/aero/core_test.clj
+++ test/aero/core_test.clj
@@ -78,3 +78,15 @@
 (deftest dummy-test
   (let [config (read-config "test/aero/config.edn" {:profile :dev})]
     (is (= "dummy" (:dummy config)))))
+
+(deftest dangling-ref-test
+  (is
+   (=
+    {:user {:favorite-color :blue}
+     :gardner {:favorite-color :blue}
+     :color :blue}
+    (read-config (java.io.StringReader.
+                  (binding [*print-meta* true]
+                    (pr-str {:user ^:ref [:gardner]
+                             :gardner {:favorite-color ^:ref [:color]}
+                             :color :blue})))))))


able to print out trees, but still need to add lexical complements

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -649,7 +649,31 @@
 (defn benchmark2 []
   (benchmark spec2 5))

-(def mapping1 (mapping spec1  (medium) 0 6))
-(def good-one (nth mapping1 10))
-(def foo (clojure.math.combinatorics/cartesian-product (vals good-one)))
-
+;; (repeatedly #(println (print-out)))
+(defn print-out []
+  (let [mapping1 (mapping spec1 (medium) 0 6)
+        all-of-them
+        (mapcat (fn [each-mapping]
+                  (let [trellis (apply combo/cartesian-product (vals each-mapping))]
+                    (map (fn [each-path-through-trellis]
+                           (zipmap (keys each-mapping)
+                                   each-path-through-trellis))
+                         trellis)))
+                mapping1)
+        good-one (first (shuffle all-of-them))]
+    (fo-ps
+     (->
+      (get good-one [])
+      (assoc-in [:comp] (get good-one [:comp]))
+      (assoc-in [:head :comp] (get good-one [:head :comp]))))))
+
+
+
+
+
+
+
+
+
+
+


modify definition of testing function (get-lex2)

--- test/babel/test/fr.cljc
+++ test/babel/test/fr.cljc
@@ -4,9 +4,11 @@
   (:require [babel.engine :as engine]
             [babel.forest :as forest]
             [babel.francais.grammar :refer [small medium]]
-            [babel.francais.morphology :refer [analyze fo replace-patterns]]
-            [babel.francais.workbook :refer [generate parse]]
+            [babel.francais.lexicon :refer [lexicon]]
+            [babel.francais.morphology :refer [analyze fo possible-lexemes replace-patterns]]
+            [babel.francais.workbook :refer [generate lookup parse tokenize]]
             [babel.over :as over]
+            [babel.parse :as parse]
             [clojure.string :as string]
             #?(:clj [clojure.test :refer [deftest is]])
             #?(:cljs [cljs.test :refer-macros [deftest is]])
@@ -14,7 +16,7 @@
             #?(:cljs [babel.logjs :as log])
             [dag_unify.core :refer [fail-path fail? get-in strip-refs unifyc]]))

-;; TODO: (lookup) and (over) convenience functions are duplicated in
+;; TODO: these defns (lookup) are convenience functions are duplicated in
 ;; babel.workbook.francais: factor out to babel.francais.
 ;; TODO: do morphological analysis
 ;; do find non-infinitives (e.g. find 'parler' given 'parle')
@@ -22,8 +24,6 @@
 ;; i.e. if input is 'parle', return
 ;; list of lexemes; for each, [:synsem :agr :person] will be
 ;; 1st, 2nd, or 3rd, and for all, number will be singular.
-(defn lookup [lexeme]
-  (get (:lexicon medium) lexeme))

 (defn over
   ([arg1]
@@ -259,13 +259,12 @@
                replace-patterns)))

 (defn get-lex2 [exp]
-  (mapcat #(let [from (first %)
-                 to (second %)
-                 unify-with (nth % 2)
-                 lex (string/replace exp from to)]
-             (map (fn [entry]
-                    (unifyc unify-with entry))
-                  (lookup lex)))
-          replace-patterns))
-
-
+  (filter (fn [result] (not (= :fail result)))
+          (mapcat #(let [from (first %)
+                         to (second %)
+                         unify-with (nth % 2)
+                         lex (string/replace exp from to)]
+                     (map (fn [entry]
+                            (unifyc unify-with entry))
+                          (lookup lex)))
+                  replace-patterns)))


use (defn)'s support for optional keyed arguments correctly

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -40,8 +40,8 @@
                                    :sem {:pred :be
                                          :subj {:pred :I}
                                          :tense :present}}}
-                         small
-                         {:do-enrich false})]
+                         :model small
+                         :do-enrich false)]
     (is (= "io sono" (fo result)))))

 (deftest passato-prossimo
@@ -50,7 +50,7 @@
                                    :sem {:subj {:pred :I}
                                          :tense :past
                                          :aspect :perfect}}}
-                         small)]
+                         :model small)]
     (is (not (nil? result)))
     (is (= "io ho bevuto" (fo result)))))

@@ -73,7 +73,7 @@
                                          :subj {:pred :I}
                                          :tense :past
                                          :aspect :perfect}}}
-                         small)]
+                         :model small)]
     (is (not (nil? result)))
     (is (= "io mi sono alzata" (fo result)))))

@@ -87,8 +87,8 @@
                                  :sem {:spec {:def :def}
                                        :mod {:pred :difficile}
                                        :number :sing
-                                       :pred :donna}}}
-                       np-grammar)]
+                                       :pred :donna}}}
+                       :model np-grammar)]
     (is (or (= (fo expr) "la donna difficile")
             (= (fo expr) "la difficile donna")))
     (is (not (empty? (reduce concat (map
@@ -100,7 +100,7 @@
 (deftest generate-and-parse-noun-phrase-with-specifier
   ;; create a noun phrase where the determiner is "ventotto", but the head of the noun phrase
   ;; might be anything.
-  (let [result (generate {:synsem {:sem {:spec {:def :twentyeight}}}} np-grammar)]
+  (let [result (generate {:synsem {:sem {:spec {:def :twentyeight}}}} :model np-grammar)]
     (is (not (= "" (fo result))))
     (is (= :twentyeight (get-in result [:synsem :sem :spec :def])))
     (is (not (empty? (parse (fo result)))))))
@@ -126,7 +126,7 @@
                                         ;; generic spec to something more specific
                                         ;; if this test fails and you want to investigate
                                         ;; why.
-                                        np-grammar)))]
+                                        :model np-grammar)))]
     (is (= do-this-many
            (count (map-fn (fn [expr]
                             (let [fo (fo expr)
@@ -145,7 +145,7 @@
                            #(generate {:synsem {:cat :verb
                                                 :sem {:tense :present}
                                                 :subcat '()}}
-                                      small)))]
+                                      :model small)))]
     (is (= do-this-many
            (count (map-fn (fn [expr]
                             (let [fo (fo expr)
@@ -165,7 +165,7 @@
                                                 :sem {:tense :past
                                                       :aspect :progressive}
                                                 :subcat '()}}
-                                      small)))]
+                                      :model small)))]
     (is (= do-this-many
            (count (map-fn (fn [expr]
                             (let [fo (fo expr)
@@ -185,7 +185,7 @@
                                                 :sem {:tense :past
                                                       :aspect :perfect}
                                                 :subcat '()}}
-                                      small)))]
+                                      :model small)))]
     (is (= do-this-many
            (count (map-fn (fn [expr]
                           (let [fo (fo expr)
@@ -203,7 +203,7 @@
                            #(generate {:synsem {:cat :verb
                                                 :sem {:tense :future}
                                                 :subcat '()}}
-                                      small)))]
+                                      :model small)))]
     (is (= do-this-many
            (count (map-fn (fn [expr]
                           (let [fo (fo expr)
@@ -221,7 +221,7 @@
                            #(generate {:synsem {:cat :verb
                                                 :sem {:tense :conditional}
                                                 :subcat '()}}
-                                      small)))]
+                                      :model small)))]
     (is (= do-this-many
            (count (map-fn (fn [expr]
                           (let [fo (fo expr)