Fix ns and function name of initial message filter

Also refactored all the client.initiate references to log2 to log, since
it is no longer referencing clojure.tools.logging.

--- src/clojure/frereth_cp/client/initiate.clj
+++ src/clojure/frereth_cp/client/initiate.clj
@@ -6,7 +6,7 @@
             [frereth-cp.shared.bit-twiddling :as b-t]
             [frereth-cp.shared.constants :as K]
             [frereth-cp.shared.crypto :as crypto]
-            [frereth-cp.shared.logging :as log2]
+            [frereth-cp.shared.logging :as log]
             [frereth-cp.shared.serialization :as serial]
             [frereth-cp.shared.specs :as specs]
             [frereth-cp.util :as utils])
@@ -31,10 +31,10 @@
         :args (s/cat :this ::state/state
                      :msg bytes?
                      :outer-nonce-suffix bytes?)
-        :ret (s/keys :req [::crypto-box ::log2/state]))
+        :ret (s/keys :req [::crypto-box ::log/state]))
 (defn build-initiate-interior
   "This is the 368+M cryptographic box that's the real payload/Vouch+message portion of the Initiate pack"
-  [{log-state ::log2/state
+  [{log-state ::log/state
     :as this} msg outer-nonce-suffix]
   ;; Important detail: we can use up to 640 bytes that we've
   ;; received from the client/child.
@@ -52,19 +52,19 @@
              ::K/child-message msg}
         work-area (::shared/work-area this)
         secret (get-in this [::state/shared-secrets ::state/client-short<->server-short])
-        log-state (log2/info log-state
-                             ::build-initiate-interior
-                             "Encrypting\nFIXME: Do not log the shared secret!"
-                             {::source src
-                              ::inner-nonce-suffix (b-t/->string inner-nonce-suffix)
-                              ::shared-secret (b-t/->string secret)})]
+        log-state (log/info log-state
+                            ::build-initiate-interior
+                            "Encrypting\nFIXME: Do not log the shared secret!"
+                            {::source src
+                             ::inner-nonce-suffix (b-t/->string inner-nonce-suffix)
+                             ::shared-secret (b-t/->string secret)})]
     {::crypto-box (crypto/build-crypto-box tmplt
                                            src
                                            (::shared/text work-area)
                                            secret
                                            K/initiate-nonce-prefix
                                            outer-nonce-suffix)
-     ::log2/state log-state}))
+     ::log/state log-state}))

 (s/fdef build-initiate-packet!
         :args (s/cat :this ::state/state
@@ -75,13 +75,13 @@
                                        ;; documentation.
                                        (fn [bs]
                                          (let [{:keys [::message/possible-response]}
-                                               (K/initiate-message-length-filter bs)]
+                                               (message/filter-initial-message-bytes bs)]
                                            possible-response))))
         :fn (fn [x]
               (let [legal-to-send (-> x
                                       :args
                                       :msg-bytes
-                                      K/initiate-message-length-filter
+                                      message/filter-initial-message-bytes
                                       ::message/possible-response)
                     real-result (-> x
                                     :ret
@@ -90,14 +90,14 @@
                    (+ 544 (count legal-to-send)))
                 true))
         :ret (s/keys :opt [::specs/byte-buf]
-                     :req [::log2/state]))
+                     :req [::log/state]))
 (defn build-initiate-packet!
   "Combine message buffer and client state into an Initiate packet

 This was destructive in the sense that it overwrites ::shared/work-area
 FIXME: Change that"
   [this msg-bytes]
-  (let [{log-state ::log2/state
+  (let [{log-state ::log/state
          msg ::message/possible-response} (message/filter-initial-message-bytes this
                                                                                msg-bytes)]
     (if msg
@@ -115,12 +115,12 @@
             nonce-suffix (b-t/sub-byte-array working-nonce
                                              K/client-nonce-prefix-length)
             {:keys [::crypto-box]
-             log-state ::log2/state} (build-initiate-interior this msg nonce-suffix)
-            log-state (log2/info log-state
-                                 ::build-initiate-packet!
-                                 "Stuffing crypto-box into Initiate packet"
-                                 {::crypto-box (b-t/->string crypto-box)
-                                  ::message-length (count crypto-box)})
+             log-state ::log/state} (build-initiate-interior this msg nonce-suffix)
+            log-state (log/info log-state
+                                ::build-initiate-packet!
+                                "Stuffing crypto-box into Initiate packet"
+                                {::crypto-box (b-t/->string crypto-box)
+                                 ::message-length (count crypto-box)})
             dscr (update-in K/initiate-packet-dscr
                             [::K/vouch-wrapper ::K/length]
                             +
@@ -136,8 +136,8 @@
         {::specs/byte-buf
          (serial/compose dscr
                          fields)
-         ::log2/state log-state})
-      {::log2/state log-state})))
+         ::log/state log-state})
+      {::log/state log-state})))

 (s/fdef build-and-send-vouch!
         :args (s/cat :wrapper ::state/state-agent
@@ -159,58 +159,58 @@
     (send wrapper (fn [_]
                     (throw (ex-info "Should have a valid cookie response packet, but do not"
                                     @wrapper)))))
-  (let [{log-state ::log2/state
-         logger ::log2/logger
+  (let [{log-state ::log/state
+         logger ::log/logger
          :as state} @wrapper
-        log-state (log2/info log-state
-                             ::build-and-send-vouch
-                             ""
-                             {::cause "Received cookie"
-                              ::effect "Forking child"
-                              ::state/state (dissoc state ::log2/state)})
+        log-state (log/info log-state
+                            ::build-and-send-vouch
+                            ""
+                            {::cause "Received cookie"
+                             ::effect "Forking child"
+                             ::state/state (dissoc state ::log/state)})
         ;; Once we've signaled the child to start doing its own thing,
         ;; cope with the cookie we just received.
         ;; Doing this statefully seems like a terrible
         ;; idea, but I don't want to go back and rewrite it
         ;; until I have a working prototype.
-        log-state (log2/info log-state
-                             ::build-and-send-vouch
-                             "Converting cookie->vouch")]
+        log-state (log/info log-state
+                            ::build-and-send-vouch
+                            "Converting cookie->vouch")]
     (let [state (state/cookie->vouch state cookie-packet)
           timeout (state/current-timeout wrapper)]
       ;; Give the other thread(s) a chance to catch up and return
       ;; from fork!
       (when-not (await-for timeout wrapper)
-        (let [log-updates [#(log2/error %
-                                        ::build-and-send-vouch
-                                        (str "Converting cookie to vouch took longer than "
-                                             timeout
-                                             " milliseconds."))]
+        (let [log-updates [#(log/error %
+                                       ::build-and-send-vouch
+                                       (str "Converting cookie to vouch took longer than "
+                                            timeout
+                                            " milliseconds."))]
               log-updates (if-let [ex (agent-error wrapper)]
                             (let [log-state (reduce (fn [current log-fn]
                                                       (log-fn current))
                                                     log-state
                                                     log-updates)]
-                              (log2/flush-logs! logger
-                                                (log2/exception log-state
-                                                                ex
-                                                                ::build-and-send-vouch
-                                                                "Agent failed while we were waiting"))
+                              (log/flush-logs! logger
+                                               (log/exception log-state
+                                                              ex
+                                                              ::build-and-send-vouch
+                                                              "Agent failed while we were waiting"))
                               ;; It's very tempting to make this just kill the client.
                               ;; Then again, for all intents and purposes it's already
                               ;; dead.
                               ;; TODO: we do need to signal the message loop to exit
                               (assert (not ex) (str "Should probably be fatal for the sake of debugging:\n"
-                                                    (log2/exception-details ex))))
+                                                    (log/exception-details ex))))
                             (let [log-update
-                                  #(log2/warn %
-                                              ::build-and-send-vouch
-                                              "Switching agent into an error state")]
+                                  #(log/warn %
+                                             ::build-and-send-vouch
+                                             "Switching agent into an error state")]
                               (send wrapper
                                     #(throw (ex-info "cookie->vouch timed out" %)))
                               (conj log-updates log-update)))]
-          (send wrapper (fn [{log-state ::log2/state
-                              logger ::log2/logger
+          (send wrapper (fn [{log-state ::log/state
+                              logger ::log/logger
                               :as this}]
                           ;; This is pretty obnoxious.
                           ;; I want to apply the functions that
@@ -225,14 +225,14 @@
                                                   log-state
                                                   log-updates)]
                             (assoc this
-                                   ::log2/state
-                                   (log2/flush-logs! logger log-state)))))))
+                                   ::log/state
+                                   (log/flush-logs! logger log-state)))))))
       (when-let [ex (agent-error wrapper)]
-        (log2/flush-logs! logger (log2/exception log-state
-                                                 ex
-                                                 ::build-and-send-vouch))
+        (log/flush-logs! logger (log/exception log-state
+                                               ex
+                                               ::build-and-send-vouch))
         (throw ex))
-      (log2/flush-logs! logger (log2/debug log-state
-                                           ::build-and-send-vouch
-                                           "cookie converted to vouch"))
+      (log/flush-logs! logger (log/debug log-state
+                                         ::build-and-send-vouch
+                                         "cookie converted to vouch"))
       (send-off wrapper state/send-vouch! wrapper))))


Add cam-name in img maps

Add cam-name in img maps

--- src/mars_ogler/scrape.clj
+++ src/mars_ogler/scrape.clj
@@ -45,7 +45,8 @@
 (defn id->camera
   [id]
   (let [abbrev (re-find #"[A-Z]+" id)]
-    (cams/abbrev->cam abbrev)))
+    {:cam (cams/abbrev->cam abbrev)
+     :cam-name (cams/abbrev->name abbrev)}))

 (defn id->type
   [id]
@@ -70,7 +71,7 @@
   [div]
   (let [rawtable (-> (html/select div [:.rawtable]) first)
         id (-> (html/select rawtable [:a]) first html/text str/trim)
-        cam (id->camera id)
+        {:keys [cam cam-name]} (id->camera id)
         type (id->type id)
         sol (->> (html/text rawtable) (re-find #"sol (\d+)") second Integer.)
         [marstime taken-utc released] (div->times div)
@@ -79,7 +80,7 @@
         url (-> (html/select div [:.rawtable :a]) first :attrs :href)
         dims (->> (re-find #"(\d+)x(\d+)" (html/text div)) (drop 1))
         [w h] (for [dim dims] (Integer/parseInt dim))]
-    {:w w, :h h, :id id, :cam cam, :type type, :sol sol
+    {:w w, :h h, :id id, :cam cam, :cam-name cam-name :type type, :sol sol
      :taken-marstime marstime :taken-utc taken-utc, :released released
      :thumbnail-url thumbnail-url, :url url}))


made the future fact reports (both varieties) format the same way the fact reports do.

--- src/midje/util/report.clj
+++ src/midje/util/report.clj
@@ -57,6 +57,12 @@

 (defmulti report-strings :type)

+(defmethod report-strings :future-fact [m]
+  (list
+   (str "\n" (color/note "WORK TO DO:") " "
+        (when-let [doc (:description m)] (str (pr-str doc) " "))
+        "at " (midje-position-string (:position m)))))
+
 (defmethod report-strings :mock-argument-match-failure [m]
    (list
     (fail-at m)
@@ -107,12 +113,6 @@
    "Actual result was NOT supposed to agree with the checking function."
    (str "        Actual result: " (attractively-stringified-form (:actual m)))
    (str "    Checking function: " (pr-str (:expected m)))))
-
-(defmethod report-strings :future-fact [m]
-  (list
-   (str "\n" (color/note "WORK TO DO:") " "
-        (:description m) " "
-        (midje-position-string (:position m)))))

 (defmethod report-strings :user-error [m]
    (list


Throw friendly exception when the user doesn't specify both the val and rate in synth params when using a vec

--- src/overtone/sc/synth.clj
+++ src/overtone/sc/synth.clj
@@ -197,7 +197,9 @@
   [params]
   (for [[p-name p-val] (partition 2 params)]
     (let [[p-val p-rate] (if (vector? p-val)
-                           p-val
+                           (do (when-not (= 2 (count p-val))
+                                 (throw (IllegalArgumentException. (str "When specifiying the rate of a control, you need to use a vector of two args - default and rate i.e. [0.2 :ar]. Got: " p-val))))
+                               p-val)
                            [p-val DEFAULT-RATE])]
       {:name  (str p-name)
        :default (float p-val)


apostrophe police out on patrol

apostrophe police out on patrol

--- src/overtone/sc/synth.clj
+++ src/overtone/sc/synth.clj
@@ -673,7 +673,7 @@
           (throw (IllegalArgumentException. (str "Invalid control parameter: " param))))))))

 (defn reset-synth-defaults
-  "Reset a synth to it's default settings defined at definition time."
+  "Reset a synth to its default settings defined at definition time."
   [synth]
   (doseq [param (:params synth)]
     (reset! (:value param) (:default param))))


Got conservation of momentum working properly

--- src/particlebox/core.cljs
+++ src/particlebox/core.cljs
@@ -6,7 +6,7 @@
 (def particle-count 10)
 (def gravitational-constant 200)
 (def initial-speed 0)
-(def bounciness 0.4)
+(def bounciness 0.6)

 (def scene-width window/innerWidth)
 (def scene-height window/innerHeight)
@@ -191,15 +191,17 @@
         (for [[a pa b pb] collisions
               :let [dir (direction-from (:pos pa) (:pos pb))
                     dist (distance (:pos pa) (:pos pb))
-                    bounce (direction dir (/ (- particle-diameter dist) 2))]]
+                    bounce (direction dir (/ (- particle-diameter dist) 2))
+                    acomp (project (:vel pa) dir)
+                    bcomp (project (:vel pb) (direction dir -1))]]
           [a :pos #(map - % bounce)
-           a :vel #(map -
+           a :vel #(map +
                         %
-                        (scale (project % dir) bounciness))
+                        (scale (map - bcomp acomp) bounciness))
            b :pos #(map + % bounce)
-           b :vel #(map -
+           b :vel #(map +
                         %
-                        (scale (project % (direction dir -1)) bounciness))])))))
+                        (scale (map - acomp bcomp) bounciness))])))))

 (defn generate-particles
   "Creates the given number of particles, and arranges them in the universe


add lines to the schema

add lines to the schema

--- src/pc/datomic/schema.clj
+++ src/pc/datomic/schema.clj
@@ -32,6 +32,7 @@
    (enum :layer.type/rect)
    (enum :layer.type/group)
    (enum :layer.type/text)
+   (enum :layer.type/line)

    (attribute :layer/start-x
               :db.type/long)


(MAINT) fix errant docstring

(MAINT) fix errant docstring

--- src/clj/puppetlabs/services/request_handler/request_handler_core.clj
+++ src/clj/puppetlabs/services/request_handler/request_handler_core.clj
@@ -249,8 +249,8 @@
        :puppetlabs.services.request-handler.request-handler-core/bad-request)))

 (defn jruby-timeout?
+  "Determine if the supplied slingshot message is for a JRuby borrow timeout."
   [x]
-  "Determine if the supplied slingshot message is for a JRuby borrow timeout."
   (when (map? x)
     (= (:type x)
        :puppetlabs.services.jruby.jruby-puppet-service/jruby-timeout)))


Move update's definition to before it's used.

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -32,6 +32,7 @@
 (defn shift [f x] (connect #(+ x %) f))
 (def major (scale [2 2 1 2 2 2 1]))
 (def g-major (translate major 0 74))
+(defn update [k f] #(update-in % [k] f))

 (defn bpm [per-minute] #(-> % (/ per-minute) (* 60) (* 1000)))
 (defn run [a & bs]
@@ -72,7 +73,6 @@
         play-at #(at %1 (piano# %2))]
     (dorun (map play-at (:time notes) (:pitch notes)))))

-(defn update [k f] #(update-in % [k] f))
 (def mirror (update :pitch #(connect - %)))
 (defn after [beats] (update :time #(shift % beats)))
 (defn transpose [interval] (update :pitch #(shift % interval)))


Can pull transactions for category

Can pull transactions for category

--- src/swanson/models/db.clj
+++ src/swanson/models/db.clj
@@ -94,3 +94,12 @@
 (defn get-transactions-by-week []
   (with-db sql/with-query-results rows [week-grouping-query]
       (doall rows)))
+
+(defn for-category
+  [category-id]
+  (with-db sql/with-query-results
+    rows
+    ["SELECT id, date, amount, category_id, description
+     FROM transactions
+     WHERE category_id = ?
+     ORDER BY date DESC" category-id] (doall rows)))


fix gender agreement for "name"

fix gender agreement for "name"

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -644,6 +644,7 @@
                    :obj {:human true}}}}
    "her"
    {:synsem {:cat :det
+             :agr {:gender :fem}
              :sem {:pred :lei}
              :def :possessive}}
    "herself"
@@ -671,6 +672,7 @@
              :subcat '()}}
    "his"
    {:synsem {:cat :det
+             :agr {:gender :masc}
              :sem {:pred :lui}
              :def :possessive}}

@@ -958,17 +960,19 @@
                    :pred :I}
              :subcat '()}}
    "name"
-   (let [of (ref :top)]
+   (let [of (ref :top)
+         agr (ref :top)]
      (unify agreement-noun
             common-noun
             countable-noun
-            {:synsem {:sem {:animate false
+            {:synsem {:agr agr
+                      :sem {:animate false
                             :pred :name
                             :subj of}
-                      :subcat {:1 {:cat :det
+                      :subcat {:1 {:agr agr
+                                   :cat :det
                                    :def :possessive
                                    :sem of}}}}))
-
    "note" {:synsem {:cat :verb
                     :sem {:pred :note}}}


constrain 'llamarse' to be only present+progressive

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -497,8 +497,10 @@
          subject-person (ref :top)
          subject-number (ref :top)]
      {:synsem {:cat :verb
-               :sem {:pred :be-called
+               :sem {:aspect :progressive
+                     :pred :be-called
                      :reflexive true
+                     :tense :present
                      :subj subject-semantics
                      :obj called-semantics}
                :subcat {:1 {:propernoun false


Fix indentation

Fix indentation

--- src/braid/server/db/group.clj
+++ src/braid/server/db/group.clj
@@ -15,11 +15,11 @@
 (defn group-with-slug-exists?
   [slug]
   (boolean (first (d/q '[:find [?g]
-                :in $ ?slug
-                :where
-                [?g :group/slug ?slug]]
-              (db/db)
-              slug))))
+                         :in $ ?slug
+                         :where
+                         [?g :group/slug ?slug]]
+                       (db/db)
+                       slug))))

 (defn group-by-id
   [group-id]


Allow to override default Jenkins sync start date

--- src/buildviz/jenkins/sync.clj
+++ src/buildviz/jenkins/sync.clj
@@ -8,16 +8,24 @@
             [clj-time
              [coerce :as tc]
              [core :as t]
+             [format :as tf]
              [local :as l]]
             [clojure.string :as string]
             [clojure.tools
              [cli :refer [parse-opts]]
              [logging :as log]]))

+(def tz (t/default-time-zone))
+
+(def date-formatter (tf/formatter tz "YYYY-MM-dd" "YYYY/MM/dd" "YYYYMMdd" "dd.MM.YYYY"))
+
 (def cli-options
   [["-b" "--buildviz URL" "URL pointing to a running buildviz instance"
     :id :buildviz-url
     :default "http://localhost:3000"]
+   ["-f" "--from DATE" "Date from which on builds are loaded, if not specified tries to pick up where the last run finished"
+    :id :sync-start-time
+    :parse-fn #(tf/parse date-formatter %)]
    ["-h" "--help"]])

 (defn usage [options-summary]
@@ -69,6 +77,9 @@
   (sort-by :timestamp builds))

 (defn- sync-jobs [jenkins-url buildviz-url sync-start-time]
+  (println "Jenkins" jenkins-url "-> buildviz" buildviz-url)
+  (println (format "Finding all builds for syncing (starting from %s)..."
+                 (tf/unparse (:date-time tf/formatters) sync-start-time)))
   (->> (api/get-jobs jenkins-url)
        (mapcat #(all-builds-for-job jenkins-url sync-start-time %))
        (progress/init "Syncing")
@@ -89,10 +100,12 @@
     (when-let [latest-build-start (:latestBuildStart buildviz-status)]
       (tc/from-long latest-build-start))))

-(defn- get-start-date [buildviz-url]
-  (if-let [latest-sync-build-start (get-latest-synced-build-start buildviz-url)]
-    latest-sync-build-start
-    last-week))
+(defn- get-start-date [buildviz-url date-from-config]
+  (if (some? date-from-config)
+    date-from-config
+    (if-let [latest-sync-build-start (get-latest-synced-build-start buildviz-url)]
+      latest-sync-build-start
+      last-week)))

 (defn -main [& c-args]
@@ -104,6 +117,6 @@

     (let [jenkins-url (first (:arguments args))
           buildviz-url (:buildviz-url (:options args))
-          sync-start-time (get-start-date buildviz-url)]
+          sync-start-time (get-start-date buildviz-url (:sync-start-time (:options args)))]

       (sync-jobs jenkins-url buildviz-url sync-start-time))))


rename exit time and exit code on action logs

--- src/circle/backend/action.clj
+++ src/circle/backend/action.clj
@@ -92,11 +92,11 @@

 (defn add-end-time
   []
-  (record assoc :end-time (time/ju-now)))
+  (record assoc :end_time (time/ju-now)))

 (defn add-exit-code
   [exit-code]
-  (record assoc :exit-code exit-code))
+  (record assoc :exit_code exit-code))

 (defn add-err
   "Appends stderr strings to action result"


New functions format-time

New functions format-time

--- src/clj_calendar/calendar.clj
+++ src/clj_calendar/calendar.clj
@@ -83,6 +83,11 @@
     [calendar]
     (format-date-using-desired-format calendar "yyyy-MM-dd"))

+(defn format-time
+    "Format given date using the following date/time format: 'HH:mm:ss'"
+    [caleldar]
+    (format-date-using-desired-format cal "HH:mm:ss"))
+
 (defn format-date-time
     "Format given date using the following date/time format: 'yyyy-MM-dd HH:mm:ss'"
     [calendar]


use threading macro to tidy consumer.zk/messages

--- src/clj_kafka/consumer/zk.clj
+++ src/clj_kafka/consumer/zk.clj
@@ -39,7 +39,7 @@
   (let [[queue-seq queue-put] (pipe)]
     (doseq [[topic streams] (.createMessageStreams consumer (topic-map topics))]
       (future (doseq [msg (iterator-seq (.iterator (first streams)))]
-                (queue-put (assoc (to-clojure msg) :topic topic)))))
+                (queue-put (-> msg to-clojure (assoc :topic topic))))))
     queue-seq))

 (defn topics


swagger naming + version #377

swagger naming + version
#377

--- src/cljc/swarmpit/routes.cljc
+++ src/cljc/swarmpit/routes.cljc
@@ -5,7 +5,18 @@
             #?(:cljs [reitit.frontend :as rf])
             #?(:clj [reitit.swagger :as swagger])
             #?(:clj [swarmpit.handler :as handler])
+            #?(:clj [swarmpit.version :as version])
             #?(:clj [swarmpit.event.handler :as event-handler])))
+
+#?(:clj
+   (defn api-version []
+     (let [version (version/info)]
+       (clojure.string/replace
+         (:version version)
+         #"SNAPSHOT"
+         (->> (:revision version)
+              (take 7)
+              (apply str))))))

 (def backend
   [["/"
@@ -63,14 +74,16 @@
     ["/swagger.json"
      {:get (array-map
              :no-doc true
-             :swagger {:info {:version     "1.0"
-                              :title       "Swarmpit API"
-                              :description "Swarmpit backend API description"
-                              :contact     {:name  "Swarmpit Team"
-                                            :email "team@swarmpit.io"
-                                            :url   "https://swarmpit.io"}
-                              :license     {:name "Eclipse Public License"
-                                            :url  "http://www.eclipse.org/legal/epl-v10.html"}}}
+             :swagger {:info
+                       (array-map
+                         :title "Swarmpit API"
+                         :description "Swarmpit backend API description"
+                         :contact {:name  "Swarmpit Team"
+                                   :email "team@swarmpit.io"
+                                   :url   "https://swarmpit.io"}
+                         :license {:name "Eclipse Public License"
+                                   :url  "http://www.eclipse.org/legal/epl-v10.html"}
+                         #?@(:clj [:version (api-version)]))}
              #?@(:clj [:handler (swagger/create-swagger-handler)]))}]
     ["/me"
      {:name    :me
@@ -125,11 +138,13 @@
      {:name    :stacks
       :swagger {:tags ["stack"]}
       :get     (array-map
+                 :summary "Stack list"
                  :parameters {:header {:authorization string?}}
                  :responses {200 {:body        spec/stack
                                   :description "Success"}}
                  #?@(:clj [:handler handler/stacks]))
       :post    (array-map
+                 :summary "Create stack"
                  :parameters {:header {:authorization string?}
                               :body   spec/stack-compose}
                  :responses {201 {:body        nil
@@ -139,6 +154,7 @@
      {:name    :stack
       :swagger {:tags ["stack"]}
       :post    (array-map
+                 :summary "Edit stack"
                  :parameters {:header {:authorization string?}
                               :path   {:name string?}
                               :body   spec/stack-compose}
@@ -146,6 +162,7 @@
                                   :description "Success"}}
                  #?@(:clj [:handler handler/stack-update]))
       :delete  (array-map
+                 :summary "Delete stack"
                  :parameters {:header {:authorization string?}
                               :path   {:name string?}}
                  :responses {200 {:body        nil
@@ -155,6 +172,7 @@
      {:name    :stack-file
       :swagger {:tags ["stack"]}
       :get     (array-map
+                 :summary "Stack info"
                  :parameters {:header {:authorization string?}
                               :path   {:name string?}}
                  :responses {200 {:body        spec/stack-file
@@ -164,6 +182,7 @@
      {:name    :stack-compose
       :swagger {:tags ["stack"]}
       :get     (array-map
+                 :summary "Stack compose"
                  :parameters {:header {:authorization string?}
                               :path   {:name string?}}
                  :responses {200 {:body        spec/stack-compose
@@ -173,6 +192,7 @@
      {:name    :stack-services
       :swagger {:tags ["stack"]}
       :get     (array-map
+                 :summary "Stack services"
                  :parameters {:header {:authorization string?}
                               :path   {:name string?}}
                  :responses {200 {:body        [spec/service]
@@ -182,6 +202,7 @@
      {:name    :stack-networks
       :swagger {:tags ["stack"]}
       :get     (array-map
+                 :summary "Stack networks"
                  :parameters {:header {:authorization string?}
                               :path   {:name string?}}
                  :responses {200 {:body        [spec/network]
@@ -191,6 +212,7 @@
      {:name    :stack-volumes
       :swagger {:tags ["stack"]}
       :get     (array-map
+                 :summary "Stack volumes"
                  :parameters {:header {:authorization string?}
                               :path   {:name string?}}
                  :responses {200 {:body        [(merge spec/volume spec/mount)]
@@ -200,6 +222,7 @@
      {:name    :stack-configs
       :swagger {:tags ["stack"]}
       :get     (array-map
+                 :summary "Stack configs"
                  :parameters {:header {:authorization string?}
                               :path   {:name string?}}
                  :responses {200 {:body        [(dissoc spec/config :data)]
@@ -209,6 +232,7 @@
      {:name    :stack-secrets
       :swagger {:tags ["stack"]}
       :get     (array-map
+                 :summary "Stack secrets"
                  :parameters {:header {:authorization string?}
                               :path   {:name string?}}
                  :responses {200 {:body        [spec/secret]
@@ -218,6 +242,7 @@
      {:name    :stack-redeploy
       :swagger {:tags ["stack"]}
       :post    (array-map
+                 :summary "Redeploy stack"
                  :parameters {:header {:authorization string?}
                               :path   {:name string?}}
                  :responses {200 {:body        nil
@@ -227,6 +252,7 @@
      {:name    :stack-rollback
       :swagger {:tags ["stack"]}
       :post    (array-map
+                 :summary "Rollback stack"
                  :parameters {:header {:authorization string?}
                               :path   {:name string?}}
                  :responses {200 {:body        nil
@@ -239,6 +265,7 @@
       {:name    :users
        :swagger {:tags ["user"]}
        :get     (array-map
+                  :summary "User list"
                   :parameters {:header {:authorization string?}}
                   :responses {200 {:body        [spec/user]
                                    :description "Success"}}
@@ -254,18 +281,21 @@
       {:name    :user
        :swagger {:tags ["user"]}
        :get     (array-map
+                  :summary "User info"
                   :parameters {:header {:authorization string?}
                                :path   {:id string?}}
                   :responses {200 {:body        spec/user
                                    :description "Success"}}
                   #?@(:clj [:handler handler/user]))
        :delete  (array-map
+                  :summary "Delete user"
                   :parameters {:header {:authorization string?}
                                :path   {:id string?}}
                   :responses {200 {:body        nil
                                    :description "Success"}}
                   #?@(:clj [:handler handler/user-delete]))
        :post    (array-map
+                  :summary "Edit user"
                   :parameters {:header {:authorization string?}
                                :path   {:id string?}
                                :body   spec/user-update}
@@ -277,11 +307,13 @@
      {:name    :secrets
       :swagger {:tags ["secret"]}
       :get     (array-map
+                 :summary "Secret list"
                  :parameters {:header {:authorization string?}}
                  :responses {200 {:body        [spec/secret]
                                   :description "Success"}}
                  #?@(:clj [:handler handler/secrets]))
       :post    (array-map
+                 :summary "Create secret"
                  :parameters {:header {:authorization string?}
                               :body   spec/secret-create}
                  :responses {201 {:body        {:id string?}
@@ -291,6 +323,7 @@
      {:name    :secret
       :swagger {:tags ["secret"]}
       :get     (array-map
+                 :summary "Secret info"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        spec/secret
@@ -303,6 +336,7 @@
                               :path   {:id string?}}
                  #?@(:clj [:handler handler/secret-update]))
       :delete  (array-map
+                 :summary "Delete secret"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        nil
@@ -312,6 +346,7 @@
      {:name    :secret-services
       :swagger {:tags ["secret"]}
       :get     (array-map
+                 :summary "Secret services"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        [spec/service]
@@ -322,11 +357,13 @@
      {:name    :configs
       :swagger {:tags ["config"]}
       :get     (array-map
+                 :summary "Config list"
                  :parameters {:header {:authorization string?}}
                  :responses {200 {:body        [spec/config]
                                   :description "Success"}}
                  #?@(:clj [:handler handler/configs]))
       :post    (array-map
+                 :summary "Create config"
                  :parameters {:header {:authorization string?}
                               :body   spec/config-create}
                  :responses {201 {:body        {:id string?}
@@ -336,12 +373,14 @@
      {:name    :config
       :swagger {:tags ["config"]}
       :get     (array-map
+                 :summary "Config info"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        spec/config
                                   :description "Success"}}
                  #?@(:clj [:handler handler/config]))
       :delete  (array-map
+                 :summary "Delete config"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        nil
@@ -351,6 +390,7 @@
      {:name    :config-services
       :swagger {:tags ["config"]}
       :get     (array-map
+                 :summary "Config services"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        [spec/service]
@@ -361,6 +401,7 @@
      {:name    :public-repositories
       :swagger {:tags ["repository"]}
       :get     (array-map
+                 :summary "Public repositories"
                  :parameters {:header {:authorization string?}
                               :query  {:query string?
                                        :page  int?}}
@@ -420,6 +461,7 @@
      ["/tags"
       {:name :repository-tags
        :get  (array-map
+               :summary "Repository tags"
                :parameters {:header {:authorization string?}
                             :query  {:repository string?}}
                :responses {200 {:body        [string?]
@@ -428,6 +470,7 @@
      ["/ports"
       {:name :repository-ports
        :get  (array-map
+               :summary "Repository ports"
                :parameters {:header {:authorization string?}
                             :query  {:repository    string?
                                      :repositoryTag string?}}
@@ -441,11 +484,13 @@
      {:name    :networks
       :swagger {:tags ["network"]}
       :get     (array-map
+                 :summary "Network list"
                  :parameters {:header {:authorization string?}}
                  :responses {200 {:body        [spec/network]
                                   :description "Success"}}
                  #?@(:clj [:handler handler/networks]))
       :post    (array-map
+                 :summary "Create network"
                  :parameters {:header {:authorization string?}
                               :body   spec/network-create}
                  :responses {201 {:body        {:id string?}
@@ -455,12 +500,14 @@
      {:name    :network
       :swagger {:tags ["network"]}
       :get     (array-map
+                 :summary "Network info"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        spec/network
                                   :description "Success"}}
                  #?@(:clj [:handler handler/network]))
       :delete  (array-map
+                 :summary "Delete network"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        nil
@@ -470,6 +517,7 @@
      {:name    :network-services
       :swagger {:tags ["network"]}
       :get     (array-map
+                 :summary "Network services"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        [spec/service]
@@ -480,6 +528,7 @@
      {:name    :nodes
       :swagger {:tags ["node"]}
       :get     (array-map
+                 :summary "Node list"
                  :parameters {:header {:authorization string?}}
                  :responses {200 {:body        [spec/node]
                                   :description "Success"}}
@@ -488,6 +537,7 @@
      {:name    :nodes-ts
       :swagger {:tags ["node"]}
       :get     (array-map
+                 :summary "Nodes timeseries"
                  :parameters {:header {:authorization string?}}
                  :responses {200 {:body        [spec/node-stats]
                                   :description "Success"}
@@ -498,12 +548,14 @@
      {:name    :node
       :swagger {:tags ["node"]}
       :get     (array-map
+                 :summary "Node info"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        spec/node
                                   :description "Success"}}
                  #?@(:clj [:handler handler/node]))
       :post    (array-map
+                 :summary "Edit node"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}
                               :body   spec/node}
@@ -514,6 +566,7 @@
      {:name    :node-tasks
       :swagger {:tags ["node"]}
       :get     (array-map
+                 :summary "Node tasks"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        [spec/task]
@@ -524,11 +577,13 @@
      {:name    :services
       :swagger {:tags ["service"]}
       :get     (array-map
+                 :summary "Service list"
                  :parameters {:header {:authorization string?}}
                  :responses {200 {:body        [spec/service]
                                   :description "Success"}}
                  #?@(:clj [:handler handler/services]))
       :post    (array-map
+                 :summary "Create service"
                  :parameters {:header {:authorization string?}
                               :body   spec/service-create}
                  :responses {201 {:body        {:id string?}
@@ -538,12 +593,14 @@
      {:name    :service
       :swagger {:tags ["service"]}
       :get     (array-map
+                 :summary "Service info"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        spec/service
                                   :description "Success"}}
                  #?@(:clj [:handler handler/service]))
       :post    (array-map
+                 :summary "Edit service"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}
                               :body   spec/service-update}
@@ -551,6 +608,7 @@
                                   :description "Success"}}
                  #?@(:clj [:handler handler/service-update]))
       :delete  (array-map
+                 :summary "Delete service"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        nil
@@ -560,6 +618,7 @@
      {:name    :service-logs
       :swagger {:tags ["service"]}
       :get     (array-map
+                 :summary "Service logs"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}
                               :query  {:since string?}}
@@ -570,6 +629,7 @@
      {:name    :service-networks
       :swagger {:tags ["service"]}
       :get     (array-map
+                 :summary "Service networks"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        [spec/network]
@@ -579,6 +639,7 @@
      {:name    :service-tasks
       :swagger {:tags ["service"]}
       :get     (array-map
+                 :summary "Service tasks"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        [spec/task]
@@ -588,6 +649,7 @@
      {:name    :service-compose
       :swagger {:tags ["service"]}
       :get     (array-map
+                 :summary "Service compose"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {200 {:body        spec/stack-compose
@@ -597,6 +659,7 @@
      {:name    :service-redeploy
       :swagger {:tags ["service"]}
       :post    (array-map
+                 :summary "Redeploy service"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {202 {:body        nil
@@ -606,6 +669,7 @@
      {:name    :service-rollback
       :swagger {:tags ["service"]}
       :post    (array-map
+                 :summary "Rollback service"
                  :parameters {:header {:authorization string?}
                               :path   {:id string?}}
                  :responses {202 {:body        nil
@@ -616,11 +680,13 @@
      {:name    :volumes
       :swagger {:tags ["volume"]}
       :get     (array-map
+                 :summary "Volume list"
                  :parameters {:header {:authorization string?}}
                  :responses {200 {:body        [spec/volume]
                                   :description "Success"}}
                  #?@(:clj [:handler handler/volumes]))
       :post    (array-map
+                 :summary "Create volume"
                  :parameters {:header {:authorization string?}
                               :body   spec/volume-create}
                  :responses {201 {:body        spec/volume
@@ -630,12 +696,14 @@
      {:name    :volume
       :swagger {:tags ["volume"]}
       :get     (array-map
+                 :summary "Volume info"
                  :parameters {:header {:authorization string?}
                               :path   {:name string?}}
                  :responses {200 {:body        spec/volume
                                   :description "Success"}}
                  #?@(:clj [:handler handler/volume]))
       :delete  (array-map
+                 :summary "Delete volume"
                  :parameters {:header {:authorization string?}
                               :path   {:name string?}}
                  :responses {200 {:body        nil
@@ -645,6 +713,7 @@
      {:name    :volume-services
       :swagger {:tags ["volume"]}
       :get     (array-map
+                 :summary "Volume services"
                  :parameters {:header {:authorization string?}
                               :path   {:name string?}}
                  :responses {200 {:body        [spec/service]
@@ -655,6 +724,7 @@
      {:name    :placement
       :swagger {:tags ["placement"]}
       :get     (array-map
+                 :summary "Placement constraints"
                  :parameters {:header {:authorization string?}}
                  :responses {200 {:body        [string?]
                                   :description "Success"}}
@@ -665,6 +735,7 @@
      ["/service"
       {:name :labels-service
        :get  (array-map
+               :summary "Service labels"
                :parameters {:header {:authorization string?}}
                :responses {200 {:body        [string?]
                                 :description "Success"}}
@@ -675,6 +746,7 @@
      ["/network"
       {:name :plugin-network
        :get  (array-map
+               :summary "Network plugins"
                :parameters {:header {:authorization string?}}
                :responses {200 {:body        [string?]
                                 :description "Success"}}
@@ -682,6 +754,7 @@
      ["/log"
       {:name :plugin-log
        :get  (array-map
+               :summary "Logging plugins"
                :parameters {:header {:authorization string?}}
                :responses {200 {:body        [string?]
                                 :description "Success"}}
@@ -689,6 +762,7 @@
      ["/volume"
       {:name :plugin-volume
        :get  (array-map
+               :summary "Volume plugins"
                :parameters {:header {:authorization string?}}
                :responses {200 {:body        [string?]
                                 :description "Success"}}


Reset selections when changing ticket form

--- src/cljs/iframe_app/core.cljs
+++ src/cljs/iframe_app/core.cljs
@@ -181,6 +181,9 @@
     :user-type (assoc selections :master-field nil
                                  :field-value nil
                                  :slave-fields #{})
+    :ticket-form (assoc selections :master-field nil
+                                   :field-value nil
+                                   :slave-fields #{})
     selections))


Parse out info we care about for related-urls

--- src/cmr/graph/data/import.clj
+++ src/cmr/graph/data/import.clj
@@ -10,14 +10,26 @@
 (def test-file
   "data/testfile.json")

+(def url-fields
+  "List of fields we are interested in parsing from a given URL."
+  [:type :url])
+
 (def relevant-fields
   "List of fields to parse from a collection record."
   [:concept-id :provider-id :related-urls :data-center :version-id :metadata-format])

+(defn parse-url-into-nodes
+  "Parses a single URL field into all the nodes we want to create for the URL."
+  [url]
+  (select-keys (json/parse-string url true) url-fields))
+
 (defn prepare-collection-for-import
   "Returns only the relevant JSON fields from the provided collection record for import into neo4j."
   [collection]
-  (select-keys (:fields collection) relevant-fields))
+  (update (select-keys (:fields collection) relevant-fields)
+          :related-urls
+          (fn [urls]
+            (mapv parse-url-into-nodes urls))))

 (defn read-json-file
   "Reads a JSON file into memory"
@@ -26,4 +38,4 @@

 (comment
  (prepare-collection-for-import (first (:hits (:hits (read-json-file json-collections-filename)))))
- (prepare-collection-for-import (first (:hits (:hits (read-json-file test-file))))))
+ (mapv prepare-collection-for-import (:hits (:hits (read-json-file test-file)))))


Clojurescript version working

Clojurescript version working

--- src/com/rpl/specter/impl.cljc
+++ src/com/rpl/specter/impl.cljc
@@ -1,9 +1,22 @@
 (ns com.rpl.specter.impl
-  (:use [com.rpl.specter.protocols :only [StructurePath StructureValsPath Collector StructureValsPathComposer comp-paths*]])
-  (:require [clojure.walk :as walk]
+  (:use [com.rpl.specter.protocols :only
+    [comp-paths*
+     select* transform* collect-val select-full* transform-full*]])
+  (:require [com.rpl.specter.protocols :as p]
+            [clojure.walk :as walk]
             [clojure.core.reducers :as r]
             [clojure.string :as s])
   )
+
+#?(
+:clj
+(defmacro field [obj quoted-field]
+  `(. ~obj ~(second quoted-field)))
+
+:cljs
+(defn field [obj field]
+  (aget obj (s/replace (str field) "-" "_")))
+)

 #?(
 :clj
@@ -58,6 +71,12 @@
 (defprotocol CoerceTransformFunctions
   (coerce-path [this]))

+(defn- seq-contains? [aseq val]
+  (->> aseq
+       (filter (partial = val))
+       empty?
+       not))
+
 (defn no-prot-error-str [obj]
   (str "Protocol implementation cannot be found for object.
         Extending Specter protocols should not be done inline in a deftype definition
@@ -65,18 +84,16 @@
         optimized performance. Instead, you should extend the protocols via an
         explicit extend-protocol call. \n" obj))

+#?(
+:clj
+
 (defn find-protocol-impl! [prot obj]
   (let [ret (find-protocol-impl prot obj)]
     (if (= ret obj)
       (throw-illegal (no-prot-error-str obj))
       ret
       )))
-
-(defn- seq-contains? [aseq val]
-  (->> aseq
-       (filter (partial = val))
-       empty?
-       not))
+)

 #?(
 :clj
@@ -94,8 +111,40 @@
     ))
 )

+#?(:clj
+(do
+(defn structure-path-impl [this]
+  (if (fn? this)
+    ;;TODO: this isn't kosher, it uses knowledge of internals of protocols
+    (-> p/StructurePath :impls (get clojure.lang.AFn))
+    (find-protocol-impl! p/StructurePath this)))
+
+(defn collector-impl [this]
+  (find-protocol-impl! p/Collector this))
+
+(defn structure-vals-path-impl [this]
+  (find-protocol-impl! p/StructureValsPath this))
+))
+
+#?(:cljs
+(do
+(defn structure-path-impl [_]
+  {:select* (fn [this structure next-fn] (select* this structure next-fn))
+   :transform* (fn [this structure next-fn] (transform* this structure next-fn))
+   })
+
+(defn collector-impl [_]
+  {:collect-val (fn [this structure] (collect-val this structure))
+   })
+
+(defn structure-vals-path-impl [_]
+  {:select-full* (fn [this structure next-fn] (select-full* this structure next-fn))
+   :transform-full* (fn [this structure next-fn] (transform-full* this structure next-fn))
+   })
+))
+
 (defn coerce-structure-vals-path [this]
-  (let [pimpl (find-protocol-impl! StructureValsPath this)
+  (let [pimpl (structure-vals-path-impl this)
         selector (:select-full* pimpl)
         transformer (:transform-full* pimpl)]
     (->TransformFunctions
@@ -108,7 +157,7 @@

 (defn coerce-collector [this]
   (let [cfn (->> this
-                 (find-protocol-impl! Collector)
+                 collector-impl
                  :collect-val
                  )
         afn (fn [vals structure next-fn]
@@ -116,12 +165,6 @@
               )]
     (->TransformFunctions StructureValsPathExecutor afn afn)))

-
-(defn structure-path-impl [this]
-  (if (fn? this)
-    ;;TODO: this isn't kosher, it uses knowledge of internals of protocols
-    (-> StructurePath :impls (get clojure.lang.AFn))
-    (find-protocol-impl! StructurePath this)))

 (defn coerce-structure-path [this]
   (let [pimpl (structure-path-impl this)
@@ -148,7 +191,7 @@
     )))

 (defn structure-path? [obj]
-  (or (fn? obj) (obj-extends? `StructurePath obj)))
+  (or (fn? obj) (obj-extends? `p/StructurePath obj)))

 (extend-protocol CoerceTransformFunctions
   nil ; needs its own path because it doesn't count as an Object
@@ -167,23 +210,23 @@
   #?(:clj Object :cljs js/Object)
   (coerce-path [this]
     (cond (structure-path? this) (coerce-structure-path this)
-          (obj-extends? `Collector this) (coerce-collector this)
-          (obj-extends? `StructureValsPath this) (coerce-structure-vals-path this)
+          (obj-extends? `p/Collector this) (coerce-collector this)
+          (obj-extends? `p/StructureValsPath this) (coerce-structure-vals-path this)
           :else (throw-illegal (no-prot-error-str this))
       )))

 (defn extype [^TransformFunctions f]
-  (let [^ExecutorFunctions exs (.executors f)]
-    (.type exs)
+  (let [^ExecutorFunctions exs (field f 'executors)]
+    (field exs 'type)
     ))

 (defn- combine-same-types [[^TransformFunctions f & _ :as all]]
   (if (empty? all)
     (coerce-path nil)
-    (let [^ExecutorFunctions exs (.executors f)
-
-          t (.type exs)
+    (let [^ExecutorFunctions exs (field f 'executors)
+
+          t (field exs 'type)

           combiner
           (if (= t :svalspath)
@@ -201,16 +244,16 @@
       (reduce (fn [^TransformFunctions curr ^TransformFunctions next]
                 (->TransformFunctions
                  exs
-                 (combiner (.selector curr) (.selector next))
-                 (combiner (.transformer curr) (.transformer next))
+                 (combiner (field curr 'selector) (field next 'selector))
+                 (combiner (field curr 'transformer) (field next 'transformer))
                  ))
               all))))

 (defn coerce-structure-vals [^TransformFunctions tfns]
   (if (= (extype tfns) :svalspath)
     tfns
-    (let [selector (.selector tfns)
-          transformer (.transformer tfns)]
+    (let [selector (field tfns 'selector)
+          transformer (field tfns 'transformer)]
       (->TransformFunctions
         StructureValsPathExecutor
         (fn [vals structure next-fn]
@@ -219,7 +262,7 @@
           (transformer structure (fn [structure] (next-fn vals structure))))
         ))))

-(extend-protocol StructureValsPathComposer
+(extend-protocol p/StructureValsPathComposer
   nil
   (comp-paths* [sp]
     (coerce-path sp))
@@ -242,8 +285,8 @@

 (defn coerce-structure-vals-direct [this]
   (cond (structure-path? this) (coerce-structure-path-direct this)
-        (obj-extends? `Collector this) (coerce-collector this)
-        (obj-extends? `StructureValsPath this) (coerce-structure-vals-path this)
+        (obj-extends? `p/Collector this) (coerce-collector this)
+        (obj-extends? `p/StructureValsPath this) (coerce-structure-vals-path this)
         (instance? TransformFunctions this) (coerce-structure-vals this)
         :else (throw-illegal (no-prot-error-str this))
   ))
@@ -334,14 +377,14 @@

 (defn compiled-select*
   [^com.rpl.specter.impl.TransformFunctions tfns structure]
-  (let [^com.rpl.specter.impl.ExecutorFunctions ex (.executors tfns)]
-    ((.select-executor ex) (.selector tfns) structure)
+  (let [^com.rpl.specter.impl.ExecutorFunctions ex (field tfns 'executors)]
+    ((field ex 'select-executor) (field tfns 'selector) structure)
     ))

 (defn compiled-transform*
   [^com.rpl.specter.impl.TransformFunctions tfns transform-fn structure]
-  (let [^com.rpl.specter.impl.ExecutorFunctions ex (.executors tfns)]
-    ((.transform-executor ex) (.transformer tfns) transform-fn structure)
+  (let [^com.rpl.specter.impl.ExecutorFunctions ex (field tfns 'executors)]
+    ((field ex 'transform-executor) (field tfns 'transformer) transform-fn structure)
     ))

 (defn selected?*
@@ -385,7 +428,7 @@

 (deftype AllStructurePath [])

-(extend-protocol StructurePath
+(extend-protocol p/StructurePath
   AllStructurePath
   (select* [this structure next-fn]
     (into [] (r/mapcat next-fn structure)))
@@ -399,14 +442,14 @@

 (deftype ValCollect [])

-(extend-protocol Collector
+(extend-protocol p/Collector
   ValCollect
   (collect-val [this structure]
     structure))

 (deftype LastStructurePath [])

-(extend-protocol StructurePath
+(extend-protocol p/StructurePath
   LastStructurePath
   (select* [this structure next-fn]
     (next-fn (last structure)))
@@ -415,7 +458,7 @@

 (deftype FirstStructurePath [])

-(extend-protocol StructurePath
+(extend-protocol p/StructurePath
   FirstStructurePath
   (select* [this structure next-fn]
     (next-fn (first structure)))
@@ -424,31 +467,31 @@

 (deftype WalkerStructurePath [afn])

-(extend-protocol StructurePath
+(extend-protocol p/StructurePath
   WalkerStructurePath
   (select* [^WalkerStructurePath this structure next-fn]
-    (walk-select (.afn this) next-fn structure))
+    (walk-select (field this 'afn) next-fn structure))
   (transform* [^WalkerStructurePath this structure next-fn]
-    (walk-until (.afn this) next-fn structure)))
+    (walk-until (field this 'afn) next-fn structure)))

 (deftype CodeWalkerStructurePath [afn])

-(extend-protocol StructurePath
+(extend-protocol p/StructurePath
   CodeWalkerStructurePath
   (select* [^CodeWalkerStructurePath this structure next-fn]
-    (walk-select (.afn this) next-fn structure))
+    (walk-select (field this 'afn) next-fn structure))
   (transform* [^CodeWalkerStructurePath this structure next-fn]
-    (codewalk-until (.afn this) next-fn structure)))
+    (codewalk-until (field this 'afn) next-fn structure)))

 (deftype FilterStructurePath [path])

-(extend-protocol StructurePath
+(extend-protocol p/StructurePath
   FilterStructurePath
   (select* [^FilterStructurePath this structure next-fn]
-    (->> structure (filter #(selected?* (.path this) %)) doall next-fn))
+    (->> structure (filter #(selected?* (field this 'path) %)) doall next-fn))
   (transform* [^FilterStructurePath this structure next-fn]
-    (let [[filtered ancestry] (filter+ancestry (.path this) structure)
+    (let [[filtered ancestry] (filter+ancestry (field this 'path) structure)
           ;; the vec is necessary so that we can get by index later
           ;; (can't get by index for cons'd lists)
           next (vec (next-fn filtered))]
@@ -459,33 +502,33 @@

 (deftype KeyPath [akey])

-(extend-protocol StructurePath
+(extend-protocol p/StructurePath
   KeyPath
   (select* [^KeyPath this structure next-fn]
-    (key-select (.akey this) structure next-fn))
+    (key-select (field this 'akey) structure next-fn))
   (transform* [^KeyPath this structure next-fn]
-    (key-transform (.akey this) structure next-fn)
+    (key-transform (field this 'akey) structure next-fn)
     ))

 (deftype SelectCollector [sel-fn selector])

-(extend-protocol Collector
+(extend-protocol p/Collector
   SelectCollector
   (collect-val [^SelectCollector this structure]
-    ((.sel-fn this) (.selector this) structure)))
+    ((field this 'sel-fn) (field this 'selector) structure)))

 (deftype SRangePath [start-fn end-fn])

-(extend-protocol StructurePath
+(extend-protocol p/StructurePath
   SRangePath
   (select* [^SRangePath this structure next-fn]
-    (let [start ((.start-fn this) structure)
-          end ((.end-fn this) structure)]
+    (let [start ((field this 'start-fn) structure)
+          end ((field this 'end-fn) structure)]
       (next-fn (-> structure vec (subvec start end)))
       ))
   (transform* [^SRangePath this structure next-fn]
-    (let [start ((.start-fn this) structure)
-          end ((.end-fn this) structure)
+    (let [start ((field this 'start-fn) structure)
+          end ((field this 'end-fn) structure)
           structurev (vec structure)
           newpart (next-fn (-> structurev (subvec start end)))
           res (concat (subvec structurev 0 start)
@@ -498,24 +541,24 @@

 (deftype ViewPath [view-fn])

-(extend-protocol StructurePath
+(extend-protocol p/StructurePath
   ViewPath
   (select* [^ViewPath this structure next-fn]
-    (->> structure ((.view-fn this)) next-fn))
+    (->> structure ((field this 'view-fn)) next-fn))
   (transform* [^ViewPath this structure next-fn]
-    (->> structure ((.view-fn this)) next-fn)
+    (->> structure ((field this 'view-fn)) next-fn)
     ))

 (deftype PutValCollector [val])

-(extend-protocol Collector
+(extend-protocol p/Collector
   PutValCollector
   (collect-val [^PutValCollector this structure]
-    (.val this)
-    ))
-
-
-(extend-protocol StructurePath
+    (field this 'val)
+    ))
+
+
+(extend-protocol p/StructurePath
   nil
   (select* [this structure next-fn]
     (next-fn structure))
@@ -537,15 +580,15 @@
        ))

 ;;TODO: test nothing matches case
-(extend-protocol StructurePath
+(extend-protocol p/StructurePath
   ConditionalPath
   (select* [this structure next-fn]
-    (if-let [selector (retrieve-selector (.cond-pairs this) structure)]
+    (if-let [selector (retrieve-selector (field this 'cond-pairs) structure)]
       (->> (compiled-select* selector structure)
            (mapcat next-fn)
            doall)))
   (transform* [this structure next-fn]
-    (if-let [selector (retrieve-selector (.cond-pairs this) structure)]
+    (if-let [selector (retrieve-selector (field this 'cond-pairs) structure)]
       (compiled-transform* selector next-fn structure)
       structure
       )))


Remove font code and simplify

Remove font code and simplify

--- src/zaffre/glterminal.clj
+++ src/zaffre/glterminal.clj
@@ -1,4 +1,4 @@
-;; Functions for rendering characters to screen
+; Functions for rendering characters to screen
 (ns zaffre.glterminal
   (:require [zaffre.aterminal :as zat]
             [zaffre.util :as zutil]
@@ -99,9 +99,13 @@
   (let [font-file ^File (clojure.java.io/as-file name-or-path)]
     (if (.exists font-file)
       ;; Load font from file
-      (.deriveFont (Font/createFont Font/TRUETYPE_FONT font-file) (int style) (float size))
+      (do
+        (log/info "Loading font from file" name-or-path)
+        (.deriveFont (Font/createFont Font/TRUETYPE_FONT font-file) (int style) (float size)))
       ;; Load font from font registry
-      (Font. name-or-path style size))))
+      (do
+        (log/info "Loading font by name")
+        (Font. name-or-path style size)))))

 (defn next-pow-2 [v]
   (int (Math/pow 2 (inc (Math/floor (/ (Math/log v) (Math/log 2)))))))
@@ -754,17 +758,13 @@
          icon-paths       nil}}]
     (let [is-windows       (>= (.. System (getProperty "os.name" "") (toLowerCase) (indexOf "win")) 0)
           normal-font      (atom nil)
-          _                (log/info "Using font" normal-font)
-          boxy-font        (make-font "fonts/Boxy/Boxy.ttf" Font/PLAIN 24)
-          ;icon-paths       ["images/icon-16x16.png"
-          ;                  "images/icon-32x32.png"
-          ;                  "images/icon-128x128.png"]
           font-textures    (atom {})
           antialias        (atom antialias)
           _                (add-watch
                              normal-font
                              :font-watcher
                              (fn [_ _ _ new-font]
+                               (log/info "Using font" new-font)
                                (let [font-metrics  ^FontMetrics (.getFontMetrics (Canvas.) new-font)
                                      char-width                 (.charWidth font-metrics \M)
                                      char-height                (.getHeight font-metrics)
@@ -861,7 +861,7 @@
                                                                       [screen-width screen-height 1.0])
                             :character-width character-width
                             :character-height character-height
-                            :character->col-row (character->col-row (character-idxs character-width (displayable-characters boxy-font)))
+                            :character->col-row (character->col-row (character-idxs character-width (displayable-characters @normal-font)))
                             :buffers {:vertices-vbo-id vertices-vbo-id
                                       :vertices-count vertices-count
                                       :texture-coords-vbo-id texture-coords-vbo-id}
@@ -974,6 +974,8 @@
                                     :columns 80 :rows 24
                                     :default-fg-color [250 250 250]
                                     :default-bg-color [5 5 8]
+                                    :windows-font "/home/santos/Downloads/cour.ttf"
+                                    :else-font "/home/santos/Downloads/cour.ttf"
                                     :font-size 18
                                     :antialias true
                                     :icon-paths ["images/icon-16x16.png"


Formatting

Formatting

--- src/zaffre/glterminal.clj
+++ src/zaffre/glterminal.clj
@@ -499,7 +499,6 @@
 (defrecord OpenGlTerminal [term-args
                            fbo-texture
                            fullscreen
-                           antialias
                            layer-character-map-cleared
                            layer-character-map
                            group-map
@@ -854,57 +853,62 @@

 (defn create-terminal
-  [group-map {:keys [title screen-width screen-height default-fg-color default-bg-color on-key-fn windows-font else-font font-size fullscreen antialias icon-paths fx-shader]
+  [group-map {:keys [title
+                     screen-width
+                     screen-height
+                     default-fg-color
+                     default-bg-color
+                     on-key-fn
+                     fullscreen
+                     icon-paths
+                     fx-shader]
     :or {title "Zaffre"
          default-fg-color [255 255 255]
          default-bg-color [0 0 0]
          on-key-fn        nil
          fullscreen       false
-         antialias        true
          icon-paths       nil
          fx-shader        {:name "passthrough.fs"}} :as opts}
    f]
-    (let [term-args        [group-map opts]
-          group-map        (into {}
-                             (map (fn [[k v]]
-                                    [k (ref v)])
-                                  group-map))
-          layer-id->group  (->> group-map
-                              (mapcat (fn [[id layer-group]]
-                                        (map (fn [layer-id]
-                                               [layer-id layer-group])
-                                             (get @layer-group :layers))))
-                              (into {}))
-          _                     (log/info "group-map" group-map)
-          _                     (log/info "layer-id->group" layer-id->group)
-          font-textures    (atom {})
-          fullscreen       (atom fullscreen)
-          antialias        (atom antialias)
-          ;; Last [col row] of mouse movement
-          mouse-col-row      (atom nil)
-          mousedown-col-row (atom nil)
-          ;; false if Display is destoyed
-          destroyed          (atom false)
-          gl-lock            (atom true)
-          latch              (java.util.concurrent.CountDownLatch. 1)
+    (let [term-args           [group-map opts]
+          group-map           (into {}
+                                (map (fn [[k v]]
+                                       [k (ref v)])
+                                     group-map))
+          layer-id->group     (->> group-map
+                                 (mapcat (fn [[id layer-group]]
+                                           (map (fn [layer-id]
+                                                  [layer-id layer-group])
+                                                (get @layer-group :layers))))
+                                 (into {}))
+          _                        (log/info "group-map" group-map)
+          _                        (log/info "layer-id->group" layer-id->group)
+          font-textures       (atom {})
+          fullscreen          (atom fullscreen)
+          ;; Last [col row] o f mouse movement
+          mouse-col-row       (atom nil)
+          mousedown-col-row   (atom nil)
+          ;; false if Display  is destoyed
+          destroyed           (atom false)
+          gl-lock             (atom true)
+          latch               (java.util.concurrent.CountDownLatch. 1)
           [window
            capabilities
            framebuffer-width
-           framebuffer-height]
-                             (init-display title screen-width screen-height icon-paths gl-lock destroyed)
-          _                  (log/info "window" window "capabilities" capabilities)
-          _                  (log/info "framebuffer size" framebuffer-width "x" framebuffer-height)
-
-          group->font-texture
-                           (with-gl-context gl-lock window capabilities
-                             (into {}
-                               (mapv (fn [[k v]]
-                                       [k (ref (let [font ((get @v :font) (platform))
-                                                     gg   (if (zfont/glyph-graphics? font)
-                                                              font
-                                                              (zfont/glyph-graphics font))
-                                                     font-texture (texture-id-2d (get gg :font-texture-image))]
-                                                 (log/info "loaded font-texture for" k font-texture (select-keys gg [:font-texture-width :font-texture-height :character-width :character-height]))
+           framebuffer-height ]
+                              (init-display title screen-width screen-height icon-paths gl-lock destroyed)
+          _                   (log/info "window" window "capabilities" capabilities)
+          _                   (log/info "framebuffer size" framebuffer-width "x" framebuffer-height)
+
+          group->font-texture (with-gl-context gl-lock window capabilities
+                                (into {}
+                                  (mapv (fn [[k v]]
+                                          [k (ref (let [font ((get @v :font) (platform))
+                                                        gg   (if (zfont/glyph-graphics? font)
+                                                                 font
+                                                                 (zfont/glyph-graphics font))
+                                                        font-texture (texture-id-2d (get gg :font-texture-image))]
+                                                    (log/info "loaded font-texture for" k font-texture (select-keys gg [:font-texture-width :font-texture-height :character-width :character-height]))
                                                  (assoc gg :font-texture font-texture)))])
                                      group-map)))
           ;; create empty character maps
@@ -916,66 +920,66 @@
                                                                                default-fg-color
                                                                                default-bg-color
                                                                                #{})))))]))
-          layer-character-map  (into {}
-                                     (for [id (keys layer-id->group)]
-                                       [id (ref (get layer-character-map-cleared id))]))
-          cursor-xy             (atom nil)
-
-          term-chan       (async/chan (async/buffer 100))
+          layer-character-map (into {}
+                                    (for [id (keys layer-id->group)]
+                                      [id (ref (get layer-character-map-cleared id))]))
+          cursor-xy           (atom nil)
+
+          term-chan           (async/chan (async/buffer 100))
           ;; Turn term-chan into a pub(lishable) channel
-          term-pub        (async/pub term-chan (fn [v]
-                                        (cond
-                                          (char? v)    :keypress
-                                          (keyword? v) v
-                                          :else        (get v :type))))
-
-          on-key-fn        (or on-key-fn
-                               (fn alt-on-key-fn [k]
-                                 (async/put! term-chan k)))
+          term-pub            (async/pub term-chan (fn [v]
+                                            (cond
+                                              (char? v)    :keypress
+                                              (keyword? v) v
+                                              :else        (get v :type))))
+
+          on-key-fn           (or on-key-fn
+                                  (fn alt-on-key-fn [k]
+                                    (async/put! term-chan k)))

           ;; create width*height texture that gets updated each frame that determines which character to draw in each cell
           _ (log/info "Creating glyph array")
-          glyph-image-data (for [[_ layer-group] group-map]
-                             (let [np2-columns (zutil/next-pow-2 (get @layer-group :columns))
-                                   np2-rows    (zutil/next-pow-2 (get @layer-group :rows))]
-                               (log/info "creating buffers for glyph/fg/bg textures" np2-columns "x" np2-rows)
-                               (BufferUtils/createByteBuffer (* np2-columns np2-rows 4 (count (get @layer-group :layers))))))
-          fg-image-data    (for [[_ layer-group] group-map]
-                             (let [np2-columns (zutil/next-pow-2 (get @layer-group :columns))
-                                   np2-rows    (zutil/next-pow-2 (get @layer-group :rows))]
-                               (BufferUtils/createByteBuffer (* np2-columns np2-rows 4 (count (get @layer-group :layers))))))
-          bg-image-data    (for [[_ layer-group] group-map]
-                             (let [np2-columns (zutil/next-pow-2 (get @layer-group :columns))
-                                   np2-rows    (zutil/next-pow-2 (get @layer-group :rows))]
-                               (BufferUtils/createByteBuffer (* np2-columns np2-rows 4 (count (get @layer-group :layers))))))
-          glyph-textures   (with-gl-context gl-lock window capabilities
-                             (mapv (fn [layer-group glyph-image-data]
-                                     (let [np2-columns (zutil/next-pow-2 (get @layer-group :columns))
-                                           np2-rows    (zutil/next-pow-2 (get @layer-group :rows))]
-                                       (xy-texture-id np2-columns np2-rows (count (get @layer-group :layers)) glyph-image-data)))
-                                   (vals group-map)
-                                   glyph-image-data))
-          fg-textures      (with-gl-context gl-lock window capabilities
-                             (mapv (fn [layer-group fg-image-data]
-                                     (let [np2-columns (zutil/next-pow-2 (get @layer-group :columns))
-                                           np2-rows    (zutil/next-pow-2 (get @layer-group :rows))]
-                                       (texture-id np2-columns np2-rows (count (get @layer-group :layers)) fg-image-data)))
-                                   (vals group-map)
-                                   fg-image-data))
-          bg-textures      (with-gl-context gl-lock window capabilities
-                             (mapv (fn [layer-group bg-image-data]
-                                     (let [np2-columns (zutil/next-pow-2 (get @layer-group :columns))
-                                           np2-rows    (zutil/next-pow-2 (get @layer-group :rows))]
-                                       (texture-id np2-columns np2-rows (count (get @layer-group :layers)) bg-image-data)))
-                                   (vals group-map)
-                                   bg-image-data))
+          glyph-image-data    (for [[_ layer-group] group-map]
+                                (let [np2-columns (zutil/next-pow-2 (get @layer-group :columns))
+                                      np2-rows    (zutil/next-pow-2 (get @layer-group :rows))]
+                                  (log/info "creating buffers for glyph/fg/bg textures" np2-columns "x" np2-rows)
+                                  (BufferUtils/createByteBuffer (* np2-columns np2-rows 4 (count (get @layer-group :layers))))))
+          fg-image-data       (for [[_ layer-group] group-map]
+                                (let [np2-columns (zutil/next-pow-2 (get @layer-group :columns))
+                                      np2-rows    (zutil/next-pow-2 (get @layer-group :rows))]
+                                  (BufferUtils/createByteBuffer (* np2-columns np2-rows 4 (count (get @layer-group :layers))))))
+          bg-image-data       (for [[_ layer-group] group-map]
+                                (let [np2-columns (zutil/next-pow-2 (get @layer-group :columns))
+                                      np2-rows    (zutil/next-pow-2 (get @layer-group :rows))]
+                                  (BufferUtils/createByteBuffer (* np2-columns np2-rows 4 (count (get @layer-group :layers))))))
+          glyph-textures      (with-gl-context gl-lock window capabilities
+                                (mapv (fn [layer-group glyph-image-data]
+                                        (let [np2-columns (zutil/next-pow-2 (get @layer-group :columns))
+                                              np2-rows    (zutil/next-pow-2 (get @layer-group :rows))]
+                                          (xy-texture-id np2-columns np2-rows (count (get @layer-group :layers)) glyph-image-data)))
+                                      (vals group-map)
+                                      glyph-image-data))
+          fg-textures         (with-gl-context gl-lock window capabilities
+                                (mapv (fn [layer-group fg-image-data]
+                                        (let [np2-columns (zutil/next-pow-2 (get @layer-group :columns))
+                                              np2-rows    (zutil/next-pow-2 (get @layer-group :rows))]
+                                          (texture-id np2-columns np2-rows (count (get @layer-group :layers)) fg-image-data)))
+                                      (vals group-map)
+                                      fg-image-data))
+          bg-textures         (with-gl-context gl-lock window capabilities
+                                (mapv (fn [layer-group bg-image-data]
+                                        (let [np2-columns (zutil/next-pow-2 (get @layer-group :columns))
+                                              np2-rows    (zutil/next-pow-2 (get @layer-group :rows))]
+                                          (texture-id np2-columns np2-rows (count (get @layer-group :layers)) bg-image-data)))
+                                      (vals group-map)
+                                      bg-image-data))
           [fbo-id fbo-texture]
-                           (with-gl-context gl-lock window capabilities (fbo-texture framebuffer-width framebuffer-height))
+                              (with-gl-context gl-lock window capabilities (fbo-texture framebuffer-width framebuffer-height))
           ; init shaders
           [^int pgm-id
-           ^int fb-pgm-id]      (with-gl-context gl-lock window capabilities (init-shaders (get fx-shader :name)))
-          pos-vertex-attribute            (with-gl-context gl-lock window capabilities (GL20/glGetAttribLocation pgm-id "aVertexPosition"))
-          texture-coords-vertex-attribute (with-gl-context gl-lock window capabilities (GL20/glGetAttribLocation pgm-id "aTextureCoord"))
+           ^int fb-pgm-id]                   (with-gl-context gl-lock window capabilities (init-shaders (get fx-shader :name)))
+          pos-vertex-attribute               (with-gl-context gl-lock window capabilities (GL20/glGetAttribLocation pgm-id "aVertexPosition"))
+          texture-coords-vertex-attribute    (with-gl-context gl-lock window capabilities (GL20/glGetAttribLocation pgm-id "aTextureCoord"))
           fb-pos-vertex-attribute            (with-gl-context gl-lock window capabilities (GL20/glGetAttribLocation fb-pgm-id "aVertexPosition"))
           fb-texture-coords-vertex-attribute (with-gl-context gl-lock window capabilities (GL20/glGetAttribLocation fb-pgm-id "aTextureCoord"))

@@ -983,7 +987,7 @@
           {:keys [vertices-vbo-id
                   vertices-count
                   texture-coords-vbo-id
-                  vao-id]}          (with-gl-context gl-lock window capabilities (init-buffers))
+                  vao-id]}   (with-gl-context gl-lock window capabilities (init-buffers))
           [glyph-tex-dim
            u-MVMatrix
            u-PMatrix
@@ -994,45 +998,47 @@
            u-num-layers
            font-size
            term-dim
-           font-tex-dim]  (with-gl-context gl-lock window capabilities (mapv #(GL20/glGetUniformLocation pgm-id (str %))
-                                                         ["glyphTextureDimensions"
-                                                          "uMVMatrix"
-                                                          "uPMatrix"
-                                                          "uFont"
-                                                          "uGlyphs"
-                                                          "uFg"
-                                                          "uBg"
-                                                          "numLayers"
-                                                          "fontSize"
-                                                          "termDimensions"
-                                                          "fontTextureDimensions"]))
+           font-tex-dim]     (with-gl-context gl-lock window capabilities
+                               (mapv #(GL20/glGetUniformLocation pgm-id (str %))
+                                     ["glyphTextureDimensions"
+                                      "uMVMatrix"
+                                      "uPMatrix"
+                                      "uFont"
+                                      "uGlyphs"
+                                      "uFg"
+                                      "uBg"
+                                      "numLayers"
+                                      "fontSize"
+                                      "termDimensions"
+                                      "fontTextureDimensions"]))
           [u-fb
            u-fb-MVMatrix
-           u-fb-PMatrix] (with-gl-context gl-lock window capabilities (mapv #(GL20/glGetUniformLocation fb-pgm-id (str %))
-                                                        ["uFb"
-                                                         "uMVMatrix"
-                                                         "uPMatrix"]))
+           u-fb-PMatrix]     (with-gl-context gl-lock window capabilities
+                               (mapv #(GL20/glGetUniformLocation fb-pgm-id (str %))
+                                     ["uFb"
+                                      "uMVMatrix"
+                                      "uPMatrix"]))
           ;; map from uniform name (string) to [value atom, uniform location]
-          fx-uniforms    (reduce (fn [uniforms [uniform-name value]]
-                                   (assoc uniforms
-                                          uniform-name
-                                          [(atom value)
-                                           (with-gl-context gl-lock window capabilities
-                                             (log/info "getting location of uniform" uniform-name)
-                                             (let [location (GL20/glGetUniformLocation fb-pgm-id (str uniform-name))]
-                                               #_(assert (not (neg? location)) (str "Could not find location for uniform " uniform-name location))
-                                               (log/info "got location of uniform" uniform-name location)
-                                               location))]))
-                                 {}
-                                 (get fx-shader :uniforms))
-          _ (with-gl-context gl-lock window capabilities
-              (doseq [idx (range (GL20/glGetProgrami fb-pgm-id GL20/GL_ACTIVE_UNIFORMS))]
-                (let [length-buffer (BufferUtils/createIntBuffer 1)
-                      size-buffer (BufferUtils/createIntBuffer 1)
-                      type-buffer (BufferUtils/createIntBuffer 1)
-                      name-buffer (BufferUtils/createByteBuffer 100)
-                      uniform-name (GL20/glGetActiveUniform fb-pgm-id idx 256 size-buffer type-buffer)]
-                (log/info "Found uniform" uniform-name))))
+          fx-uniforms        (reduce (fn [uniforms [uniform-name value]]
+                                       (assoc uniforms
+                                              uniform-name
+                                              [(atom value)
+                                               (with-gl-context gl-lock window capabilities
+                                                 (log/info "getting location of uniform" uniform-name)
+                                                 (let [location (GL20/glGetUniformLocation fb-pgm-id (str uniform-name))]
+                                                   (assert (not (neg? location)) (str "Could not find location for uniform " uniform-name location))
+                                                   (log/info "got location of uniform" uniform-name location)
+                                                   location))]))
+                                     {}
+                                     (get fx-shader :uniforms))
+          _                  (with-gl-context gl-lock window capabilities
+                               (doseq [idx (range (GL20/glGetProgrami fb-pgm-id GL20/GL_ACTIVE_UNIFORMS))]
+                                 (let [length-buffer (BufferUtils/createIntBuffer 1)
+                                       size-buffer (BufferUtils/createIntBuffer 1)
+                                       type-buffer (BufferUtils/createIntBuffer 1)
+                                       name-buffer (BufferUtils/createByteBuffer 100)
+                                       uniform-name (GL20/glGetActiveUniform fb-pgm-id idx 256 size-buffer type-buffer)]
+                                 (log/info "Found uniform" uniform-name))))
           key-callback          (proxy [GLFWKeyCallback] []
                                   (invoke [window key scancode action mods]
                                     (when-let [key (zkeyboard/convert-key-code key scancode action mods)]
@@ -1069,69 +1075,67 @@
                                           (async/put! term-chan {:type :mouse-leave :col last-col :row last-row}))
                                         (reset! mouse-col-row [col row])
                                         (async/put! term-chan {:type :mouse-enter :col col :row row})))))
-          gl               {:p-matrix-buffer (ortho-matrix-buffer framebuffer-width framebuffer-height)
-                            :mv-matrix-buffer (position-matrix-buffer [(- (/ framebuffer-width 2)) (- (/ framebuffer-height 2)) -1.0 0.0]
-                                                                      [framebuffer-width framebuffer-height 1.0])
-                            :buffers {:vertices-vbo-id vertices-vbo-id
-                                      :vertices-count vertices-count
-                                      :texture-coords-vbo-id texture-coords-vbo-id
-                                      :vao-id vao-id
-                                      :fbo-id fbo-id}
-                            :textures {:glyph-textures glyph-textures
-                                       ;:font-texture font-texture
-                                       :fg-textures fg-textures
-                                       :bg-textures bg-textures
-                                       :fbo-texture fbo-texture}
-                            :attributes {:pos-vertex-attribute pos-vertex-attribute
-                                         :texture-coords-vertex-attribute texture-coords-vertex-attribute
-                                         :fb-pos-vertex-attribute fb-pos-vertex-attribute
-                                         :fb-texture-coords-vertex-attribute fb-texture-coords-vertex-attribute
+          gl                 {:p-matrix-buffer (ortho-matrix-buffer framebuffer-width framebuffer-height)
+                              :mv-matrix-buffer (position-matrix-buffer [(- (/ framebuffer-width 2)) (- (/ framebuffer-height 2)) -1.0 0.0]
+                                                                        [framebuffer-width framebuffer-height 1.0])
+                              :buffers {:vertices-vbo-id vertices-vbo-id
+                                        :vertices-count vertices-count
+                                        :texture-coords-vbo-id texture-coords-vbo-id
+                                        :vao-id vao-id
+                                        :fbo-id fbo-id}
+                              :textures {:glyph-textures glyph-textures
+                                         ;:font-texture font-texture
+                                         :fg-textures fg-textures
+                                         :bg-textures bg-textures
+                                         :fbo-texture fbo-texture}
+                              :attributes {:pos-vertex-attribute pos-vertex-attribute
+                                           :texture-coords-vertex-attribute texture-coords-vertex-attribute
+                                           :fb-pos-vertex-attribute fb-pos-vertex-attribute
+                                           :fb-texture-coords-vertex-attribute fb-texture-coords-vertex-attribute
 }
-                            :program-id pgm-id
-                            :fb-program-id fb-pgm-id
-                            :uniforms {:u-MVMatrix u-MVMatrix
-                                       :u-PMatrix u-PMatrix
-                                       :u-fb-MVMatrix u-fb-MVMatrix
-                                       :u-fb-PMatrix u-fb-PMatrix
-                                       :u-font u-font
-                                       :u-glyphs u-glyphs
-                                       :u-fg u-fg
-                                       :u-bg u-bg
-                                       :u-num-layers u-num-layers
-                                       :font-size font-size
-                                       :term-dim term-dim
-                                       :font-tex-dim font-tex-dim
-                                       ;:font-texture-width font-texture-width
-                                       ;:font-texture-height font-texture-height
-                                       :glyph-tex-dim glyph-tex-dim
-                                       ;:glyph-texture-width glyph-texture-width
-                                       ;:glyph-texture-height glyph-texture-height
-                                       :u-fb u-fb
-                                       :framebuffer-width framebuffer-width
-                                       :framebuffer-height framebuffer-height}
-                            :data {:glyph-image-data glyph-image-data
-                                   :fg-image-data fg-image-data
-                                   :bg-image-data bg-image-data}}
-          terminal
-          ;; Create and return terminal
-          (OpenGlTerminal. term-args
-                           fbo-texture
-                           fullscreen
-                           antialias
-                           layer-character-map-cleared
-                           layer-character-map
-                           group-map
-                           group->font-texture
-                           layer-id->group
-                           cursor-xy
-                           fx-uniforms
-                           gl
-                           term-chan
-                           term-pub
-                           gl-lock
-                           destroyed
-                           window
-                           capabilities)]
+                              :program-id pgm-id
+                              :fb-program-id fb-pgm-id
+                              :uniforms {:u-MVMatrix u-MVMatrix
+                                         :u-PMatrix u-PMatrix
+                                         :u-fb-MVMatrix u-fb-MVMatrix
+                                         :u-fb-PMatrix u-fb-PMatrix
+                                         :u-font u-font
+                                         :u-glyphs u-glyphs
+                                         :u-fg u-fg
+                                         :u-bg u-bg
+                                         :u-num-layers u-num-layers
+                                         :font-size font-size
+                                         :term-dim term-dim
+                                         :font-tex-dim font-tex-dim
+                                         ;:font-texture-width font-texture-width
+                                         ;:font-texture-height font-texture-height
+                                         :glyph-tex-dim glyph-tex-dim
+                                         ;:glyph-texture-width glyph-texture-width
+                                         ;:glyph-texture-height glyph-texture-height
+                                         :u-fb u-fb
+                                         :framebuffer-width framebuffer-width
+                                         :framebuffer-height framebuffer-height}
+                              :data {:glyph-image-data glyph-image-data
+                                     :fg-image-data fg-image-data
+                                     :bg-image-data bg-image-data}}
+          terminal           ;; Create and return terminal
+                             (OpenGlTerminal. term-args
+                                              fbo-texture
+                                              fullscreen
+                                              layer-character-map-cleared
+                                              layer-character-map
+                                              group-map
+                                              group->font-texture
+                                              layer-id->group
+                                              cursor-xy
+                                              fx-uniforms
+                                              gl
+                                              term-chan
+                                              term-pub
+                                              gl-lock
+                                              destroyed
+                                              window
+                                              capabilities)]
       ;; Access to terminal will be multi threaded. Release context so that other threads can access it)))
       (when @fullscreen
         (zat/fullscreen! terminal (first (zat/fullscreen-sizes terminal))))


STORM-1203. worker metadata file creation doesn't use storm.log.dir config.

--- storm-core/src/clj/backtype/storm/util.clj
+++ storm-core/src/clj/backtype/storm/util.clj
@@ -1039,8 +1039,9 @@
   ([x form & more] `(-<> (-<> ~x ~form) ~@more)))

 (def LOG-DIR
-  (.getCanonicalPath
-                (clojure.java.io/file (System/getProperty "storm.home") "logs")))
+  (.getCanonicalPath
+    (clojure.java.io/file (or (System/getProperty "storm.log.dir") (str (System/getProperty "storm.home") "logs")))))
+

 (defn logs-filename
   [storm-id port]


Fix the tests

Fix the tests

--- test/gogolica/core_test.clj
+++ test/gogolica/core_test.clj
@@ -1,6 +1,6 @@
 (ns gogolica.core-test
   (:require [clojure.test :refer :all]
-            [gogolica.core :as g]))
+            [gogolica.generate :as g]))

 (def parameters {:fooBar {:required true
                           :location "path"}


Oops, accidental paredit spill

Oops, accidental paredit spill

--- test/icecap/schema_test.clj
+++ test/icecap/schema_test.clj
@@ -22,7 +22,7 @@
     (are [example reason] (= (pr-str (s/check Plan example))
                              (pr-str reason))
       [#{} simple-http-step] ['(not ("collection of one or more plans" #{})) nil]))
-  (testing "plans with unknown/unsupported schemes don't validate"))
-(are [example reason] (= (pr-str (s/check Plan example))
-                         (pr-str reason))
-     simple-ftp-step {:target '(not ("supported-scheme?" "ftp://example.test"))})
+  (testing "plans with unknown/unsupported schemes don't validate"
+    (are [example reason] (= (pr-str (s/check Plan example))
+                             (pr-str reason))
+         simple-ftp-step {:target '(not ("supported-scheme?" "ftp://example.test"))})))


made schema less strict

made schema less strict

--- src/corpus_utils/document.clj
+++ src/corpus_utils/document.clj
@@ -36,7 +36,7 @@
           :year      s/Int
           :basename  s/Str
           :corpus    s/Str
-          :subcorpus s/Str
+          (s/optional-key :subcorpus) s/Str
           :category  [s/Str]}))

 (def SentencesSchema