updated altitude

updated altitude

--- src/cljs/triangulator/handlers.cljs
+++ src/cljs/triangulator/handlers.cljs
@@ -102,14 +102,13 @@
 (defn draw-triangle
   "draw triangle p1 p2 p3 in draw-chan with options"
   [p1 p2 p3 draw-chan options]
-  (let [circumcenter (geom/circumcenter [p1 p2 p3])
-        _ (println "circumcenter: " circumcenter)]
+  (let [circumcenter (geom/circumcenter [p1 p2 p3])]
     (when (contains? options :circumcircle)
       (draw-circle-2 circumcenter (geom/distance p1 circumcenter)
                      draw-chan {:stroke :blue :fill :lt-blue})
-      (draw-line p1 circumcenter draw-chan #{} :lt-blue)
-      (draw-line p2 circumcenter draw-chan #{} :lt-blue)
-      (draw-line p3 circumcenter draw-chan #{} :lt-blue))
+      (draw-line p1 circumcenter draw-chan #{} :yellow)
+      (draw-line p2 circumcenter draw-chan #{} :yellow)
+      (draw-line p3 circumcenter draw-chan #{} :yellow))
     (draw-line p1 p2 draw-chan #{:perp-bisector} :red)
     (draw-line p2 p3 draw-chan #{:perp-bisector} :red)
     (draw-line p3 p1 draw-chan #{:perp-bisector} :red)
@@ -161,8 +160,7 @@
                              (dt/point value)]))
           {:step 1 :p1 value})
       1 (let [p1 (:p1 current-state)
-              line (dt/line [p1 value])
-              _ (println "line: " line)]
+              line (dt/line [p1 value])]
           (go (>! out line)
               (>! draw-chan clear)
               (>! out [:draw :line draw-chan]))
@@ -202,14 +200,12 @@
                              (dt/point value)]))
           {:step 1 :p1 value})
       1 (let [p1 (:p1 current-state)
-              line (dt/line [p1 value])
-              _ (println "line: " line)]
+              line (dt/line [p1 value])]
           (go (>! out [:draw :triangle draw-chan]))
           {:step 2 :p1 p1 :p2 value})
       2 (let [p1 (:p1 current-state)
               p2 (:p2 current-state)
-              triangle (dt/triangle p1 p2 value)
-              _ (println "triangle: " triangle)]
+              triangle (dt/triangle p1 p2 value)]
           (go (>! out triangle)
               (>! out [:draw :triangle draw-chan]))
           {:step 0}))))
@@ -232,11 +228,12 @@
             current-state)
         2 (let [p1 (:p1 current-state)
                 p2 (:p2 current-state)
+                p3 value
                 base (geom/altitude p1 p2 value)]
             (draw-line p1 p2 draw-chan #{:extended} :red)
-            (draw-line p2 value draw-chan nil :red)
-            (draw-line value p1 draw-chan nil :red)
-            (draw-line value base draw-chan nil :red)
+            (draw-line p2 p3 draw-chan nil :green)
+            (draw-line p3 p1 draw-chan nil :blue)
+            (draw-line p3 base draw-chan nil :yellow)
             current-state)))
     :click
     (condp = (:step current-state)
@@ -248,14 +245,12 @@
                              (dt/point value)]))
           {:step 1 :p1 value})
       1 (let [p1 (:p1 current-state)
-              line (dt/line [p1 value])
-              _ (println "line: " line)]
+              line (dt/line [p1 value])]
           (go (>! out [:draw :triangle draw-chan]))
           {:step 2 :p1 p1 :p2 value})
       2 (let [p1 (:p1 current-state)
               p2 (:p2 current-state)
-              triangle (dt/triangle p1 p2 value)
-              _ (println "triangle: " triangle)]
+              triangle (dt/triangle p1 p2 value)]
           (go (>! out triangle)
               (>! out [:draw :triangle draw-chan]))
           {:step 0}))))
@@ -321,8 +316,7 @@
                              (dt/point value)]))
           {:step 1 :p1 value})
       1 (let [p1 (:p1 current-state)
-              circle (dt/circle p1 (geom/distance p1 value))
-              _ (println "circle: " circle)]
+              circle (dt/circle p1 (geom/distance p1 value))]
           (go (>! out circle)
               (>! out [:draw :circle draw-chan]))
           {:step 0}))))
@@ -479,7 +473,6 @@
           {:step 1 :center value})
       1 (let [center (:center current-state)
               radius (geom/distance value center)
-              _ (println "center: " center " radius: " radius)
               inversion (complex/inversion center radius)]
           {:step 2
            :center center


Implement encrypt, decrypt, sign and verify

--- src/clojure_fabric/crypto_suite.clj
+++ src/clojure_fabric/crypto_suite.clj
@@ -7,10 +7,12 @@
            [org.bouncycastle.jcajce.provider.asymmetric.ec KeyPairGeneratorSpi$ECDSA
             BCECPrivateKey BCECPublicKey]
            [org.bouncycastle.util.encoders Hex]
+           [java.io FileInputStream]
            [java.util Arrays]
+           [javax.crypto Cipher SecretKeyFactory]
            [javax.crypto.spec SecretKeySpec]
-           [javax.crypto SecretKeyFactory]
-           [java.security KeyFactory KeyPairGenerator SecureRandom Security MessageDigest]
+           [java.security Key KeyStore KeyFactory KeyPairGenerator SecureRandom
+            Security MessageDigest Signature]
            [java.security.spec ECPoint ECParameterSpec ECPublicKeySpec ECPrivateKeySpec])
   (:refer-clojure :exclude [hash]))

@@ -21,6 +23,14 @@

 ;; Add provider!
 (Security/addProvider (BouncyCastleProvider.))
+
+;; (defonce key-store (atom nil))
+
+;; TBD
+;; (defn init-key-store [file password {:keys [type] :or {type "PKCS12"}}]
+;;   (let [ks (KeyStore/getInstance type)]
+;;     (.load ks (FileInputStream. ^String file) (.toCharArray ^String password))
+;;     (reset! key-store ks)))

 ;;;generate_key
 (defn generate-key
@@ -124,13 +134,16 @@
         opts (Object)
   Returns
         (Key) An instance of the Key class wrapping the raw key bytes"
-  [#^bytes k-byte-array {:keys [algorithm curve ephemeral type]}]
-  ;; FIXME: What is the type of input k-byte-array? Base64 encoded string or decoded bytes?
-  ;;    (current implementation assumes decoded bytes)
+  [k {:keys [algorithm curve ephemeral type]}]
   (let [curve-name (name curve)
         parameter-spec (ECNamedCurveTable/getParameterSpec curve-name)
         curve (.getCurve parameter-spec)
         curve-size (/ (* 2 (.getFieldSize curve)) 8) ;; x + y
+        #^bytes k-byte-array (if (string? k)
+                       ;; assume base64
+                       (b64/decode (.getBytes ^String k))
+                       ;; otherwise bytes
+                       k)
         key-size (count k-byte-array)]
     (if (= curve-size key-size)
       (let [middle (int (/ key-size 2))
@@ -172,11 +185,27 @@
         (Key) An instance of the Key class corresponding to the ski"
   [msg {:keys [algorithm]}]
   (let [md (MessageDigest/getInstance (name algorithm))]
-    (Hex/toHexString (.digest md (if (string? msg)
-                                   (.getBytes ^String msg)
-                                   msg)))))
+    (->> (if (string? msg)
+           (.getBytes ^String msg)
+           msg)
+         (.digest md)
+         (Hex/toHexString))))
 ;;(hash test-msg {:algorithm :sha384})

+(defonce cipher-mode-map {:encrypt Cipher/ENCRYPT_MODE
+                          :decrypt Cipher/DECRYPT_MODE})
+
+(defn %encrypt-or-decrypt
+  ;; https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html
+  [k text {:keys [algorithm cipher-mode]}]
+  (let [tname (name algorithm)
+        tk (SecretKeySpec. k tname)
+        cipher (doto (Cipher/getInstance tname)
+                 (.init ^java.lang.Integer (cipher-mode-map cipher-mode) tk))]
+    (.doFinal cipher
+              (if (string? text)
+                (.getBytes ^String text)
+                text))))

 ;;;encrypt
 (defn encrypt
@@ -187,8 +216,8 @@
         opts (Object)
   Returns
         (byte[]) Cipher text"
-  [key prain-text opts]
-  )
+  [k plain-text {:keys [algorithm] :as opts}]
+  (%encrypt-or-decrypt k plain-text (assoc opts :cipher-mode :encrypt)))

 ;;; decrypt
 (defn decrypt
@@ -199,8 +228,8 @@
         opts (Object)
   Returns
         (byte[]) Plain text"
-  [key cipher-text opts])
-
+  [k cipher-text {:keys [algorithm] :as opts}]
+  (%encrypt-or-decrypt k cipher-text (assoc opts :cipher-mode :decrypt)))

 ;;;sign
 (defn sign
@@ -211,9 +240,11 @@
         opts (function) hashing function to use
   Returns
         Result(Object):Signature object"
-  [key digest opts])
-
-
+  [priv-key ^bytes digest {:keys [algorithm]}]
+  (doto (Signature/getInstance (name algorithm))
+    (.initSign priv-key)
+    (.update digest)
+    (.sign)))

 ;;; verify
 (defn verify
@@ -224,7 +255,11 @@
         digest (byte[]) original digest that was signed
   Returns
         (bool): verification successful or not"
-  [key signature digest])
+  [pub-key signature ^bytes digest {:keys [algorithm]}]
+  (doto (Signature/getInstance (name algorithm))
+    (.initVerify pub-key) ;; pub-key type is unknown :(
+    (.update digest)
+    (.verify signature)))

 #_
 (comment


Rest integration of mailgun completed

Rest integration of mailgun completed

1. post methods with checks for valid emails and templates

Signed-off-by: himangshu <2f9a8ca67e2403f8494200f6890e3afed1eb6260@gozoomo.com>

--- src/clojure_mailgun_server/core.clj
+++ src/clojure_mailgun_server/core.clj
@@ -3,13 +3,40 @@
             [ring.middleware.params :refer [wrap-params]]
             [compojure.core :refer [defroutes ANY]]
             [cheshire.core :as json]
-            [liberator.representation :refer [ring-response]]))
+            [clojure-mailgun-server.mailer.mailgun :as mailgun]
+            [liberator.representation :refer [ring-response]])
+  (:import [clojure_mailgun_server.mailer.mailgun EmailRequest]))
+
+(def ^:private allowed-templates #{"welcome.html" "password_reset.html"} )
+
+
+(defresource email [to subject template]
+  :available-media-types ["application/json"]
+  :allowed-methods [:post]
+  :processable? (fn [ctx]
+                  (allowed-templates template)) ;;only valid templates should proceed
+  :post! (fn [ctx]
+           (let [body (get-in ctx [:request :body])
+                 body# (slurp body)
+                 val-map (json/parse-string body#)
+                 val-map# (clojure.walk/keywordize-keys val-map)
+                 email-reqeust (EmailRequest. to subject template val-map#)]
+             (mailgun/send-email email-reqeust)))
+  :handle-unprocessable-entity (fn [_]
+                                 (ring-response {:body (json/generate-string "cannot process ! Template does not exist in repo")}) )
+  :handle-created  (fn [_]
+                 (ring-response {:body (json/generate-string "emailed")})))

 (defroutes app
   ;;Route to check if the server is up and running
   (ANY "/ping" [] (resource
                     :available-media-types ["application/json"]
-                    :handle-ok (fn [_] (ring-response {:body (json/generate-string "pong")})))))
+                    :handle-ok (fn [a] (ring-response {:body (json/generate-string "pong")}))))
+  (ANY "/email/:to{.+@.+}/:subject/:template"
+    [to subject template]
+    (email to subject template) ))
+
+

 (def handler
   (-> app


Implement structify, remove-comments, and cast-with as transducers.

--- src/semantic_csv/transducers.clj
+++ src/semantic_csv/transducers.clj
@@ -4,8 +4,14 @@
             [semantic-csv.impl.core :as impl :refer [?>>]]))

 (defn mappify
+  "Takes a sequence of row vectors, as commonly produced by csv parsing libraries, and returns a sequence of
+  maps. By default, the first row vector will be interpreted as a header, and used as the keys for the maps.
+  However, this and other behaviour are customizable via an optional `opts` map with the following options:
+
+  * `:keyify` - bool; specify whether header/column names should be turned into keywords (default: `true`).
+  * `:header` - specify the header to use for map keys, preventing first row of data from being consumed as header."
   ([] (mappify {}))
-  ([{:keys [keyify header structs] :or {keyify true} :as opts}]
+  ([{:keys [keyify header] :or {keyify true} :as opts}]
    (fn [rf]
      (let [hdr (volatile! header)]
        (fn
@@ -16,3 +22,83 @@
             (do (vreset! hdr (if keyify (mapv keyword input) input))
                 results)
             (rf results (impl/mappify-row @hdr input)))))))))
+
+(defn structify
+  "Takes a sequence of row vectors, as commonly produced by csv parsing libraries, and returns a sequence of
+  structs. By default, the first row vector will be interpreted as a header, and used as the keys for the maps.
+  However, this and other behaviour are customizable via an optional `opts` map with the following options:
+
+  * `:keyify` - bool; specify whether header/column names should be turned into keywords (default: `true`).
+  * `:header` - specify the header to use for map keys, preventing first row of data from being consumed as header."
+  ([] (structify {}))
+  ([{:keys [keyify header] :or {keyify true} :as opts}]
+   (fn [rf]
+     (let [hdr (volatile! header)]
+       (fn
+         ([] (rf))
+         ([results] (rf results))
+         ([results input]
+          (if (empty? @hdr)
+            (do (vreset! hdr (if keyify (mapv keyword input) input))
+                results)
+            (rf results (apply struct (apply create-struct @hdr) input)))))))))
+
+(defn remove-comments
+  "Removes rows which start with a comment character (by default, `#`). Operates by checking whether
+  the first item of every row in the collection matches a comment pattern. Also removes empty lines.
+  Options include:
+
+  * `:comment-re` - Specify a custom regular expression for determining which lines are commented out.
+  * `:comment-char` - Checks for lines lines starting with this char.
+
+  Note: this function only works with rows that are vectors, and so should always be used before mappify."
+  ([] (remove-comments {:comment-re #"^\#"}))
+  ([{:keys [comment-re comment-char]}]
+   (fn [rf]
+     (let [commented? (if comment-char
+                        #(= comment-char (first %))
+                        (partial re-find comment-re))]
+       (fn
+         ([] (rf))
+         ([results] (rf results))
+         ([results input]
+          (let [x (first input)]
+            (if (and x (commented? x))
+              results
+              (rf results input)))))))))
+
+(defn cast-with
+  "Casts the vals of each row according to `cast-fns`, which must either be a map of
+  `column-name -> casting-fn` or a single casting function to be applied towards all columns.
+  Additionally, an `opts` map can be used to specify:
+
+  * `:except-first` - Leaves the first row unaltered; useful for preserving header row.
+  * `:exception-handler` - If cast-fn raises an exception, this function will be called with args
+    `colname, value`, and the result used as the parse value.
+  * `:only` - Only cast the specified column(s); can be either a single column name, or a vector of them."
+  ([cast-fns]
+   (cast-with cast-fns {}))
+  ([cast-fns {:keys [except-first exception-handler only] :as opts}]
+   (fn [rf]
+     (let [fst (volatile! nil)]
+       (fn
+         ([] (rf))
+         ([results] (rf results))
+         ([results input]
+          (if except-first
+            (if @fst
+              (rf results (impl/cast-row cast-fns input :only only :exception-handler exception-handler))  ;; we captured the first already, keep reducing.
+              (do (vreset! fst input) (rf results input))) ;; fst is nil. reset fst and return the results.
+            (rf results (impl/cast-row cast-fns input :only only :exception-handler exception-handler)))))))))
+
+;; TODO: properly implement except first as transducer.  need to take n functions and apply then in order as in ->>.
+;; (defn except-first
+;;   []
+;;   (fn [rf]
+;;     (let [fst (volatile! nil)]
+;;       (fn
+;;         ([] (rf))
+;;         ([results] (rf results))
+;;         ([results input]
+;;          (if @fst
+;;            (rf results)))))))


Correctly specify license

Correctly specify license

--- build.boot
+++ build.boot
@@ -32,8 +32,7 @@
       :version +version+
       :description "GitHub changelog"
       :url "https://github.com/raszi/github-changelog"
-      :license {"name" "MIT"
-                "url" "http://choosealicense.com/licenses/mit/"}}
+      :license {"MIT" "http://choosealicense.com/licenses/mit/"}}
  jar {:main 'github-changelog.cli}
  aot {:namespace #{'github-changelog.cli}})


0.3.1

--- build.boot
+++ build.boot
@@ -7,7 +7,7 @@

 (require '[adzerk.bootlaces :refer :all])

-(def +version+ "0.3.0")
+(def +version+ "0.3.1")

 (bootlaces! +version+)


Change proc to a regular function

Change proc to a regular function

--- build.boot
+++ build.boot
@@ -58,11 +58,10 @@
 (defn proc
   "Runs the args as a shell command."
   [& args]
-  (with-pass-thru _
-    (-> (ProcessBuilder. args)
-        (.inheritIO)
-        (.start)
-        (.waitFor))))
+  (-> (ProcessBuilder. args)
+      (.inheritIO)
+      (.start)
+      (.waitFor)))

 ;; Config

@@ -134,12 +133,17 @@
    s self-hosted?     bool "True if self-hosted."]
   (let [opt (or opt :none)]
     (comp (testing)
-          (target)
           (if self-hosted?
-            (proc "lumo"
-                  "-c" (str "\"" (System/getProperty "fake.class.path") "\"")
-                  "-k" "lumo_cache"
-                  "src/test/cljs/mikron/test_runner/node.cljs")
+            (with-pass-thru fileset
+              (proc "lumo"
+                    "-c" (str "\"" (System/getProperty "fake.class.path") "\"")
+                    "-k" "lumo_cache"
+                    (->> fileset
+                         (input-files)
+                         (map tmp-file)
+                         (by-re [#"mikron[\\/]test_runner[\\/]node.cljs"])
+                         (first)
+                         (.getAbsolutePath))))
             (boot-cljs-test/test-cljs :js-env        :node
                                       :namespaces    cljs-test-namespaces
                                       :optimizations opt
@@ -211,7 +215,6 @@
               "-k" "lumo_cache"
               "-e" (str "\"(require '[mikron.runtime.core :as mikron "
                         ":refer [schema defschema pack unpack gen valid?]])\"")
-              "-v"
               "-r")))

 (deftask generate-docs


Add confetti deployment on S3

Add confetti deployment on S3

--- build.boot
+++ build.boot
@@ -4,7 +4,10 @@
                  [pandeiro/boot-http          "0.7.2"     :scope "test"]
                  [adzerk/boot-reload          "0.4.4"     :scope "test"]
                  [degree9/boot-semver         "1.2.4"     :scope "test"]
-                 [replumb/boot-pack-source    "0.1.0"     :scope "test"]
+                 [replumb/boot-pack-source    "0.1.2-1"   :scope "test"]
+                 [confetti/confetti           "0.1.2-SNAPSHOT"     :scope "test"]
+                 [adzerk/env                  "0.3.0"     :scope "test"]
+
                  ;; Repl
                  [adzerk/boot-cljs-repl       "0.3.0"  :scope "test"]
                  [com.cemerick/piggieback     "0.2.1"  :scope "test"]
@@ -37,9 +40,6 @@
                  [adzerk/cljs-console "0.1.1"]])

 (def pack-source-deps '[[org.clojure/clojurescript   "1.7.228"]
-                        [org.clojure/core.async      "0.2.374"]
-                        [reagent                     "0.5.1"]
-                        [re-frame                    "0.5.0"]
                         [replumb/replumb             "0.2.2-SNAPSHOT"]
                         [org.clojure/tools.reader    "1.0.0-alpha3"]])

@@ -56,18 +56,30 @@
          '[boot-semver.core            :refer :all]
          '[boot.pod                    :as pod]
          '[clojure.pprint              :refer [pprint]]
-         '[replumb.boot-pack-source    :refer [pack-source]])
+         '[replumb.boot-pack-source    :refer [pack-source]]
+         '[confetti.boot-confetti      :refer [create-site sync-bucket]]
+         '[adzerk.env                  :as env])

 (def +version+ (get-version))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;
+;;;  Env Variables  ;;;
+;;;;;;;;;;;;;;;;;;;;;;;
+
+(env/def
+  AWS_BUCKET nil
+  AWS_ACCESS_KEY nil
+  AWS_SECRET_KEY nil)
+
+;;;;;;;;;;;;;;;;;;;;;;
+;;;    Options     ;;;
+;;;;;;;;;;;;;;;;;;;;;;

 (task-options! pom {:project "cljs-repl-web"
                     :version +version+}
                test-cljs {:js-env :phantom
                           :out-file "phantom-tests.js"})
-
-;;;;;;;;;;;;;;;;;;;;;;
-;;;    Options     ;;;
-;;;;;;;;;;;;;;;;;;;;;;

 (def foreign-libs
   [{:file "resources/public/js/clojure-parinfer.js"
@@ -157,8 +169,7 @@
     (set-system-properties! (:props options))
     (comp (version-file)
           (apply cljs (reduce #(into %2 %1) [] (:cljs options)))
-          (source)
-          (target))))
+          (source))))

 (deftask dev
   "Start the dev interactive environment."
@@ -175,11 +186,22 @@
           (source)
           (serve))))

-;; (deftask deploy-s3
-;; []
-;; (let [:username (System/getenv "CLOJARS_USER")
-;; :password]) (System/getenv "CLOJARS_PASS")
-;; )
+;;;;;;;;;;;;;;
+;;  DEPLOY  ;;
+;;;;;;;;;;;;;;
+
+(deftask deploy-s3
+  []
+  (let [bucket (get (env/env) "AWS_BUCKET")]
+    (boot.util/info "Deploying on bucket %s...\n" bucket)
+    (sync-bucket #_:dry-run #_true
+                 :bucket bucket
+                 :access-key (get (env/env) "AWS_ACCESS_KEY")
+                 :secret-key (get (env/env) "AWS_SECRET_KEY"))))
+
+;;;;;;;;;;;;;;;;;;;;;
+;;  TEST (please)  ;;
+;;;;;;;;;;;;;;;;;;;;;

 ;; This prevents a name collision WARNING between the test task and
 ;; clojure.core/test, a function that nobody really uses or cares


Introducing environ

Introducing environ

--- jvm-runner/project.clj
+++ jvm-runner/project.clj
@@ -5,7 +5,10 @@
   :dependencies [[org.clojure/clojure "1.6.0"]
                  [cheshire "5.3.1"]
                  [org.tcrawley/dynapath "0.2.3"]
-                 [junit/junit "4.11"]]
+                 [junit/junit "4.11"]
+                 [environ "0.5.0"]]
+  :plugins [[lein-environ "0.5.0"]]
   :source-paths      ["src/clojure"]
   :java-source-paths ["src/java"]
+  :env {:timeout "2000"}
   :main codewars.core)


Mark the servlet as supporting async [IMMUTANT-114]

--- modules/web/src/main/clojure/immutant/web/internal.clj
+++ modules/web/src/main/clojure/immutant/web/internal.clj
@@ -92,6 +92,7 @@
             (.setServletClass servlet-class)
             (.setEnabled true)
             (.setDynamic true)
+            (.setAsyncSupported true)
             (.setLoadOnStartup -1))
           (doto context
             (.addChild wrapper)


CMR-1344: Minor test change

CMR-1344: Minor test change

--- system-int-test/test/cmr/system_int_test/ingest/message_queue_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/message_queue_test.clj
@@ -62,8 +62,7 @@
 (defn- assert-not-indexed
   "Verifies that a given concept is not found when searching"
   [concept-type concept]
-  (is (d/refs-match? []
-                     (search/find-refs concept-type (select-keys concept [:concept-id])))))
+  (is (zero? (:hits (search/find-refs concept-type (select-keys concept [:concept-id]))))))

 (defn- assert-in-metadata-db
   "Verifies that all of the provided concepts are stored in metadata-db"


bug #5224 - showing gas info in unconfirmed transactions

Signed-off-by: Goran Jovic <fc686822162e6f379ea05b6f92d78d206147085c@gmail.com>

--- src/status_im/models/wallet.cljs
+++ src/status_im/models/wallet.cljs
@@ -140,12 +140,12 @@
           (assoc :confirmations "0"
                  :timestamp (str now)
                  :type :outbound
-                 :hash hash)
+                 :hash hash
+                 :value (:amount transaction)
+                 :token token
+                 :gas-limit (str (:gas transaction)))
           (update :gas-price str)
-          (assoc :value (:amount transaction))
-          (assoc :token token)
-          (update :gas str)
-          (dissoc :message-id :id)))))
+          (dissoc :message-id :id :gas)))))

 (defn handle-transaction-error [db {:keys [code message]}]
   (let [{:keys [dapp-transaction]} (get-in db [:wallet :send-transaction])]


edit of panels

edit of panels

--- src/tango/cljs/runtime/core.cljs
+++ src/tango/cljs/runtime/core.cljs
@@ -171,7 +171,6 @@
       ;(log "Selected")
       ;(log (:selected-activities p))
       (log "Speaker")
-      (log (:speaker-activities p))
       (dom/div nil
         (dom/h2 nil "Time Schedule")
         (dom/table
@@ -471,8 +470,6 @@
                         true
                         false))]
       (log "SelectPanelAdjudicatorsView")
-      (log (om/props this))
-      (log selected-panel)
       (dom/div #js {:className "container-fluid"}
         (dom/div #js {:className "col-sm-12"}

@@ -482,7 +479,7 @@
                 (dom/div #js {:className "btn-group"}
                   (dom/button #js {:type      "button"
                                    :className "btn btn-primary"
-                                   :onClick #(select-page this :create-panel)}
+                                   :onClick #(select-page reconciler :create-panel)}
                               (dom/span #js {:className "glyphicon glyphicon-ok"})
                               " Done")))
               (dom/h2 nil (str "Select Adjudicators for Panel " (:adjudicator-panel/name selected-panel)))))
@@ -526,7 +523,6 @@
                         true
                         false))]
       (log "SelectedClassParticipantsView")
-      (log selected-class)
       (dom/div #js {:className "col-sm-12"}

         (dom/div #js {:className "col-sm-12"}
@@ -722,8 +718,6 @@
           selected-class (:selected-class (om/props this))
           selected-dance (:selected-dance (om/props this))]
       (log "DancesView")
-      (log dances)
-      (log selected-dance)
       (dom/div #js {:className "col-sm-12"}

         (dom/div #js {:className "col-sm-12"}
@@ -927,7 +921,8 @@
             (dom/div #js {:className "row col-sm-12"}
               (dom/label #js {:className "col-sm-3 control-label"} "Adjudicators")
               (dom/div #js {:className "col-sm-8"}
-                (map #(dom/button #js {:className "col-sm-6 btn btn-default"}
+                (map #(dom/button #js {:className "col-sm-6 btn btn-default"
+                                       :key (:adjudicator/id %)}
                                   (str (:adjudicator/number %) " - " (:adjudicator/name %)))
                      (sort-by :adjudicator/number (:adjudicator-panel/adjudicators selected-panel))))
               (dom/div #js {:className "col-sm-1"}
@@ -978,7 +973,7 @@
                              :onClick   #(on-delete-fn)}
                         (dom/span #js {:className "glyphicon glyphicon-trash"}))
             (dom/button #js {:className "btn btn-default"
-                             :onClick   #(on-edit-fn)}
+                             :onClick   #(on-edit-fn this (om/props this))}
                         (dom/span #js {:className "glyphicon glyphicon-edit"}))))

         (dom/div #js {:className "panel-body"}
@@ -992,7 +987,6 @@
                      (sort-by :adjudicator/number adjudicators))))))))))

 (defn adjudicator-panels [panels on-add-fn on-delete-fn on-edit-fn]
-  (log panels)
   (dom/div nil
     (dom/div #js {:className "container-fluid"}
       (dom/h2 {:className "sub-header"} "Adjudicator Panels")
@@ -1000,7 +994,7 @@
         (dom/div #js {:className "form-group"}
           (dom/div #js {:className "btn-group"}
             (dom/button #js {:className "btn btn-default"
-                             :onClick (on-add-fn)}
+                             :onClick #(on-add-fn)}
                         (dom/span #js {:className "glyphicon glyphicon-plus"}))))
         (apply dom/div nil
                (map #((om/factory AdjudicatorPanelsRow {:keyfn :adjudicator-panel/id})
@@ -1116,10 +1110,21 @@

           :participants ((om/factory ParticipantsView) participants)

-          :adjudicator-panels (adjudicator-panels (:app/adjudicator-panels p)
-                                                  #(om/transact! reconciler (make-create-panel-command))
-                                                  #()
-                                                  #())
+          #_(om/transact!
+            reconciler
+            `[(app/select-class {:class/id ~(:class/id selected)})
+              (app/select-page {:selected-page :create-class})])
+          :adjudicator-panels (adjudicator-panels
+                                (:app/adjudicator-panels p)
+                                #(om/transact! reconciler (make-create-panel-command))
+                                #(log "Delete X")
+                                (fn [component selected]
+                                  (om/transact!
+                                    component
+                                    `[(app/select-panel {:panel/id ~(:adjudicator-panel/id selected)})
+                                      (app/select-page {:selected-page :create-panel})
+                                      :app/selected-panel
+                                      :app/selected-page])))

           :adjudicators (adjudicators-view adjudicators selected-adjudicator
                                            select-adjudicator


Fix commented js modules still being loaded

--- resources/leiningen/new/expo/env/dev/user.clj
+++ resources/leiningen/new/expo/env/dev/user.clj
@@ -147,7 +147,7 @@
                                                        (vec))
                                           commented-modules (some->>
                                                               content
-                                                              (re-seq #"[;]+[\s]*\(js/require \"([^\"]+)\"\)")
+                                                              (re-seq #"[;]{2,}.*\(js/require \"([^\"]+)\"\)")
                                                               (map last)
                                                               (set))
                                           js-modules (if commented-modules
@@ -183,7 +183,7 @@
                              (vec))
                 commented-modules (some->>
                                     content
-                                    (re-seq #"[;]+[\s]*\(js/require \"([^\"]+)\"\)")
+                                    (re-seq #"[;]{2,}.*\(js/require \"([^\"]+)\"\)")
                                     (map last)
                                     (set))
                 js-modules (if commented-modules


map for masks

map for masks

--- src/makerbar/pov/controller/ddr.clj
+++ src/makerbar/pov/controller/ddr.clj
@@ -3,16 +3,18 @@
             [serial.core :as serial]
             [clojure.core.async :as async]))

-(def button-nw 0x0200)                                      ; x
-(def button-n 0x0008)                                       ; up
-(def button-ne 0x0400)                                      ; o
+(def button-masks
+  {:north-west 0x0200                                       ; x
+   :north      0x0008                                       ; up
+   :north-east 0x0400                                       ; o

-(def button-w 0x0001)                                       ; left
-(def button-e 0x0004)                                       ; right
+   :west       0x0001                                       ; left
+   :east       0x0004                                       ; right

-(def button-sw 0x0800)                                      ; triangle
-(def button-s 0x0002)                                       ; down
-(def button-se 0x0100)                                      ; square
+   :south-west 0x0800                                       ; triangle
+   :south      0x0002                                       ; down
+   :south-east 0x100                                        ; square
+   })

 (defn read-byte
@@ -31,14 +33,9 @@
          cardinal-buttons))))

 (defn deserialize-button-value [button-bytes]
-  {:north      (not= 0 (bit-and button-bytes button-n))
-   :south      (not= 0 (bit-and button-bytes button-s))
-   :east       (not= 0 (bit-and button-bytes button-e))
-   :west       (not= 0 (bit-and button-bytes button-w))
-   :north-west (not= 0 (bit-and button-bytes button-nw))
-   :north-east (not= 0 (bit-and button-bytes button-ne))
-   :south-west (not= 0 (bit-and button-bytes button-sw))
-   :south-east (not= 0 (bit-and button-bytes button-se))})
+  (apply merge
+         (for [[kw mask] button-masks]
+           {kw (not= 0 (bit-and button-bytes mask))})))

 (defn ddr-serial [ch #_core.async.channel]
   (fn [in-stream]


Rename `range-domain-pairs` -> `domain-range-pairs`

--- test/com/nomistech/clojure_the_language/c_850_utils/s_100_utils.clj
+++ test/com/nomistech/clojure_the_language/c_850_utils/s_100_utils.clj
@@ -69,7 +69,7 @@
   For explanations of terminology, see:
     https://www.mathsisfun.com/sets/domain-range-codomain.html
     https://www.mathsisfun.com/sets/injective-surjective-bijective.html"
-  (let [range-domain-pairs (for [d domain-subset
+  (let [domain-range-pairs (for [d domain-subset
                                  r (rel d)]
                              [d r])]
     (reduce (fn [sofar [d r]]
@@ -78,7 +78,7 @@
                       (fnil conj [])
                       d))
             {}
-            range-domain-pairs)))
+            domain-range-pairs)))

 ;;;; ___________________________________________________________________________
 ;;;; ---- with-extras ----


(maint) Use sha256 instead of md5

(maint) Use sha256 instead of md5

We use sha256 instead of md5 in the Puppet 7 stream.

--- test/integration/puppetlabs/services/master/master_service_test.clj
+++ test/integration/puppetlabs/services/master/master_service_test.clj
@@ -855,8 +855,8 @@
         ;; Only check some of the entries that won't vary based on the test environment
         (is (= nil (get file-entry "destination")))
         (is (= "file" (get file-entry "type")))
-        (is (= "md5" (get-in file-entry ["checksum" "type"])))
-        (is (= "{md5}0e65e68baff3f37e4d62ee9ce2129a55" (get-in file-entry ["checksum" "value"])))
+        (is (= "sha256" (get-in file-entry ["checksum" "type"])))
+        (is (= "{sha256}76b2e03b82880885385595045033c4e3122e373c7023e037461a650ec85829ad" (get-in file-entry ["checksum" "value"])))
         ;; Does it choose from the right module?
         (is (str/ends-with? (get file-entry "path") "bic_module_one/lib"))))


Snapshot version

Snapshot version

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.26.0"
+(defproject cook "1.26.1-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Version bump to 1.61.1-SNAPSHOT

Version bump to 1.61.1-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.61.0"
+(defproject cook "1.61.1-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.10.3"]


Fixes to web.

Fixes to web.

Changed the query to subtract an interval of 75 minutes,
ordering by count descending, and limiting to just 10 rows.

--- web/src/twitter_hashtags_visualizer/handler.clj
+++ web/src/twitter_hashtags_visualizer/handler.clj
@@ -33,7 +33,11 @@

 (defn query-top-tags []
   (take 10 (jdbc/query pooled-db-spec
-                       ["select * from tag_count where valid_to > current_timestamp"]
+                       ["
+SELECT * FROM tag_count
+ WHERE valid_to > CURRENT_TIMESTAMP - INTERVAL '75 minutes'
+ ORDER BY count DESC
+ LIMIT 10"]
                        :row-fn #(select-keys % [:tag :count]))))

 (defn update-tags []


Added logging

Added logging

--- src/clojure/funcatron/tron/routers/shim_router.clj
+++ src/clojure/funcatron/tron/routers/shim_router.clj
@@ -193,6 +193,7 @@

 (defn exec-app
   [op-i req]
+  (clojure.tools.logging/log :info "Dispatching request to " op-i)
   (let [req2 (dissoc req :swagger)
         req2 (assoc req2 :body (get-in req [:parameters :body]))]
     (let [uuid (.toString (UUID/randomUUID))
@@ -203,9 +204,12 @@
                      :class   op-i
                      :replyTo uuid
                      :body    (if (:body req2) (json/generate-string (:body req2)) nil)})
+      (clojure.tools.logging/log :info "Sent the request over the wire to the IDE/App ")
       (let [answer (deref p 10000 ::failed)]
         (if (= ::failed answer)
-          {:status 500 :headers {"Content-Type" "text/plain"} :body "Didn't get the answer"}
+          (do
+            (clojure.tools.logging/log :info "Timed Out after 10 Seconds")
+            {:status 500 :headers {"Content-Type" "text/plain"} :body "Didn't get the answer"})
           (let [response (:response answer)
                 response (update response :headers fu/stringify-keys)
                 response (if (and (:body response) (:decodeBody answer))
@@ -214,6 +218,7 @@
                              (ByteArrayInputStream. (.decode (Base64/getDecoder) ^String (:body response))))
                            response)
                 ]
+            (clojure.tools.logging/log :info "Got a response. Status code " (:status response))
             response
             ))))))

@@ -248,12 +253,15 @@

 (defn http-handler
   [req]
+  (clojure.tools.logging/log :info "Incoming request to " (:uri req))
   (if-let [swagger (::swagger @shim-socket)]
     (let [app (make-app swagger)
           resp (app req)]
       resp
       )
-    {:status 404 :headers {"Content-Type" "text/plain"} :body "No Swagger Defined. Unable to route request\n"}
+    (do
+      (clojure.tools.logging/log :info "No Connection from dev-shim or no Swagger file defined")
+      {:status 404 :headers {"Content-Type" "text/plain"} :body "No Swagger Defined. Unable to route request\n"})
     ))

 (defonce end-server (atom nil))
@@ -268,4 +276,5 @@
   [& args]
   (run-server)
   (setup 54657)
+  (clojure.tools.logging/log :info "Your Funcatron Dev Server is running. Point your dev-shim at port 54657 and your browser at http://localhost:3000")
   )


handle limits more generally

handle limits more generally

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

--- plugins/SlideExplorer2/src/slide_explorer/contrast.clj
+++ plugins/SlideExplorer2/src/slide_explorer/contrast.clj
@@ -58,8 +58,8 @@
              :stroke {:width 2}
              :fill {:color fill-color}}])

-(defn update-limit! [val]
-  (let [val (canvas/clip-value val 0 255)]
+(defn update-limit! [val max]
+  (let [val (canvas/clip-value val 0 max)]
     (swap! channel-atom assoc :min val)))

 (defn contrast-graph [data width height {:keys [name color min max]}]
@@ -78,8 +78,8 @@
         :stroke {:width 0 :cap :butt}}]
       [:rect {:b 2 :h 20 :l 0 :w width
               :hidden false
-              :on-mouse-down (fn [x _] (update-limit! (* n (/ x width))))
-              :on-mouse-drag (fn [x _] (update-limit! (* n (/ x width))))}]
+              :on-mouse-down (fn [x _] (update-limit! (* n (/ x width)) max))
+              :on-mouse-drag (fn [x _] (update-limit! (* n (/ x width)) max))}]
       (color-slider :min-handle xmin :black)
       (color-slider :max-handle xmax color)]
      [:text {:text name :l 50 :t 12 :color :white :font {:size 18}}]
@@ -117,8 +117,10 @@
     (handle-settings)
     (reset! data-atom (test-data))))

-(defn random-test [n]
+(defn random-test [secs]
   (future
-    (dotimes [_ n]
+    (let [t0 (System/currentTimeMillis)]
+    (while (< (- (System/currentTimeMillis) t0)
+              (int (* 1000 secs)))
       (Thread/sleep 10)
-      (reset! data-atom (test-data)))))
+      (reset! data-atom (test-data))))))


fix typos

fix typos

--- frontend/components/integrations.cljs
+++ frontend/components/integrations.cljs
@@ -110,7 +110,7 @@
                    [:article.integrations-hero-units
                     [:div.integrations-hero-unit
                      circle-logo
-                     [:p "CircleCI makes modern continous integration and deployment easy."]]
+                     [:p "CircleCI makes modern Continuous Integration and Deployment easy."]]
                     [:div.integrations-hero-unit
                      docker-logo
                      [:p "Docker makes it easy to build, run, and ship applications anywhere.  "]]]
@@ -125,7 +125,7 @@
                       [:img {:src "/icons/cloud-circle.png"}]
                       [:h3 "Continous Deployment of your Docker images"]
                       [:p
-                       "CircleCI makes it easy to deploy images to Docker Hub as well as to continously deploy applications to AWS Elastic Beanstalk, Kubernetes on Google Compute Engine, and others."]
+                       "CircleCI makes it easy to deploy images to Docker Hub as well as to continously deploy applications to AWS Elastic Beanstalk, Google Compute Engine, and others."]
                       [:a {:href "/docs/docker"} "docs"]]
                      [:div.feature
                       [:img {:src "/icons/scale-circle.png"}]


More complete encoding of values to Cassandra encoded ByteBuffers. WIP

--- systems/cassandra-node/src/containium/systems/cassandra/embedded12.clj
+++ systems/cassandra-node/src/containium/systems/cassandra/embedded12.clj
@@ -12,12 +12,15 @@
             [clojure.string :refer (replace split)])
   (:import [org.apache.cassandra.cql3 QueryProcessor ResultSet ColumnSpecification]
            [org.apache.cassandra.db ConsistencyLevel]
-           [org.apache.cassandra.db.marshal AbstractType]
+           [org.apache.cassandra.db.marshal AbstractType BooleanType BytesType DoubleType
+            EmptyType FloatType InetAddressType Int32Type ListType LongType MapType SetType
+            UTF8Type UUIDType]
            [org.apache.cassandra.service CassandraDaemon ClientState QueryState]
            [org.apache.cassandra.transport.messages ResultMessage$Rows]
            [containium ByteBufferInputStream]
            [java.io ByteArrayOutputStream]
-           [java.util Arrays List]
+           [java.util Arrays List Map Set UUID]
+           [java.net InetAddress]
            [java.nio CharBuffer ByteBuffer]
            [java.nio.charset Charset]))

@@ -43,28 +46,6 @@
       (copy (bytebuffer->inputstream bb) baos)
       (.toByteArray baos))))

-
-(defprotocol Encode
-  (encode [value]
-    "Encodes a Clojure value to a ByteBuffer."))
-
-(extend-protocol Encode
-  (Class/forName "[B")
-  (encode [value]
-    (ByteBuffer/wrap value))
-
-  String
-  (encode [value]
-    (let [encoder (.newEncoder (Charset/forName "UTF-8"))]
-      (.encode encoder (CharBuffer/wrap ^String value))))
-
-  Long
-  (encode [value]
-    (.putLong (ByteBuffer/allocate 8) value))
-
-  ByteBuffer
-  (encode [value]
-    value))

 ;;; Helper functions.
@@ -98,7 +79,6 @@
 ;;--- TODO: Test decoded types.
 (defn- decode-resultset
   [^ResultSet resultset]
-  (println resultset)
   (let [^List metas (.. resultset metadata names)]
     (for [^List row (.rows resultset)]
       (->> (for [[^ColumnSpecification meta ^ByteBuffer column] (zipmap metas row)
@@ -106,6 +86,32 @@
                        ^String name (.. meta name toString)]]
              [name (.compose type column)])
            (into {})))))
+
+
+(defn abstract-type
+  [value]
+  (if value
+    (condp instance? value
+      Boolean BooleanType/instance
+      ByteBuffer BytesType/instance
+      Double DoubleType/instance
+      Float FloatType/instance
+      InetAddress InetAddressType/instance
+      Integer Int32Type/instance
+      List (ListType/getInstance ^AbstractType (abstract-type (first value)))
+      Map (MapType/getInstance (abstract-type (ffirst value))
+                               (abstract-type (second (first value))))
+      Long LongType/instance
+      Set (SetType/getInstance ^AbstractType (abstract-type (first value)))
+      String UTF8Type/instance
+      UUID UUIDType/instance)
+    EmptyType/instance))
+
+
+(defn- encode-value
+  [value]
+  (let [^AbstractType dbtype (abstract-type value)]
+    (.decompose dbtype value)))

 ;;; Cassandra protocol implementation.
@@ -124,7 +130,8 @@
 (defn- do-prepared*
   [{:keys [query-state]} prepared consistency args]
   (let [consistency (kw->consistency consistency)
-        result (QueryProcessor/processPrepared prepared consistency query-state (map encode args))]
+        result (QueryProcessor/processPrepared prepared consistency query-state
+                                               (map encode-value args))]
     (when (instance? ResultMessage$Rows result)
       (decode-resultset (.result ^ResultMessage$Rows result)))))


Shorter attacks, and start with only one octave.

--- src/african_polyphony_and_polyrhythm/talk.clj
+++ src/african_polyphony_and_polyrhythm/talk.clj
@@ -263,9 +263,10 @@
   "Linda horn music - page 316"
   []
   (->> [tete ta ha tulule bongo
-        (big tete) (big ta) (big ha) (big tulule) (big bongo)
-        (big (big tete)) (big (big ta)) (big (big ha)) (big (big tulule)) (big (big bongo))
-        (big (big (big tete))) (big (big (big ta))) (big (big (big ha)))]
+        ;(big tete) (big ta) (big ha) (big tulule) (big bongo)
+        ;(big (big tete)) (big (big ta)) (big (big ha)) (big (big tulule)) (big (big bongo))
+        ;(big (big (big tete))) (big (big (big ta))) (big (big (big ha)))
+        ]
        (map rand-variations)
        (introduce-after 4)
        (map pan)
@@ -308,9 +309,9 @@
       (+ (* 1/8 (sin-osc (* 7.01 freq))))
       (clip2 0.8)
       (rlpf (line:kr (* 2 freq) (* 7 freq) 0.8))
-      (* (env-gen (adsr 0.2 0.1 0.25 0.2) (line:kr 1 0 dur) :action FREE))
+      (* (env-gen (adsr 0.1 0.1 0.35 0.05) (line:kr 1 0 dur) :action FREE))
       (pan2 pan)
       (* vol)))

-(defmethod live/play-note :horn [{:keys [pitch pan]}]
-  (whistle :freq pitch :pan (or pan 0) :dur 0.1))
+(defmethod live/play-note :horn [{:keys [pitch pan duration]}]
+  (whistle :freq pitch :pan (or pan 0) :dur (min duration 0.2)))


Fix kibit warnings

Fix kibit warnings

--- src/clj/lambdacd/util/internal/reflection.clj
+++ src/clj/lambdacd/util/internal/reflection.clj
@@ -2,5 +2,5 @@

 (defn private-field [obj fn-name-string]
   (let [m (.. obj getClass (getDeclaredField fn-name-string))]
-    (. m (setAccessible true))
-    (. m (get obj))))
+    (.setAccessible m true)
+    (.get m obj)))


refactor

refactor

--- src/cljs/foosball/locations/report_match.cljs
+++ src/cljs/foosball/locations/report_match.cljs
@@ -49,11 +49,8 @@
                                            :placeholder "0"
                                            :input-props {:type "number"}}})]]))))

-(defn- render-players-select [{:keys [team other-team active-players]}
-                              selected-player-path
-                              change-ch]
-  (let [selected-player  (get-in team selected-player-path)
-        other-selected   (disj (selected-players team other-team) selected-player)
+(defn- render-players-select [selected-player team other-team active-players change-ch]
+  (let [other-selected   (disj (selected-players team other-team) selected-player)
         possible-options (->> active-players
                               (filter (complement (partial contains? other-selected))))]
     [:select.form-control
@@ -68,21 +65,23 @@
             [:option {:value id} name])
           possible-options)]))

-(defn team-player-component [{:keys [team other-team active-players player-num] :as teams}
+(defn team-player-component [{:keys [selected-player team other-team active-players player-num]}
                              owner
                              {:keys [change-ch]}]
   (reify
     om/IRender
     (render [_]
       (html
-       (let [player-selector (keyword (str "player" player-num))]
-         [:div.form-group
-          [:label.control-label.col-lg-4 (str "Player " player-num)]
-          [:div.controls.col-lg-8
-           (render-players-select teams [player-selector] change-ch)]])))))
+       [:div.form-group
+        [:label.control-label.col-lg-4 (str "Player " player-num)]
+        [:div.controls.col-lg-8
+         (render-players-select selected-player team other-team active-players change-ch)]]))))

 (defn team-selector [team-num]
   (keyword (str "team" team-num)))
+
+(defn player-selector [player-num]
+  (keyword (str "player" player-num)))

 (defn other-team [this-team]
   (let [difference (disj #{:team1 :team2} this-team)]
@@ -94,14 +93,18 @@
                              {:keys [score player1 player2] :as chans}]
   (let [team-sel       (team-selector team-num)
         other-team-sel (other-team team-sel)
+        team           (team-sel report-match)
+        other-team     (other-team-sel report-match)
         render-player  (fn [num change-ch]
-                         (om/build team-player-component (team-sel report-match)
-                                   {:opts      {:change-ch change-ch}
-                                    :react-key (str team-selector "-" num)
-                                    :fn        (fn [t] {:team t
-                                                       :other-team (other-team-sel report-match)
-                                                       :active-players active-players
-                                                       :player-num num})}))]
+                         (let [selected-player ((player-selector num) team)]
+                           (om/build team-player-component team
+                                     {:opts      {:change-ch change-ch}
+                                      :react-key (str team-selector "-" num)
+                                      :fn        (fn [t] {:selected-player selected-player
+                                                         :team t
+                                                         :other-team other-team
+                                                         :active-players active-players
+                                                         :player-num num})})))]
     [:div.col-lg-5.well.well-lg
      [:h2 (str "Team " team-num ":")]
      (render-player 1 player1)


Clean up of histories. Order by creation

--- src/clojure/staircase/resources/histories.clj
+++ src/clojure/staircase/resources/histories.clj
@@ -4,7 +4,7 @@
         [clojure.tools.logging :only (info)])
   (:require staircase.sql
             staircase.resources
-            [honeysql.helpers :refer (select from where left-join group)]
+            [honeysql.helpers :refer (select from where left-join group order-by)]
             [honeysql.core :as hsql]
             [staircase.resources.schema :as schema]
             [com.stuartsierra.component :as component]
@@ -18,6 +18,25 @@
     (reduce f init rows)))

 (def table-spec (merge schema/histories schema/history-step))
+
+(defn- all-history-query []
+  (-> (select :h.id :h.title :h.created_at :h.description :h.owner [:%count.hs.* :steps])
+                    (from [:histories :h])
+                    (left-join [:history_step :hs] [:= :h.id :hs.history_id])
+                    (group :h.id :h.title :h.created_at :h.description :h.owner)
+                    (where [:= :h.owner :?user])
+                    (order-by [:h.created_at :desc])
+                    (hsql/format :params staircase.resources/context)))
+
+(defn- one-history-query [history]
+  (-> (select :h.*, :hs.step_id)
+      (from [:histories :h])
+      (left-join [:history_step :hs] [:= :h.id :hs.history_id])
+      (where [:and
+              [:= :h.id :?history]
+              [:= :h.owner :?user]])
+      (order-by [:hs.created_at :desc])
+      (hsql/format :params (assoc staircase.resources/context :history history))))

 (defrecord HistoryResource [db]
   component/Lifecycle
@@ -33,13 +52,7 @@
   Resource

   (get-all [histories]
-    (into [] (sql/query (:connection db)
-                        (-> (select :h.id :h.title :h.created_at :h.description :h.owner [:%count.hs.* :steps])
-                            (from [:histories :h])
-                            (left-join [:history_step :hs] [:= :h.id :hs.history_id])
-                            (group :h.id :h.title :h.created_at :h.description :h.owner)
-                            (where [:= :h.owner :?user])
-                            (hsql/format :params staircase.resources/context)))))
+    (sql/query (:connection db) (all-history-query)))

   (exists? [_ id] (staircase.sql/exists-with-owner (:connection db) :histories id (:user staircase.resources/context)))

@@ -47,11 +60,7 @@
     (when-let [uuid (string->uuid id)]
       (sql/query
         (:connection db)
-        [" select h.*, hs.step_id
-           from histories as h
-           left join history_step as hs on h.id = hs.history_id
-           where h.id = ? and h.owner = ?
-           order by hs.created_at desc " uuid (:user staircase.resources/context)]
+        (one-history-query uuid)
         :result-set-fn #(if (empty? %) nil (apply build-history %)))))

   (update [_ id doc] (staircase.sql/update-owned-entity


test-stones can be replaced with starting-stones

--- test/greybear/model_test.clj
+++ test/greybear/model_test.clj
@@ -21,9 +21,6 @@

 (use-fixtures :each database-fixture)

-
-(def test-stones
-  (apply str (repeat (* 19 19) "0")))

 (deftest user-create
   (create-user "foo" "bar")
@@ -60,8 +57,8 @@
                    :black_id (subselect players
                                         (fields :id)
                                         (where {:name [like "user2"]}))
-                   :stones test-stones}))
-  (is (= {:white "user1" :black "user2" :stones test-stones}
+                   :stones starting-stones}))
+  (is (= {:white "user1" :black "user2" :stones starting-stones}
          (read-game 1))))

 (deftest new-game-unknown-user-test


reuse user-create test

reuse user-create test

--- test/greybear/model_test.clj
+++ test/greybear/model_test.clj
@@ -16,8 +16,7 @@
          [{:name "foo"}])))

 (deftest user-create-already-exists
-  (clear-database)
-  (create-user "foo" "bar")
+  (user-create)
   (is (nil? (create-user "foo" "bar")))
   (is (= {:cnt 1}
          (first (select players


Remove another disabled test

Remove another disabled test

--- test/io/aviso/twixt_test.clj
+++ test/io/aviso/twixt_test.clj
@@ -91,15 +91,6 @@
     (is (:compiled asset))
     (is (= (sorted-dependencies asset) ["coffeescript-source.coffee"])))

-  #_ (deftest compiled-results-are-cached
-    (let [v1 (get-streamable twixt "coffeescript-source.coffee")
-          v2 (get-streamable twixt "coffeescript-source.coffee")]
-
-      ;; Clojure doesn't have a good way of checking that two references are to the same object (e.g., Groovy's is()
-      ;; method). Instead, we compare the :content keys, which are a byte array, which should compare based on identity
-      ;; rather than content.
-      (is (= (:content v1) (:content v2)))))
-
   (testing "compilation failure"

     (is (thrown-with-msg? Exception


oops.  need to make sure drivers are loaded for unit tests.

--- test/metabase/test_setup.clj
+++ test/metabase/test_setup.clj
@@ -6,6 +6,7 @@
             [expectations :refer :all]
             (metabase [core :as core]
                       [db :as db]
+                      [driver :as driver]
                       [util :as u])
             (metabase.models [setting :as setting]
                              [table :refer [Table]])
@@ -65,6 +66,10 @@

 ;; # ------------------------------ FUNCTIONS THAT GET RUN ON TEST SUITE START / STOP ------------------------------

+;; this is a little odd, but our normal `test-startup` function won't work for loading the drivers because
+;; they need to be loaded at compile time for some of the unit tests work work properly, so we put this here
+(defonce ^:private loaded-drivers (driver/find-and-load-drivers!))
+
 (defn- load-test-data!
   "Call `load-data!` on all the datasets we're testing against."
   []


Added require

Added require

--- test/priceous/utils_test.clj
+++ test/priceous/utils_test.clj
@@ -5,7 +5,7 @@
             [clojure.test.check.generators :as gen]
             [clojure.test.check.properties :as prop]
             [clojure.test.check.clojure-test :refer [defspec]]
-            ))
+            [priceous.utils :as u]))

 ;; make sure debug does not corrupt messages
 (defspec debug--equal-property-test
@@ -111,6 +111,7 @@
   (is (nil? (force-pos 0)))
   (is (nil? (force-pos -100))))

+(u/require-all-providers)
 (deftest test--find-all-providers
   (is (= #{"alcoland" "alcomag" "alcoparty" "alcostore"
            "alcovegas" "auchan" "barbados" "bestwine"


add more tests

add more tests

--- test/s7p/slave/core_test.clj
+++ test/s7p/slave/core_test.clj
@@ -72,4 +72,15 @@
             ret (auction fp arg)]
        (is ret)
        (is (= dsp1 (:dsp ret)))
-       (is (= bid-price (:second-price ret)))))))
+       (is (= bid-price (:second-price ret)))))
+
+    (testing "more than 1 valid response"
+      (let [fp 4.0
+            bid-price1 4.1
+            bid-price2 4.2
+            arg [{:dsp dsp1 :response {:id "1", :bidPrice bid-price1 :advertiserId "2"}}
+                 {:dsp dsp2 :response {:id "1", :bidPrice bid-price2 :advertiserId "2"}}]
+            ret (auction fp arg)]
+        (is ret)
+        (is (= dsp2 (:dsp ret)))
+        (is (= bid-price1 (:second-price ret)))))))


Update `in-context` and `deref-capture` documentation

--- src/reagent/ratom.cljs
+++ src/reagent/ratom.cljs
@@ -33,22 +33,19 @@
                  false))))))

 (defn- in-context [obj f]
-  "If 'f' uses '*ratom-context*' anywhere, it will be given 'obj'
-
-   When f is executed, if (f) derefs any ratoms, they are then added to 'obj.captured'(*ratom-context*).
+  "When f is executed, if (f) derefs any ratoms, they are then added to 'obj.captured'(*ratom-context*).

    See function notify-deref-watcher! to know how *ratom-context* is updated"
   (binding [*ratom-context* obj]
     (f)))

 (defn- deref-capture
-  " Captures the ratoms used by f as an array in r (in r.captured field).
-
-    If r.watching is not equal to r.captured, it then updates the 'watching'
-    by calling  (._update-watching r c)
-
-    Inside '_update-watching' along with adding the ratoms in 'r.watching' of reaction,
-    the reaction is also added to the list of watches on each ratoms f derefs."
+  "Returns `(in-context f r)`.  Calls `_update-watching` on r with any
+   `deref`ed atoms captured during `in-context`, if any differ from the
+   `watching` field of r.  Clears the `dirty?` flag on r.
+
+   Inside '_update-watching' along with adding the ratoms in 'r.watching' of reaction,
+   the reaction is also added to the list of watches on each ratoms f derefs."
   [f r]
   (set! (.-captured r) nil)
   (when (dev?)


Use all expressions for rule generation.

--- test/smallex/test/generators.clj
+++ test/smallex/test/generators.clj
@@ -149,7 +149,7 @@
                                            (Character/isLetter (first %))
                                            (not (contains? alias-names %)))
                                      (gen/resize 20 gen/string-alpha-numeric))]
-    (->> (gen/map rule-name-gen alias-gen)
+    (->> (gen/map rule-name-gen (expression alias-gen))
          (gen/not-empty)
          (gen/fmap (fn [m] ;; tag on priority on rules
                      (into {}


Put result in list-of-lists format

Put result in list-of-lists format

--- src/main/cljc/clojure_club/sudoku/mgrimm.cljc
+++ src/main/cljc/clojure_club/sudoku/mgrimm.cljc
@@ -4,9 +4,9 @@
   (:require [clojure.core.logic.fd :as fd]
             [clojure-club.sudoku.example-problems :as ex]))

-(defn solve [initial]
-  (let [cells (mapv (fn [c l] (do (if c (== c l)) l))
-                   (apply concat initial) (repeatedly 81 lvar))
+(defn solve* [initial]
+  (let [cells (mapv (fn [c l] (if c (== c l)) l)
+                    (apply concat initial) (repeatedly 81 lvar))
         rows (partition 9 cells)
         cols (apply map vector rows)
         blks (for [y (range 0 81 27) x (range 0 9 3)]
@@ -17,3 +17,5 @@
       (everyg fd/distinct rows)
       (everyg fd/distinct cols)
       (everyg fd/distinct blks))))
+
+(def solve #(partition 9 (first (solve* %))))


Fix history model for pulling from history using chat source uuid

--- src/yetibot/core/models/history.clj
+++ src/yetibot/core/models/history.clj
@@ -10,66 +10,66 @@
 ;;;; read

 (defn history-for-chat-source
-  [{:keys [adapter room] :as chat-source}]
+  [{:keys [uuid room] :as chat-source}]
   "Retrieve a map of user to chat body"
   (query {:where/map
-          {:chat-source-adapter (pr-str adapter)
+          {:chat-source-adapter (pr-str uuid)
            :chat-source-room room}}))

 (defn count-entities
-  [{:keys [adapter room] :as chat-source}]
+  [{:keys [uuid room] :as chat-source}]
   (-> (query
         {:where/map
-         {:chat-source-adapter (pr-str adapter)
+         {:chat-source-adapter (pr-str uuid)
           :chat-source-room room}
          :select/clause "COUNT(*) as count"})
       first
       :count))

 (defn head
-  [{:keys [adapter room] :as chat-source} n]
+  [{:keys [uuid room] :as chat-source} n]
   (query
     {:where/map
-     {:chat-source-adapter (pr-str adapter)
+     {:chat-source-adapter (pr-str uuid)
       :chat-source-room room}
      :limit/clause (str n)}))

 (defn tail
-  [{:keys [adapter room] :as chat-source} n]
+  [{:keys [uuid room] :as chat-source} n]
   (-> (query
         {:where/map
-         {:chat-source-adapter (pr-str adapter)
+         {:chat-source-adapter (pr-str uuid)
           :chat-source-room room}
          :order/clause "created_at DESC"
          :limit/clause (str n)})
       reverse))

 (defn random
-  [{:keys [adapter room] :as chat-source}]
+  [{:keys [uuid room] :as chat-source}]
   (query
     {:where/map
-     {:chat-source-adapter (pr-str adapter)
+     {:chat-source-adapter (pr-str uuid)
       :chat-source-room room}
      :order/clause "random()" ;; possibly slow on large tables
      :limit/clause "1"}))

-(defn grep [{:keys [adapter room] :as chat-source} pattern]
+(defn grep [{:keys [uuid room] :as chat-source} pattern]
   (query
     {:where/clause (str "chat_source_adapter=? AND chat_source_room=?"
                         " AND body ~ ?")
-     :where/args  [(pr-str adapter) room pattern]}))
+     :where/args  [(pr-str uuid) room pattern]}))

 (defn last-chat-for-room
   "Takes chat source and returns the last chat for the room.
    `cmd?` is a boolean specifying whether it should be the last yetibot command
    or a normal chat. Useful for `that` commands."
   ([chat-source cmd?] (last-chat-for-room chat-source cmd? 1))
-  ([{:keys [adapter room]} cmd? history-count]
+  ([{:keys [uuid room]} cmd? history-count]
    (query {:limit/clause history-count
            :order/clause "created_at DESC"
            :where/map
            {:is-command cmd?
-            :chat-source-adapter (pr-str adapter)
+            :chat-source-adapter (pr-str uuid)
             :chat-source-room room}})))

 ;; Note: these aren't currently used. If the eventually are, we should figure
@@ -77,31 +77,31 @@
 ;; cmd or non-cmd items for a given chat-source.
 (defn non-cmd-items
   "Return `chat-item` only if it doesn't match any regexes in `history-ignore`"
-  [{:keys [adapter room] :as chat-source}]
+  [{:keys [uuid room] :as chat-source}]
   (query {:where/map
           {:is-command false
-           :chat-source-adapter (pr-str adapter)
+           :chat-source-adapter (pr-str uuid)
            :chat-source-room room}}))

 (defn cmd-only-items
   "Return `chat-item` only if it does match any regexes in `history-ignore`"
-  [{:keys [adapter room] :as chat-source}]
+  [{:keys [uuid room] :as chat-source}]
   (query {:where/map
             {:is-command true
-             :chat-source-adapter (pr-str adapter)
+             :chat-source-adapter (pr-str uuid)
              :chat-source-room room}}))

 (defn items-for-user
   "Ordered by most recent. Used by the `!` command.
    Filters out all `!` commands to prevent infinite recursion."
   [{:keys [chat-source user cmd? limit]}]
-  (let [{:keys [adapter room]} chat-source
+  (let [{:keys [uuid room]} chat-source
         limit (or limit 1)]
     (reverse
       (query
           {:where/clause (str "chat_source_adapter=? AND chat_source_room=?"
                               " AND is_command=? AND body NOT LIKE '!!%'")
-           :where/args  [(pr-str adapter) room cmd?]
+           :where/args  [(pr-str uuid) room cmd?]
            :limit/clause limit
            :order/clause "created_at DESC"}))))


bump cljdev

bump cljdev

--- stow/lein-nubank/.lein/profiles.clj
+++ stow/lein-nubank/.lein/profiles.clj
@@ -1,5 +1,5 @@
 {:user
- {:dependencies        [[cljdev "0.9.0"]]
+ {:dependencies        [[cljdev "0.10.0"]]

   :injections          [(require 'nu)]

@@ -15,7 +15,7 @@
                         [venantius/ultra "0.6.0"]
                         [lein-ancient "0.6.15"]
                         [lein-auto "0.1.3"]
-                        [jonase/eastwood "0.3.10"]
+                        [jonase/eastwood "0.3.12"]
                         [com.jakemccrary/lein-test-refresh "0.24.1"]]}

  :repl


Re-formatted test for consistent style.

Re-formatted test for consistent style.

--- test/com/rpl/specter/core_test.cljc
+++ test/com/rpl/specter/core_test.cljc
@@ -1445,7 +1445,8 @@
   (is (= (transform #"aa*" (fn [s] (-> s count str)) "aadt") "2dt"))
   (is (= (transform #"[Aa]+" (fn [s] (apply str (take (count s) (repeat "@")))) "Amsterdam Aardvarks") "@msterd@m @@rdv@rks"))
   (is (= (select [#"(\S+):\ (\d+)" (s/nthpath 2)] "Mary: 1st George: 2nd Arthur: 3rd") ["1" "2" "3"]))
-  (is (= (transform (s/subselect #"\d\w+") reverse "Mary: 1st George: 2nd Arthur: 3rd"))))
+  (is (= (transform (s/subselect #"\d\w+") reverse "Mary: 1st George: 2nd Arthur: 3rd")))
+  )

 (deftest single-value-none-navigators-test
   (is (predand= vector? [1 2 3] (setval s/AFTER-ELEM 3 [1 2])))


changes to (generate) that cause one test to fail

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -43,17 +43,37 @@
            (repeatedly function))))))

 (defn generate [spec grammar lexicon index morph]
-  (if (or (vector? spec)
-          (seq? spec))
-    (first (take 1
-                 (mapcat (fn [each-spec]
-                           (generate-all each-spec grammar lexicon index morph))
-                         spec)))
-    (if (empty? grammar)
-      (do
-        (log/error (str "grammar is empty."))
-        (exception (str "grammar is empty.")))
-      (first (take 1 (generate-all spec grammar lexicon index morph))))))
+  (cond (or (vector? spec)
+            (seq? spec))
+        (first (take 1
+                     (map (fn [each-spec]
+                            (log/info (str "generate: generating from spec: "
+                                           (strip-refs each-spec)))
+                            (let [expression
+                                  (generate each-spec grammar lexicon index morph)]
+                              (log/info (str "generate: expression generated for spec:"
+                                             (strip-refs each-spec) ":"
+                                             "'" (morph expression) "'"))
+                              expression))
+                          spec)))
+
+        (empty? grammar)
+        (do
+          (log/error (str "grammar is empty."))
+          (exception (str "grammar is empty.")))
+
+        true
+        (do
+          (log/info (str "generate: generating from spec: "
+                         (strip-refs spec)))
+          (let [expression
+                (first (take 1 (generate-all spec grammar lexicon index morph)))]
+            (if expression
+              (log/info (str "generate: generated "
+                             "'" (morph expression) "'"
+                             " for spec:" (strip-refs spec)))
+              (log/info (str "generate: no expression could be generated for spec:" (strip-refs spec))))
+            expression))))

 (defn generate-all-with-model [spec {grammar :grammar
                                      index :index


s/lb/bolt/

s/lb/bolt/

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -51,13 +51,13 @@
     (log/debug (str "generate-all:" depth "/" max-depth ":         " (strip-refs spec)))
     (->>
      (lightning-bolts model spec depth max-depth)
-     (pmap (fn [lb]
+     (pmap (fn [bolt]
              (let [cp2c
-                   (comp-paths-to-complements lb (find-comp-paths lb) model depth max-depth)]
+                   (comp-paths-to-complements bolt (find-comp-paths bolt) model depth max-depth)]
                (if (not (nil? cp2c))
                  (merge
                   {[]
-                   (filter not-fail? [lb])}
+                   (filter not-fail? [bolt])}
                   cp2c)))))
      (remove nil?)
      (map (fn [each-bolt-and-comps]


Fix tests under Clojure 1.9

Fix tests under Clojure 1.9

Fixes bad ns form which clojure.spec doesn't accept.

--- test/flatland/useful/debug_test.clj
+++ test/flatland/useful/debug_test.clj
@@ -1,5 +1,5 @@
 (ns flatland.useful.debug-test
-  (use flatland.useful.debug clojure.test))
+  (:use flatland.useful.debug clojure.test))

 (defmacro test-? [form]
   `(let [form# '~form


turned output from vectors to time series

--- test/forma/trends/analysis_test.clj
+++ test/forma/trends/analysis_test.clj
@@ -172,11 +172,16 @@
   start and end index don't matter for this application, but are left
   in there anyway to ensure forward compatibility"
   [m]
-  (let [[ndvi-ts reli-ts rain-ts] ((juxt :ndvi :reli :rain) m)]
-    (transpose (telescoping-long-trend 23 135 136 ndvi-ts reli-ts rain-ts))))
+  (let [start 135
+        end 136
+        [ndvi-ts reli-ts rain-ts] ((juxt :ndvi :reli :rain) m)]
+    (vec (map
+          (partial schema/timeseries-value start end)
+          (transpose
+           (telescoping-long-trend 23 start end ndvi-ts reli-ts rain-ts))))))

 (def long-trend-query
-  (<- [?han-stat ?long-drop ?long-tstat]
+  (?<- (stdout) [?han-stat ?long-drop ?long-tstat]
       (ts-tap ?ts-map)
       (long-trend-results ?ts-map :> ?han-stat ?long-drop ?long-tstat)
       (:distinct false)))


Fix cancellation of auto-binder.

Fix cancellation of auto-binder.

--- src/afterglow/midi.clj
+++ src/afterglow/midi.clj
@@ -96,7 +96,7 @@
   removal is no longer of interest."
   [device f]
   {:pre [(= (type device) :midi-device) (fn? f)]}
-  (swap! disconnected-device-handlers #(update-in % [(:device device) disj f])))
+  (swap! disconnected-device-handlers #(update-in % [(:device device)] disj f)))

 (defonce ^{:private true
            :doc "The metronomes which are being synced to MIDI clock


Add ability to patch a group of fixtures at once.

--- src/afterglow/show.clj
+++ src/afterglow/show.clj
@@ -179,16 +179,16 @@

 (defn- address-map-internal
   "Helper function which returns a map whose keys are all addresses in use in a given universe
-  within a fixture map, and whose values are the fixture which is using that universe address."
+  within a fixture map, and whose values are the fixture key using that universe address."
   [fixtures universe]
   (reduce (fn [addr-map [k v]] (if (= universe (:universe (first (:channels v))))
-                                 (into addr-map (for [c (:channels v)] [(:address c) v]))
+                                 (into addr-map (for [c (:channels v)] [(:address c) (:id v)]))
                                  addr-map)) {} fixtures))

 (defn address-map
   "Returns a map whose keys are the IDs of the universes managed by the show, and whose values are
-  address maps for the corresponding universe. The address maps have keys for ever channel in use
-  by the show in that universe, and the value is the fixture using that address."
+  address maps for the corresponding universe. The address maps have keys for every channel in use
+  by the show in that universe, and the value is the key of the fixture using that address."
   [show]
   (into {} (for [u (:universes show)]
              [u (address-map-internal @(:fixtures show) u)])))
@@ -209,8 +209,7 @@
     (when (seq conflicts)
       (throw (IllegalStateException. (str "Cannot complete patch: "
                                           (clojure.string/join ", " (into [] (for [[k v] conflicts]
-                                                                               (str "Channel " k " in use by fixture "
-                                                                                (:id v)))))))))
+                                                                               (str "Channel " k " in use by fixture " v))))))))
     (assoc fixtures key (assoc fixture :id key))))

 (defn patch-fixture!
@@ -219,6 +218,19 @@
   (when-not (contains? (:universes show) universe)
     (throw (IllegalArgumentException. (str "Show does not contain universe " universe))))
   (swap! (:fixtures show) #(patch-fixture-internal % (keyword key) (chan/patch-fixture fixture universe start-address))))
+
+(defn patch-fixture-group!
+  "Patch a fixture group to a universe in the show at a starting DMX channel.
+Names will be assigned by adding a hyphen and numeric suffix, starting with 1,
+to the key supplied. If an offset is supplied, it will be added to the starting
+address for each subsequent fixture; if not, the largest offset used by the
+  fixture will be used to calculate a suitable offset."
+  ([show key fixture universe start-address count]
+   (patch-fixture-group! show key fixture universe start-address count (apply max (map :offset (:channels fixture)))))
+  ([show key fixture universe start-address count offset]
+   (for [i (range count)]
+     (patch-fixture! show (keyword (str (name key) "-" (inc i))) fixture universe (+ start-address (* i offset))))))
+

 (defn all-fixtures
   "Returns all fixtures patched in a show."


format javaparser

format javaparser

--- src/app/javaparser.clj
+++ src/app/javaparser.clj
@@ -209,7 +209,7 @@
     (do
       (when (zero? (count (.getParameters this)))
         (.setParameters this []))
-    (.getDeclarationAsString this false false)))
+      (.getDeclarationAsString this false false)))
   (getQName [this]
     (let [pn (.getParentNode this)]
       (str (getQName pn) "." (getName this)))))


fix typo

fix typo

--- src/babel/english.cljc
+++ src/babel/english.cljc
@@ -49,7 +49,7 @@
   (forest/lightning-bolt (:grammar medium) (:lexicon medium) spec 0 (:index medium) nil (:morph medium)))

 (defn parse
-  "parse a string in Italian into zero or more (hopefully more) phrase structure trees"
+  "parse a string in English into zero or more (hopefully more) phrase structure trees"

   ([input]
    (parse input medium))


diagnostics for ratholes in sentences.sh

--- src/babel/english.cljc
+++ src/babel/english.cljc
@@ -148,13 +148,14 @@
     (doall (map
             (fn [num]
               (let [specs (spec-fn)
-                    expr (-> (->> (lazy-seq specs)
-                                  (map (fn [spec]
-                                         (println (str "trying spec: " spec))
-                                         (generate spec :model model)))
-                                  (remove #(= :fail %))
-                                  (take 1))
-                             first)
+                    expr (first (->> (lazy-seq specs)
+                                     (map (fn [spec]
+                                            (generate spec :model model)))
+                                     (filter #(if (empty? (morph % :show-notes false))
+                                                (do (log/info (str "failed to generate with spec: " spec))
+                                                    false)
+                                                true))
+                                     (take 1)))
                     fo (morph expr :show-notes false)]
                 (let [to-print
                       (cond


spec rename

spec rename

--- test/celestial/integration/workflows/openstack.clj
+++ test/celestial/integration/workflows/openstack.clj
@@ -4,7 +4,7 @@
   (:require
     [celestial.fixtures.core :refer (with-defaults is-type? with-admin with-conf)]
     [celestial.persistency.systems :as s]
-    [celestial.fixtures.data :refer (redis-type local-conf redis-openstack)]
+    [celestial.fixtures.data :refer (redis-type local-conf redis-openstack-spec)]
     [celestial.fixtures.populate :refer (populate-system)]
     [celestial.integration.workflows.common :refer (spec get-spec)]
     [celestial.workflows :as wf]
@@ -17,7 +17,7 @@

 (with-admin
   (with-conf local-conf
-    (with-state-changes [(before :facts (populate-system redis-type redis-openstack))]
+    (with-state-changes [(before :facts (populate-system redis-type redis-openstack-spec))]
       (fact "openstack creation workflows" :integration :openstack :workflow
           (wf/create (spec)) => nil
           (wf/create (spec)) => (throws ExceptionInfo  (is-type? :celestial.workflows/machine-exists))


cleanup

cleanup

--- src/celestial/redis.clj
+++ src/celestial/redis.clj
@@ -12,7 +12,6 @@
 (ns celestial.redis
   "Redis utilities like a distributed lock, connection managment and ref watcher"
   (:use
-    [flatland.useful.map :on map-vals]
     [clojure.set :only (difference)]
     [flatland.useful.utils :only (defm)]
     [celestial.common :only (get! curr-time gen-uuid half-hour minute)]


moving puny connection to component

moving puny connection to component

--- src/celestial/redis.clj
+++ src/celestial/redis.clj
@@ -21,14 +21,11 @@
     [taoensso.carmine.locks :only (with-lock)]
     [taoensso.timbre :only (debug trace info error warn)])
   (:require
-    [puny.redis :as r]
     [taoensso.carmine.message-queue :as carmine-mq]
     [taoensso.carmine :as car])
   (:import java.util.Date))

-(defm server-conn [] {:pool {} :spec (get! :redis)})
-
-(r/server-conn (server-conn))
+(defn server-conn [] {:pool {} :spec (get! :redis)})

 (defmacro wcar [& body]
    `(try


add all resources to war

add all resources to war

--- src/cake/tasks/jar.clj
+++ src/cake/tasks/jar.clj
@@ -164,7 +164,7 @@
          (add-source-files "WEB-INF/classes")
          (add-zipfileset {:dir (file "src")         :prefix web     :includes "*web.xml"})
          (add-zipfileset {:dir (file "classes")     :prefix classes :includes "**/*.class"})
-         (add-zipfileset {:dir (file "resources")   :prefix classes :includes "*"})
+         (add-zipfileset {:dir (file "resources")   :prefix classes :includes "**/*"})
          (add-zipfileset {:dir (file "build" "jar") :prefix classes})
          (add-fileset    {:dir (file "build" "war")})
          (add-fileset    {:dir (file "src" "html")})


Unified timestamps for ss-ts, prog-event, reqs.

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -21,8 +21,8 @@
 (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.
-(def prog-history (atom []))  ; Each event is [ss-ts label prog-frame].
-(def prog-ss      (atom {}))  ; ss-ts => agw-snapshot.
+(def prog-history (atom []))  ; Each event is [ts label prog-frame].
+(def prog-ss      (atom {}))  ; ts => agw-snapshot.

 (defn prog-init [world]
   (reset! prog-base {:world world
@@ -53,17 +53,17 @@
   (reset! prog-hover nil)
   (.remove gdom/classes (gdom/getElement "prog-container") "hover"))

-(defn on-prog-frame-restore [ss-ts prog-frame]
+(defn on-prog-frame-restore [ts prog-frame]
   ; Time-travel to the past if snapshot is available.
-  (when-let [ago-ss (get @prog-ss ss-ts)]
+  (when-let [ago-ss (get @prog-ss ts)]
     (ago-restore (actx-agw (:world @prog-base)) ago-ss)
     ; TODO: This prog-frame deref is strange, as it turned into a
     ; om.core/MapCursor somehow during the event handler rather than
     ; an expected prog-frame dict.
     (reset! prog-curr @prog-frame)
     (reset! prog-hover nil)
-    (swap! prog-history #(vec (filter (fn [[s & _]] (<= s ss-ts)) %)))
-    (swap! prog-ss #(into {} (filter (fn [[s _]] (<= s ss-ts)) %)))
+    (swap! prog-history #(vec (filter (fn [[s & _]] (<= s ts)) %)))
+    (swap! prog-ss #(into {} (filter (fn [[s _]] (<= s ts)) %)))
     (cbfg.world.base/render-client-hist (:reqs @prog-curr))))

 ; -------------------------------------------------------------------
@@ -75,14 +75,14 @@

 (defn render-events [app owner]
   (apply dom/ul nil
-         (map (fn [[ss-ts label prog-frame]]
-                (dom/li #js {:className (str "evt evt-" ss-ts)
+         (map (fn [[ts label prog-frame]]
+                (dom/li #js {:className (str "evt evt-" ts)
                              :onMouseEnter #(on-prog-frame-focus prog-frame)
                              :onMouseLeave #(on-prog-frame-blur)}
                         (dom/button
-                         #js {:onClick #(on-prog-frame-restore ss-ts prog-frame)}
+                         #js {:onClick #(on-prog-frame-restore ts prog-frame)}
                          "rollback")
-                        (str ss-ts (apply str label))))
+                        (str ts (apply str label))))
               app)))

 (defn render-clients [app owner]
@@ -182,15 +182,14 @@
               prog-res (try (js/eval prog-js) (catch js/Object ex ex))]
           (go-loop [num-requests 0 num-responses 0]
             (let [[v ch] (alts! [req-ch (:res-ch @prog-base)])
-                  ts (+ num-requests num-responses)]
+                  ts (:ts @prog-curr)]
               (when v
                 (if (= ch req-ch)
                   (if (= (:op v) "replay")
                     (println "TODO-REPLAY-IMPL")
                     (let [req ((get req-handlers (:op v)) (assoc v :opaque ts))]
                       (when-let [client-req-ch
-                                 (get-in @prog-curr
-                                         [:clients (:client req) :req-ch])]
+                                 (get-in @prog-curr [:clients (:client req) :req-ch])]
                         (prog-event world [:req] #(assoc-in % [:reqs ts] [req nil]))
                         (cbfg.world.base/render-client-hist (:reqs @prog-curr))
                         (>! client-req-ch req)


core: interleave

core: interleave

--- data/core.clj
+++ data/core.clj
@@ -2037,3 +2037,20 @@
   (lazy-seq
    (when-let [s (seq coll)]
      (cons (first s) (take-nth n (drop n s))))))
+
+(defn interleave
+  "Returns a lazy seq of the first item in each coll, then the second etc."
+  {:added "1.0"}
+  ([] ())
+  ([c1] (lazy-seq c1))
+  ([c1 c2]
+   (lazy-seq
+    (let [s1 (seq c1) s2 (seq c2)]
+      (when (and s1 s2)
+        (cons (first s1) (cons (first s2)
+                               (interleave (rest s1) (rest s2))))))))
+  ([c1 c2 & colls]
+   (lazy-seq
+    (let [ss (map seq (conj colls c2 c1))]
+      (when (every? identity ss)
+        (concat (map first ss) (apply interleave (map rest ss))))))))


fix with-context

fix with-context

--- src/clj/flambo/api.clj
+++ src/clj/flambo/api.clj
@@ -57,8 +57,8 @@
     (spark-context conf)))

 (defmacro with-context
-  [context-sym & body]
-  `(let [~context-sym (f/spark-context "local[*]" "test")]
+  [context-sym conf & body]
+  `(let [~context-sym (f/spark-context ~conf)]
      (try
        ~@body
        (finally (.stop ~context-sym)))))


Fix Housekeeping?

Fix Housekeeping?

Does this fix Housekeeping?

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -753,10 +753,10 @@
    {:effect (effect (gain :credit 7 :bad-publicity 1))}

    "Housekeeping"
-   {:events {:play {:req (req (= side :runner)) :choices (req (:hand runner))
-                    :prompt "Choose a card to trash for Housekeeping" :once :per-turn
-                    :msg (msg "to force the Runner to trash " (:title target) " from Grip")
-                    :effect (effect (trash target))}}}
+   {:events {:runner-install {:req (req (= side :runner)) :choices (req (:hand runner))
+                              :prompt "Choose a card to trash for Housekeeping" :once :per-turn
+                              :msg (msg "to force the Runner to trash " (:title target) " from Grip")
+                              :effect (effect (trash target))}}}

    "House of Knives"
    {:data {:counter 3}


Insert middleware to provide templates with request

--- src/clj/ji/service.clj
+++ src/clj/ji/service.clj
@@ -150,4 +150,5 @@
                (route/not-found (tmpl/game-create game-id))))
         (GET "/" [] {:status 302 :headers {"Location" "/games"} :body ""})
         (route/resources "/"))
+      (tmpl/wrap-with-request)
       (wrap-params)))


blue lines

blue lines

--- src/cljs/sol/core.cljs
+++ src/cljs/sol/core.cljs
@@ -19,16 +19,19 @@
 (def ws (new js/WebSocket ws-url))

 (def two-pi (* 2 js/Math.PI))
-(def paper-dimensions {:width 2800 :height 1380})
+(def paper-dimensions {:width 820 :height 820})
+;; (def paper-dimensions {:width (.-innerWidth js/window) :height (.-innerHeight js/window)})
+;; (def paper-dimensions {:width 2800 :height 1380})
 (def draw (js/Snap (:width paper-dimensions) (:height paper-dimensions)))
 (def layer-radius 75)
 (def board-radius 400)
 (def sun-radius (- board-radius layer-radius))
 (def zone-opacity 0.3)
-(def starmax 2000)
+(def starmax 1000)
+;; (def starmax 2000)
 (def board-center
-  {:x (* 0.5 (.-innerWidth js/window))
-   :y (* 0.5 (.-innerHeight js/window))})
+  {:x (* 0.5 (:width paper-dimensions))
+   :y (* 0.5 (:height paper-dimensions))})

 (defn log
   [e]
@@ -220,7 +223,8 @@

 (defn init
   [data]
-  (draw-board))
+  (draw-board)
+  (log (.toString draw)))

 (defn dispatch-message
   []


[#10183] Fix balance updating on first transaction

--- src/status_im/ethereum/transactions/core.cljs
+++ src/status_im/ethereum/transactions/core.cljs
@@ -227,7 +227,7 @@
                   true
                   (conj (wallet/update-balances
                          (into [] (reduce (fn [acc {:keys [address block]}]
-                                            (if (> block min-known-block)
+                                            (if (>= block min-known-block)
                                               (conj acc address)
                                               acc))
                                           #{}


Added some fetch

Added some fetch

--- src-cljs/live/core.cljs
+++ src-cljs/live/core.cljs
@@ -1,26 +1,33 @@
 (ns live.core
   (:require [om-tools.core :refer-macros [defcomponent]]
             [om-tools.dom :as dom :include-macros true]
-
             [om.core :as om :include-macros true]
-
             [goog.net.cookies :as cks]
-
-            [cljs.reader :as cr])
+            [cljs.reader :as cr]
+            [fetch.remotes :as remotes])
+  (:require-macros [schema.macros :refer [defschema]]
+                   [fetch.macros :as fm]))

-  (:require-macros [schema.macros :refer [defschema]]))
+; Cookie stuff
+;(def cooky (goog.net.Cookies. js/Document))

-(def cooky (goog.net.Cookies. js/Document))
-
-(defn setcookie! [n]
-  (.set cooky "saved-count" n 500)
-  (.log js/console "set cookie"))
+;(defn setcookie! [n]
+  ;(.set cooky "saved-count" n 500)
+  ;(.log js/console "set cookie"))

 ;(setcookie! 39)

+;(.log js/console cooky)
+
+(defn log [expr]
+  (.log js/console expr)
+  expr)
+
 (defn change-count [owner f n]
   (om/set-state! owner :n (f n))
-  (setcookie! (f n)))
+  ;(setcookie! (f n))
+  (fm/remote (set-count) [ret] (log ret)))
+

 (defschema Counter
   {:value number})
@@ -45,14 +52,8 @@
         {:on-click #(change-count owner (fn [a] (* a 0)) n)}
         "Reset"))))

-(.log js/console cooky)
-      ;(.max-cookie-length goog.net.cookies "saved-count"))
-
-;(defn widget [data owner]
-  ;(reify
-    ;om/IRender
-    ;(render [this]
-      ;(dom/h1 nil (:text data)))))
-
 (om/root widget {:init (cr/read-string (.get cooky "saved-count"))}
   {:target (. js/document (getElementById "my-app"))})
+
+(fm/remote (get-count) [result]
+  (js/alert result))


Integrate new CLJS code

Integrate new CLJS code

--- src/active/clojure/cljs/record_cljs_internals.cljc
+++ src/active/clojure/cljs/record_cljs_internals.cljc
@@ -24,18 +24,23 @@
 (core/defn- build-map-factory [rsym rname fields]
   (core/let [fn-name (with-meta (symbol (core/str 'map-> rsym))
                        (assoc (meta rsym) :factory :map))
+             docstring (core/str "Factory function for " rname ", taking a map of keywords to field values.")
              ms (gensym)
              ks (map keyword fields)
              getters (map (core/fn [k] `(~k ~ms)) ks)]
-    `(defn ~fn-name [~ms]
-       (new ~rname ~@getters nil (not-empty (dissoc ~ms ~@ks)) nil))))
+    `(defn ~fn-name ~docstring [~ms]
+       (let [extmap# (cond->> (dissoc ~ms ~@ks)
+                       (record? ~ms) (into {}))]
+         (new ~rname ~@getters nil (not-empty extmap#) nil)))))

 (core/defn- build-positional-factory
   [rsym rname fields]
   (core/let [fn-name (with-meta (symbol (core/str '-> rsym))
                        (assoc (meta rsym) :factory :positional))
+             docstring (core/str "Positional factory function for " rname ".")
              field-values (if (core/-> rsym meta :internal-ctor) (conj fields nil nil nil) fields)]
     `(defn ~fn-name
+       ~docstring
        [~@fields]
        (new ~rname ~@field-values))))


perf tweak for rest

perf tweak for rest

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -462,8 +462,8 @@
     (if (satisfies? ISeq coll false)
       (-rest ^not-native coll)
       (let [s (seq coll)]
-        (if-not (nil? s)
-          (-rest s)
+        (if s
+          (-rest ^not-native s)
           ())))
     ()))


Fix invites button strings (@peeja did this with my fingers)

--- src-cljs/frontend/components/pages/team.cljs
+++ src-cljs/frontend/components/pages/team.cljs
@@ -105,10 +105,8 @@

 (defn- invite-button-text [number-of-invites]
   (if (zero? number-of-invites)
-    "Send Invite"
-    (gstr/format "Send %s %s"
-                 number-of-invites
-                 (inflections/pluralize number-of-invites "Invite"))))
+    "Send Invites"
+    (str "Send " (inflections/pluralize number-of-invites "Invite"))))

 (defn invite-teammates-modal [{:keys [selected-org close-fn show-modal?]} owner]
   (reify


Added route for static content.

Added route for static content.

--- app/src/clj_web_example/routes.clj
+++ app/src/clj_web_example/routes.clj
@@ -2,6 +2,7 @@
   (:require [compojure.api.sweet :refer :all]
             [schema.core :as s]
             [clj-web-example.ui.index :as index]
+            [compojure.route :as route]
             [ring.util.response :as response]))

 (def Message {:body s/Str})
@@ -15,6 +16,8 @@
     :no-doc true
     index/index-page)

+  (route/resources "/static")
+
   (context* "/api" []
     :tags ["API"]


improve order

improve order

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

--- buildscripts/buildcheck/src/buildcheck/core.clj
+++ buildscripts/buildcheck/src/buildcheck/core.clj
@@ -186,10 +186,10 @@
         (when (= 32 bits)
           (report-segment "Missing .vcproj files" missing-vcproj-files))
         (report-segment "Uncompiled device adapters" (missing-device-adapters bits))
-        "\n\nIs installer download available on website?\n"
-        (if installer-ok "Yes" "No. (build missing)\n")
         (when (= 32 bits)
           (report-segment "Missing device pages" (missing-device-pages)))
+        "\n\nIs installer download available on website?\n"
+        (if installer-ok "Yes." "No. (build missing)\n")
       ))))

 (defn make-full-report [mode send?]


Fix aliases and imports on core ns.

Fix aliases and imports on core ns.

--- src/bytebuf/core.cljx
+++ src/bytebuf/core.cljx
@@ -1,26 +1,32 @@
 (ns bytebuf.core
   (:refer-clojure :exclude [read byte float double short long bytes])
   (:require [bytebuf.spec :as spec]
+            [bytebuf.spec.basic :as basic-spec]
+            [bytebuf.spec.string :as string-spec]
             [bytebuf.buffer :as buffer]
             [bytebuf.proto :as proto]))

 (def compose-type spec/compose-type)
 (def spec spec/spec)
-;; (def string spec/string)
-;; (def string* spec/string*)
-(def int16 spec/int16)
-(def int32 spec/int32)
-(def int64 spec/int64)
-(def short spec/short)
-(def integer spec/integer)
-(def long spec/long)
-(def float spec/float)
-(def double spec/double)
-(def byte spec/byte)
-(def bytes spec/bytes)
-(def bool spec/bool)
+
+(def string string-spec/string)
+(def string* string-spec/string*)
+
+(def int16 basic-spec/int16)
+(def int32 basic-spec/int32)
+(def int64 basic-spec/int64)
+(def float basic-spec/float)
+(def double basic-spec/double)
+(def byte basic-spec/byte)
+(def bytes basic-spec/bytes)
+(def bool basic-spec/bool)
+
 (def allocate buffer/allocate)
 (def size proto/size)
+
+(def ^{:doc "Alias for int16"} short int16)
+(def ^{:doc "Alias for int32"} integer int32)
+(def ^{:doc "Alias for int64"} long int64)

 (defn write!
   "Write data into buffer following the specified


Moved function definitions to before usage. Added turns to tables.

--- src/demogorgon/web.clj
+++ src/demogorgon/web.clj
@@ -39,6 +39,9 @@
      [:br]
      content]]))

+(defn page-not-found []
+  "
Page not found
")
+
 (defn make-dump-link [row]
   (let [base (str "/user/" (:name row) "/dumps/" (:name row ) "." (:endtime row))
         file-base (str "/srv/un.nethack.nu" base)
@@ -51,23 +54,26 @@
       [:a {:href (str base extension)} "dump #" (:id row)]
       [:div "No dump file for game " (:id row)])))

+
+(defn rs-row-to-tr [row]
+  [:tr
+   [:td [:a {:href (str "/game/" (:id row))} (:id row)]]
+   [:td [:a {:href (str "/user/" (:name row))} (:name row)]]
+   [:td (:points row)]
+   [:td (:turns row)]
+   [:td (:deathdate row)]
+   [:td [:a {:href (str "/cause/" (url-encode (:death_uniq row)))} (:death row)]]])
+
 (defn rs-to-table [rs]
   [:table
    [:tr
     [:th "game"]
     [:th "name"]
     [:th "points"]
+    [:th "turns"]
     [:th "deathdate"]
     [:th "death"]]
    (map #'rs-row-to-tr rs)])
-
-(defn rs-row-to-tr [row]
-  [:tr
-   [:td [:a {:href (str "/game/" (:id row))} (:id row)]]
-   [:td [:a {:href (str "/user/" (:name row))} (:name row)]]
-   [:td (:points row)]
-   [:td (:deathdate row)]
-   [:td [:a {:href (str "/cause/" (url-encode (:death_uniq row)))} (:death row)]]])

 (defn game [id]
   (sql/with-connection db
@@ -119,11 +125,17 @@
            [:div
             [:h2 name]
             [:p (:games_played row) " games played, " (:ascensions row) " ascensions."]
-            [:br]
             [:a {:href (str "/user/" name "/dumps/")} "dumps"]
             [:br]
-            [:a {:href (str "/user/" name "/ttyrecs/")} "ttyrecs"]]))))))
-
+            [:a {:href (str "/user/" name "/ttyrecs/")} "ttyrecs"]
+            [:br]
+            [:br]
+            (sql/with-query-results
+              rs2
+              ["select * from xlogfile where name = ? order by endtime desc limit 50" name]
+              (doall rs2)
+              (rs-to-table rs2))]))))))
+
 (defn users []
   (sql/with-connection db
     (sql/with-query-results
@@ -148,9 +160,6 @@
                [:br]])
              rs)))))

-(defn page-not-found []
-  "
Page not found
")
-
 (defroutes main-routes
   (GET "/" [] (last-games 25))
   (GET "/highscores" [] (highscores 25))


Rename function

Rename function

--- src/expound/alpha.cljc
+++ src/expound/alpha.cljc
@@ -542,12 +542,12 @@
        form))
    groups))

-(defn ^:private remove-vec [v x]
+(defn ^:private vec-remove [v x]
   (vec (remove #{x} v)))

 (defn ^:private replace-group [groups old-groups group]
   (-> groups
-      (remove-vec old-groups)
+      (vec-remove old-groups)
       (conj (problem-group old-groups group))))

 (defn conj-groups


fixup! add tests

fixup! add tests

--- src/expound/alpha.cljc
+++ src/expound/alpha.cljc
@@ -181,7 +181,7 @@
 (defn ^:private spec-w-error-message? [via pred]
   (boolean (let [last-spec (last via)]
              (and (not= ::s/unknown pred)
-                  ;; (qualified-keyword? last-spec)
+                  (qualified-keyword? last-spec)
                   (error-message last-spec)
                   (s/get-spec last-spec)))))


+babel.francais.grammar/small

+babel.francais.grammar/small

--- src/babel/francais.cljc
+++ src/babel/francais.cljc
@@ -1,7 +1,7 @@
 (ns babel.francais
   (:require
    [babel.engine :as engine]
-   [babel.francais.grammar :refer [medium]]
+   [babel.francais.grammar :refer [medium small]]
    [babel.francais.morphology :as morph :refer [fo]]
    [babel.generate :as generate :refer [try-hard-to]]
    [babel.parse :as parse]


s/unifyc/unify/

s/unifyc/unify/

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -6,7 +6,7 @@
    #?(:clj [clojure.tools.logging :as log])
    #?(:cljs [babel.logjs :as log])
    [clojure.string :as string]
-   [dag_unify.core :refer [copy get-in fail? strip-refs unify unifyc]]))
+   [dag_unify.core :refer [copy get-in fail? strip-refs unify]]))

 ;; during generation, will not decend deeper than this when creating a tree:
 ;; TODO: should also be possible to override per-language.
@@ -340,16 +340,16 @@
   (filter #(not (= :fail %))
           (pmap (fn [rule]
                   (log/trace (str "candidate-parents: rule: " (:rule rule)))
-                  (if (and (not-fail? (unifyc (get-in rule [:synsem :cat] :top)
-                                              (get-in spec [:synsem :cat] :top)))
-                           (not-fail? (unifyc (get-in rule [:synsem :infl] :top)
-                                              (get-in spec [:synsem :infl] :top)))
-                           (not-fail? (unifyc (get-in rule [:synsem :sem :tense] :top)
-                                               (get-in spec [:synsem :sem :tense] :top)))
-                           (not-fail? (unifyc (get-in rule [:synsem :modified] :top)
-                                              (get-in spec [:synsem :modified] :top))))
+                  (if (and (not-fail? (unify (get-in rule [:synsem :cat] :top)
+                                             (get-in spec [:synsem :cat] :top)))
+                           (not-fail? (unify (get-in rule [:synsem :infl] :top)
+                                             (get-in spec [:synsem :infl] :top)))
+                           (not-fail? (unify (get-in rule [:synsem :sem :tense] :top)
+                                             (get-in spec [:synsem :sem :tense] :top)))
+                           (not-fail? (unify (get-in rule [:synsem :modified] :top)
+                                             (get-in spec [:synsem :modified] :top))))
                     (let [result
-                           (unifyc spec rule)]
+                          (unify spec rule)]
                       (if (fail? result)
                         :fail
                         result))