don't start a new text if text is in progress

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -497,11 +497,12 @@
 (defmethod post-control-event! :mouse-depressed
   [browser-state message [x y {:keys [button ctrl?]}] previous-state current-state]
   (let [cast! (fn [msg & [payload]]
-                (put! (get-in current-state [:comms :controls]) [msg payload]))]
+                (put! (get-in current-state [:comms :controls]) [msg payload]))
+        drawing-text? (and (= (get-in current-state state/current-tool-path) :text)
+                           (get-in current-state [:drawing :in-progress?]))]
     ;; If you click while writing text, you probably wanted to place it there
     ;; You also want the right-click menu to open
-    (when (and (= (get-in current-state state/current-tool-path) :text)
-               (get-in current-state [:drawing :in-progress?]))
+    (when drawing-text?
       (cast! :text-layer-finished))
     (cond
       (= button 2) (cast! :menu-opened)
@@ -511,7 +512,9 @@
       (get-in current-state [:layer-properties-menu :opened?]) (cast! :layer-properties-submitted)
       (= (get-in current-state state/current-tool-path) :pen) (cast! :drawing-started [x y])

-      (= (get-in current-state state/current-tool-path) :text) (cast! :drawing-started [x y])
+      (= (get-in current-state state/current-tool-path) :text)
+      (when-not drawing-text?
+        (cast! :drawing-started [x y]))

       (= (get-in current-state state/current-tool-path) :rect) (cast! :drawing-started [x y])
       (= (get-in current-state state/current-tool-path) :circle) (cast! :drawing-started [x y])


Refactor connecting and disconnecting edges.

--- src/constraint/core.cljs
+++ src/constraint/core.cljs
@@ -134,24 +134,35 @@
              (- (.-clientY event) (.-top rect))]]
     (update-in world-state [:vertices moving 1] (constantly pos))))

+(defn largest-key [the-map]
+  (-> the-map
+      (keys)
+      (sort)
+      (reverse)
+      (first)))
+
+(defn next-key [a-key]
+  (str edge-id
+       (->> a-key
+            (drop 4)
+            (apply str)
+            (js/parseInt)
+            (inc))))
+
+(defn get-connected-edges [from to {:keys [edges]}]
+  (let [both-ways #{[from to] [to from]}]
+    (filter #(both-ways (butlast (second %))) edges)))
+
+
 (defn connect-or-disconnect [from to world-state]
-  (let [connections (filter #(#{[from to] [to from]}
-                                      (butlast (second %))) (:edges world-state))
-        largest-key (-> (:edges world-state)
-                        (keys)
-                        (sort)
-                        (reverse)
-                        (first))
-        next-key (str edge-id (->> largest-key
-                                   (drop 4)
-                                   (apply str)
-                                   (js/parseInt)
-                                   (inc)))]
-    (if (empty? connections)
-      (update-in world-state [:edges] #(conj % [next-key [from to :red]]))
-      (update-in world-state [:edges] #(dissoc % (first (first connections)))))
-    )
-  )
+  (let [connected-id (first (first (get-connected-edges from to world-state)))
+        next-to-largest-key (next-key (largest-key (:edges world-state)))
+        new-edge [next-to-largest-key [from to :red]]]
+    (update-in world-state
+               [:edges]
+               (if (nil? connected-id)
+                 #(conj % new-edge)
+                 #(dissoc % connected-id)))))

 (defn edit-vertex-or-connections [clicked-vertex world-state]
   (let [selected (:selected world-state)]


Update project-ssh-key API Calls

Update project-ssh-key API Calls

  Update project-ssh-key API calls to use `api-path` utils.

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -733,9 +733,10 @@
 (defmethod post-control-event! :saved-ssh-key
   [target message {:keys [project-id ssh-key]} previous-state current-state]
   (let [project-name (vcs-url/project-name project-id)
+        vcs-type (vcs-url/vcs-type project-id)
         api-ch (get-in current-state [:comms :api])]
     (button-ajax :post
-                 (gstring/format "/api/v1/project/%s/ssh-key" project-name)
+                 (api-path/project-ssh-key vcs-type project-name)
                  :save-ssh-key
                  api-ch
                  :params ssh-key
@@ -745,9 +746,10 @@
 (defmethod post-control-event! :deleted-ssh-key
   [target message {:keys [project-id hostname fingerprint]} previous-state current-state]
   (let [project-name (vcs-url/project-name project-id)
+        vcs-type (vcs-url/vcs-type project-id)
         api-ch (get-in current-state [:comms :api])]
     (ajax/ajax :delete
-               (gstring/format "/api/v1/project/%s/ssh-key" project-name)
+               (api-path/project-ssh-key vcs-type project-name)
                :delete-ssh-key
                api-ch
                :params {:fingerprint fingerprint


Bugfix to make sure layer arguments do not flatten individual arg values.

--- src/cortex/nn/layers.clj
+++ src/cortex/nn/layers.clj
@@ -467,7 +467,7 @@
    (assert (and kernel-dim pad stride))
    (let [retval (-> (apply convolutional-type-layer :max-pooling
                           kernel-dim kernel-dim pad pad
-                          stride stride 0 :ceil (flatten (seq args)))
+                          stride stride 0 :ceil (apply concat (seq args)))
                    (#(if (contains? % :pool-op)
                        %
                        (assoc % :pool-op :max))))]


Add missing curly brace to doc

Add missing curly brace to doc

--- src/datascript/core.cljc
+++ src/datascript/core.cljc
@@ -112,7 +112,7 @@
                  ; => {:db/id   1,
                  ;     :name    \"Ivan\"
                  ;     :likes   [:pizza]
-                 ;     :friends [{:db/id 2, :name \"Oleg\"}]"}
+                 ;     :friends [{:db/id 2, :name \"Oleg\"}]}"}
   pull dp/pull)


fixed and improved handling of zero rope insertions

--- src/engine/data/rope.clj
+++ src/engine/data/rope.clj
@@ -389,11 +389,9 @@
   "Insert string in Rope at index or line/column"
   ([root index string]
      (rooted
-      (if (= index (count root))
-        (conc root string)
-        (let [[left-rope target right-rope position] (rope-split-at root index)]
-          (merge (conjoin left-rope (subs target 0 position) string (subs target position))
-                 right-rope)))))
+      (let [[left-rope target right-rope position] (rope-split-at root index)]
+        (merge (conjoin left-rope (subs target 0 position) string (subs target position))
+               right-rope))))
   ([root line column string]
      (let [[left-rope left-lines line right-lines right-rope] (rope-split-at-line root line)]
        (rooted (merge (conjoin left-rope


Parallelize parsing

Parallelize parsing


Updated distance docs

Updated distance docs


Update cancred copyright year

Update cancred copyright year

--- src/cljs/salava/extra/cancred/ui/block.cljs
+++ src/cljs/salava/extra/cancred/ui/block.cljs
@@ -6,7 +6,7 @@
   [:footer.footer
    [:div.footer-container
     [:p.text-muted
-    "Copyright © Learning Agents 2015-2017. | "
+    "Copyright © Learning Agents 2015-2019. | "
      [:a {:class "bottom-link" :href "/terms/" }
       "Terms of Use"]
     " | "


(MAINT) Tidy up 'simple' API

(MAINT) Tidy up 'simple' API

This commit is a follow-up to the initial 'simple' API commit, which
removes an errant `dissoc`, fixes a typo, and adds developer TODO
comments for adding an `options` parameter.

--- src/clojure/puppetlabs/ssl_utils/simple.clj
+++ src/clojure/puppetlabs/ssl_utils/simple.clj
@@ -16,7 +16,7 @@

 (defn ssl-keys?
   "Returns true if the given map contains all the fields required to define an
-  SSL keypair and associated cetname info."
+  SSL keypair and associated certname info."
   [x]
   (and (map? x)
     (ssl-utils/public-key? (:public-key x))
@@ -50,6 +50,7 @@

 (def key-length 4096)

+;; TODO Add final optional `options' map for :key-length
 (defn gen-keys
   [certname]
   {:pre [(string? certname)]
@@ -60,6 +61,7 @@
      :x500-name (ssl-utils/cn certname)
      :certname certname}))

+;; TODO Add final optional `options' map for :extensions
 (defn gen-cert*
   [ca-keys host-keys serial]
   {:pre [(ssl-keys? ca-keys)
@@ -77,6 +79,7 @@
       (:public-key host-keys)
       [])))

+;; TODO Add final optional `options' map for :key-length and :extensions
 (defn gen-cert
   [certname ca-cert serial]
   {:pre [(string? certname)
@@ -84,11 +87,9 @@
          (integer? serial)]
    :post [(ssl-cert? %)]}
   (let [cert-keys (gen-keys certname)]
-    (assoc cert-keys :cert (gen-cert*
-                             (dissoc ca-cert :cert)
-                             cert-keys
-                             serial))))
+    (assoc cert-keys :cert (gen-cert* ca-cert cert-keys serial))))

+;; TODO Add final optional `options' map for :key-length and :extensions
 (defn gen-self-signed-cert
   [certname serial]
   {:pre [(string? certname)


Minor jumpbot tweaks.

Minor jumpbot tweaks.

--- src/examples/jumpbot.clj
+++ src/examples/jumpbot.clj
@@ -15,6 +15,7 @@
 (defn make-jumpbot [server username]
   (let [bot (core/connect server username)]
     (events/add-handler bot :dead #'handle-dead)
-    (loops/add-loop bot #'jump 3000 :jump-loop)
+    (loops/add-loop bot #'jump 2000 :jump-loop)
+    (Thread/sleep 10000)
     bot))


add exception handle for redis client timeout

--- jepsen-test/src/jepsen/elasticell.clj
+++ jepsen-test/src/jepsen/elasticell.clj
@@ -55,26 +55,32 @@
     (invoke! [this test op]
       (let [[k v] (:value op)
             crash (if (= :read (:f op)) :fail :info)]
-          (case (:f op)
-           :read (  let[value (wcar* (car/get k))]
-                    (assoc op :type :ok, :value (independent/tuple k (parse-long value))))
+        (try
+            (case (:f op)
+              :read (  let[value (wcar* (car/get k))]
+                        (assoc op :type :ok, :value (independent/tuple k (parse-long value))))

-            :write (do  (wcar* (car/set k v))
-                        (assoc op :type, :ok))
+              :write (do  (wcar* (car/set k v))
+                          (assoc op :type, :ok))

-            :cas (let [[value value'] v
-                        res (wcar* (car/compare-and-set k value value'))]
-                   (assoc op :type (if (= res 1)
-                                     :ok
-                                     :fail)))
+              :cas (let [[value value'] v
+                          res (wcar* (car/compare-and-set k value value'))]
+                    (assoc op :type (if (= res 1)
+                                      :ok
+                                      :fail)))

-            :hset (let [ [member value] v
-                        _  (wcar*  (car/hset (str "hkey" k) member value))]
-                        (assoc op :type, :ok))
-            :hget (let [ [member _] v
-                        res  (wcar* (car/hget (str "hkey" k) member))]
-                        (assoc op :type, :ok :value (independent/tuple k [member (parse-long res)])))
-                                     )))
+              :hset (let [ [member value] v
+                          _  (wcar*  (car/hset (str "hkey" k) member value))]
+                          (assoc op :type, :ok))
+              :hget (let [ [member _] v
+                          res  (wcar* (car/hget (str "hkey" k) member))]
+                          (assoc op :type, :ok :value (independent/tuple k [member (parse-long res)]))))
+          (catch clojure.lang.ExceptionInfo e (do (assoc op :type :crash :error e)))
+          (catch java.net.SocketTimeoutException e (do (assoc op :type :crash :error e)))
+          (catch Exception e (do (info "Exception type: " (type e)) (assoc op :type :crash :error e)) )
+        )
+      )
+    )

     (teardown! [_ test]
       ; If our connection were stateful, we'd close it here.


playing around

playing around

--- src/fogus/me/trammel.clj
+++ src/fogus/me/trammel.clj
@@ -232,13 +232,39 @@
               {:factory ~factory-name})))
        ~name)))

+(defmacro defconstrainedrecord
+  [name slots invariants & etc]
+  (let [fields       (->> slots (partition 2) (map first) vec)
+        defaults     (->> slots (partition 2) (map second))
+        ctor-name    (symbol (str name \.))
+        factory-name (symbol (str "new-" name))]
+    `(do
+       (defrecord ~name
+         ~fields
+         ~@etc)
+       (defconstrainedfn ~factory-name
+         ([] [] (with-meta
+                  (~ctor-name ~@defaults)
+                  {:contract (contract ~name "" ~fields ~invariants)}))
+         ([& {:keys ~fields :as kwargs# :or ~(apply hash-map slots)}]
+            ~invariants
+            (with-meta
+              (-> (~ctor-name ~@defaults)
+                  (merge kwargs#))
+              {:contract (contract ~name "" ~fields ~invariants)})))
+       ~name)))
+
 (comment
   (defconstrainedrecord Foo [a 1 b 2]
     [(every? number? [a b])]
     Object
     (toString [this] (str "record Foo has " a " and " b)))

-  (meta (new-Foo :a 2))
+  (defn f [m]
+    (flatten (map (fn [[k v]] [(symbol (name k)) v]) m)))
+  (f (assoc (new-Foo) :a 4 :c 5))
+
+  ((:contract (meta (new-Foo :a 2))) #(apply new-Foo %&) :a 6)
 )


fixed changing volume when no track is loaded

--- src/frontend/player.cljs
+++ src/frontend/player.cljs
@@ -86,4 +86,6 @@

 (defn set-volume [volume]
   (swap! app-state assoc :volume volume)
-  (.setVolume (:current-sound @app-state) volume))
+
+  (if-not (nil? (:current-sound @app-state))
+    (.setVolume (:current-sound @app-state) volume)))


Add deprecate notice to connect.graphql namespace

--- src/com/wsscode/pathom/connect/graphql.cljc
+++ src/com/wsscode/pathom/connect/graphql.cljc
@@ -1,6 +1,10 @@
 (ns com.wsscode.pathom.connect.graphql
-  (:require [camel-snake-kebab.core :as csk]
-            [clojure.spec.alpha :as s]
+  "DEPRECATED: this whole namespaced is deprecated, it will stay in the codebase to keep
+  compatibility for old users, but we recommend moving to the graphql2 ns, the issues
+  that happen is that by trying to normalize the graphql names to be more clojure friendly
+  we end up in cases were graphql things get unreachable, the new approach just sends
+  the data as-is, making everything reachable"
+  (:require [clojure.spec.alpha :as s]
             [clojure.string :as str]
             [#?(:clj  com.wsscode.common.async-clj
                 :cljs com.wsscode.common.async-cljs) :refer [let-chan go-catch <? <?maybe]]


Remove comment

Remove comment

--- src/graphql_clj/spec.clj
+++ src/graphql_clj/spec.clj
@@ -1,4 +1,4 @@
-(ns graphql-clj.spec                                        ;; TODO move to graphql-clj.type
+(ns graphql-clj.spec
   (:require [clojure.spec :as s]
             [clojure.string :as str]
             [graphql-clj.visitor :as v]


OO: Fix cljfmt check

OO: Fix cljfmt check

--- src/hatti/map/utils.cljs
+++ src/hatti/map/utils.cljs
@@ -141,8 +141,8 @@
 (defmulti get-as-geom
   (fn [record field & [repeat-child-index]]
     (cond
-     (f/repeat? field) :repeat
-     :else :default)))
+      (f/repeat? field) :repeat
+      :else :default)))

 (defmethod get-as-geom :repeat
   [record {:keys [children full-name] :as field}]


Chaning the way geofields are parsed off of csv data.

--- src/hatti/map/utils.cljs
+++ src/hatti/map/utils.cljs
@@ -137,16 +137,16 @@
                   "gps" "Point"
                   "geoshape" "Polygon"
                   "geotrace" "LineString"} (:type geofield))
-        parse (fn [s] (when (seq s)
+        parse (fn [s] (when (and (seq s) (not= s "n/a"))
                        (for [coord-string (string/split s #";")]
                          (let [[lat lng _ _ ] (string/split coord-string #" ")]
                            [(read-string lng) (read-string lat)]))))
         coordfn (case geotype
-                  "Point" reverse
+                  "Point" #(first (parse %))
                   "LineString" parse
                   "Polygon" #(vector (parse %))
                   identity)
-        key (if (= geotype "Point") "_geolocation" (:full-name geofield))
+        key (:full-name geofield)
         value (get record key)
         coords (coordfn value)]
     (if (f/osm? geofield)


Fix digest subtitle copy.

Fix digest subtitle copy.


Make merge-io arity safer for reducing

Make merge-io arity safer for reducing

--- src/com/wsscode/pathom/connect/indexes.cljc
+++ src/com/wsscode/pathom/connect/indexes.cljc
@@ -50,8 +50,10 @@

 (defn merge-io
   "Merge ::pc/index-io maps."
-  [a b]
-  (merge-with merge-io-attrs a b))
+  ([] {})
+  ([a] a)
+  ([a b]
+   (merge-with merge-io-attrs a b)))

 (defn io->query
   "Converts IO format to query format."


cleanup fsworker

cleanup fsworker

--- src/brainbot/nozzle/fsworker.clj
+++ src/brainbot/nozzle/fsworker.clj
@@ -1,10 +1,6 @@
 (ns brainbot.nozzle.fsworker
-  (:gen-class)
-  (:require [clojure.tools.logging :as logging]
-            [clj-logging-config.log4j :as log-config])
-  (:require [brainbot.nozzle.reap :as reap]
-            [brainbot.nozzle.mqhelper :as mqhelper]
-            [brainbot.nozzle.routing-key :as rk]
+  (:require [clojure.tools.logging :as logging])
+  (:require [brainbot.nozzle.mqhelper :as mqhelper]
             [brainbot.nozzle.misc :as misc])
   (:require [langohr.basic :as lb]
             [langohr.shutdown :as lshutdown]
@@ -13,17 +9,7 @@
             [langohr.queue :as lq]
             [langohr.channel :as lch]
             [langohr.consumers :as lcons])
-  ;; (:require [me.raynes.fs :as fs])
-  (:require [clojure.tools.cli :as cli])
-  (:require [clojure.string :as string])
-  (:require [brainbot.nozzle.stat :as stat]
-            [brainbot.nozzle.vfs :as vfs])
-  (:require [clojure.stacktrace :as trace])
-  (:require [com.brainbot.iniconfig :as ini])
-  (:require [tika])
-  (:import java.io.File)
-  (:import [com.rabbitmq.client Address ConnectionFactory Connection Channel ShutdownListener])
-  (:import [java.util.concurrent Executors]))
+  (:require [brainbot.nozzle.vfs :as vfs]))

 (defn get-permissions-for-entry
@@ -37,6 +23,7 @@
   [fs directory entries]
   (map (partial get-permissions-for-entry fs directory)
        entries))
+

 (defn entry-is-type?
   [type entry]
@@ -62,20 +49,6 @@
   [fs {path :path :as body} {publish :publish}]
   (publish "get_permissions" {:directory path
                               :entries (vfs/cmd-listdir fs path)}))
-
-
-
-
-
-(defn publish-some-message
-  [conn]
-  (let [ch (lch/open conn)
-        queue-name (misc/initialize-rabbitmq-structures ch "extract_content" "nextbot" "fscrawler:test")]
-    (doseq [i (range 15)]
-      (println "[main] Publishing...")
-      (lb/publish ch "nextbot" queue-name "Hello!" :content-type "text/plain" :type "greetings.hi"))
-    (lch/close ch)
-    queue-name))

 (def command->msg-handler


remove TODO, is no longer valid

remove TODO, is no longer valid

--- example/lambdacd_git/example/pipeline.clj
+++ example/lambdacd_git/example/pipeline.clj
@@ -10,8 +10,6 @@
             [lambdacd-git.core :as core]
             [lambdacd.runners :as runners]
             [lambdacd-git.ssh-agent-support :as ssh-agent-support]))
-
-; TODO: namespace inconsistency? with-workspace from core, clone from git

 (def repo "git@github.com:flosell/testrepo")
 (def branch "master")


feat(replay): idempotent timeline [PDOK-2291]

Uses all versions to check whether or not the event should be processed

--- src/main/clojure/pdok/featured/timeline.clj
+++ src/main/clojure/pdok/featured/timeline.clj
@@ -309,17 +309,18 @@
           batched-history (with-batch new-history-batch new-history-batch-size (partial new-history db) flush-fn)
           cached-get-current (use-cache feature-cache cache-use-key)]
       (if-let [current (cached-get-current dataset root-col root-id)]
-        (let [new-current (merge current path feature)]
-          (if (= (:action feature) :close)
-            (cache-batched-update (sync-valid-to new-current feature))
-            (if (t/before? (:_valid_from current) (:validity feature))
-              (do ;(println "NOT-SAME")
-                        (batched-history (sync-valid-to current feature))
-                ;; reset valid-to for new-current.
-                        (cache-batched-update (reset-valid-to (sync-valid-from new-current feature))))
-              (do ;(println "SAME")
-                        ;; reset valid-to because it might be closed because of nested features.
-                        (cache-batched-update (reset-valid-to (sync-valid-from new-current feature)))))))
+        (when-not (some #{(:version feature)} (:_all_versions current))
+          (let [new-current (merge current path feature)]
+            (if (= (:action feature) :close)
+              (cache-batched-update (sync-valid-to new-current feature))
+              (if (t/before? (:_valid_from current) (:validity feature))
+                (do ;(println "NOT-SAME")
+                  (batched-history (sync-valid-to current feature))
+                  ;; reset valid-to for new-current.
+                  (cache-batched-update (reset-valid-to (sync-valid-from new-current feature))))
+                (do ;(println "SAME")
+                  ;; reset valid-to because it might be closed because of nested features.
+                  (cache-batched-update (reset-valid-to (sync-valid-from new-current feature))))))))
         (cache-batched-new (sync-valid-from (merge (init-root dataset root-col root-id) path feature) feature)))))
   (proj/change-feature [_ feature]
     ;; change can be the same, because a new nested feature validity change will also result in a new validity


CLJ-2026 Prevent concurrent loads in dynaload

Signed-off-by: Alex Miller <99328387f8334f68433c424d2dfd83062f62754b@cognitect.com>

--- src/main/clojure/clojure/spec/gen/alpha.clj
+++ src/main/clojure/clojure/spec/gen/alpha.clj
@@ -12,11 +12,14 @@

 (alias 'c 'clojure.core)

+(defonce ^:private dynalock (Object.))
+
 (defn- dynaload
   [s]
   (let [ns (namespace s)]
     (assert ns)
-    (require (c/symbol ns))
+    (locking dynalock
+      (require (c/symbol ns)))
     (let [v (resolve s)]
       (if v
         @v


PDOK-1599 vullen van metadata voor extract-tabellen nu in Featured

--- src/main/clojure/pdok/featured/extracts.clj
+++ src/main/clojure/pdok/featured/extracts.clj
@@ -10,6 +10,8 @@

 (def ^{:private true } extract-schema "extractmanagement")
+(def ^{:private true } extractset-table "extractmanagement.extractset")
+(def ^{:private true } extractset-area-table "extractmanagement.extractset_area")

 (defn- template [templates-dir dataset feature-type extract-type]
   (let [template-file (clojure.java.io/as-file (str templates-dir "/" dataset "/" extract-type "/" feature-type ".mustache"))]
@@ -57,29 +59,46 @@

 (defn- jdbc-insert-extract [db table entries]
    (try (j/with-db-connection [c db]
-          (apply
-            (partial j/insert! c (str extract-schema "." table) :transaction? false
+          (apply (partial j/insert! c (str extract-schema "." table) :transaction? false
                     [:valid_from :valid_to :tiles :xml :created_on])
                     entries))
         (catch java.sql.SQLException e (j/print-sql-exception-chain e))))

-(defn- jdbc-insert-extractset [db extract-type version tiles]
-  ;TODO
-  )
+(defn add-extractset [db extractset version]
+  (let [query (str "select id from " extractset-table " where extractset_name = ? and version = ?")]
+    (j/with-db-connection [c db]
+      (let [result (j/query c [query extractset version])]
+        (if (empty? result)
+          (j/insert! db extractset-table {:extractset_name extractset :version version :active false})
+          result)))))

-(defn prepare-feature [[tiles xml-feature valid-from valid-to]]
-  [[valid-from valid-to (vec tiles) xml-feature nil] (vec tiles)])
+(defn add-extractset-area [db extractset-id tiles]
+  (let [query (str "select * from " extractset-area-table " where extractset_id = ? and area_id = ?")]
+    (j/with-db-transaction [c db]
+      (doseq [area-id tiles]
+        (if (empty? (j/query c [query extractset-id area-id]))
+          (j/insert! db extractset-area-table {:extractset_id extractset-id :area_id area-id}))))))
+
+(defn- tiles-from-feature [[tiles & more]]
+   tiles)
+
+(defn add-metadata-extract-records [db dataset extract-type version rendered-features]
+   (let [extractset-id (:id (first (add-extractset db (str dataset "_" extract-type) version)))
+         tiles (reduce clojure.set/union (map tiles-from-feature rendered-features))]
+     (add-extractset-area db extractset-id tiles)))
+
+(defn- tranform-feature-for-db [[tiles xml-feature valid-from valid-to]]
+  [valid-from valid-to (vec tiles) xml-feature nil])

 (defn add-extract-records [db dataset feature-type extract-type version rendered-features]
   "Inserts the xml-features and tile-set in an extract schema based on dataset, extract-type, version and feature-type,
    if schema or table doesn't exists it will be created."
-   (let [table (str dataset "_" extract-type "_v" version "_" feature-type)]
-  (do
-   (create-extract-collection config/data-db table)
-   (let [[entries tiles] (map prepare-feature rendered-features)]
-     (jdbc-insert-extract db table entries)
-     (jdbc-insert-extractset db extract-type version tiles))
- (count rendered-features))))
+  (let [table (str dataset "_" extract-type "_v" version "_" feature-type)]
+    (do
+      (create-extract-collection db table)
+      (jdbc-insert-extract db table (map tranform-feature-for-db rendered-features))
+      (add-metadata-extract-records db dataset extract-type version rendered-features))
+    (count rendered-features)))

 (defn fill-extract [dataset collection extract-type extract-version]
   (let [feature-type collection


PDOK-1025: execute function on-attribute specified in template

--- src/main/clojure/pdok/featured/geometry.clj
+++ src/main/clojure/pdok/featured/geometry.clj
@@ -16,16 +16,19 @@
 (defn replace-template [template f-key-value]
   (clojure.string/replace template (template-to-pattern template) f-key-value))

+(defn on-attribute [function-as-string]
+  (ns-resolve *ns* (symbol (str "pdok.featured.feature/as-" function-as-string))))
+
 (deftype MapProxy [feature]
     clojure.lang.IFn
     	(invoke [_ k]
              (let [key-in-feature (keyword (clojure.string/replace k #"\{\{|\}\}" ""))]
       				(if (= :_geometry.gml key-in-feature)
-            			;TODO split key and resolve function based on key
-                    (as-gml (:_geometry feature))
-                   ; ((ns-resolve *ns* (symbol "pdok.featured.feature/as-gml")) (:_geometry feature))
+                  (let [function-on-attribute (str key-in-feature)
+                        function-on-attribute (last (clojure.string/split function-on-attribute #"\."))]
+                    ((on-attribute function-on-attribute) (:_geometry feature)))

-                 		(or (.valAt feature key-in-feature)
+                 	(or (.valAt feature key-in-feature)
           				"")))))

 (defn replace-features-in-template [template features]


Fixed accuracy of docs for ScrapeTripReport protocol.

--- project/scrape-trs/src/scrape_trs/protocol.clj
+++ project/scrape-trs/src/scrape_trs/protocol.clj
@@ -10,8 +10,8 @@
   (extract-pager-urls
     [this list-page]
     "Given a page (as a string) that lists links to trip reports and may have
-    pagination, return a sequence of urls to all pages in the pagination, or a
-    one item sequence containing list-page if there is no pagination.")
+    pagination, return a sequence of urls to all pages in the pagination, or
+    nil if there is no pagination.")
   (extract-trip-report-urls
     [this list-page]
     "Given a page (as a string) that lists links to trip reports, return a


Fix synopsis of previous gathering

Fix synopsis of previous gathering

--- src/clj/chili_dog_night/data.clj
+++ src/clj/chili_dog_night/data.clj
@@ -3,7 +3,7 @@

 (def gatherings [{:date "2016/03/16"
                   :address "3828 Meridian Ave N, Seattle, WA 98103, USA"
-                  :synopsis "March 16th, 2016: Cookies, Fuller House, Pinocchio, and David and Goliath."
+                  :synopsis "March 16th, 2016: Cookies, Fuller House, Pinocchio, and Extraction."
                   :food ["Hydrox Creme Filled Chocolate Sandwich Cookies"
                          "Pepperidge Farm Double Chocolate Milano"
                          "Pepperidge Farm Dulce de Leche Cookies"]


Get the main page minimally rendering

Get the main page minimally rendering

--- src/clj/comic_reader/web_app.clj
+++ src/clj/comic_reader/web_app.clj
@@ -59,7 +59,8 @@
        [[:div.row
          [:div#app.small-12.columns]]
         [:input#history_state {:type "hidden"}]]
-       :js [(page/include-js "/public/js/main.js")]))
+       :js [(page/include-js "/public/js/main.js")
+            [:script "comic_reader.main.main();"]]))

     (c/GET "/devcards" []
       (render-page


implement Globalsec Security Clearance

implement Globalsec Security Clearance

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -159,6 +159,14 @@
     :abilities [{:counter-cost 1 :msg "gain 1 [Credits]" :req (req (:run @state))
                  :effect (req (gain state side :credit 1)
                               (when (zero? (:counter card)) (trash state :runner card)))}]}
+
+   "Globalsec Security Clearance"
+   {:req (req (> (:link runner) 1))
+    :events {:runner-turn-begins
+             {:optional {:prompt "Use Globalsec Security Clearance to lose [Click]?" :msg "lose [Click]"
+                         :effect (effect (lose :click 1)
+                                         (prompt! card (str "The top card of R&D is "
+                                         (:title (first (:deck corp)))) ["OK"] {}))}}}}

    "Grifter"
    {:events {:runner-turn-ends


Add equality fixes on Person class, so we can find clashes

--- src/clj/herder/solver/person.clj
+++ src/clj/herder/solver/person.clj
@@ -23,3 +23,8 @@

 (defn- person-setName [this item]
   (setValue this :name item))
+
+(defn- person-equals [this b]
+  (= (person-getId this) (person-getId b)))
+(defn- person-hashCode [this]
+  (.hashCode (person-getId this)))


Fix add vertical scroll

Fix add vertical scroll

--- src/cljs/dbquery/db_console.cljs
+++ src/cljs/dbquery/db_console.cljs
@@ -125,7 +125,7 @@
 (defn share-query [db-list q-id]
   (let [ids (atom (into #{} (for [db db-list :when (:query_id db)] (:id db))))]
     (fn [db-list q-id]
-      [:div.my-popover.panel {:style {:margin-top "37px" :padding "5px"}}
+      [:div.my-popover.panel {:style {:margin-top "37px" :padding "5px" :max-height "300px" :overflow-y "scroll"}}
        [:form
         (doall
          (map-indexed


Force some recompiles

Force some recompiles

--- src/cljs/modern_cljs/modern.cljs
+++ src/cljs/modern_cljs/modern.cljs
@@ -12,10 +12,12 @@
 (def SmallComponentComponent
   (.extend (.-Component Ember)
     #js {:dynamicAttribute "foo"
+         :thing "123"
          :actions
          #js {:myAction
               (fn []
-                (.set js/this "dynamicAttribute" "bar"))}}))
+                (this-as this
+                 (.set this "dynamicAttribute" "abc")))}}))

 (let [application (.create (.-Application Ember))
       router (.-Router application)]


Autofocus on show search input

Autofocus on show search input

--- src/cljs/movement/generator.cljs
+++ src/cljs/movement/generator.cljs
@@ -246,10 +246,9 @@
         [:div.pure-u-2-5]
         [:div.pure-u-1-5
          [:i.fa.fa-plus.fa-2x
-          {:on-click #(do (add-movement title)
-                          (reset! show-search-input? false))
-           :style    {:opacity 0.5
-                      :cursor  'pointer}}]]]
+          {:on-click #(add-movement title)
+           :style {:opacity 0.5
+                   :cursor  'pointer}}]]]
        (if @show-search-input?
          [:div.pure-g
           [:div.pure-u
@@ -262,6 +261,7 @@
                                  :class       "edit"
                                  :placeholder "type to find and add movement.."
                                  :size        21
+                                 :auto-focus true
                                  :on-save     #(when (some #{%} (session/get :all-movements))
                                                 (add-movement-from-search title %))}])]]
          [:div.pure-g {:style {:margin-bottom "30px"


Fix castle rights bug.

Fix castle rights bug.

--- src/clojure/clj_chess/board.cljc
+++ src/clojure/clj_chess/board.cljc
@@ -114,10 +114,10 @@
   [board]
   (into #{}
         (concat
-          (for [[c k] (map vector (range) [:white-oo :black-oo])
+          (for [[c k] [[:white :white-oo] [:black :black-oo]]
                 :when (can-castle-kingside? board c)]
             k)
-          (for [[c k] (map vector (range) [:white-ooo :black-ooo])
+          (for [[c k] [[:white :white-ooo] [:black :black-ooo]]
                 :when (can-castle-queenside? board c)]
             k))))


added accessibility-labels

added accessibility-labels

Signed-off-by: Churikova Tetiana <df59d4ef10565572befc1f25db27f19bd387b29a@gmail.com>

--- src/status_im/ui/screens/pairing/views.cljs
+++ src/status_im/ui/screens/pairing/views.cljs
@@ -77,7 +77,8 @@
       [icons/icon :main-icons/add (icon-style (styles/pairing-button-icon true))]]]
     [react/view {:style styles/pairing-actions-text}
      [react/view
-      [react/text {:style styles/pair-this-device-title} (i18n/label :t/pair-this-device)]]
+      [react/text {:style               styles/pair-this-device-title
+                   :accessibility-label :advertise-device} (i18n/label :t/pair-this-device)]]
      [react/view
       [react/text (i18n/label :t/pair-this-device-description)]]]]])

@@ -160,11 +161,12 @@
      [react/text (i18n/label :t/pairing-please-set-a-name)]]
     [text-input/text-input-with-label
      {:placeholder     (i18n/label :t/specify-name)
-      :style           styles/input
-      :container       styles/input-container
-      :default-value   @installation-name
-      :on-change-text  #(reset! installation-name %)
-      :auto-focus      true}]]
+      :style               styles/input
+      :accessibility-label :device-name
+      :container           styles/input-container
+      :default-value       @installation-name
+      :on-change-text      #(reset! installation-name %)
+      :auto-focus          true}]]
    [react/view styles/bottom-container
     [react/view components.styles/flex]
     [components.common/bottom-button


border style changed to dotted

border style changed to dotted

--- src/NoteHub/views/css_generator.clj
+++ src/NoteHub/views/css_generator.clj
@@ -108,6 +108,7 @@
             helvetica-neue
             :position :fixed
             :width (% 100)
+            :border-top [:1px :dotted foreground-halftone]
             :background background-halftone
             :padding :0.2em
             :bottom :0px


Pulled cluster-eval method out of cluster, to allow for layering of lein tasks.

--- leiningen/cluster.clj
+++ leiningen/cluster.clj
@@ -1,37 +1,45 @@
 (ns leiningen.cluster
-  (:use [leiningen.compile :only (eval-in-project)]))
+  (:use [leiningen.compile :only (eval-in-project)]
+        [leiningen.uberjar :only (uberjar)]))
+
+(defn cluster-eval [project form]
+  (eval-in-project project form nil nil
+                   `(do (println "Loading cluster namespace...")
+                        (require 'forma.hadoop.cluster)
+                        (println "Loaded!"))))

 (defn create-cluster
-  [node-type node-count]
-  `(do (println (str (format "Running create-cluster of type %s, with %d nodes."
-                             ~node-type ~node-count)))
-       (forma.hadoop.cluster/create-cluster ~node-type ~node-count)
-       (println "Cluster created! Hit Control-C to exit.")))
+  [project node-type node-count]
+  (cluster-eval
+   project
+   `(do (println (str (format "Running create-cluster of type %s, with %d nodes."
+                              ~node-type ~node-count)))
+        (forma.hadoop.cluster/create-cluster ~node-type ~node-count)
+        (println "Cluster created! Hit Control-C to exit."))))

-(defn destroy-cluster []
-  `(do (println "Running destroy-cluster.")
-       (forma.hadoop.cluster/destroy-cluster)
-       (println "Cluster destroyed! Hit Control-C to exit.")))
+(defn destroy-cluster [project]
+  (cluster-eval
+   project
+   `(do (println "Running destroy-cluster.")
+        (forma.hadoop.cluster/destroy-cluster)
+        (println "Cluster destroyed! Hit Control-C to exit."))))

 (defn execute-jar
   "TODO: Fill this out with code for uberjarring, uploading to
-  jobtracker and running a command as the hadoop user."  [])
+  jobtracker and running a command as the hadoop user."
+  []
+  `(do (println)))

 (defn cluster
   "Start or destroy a pallet-hadoop cluster."
   ([project]
-     (println
-      "Go ahead and supply a subtask. Options are create and destroy."))
+     (println "Go ahead and supply a subtask.")
+     (println "Options are `create` and `destroy`."))
   ([project subtask & args]
      (let [task-func (case subtask
                            "create" create-cluster
                            "destroy" destroy-cluster
                            "execute" execute-jar)]
-       (eval-in-project project
-                        (apply task-func args)
-                        nil nil
-                        `(do (println "Loading cluster namespace...")
-                             (require 'forma.hadoop.cluster)
-                             (println "Loaded!"))))))
+       (apply task-func project args))))

 ;; Gotta figure out native deps in leiningen.


core: group-by

core: group-by

--- core/data/core.clj
+++ core/data/core.clj
@@ -3498,6 +3498,18 @@
   (filter (complement sequential?)
           (rest (tree-seq sequential? seq x))))

+(defn group-by
+  "Returns a map of the elements of coll keyed by the result of
+  f on each element. The value at each key will be a vector of the
+  corresponding elements, in the order they appeared in coll."
+  {:added "1.0"}
+  [f coll]
+  (reduce
+   (fn [ret x]
+     (let [k (f x)]
+       (assoc ret k (conj (get ret k []) x))))
+   {} coll))
+
 (defmacro cond->
   "Takes an expression and a set of test/form pairs. Threads expr (via ->)
   through each form for which the corresponding test


fix race condition in :node-test with :autorun

--- src/main/shadow/build/targets/node_test.clj
+++ src/main/shadow/build/targets/node_test.clj
@@ -12,7 +12,8 @@
             [cljs.compiler :as cljs-comp]
             [shadow.build.api :as build-api]
             [shadow.build.output :as output]
-            [shadow.build.data :as data])
+            [shadow.build.data :as data]
+            [shadow.build.async :as async])
   (:import [java.lang ProcessBuilder$Redirect]))

 (defn configure [{::build/keys [config mode] :as state}]
@@ -86,5 +87,6 @@
       (cond->
         (and (= stage :flush)
              (:autorun config))
-        (autorun-test)
+        (-> (async/wait-for-pending-tasks!)
+            (autorun-test))
         )))


Remove sgen alias from conventional test

--- test/github_changelog/conventional_test.clj
+++ test/github_changelog/conventional_test.clj
@@ -2,7 +2,7 @@
   (:require
    [github-changelog
     [conventional :as conventional]
-    [schema-generators :as sgen :refer [complete-pull complete-config]]]
+    [schema-generators :refer [complete-pull complete-config]]]
    [clojure.test :refer :all]
    [clojure.test.check.generators :as gen]
    [clojure.string :refer [join]]))


Always return entity on swap-entity!

Always return entity on swap-entity!

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -245,7 +245,8 @@
   [env fn & args]
   (let [e (raw-entity env)]
     (if (atom? e)
-      (apply swap! e fn args))))
+      (apply swap! e fn args)
+      e)))

 (s/fdef swap-entity!
   :args (s/cat :env ::env :fn fn? :args (s/* any?))


Adjust contributors next urls.

Adjust contributors next urls.

--- src/oc/storage/representations/activity.clj
+++ src/oc/storage/representations/activity.clj
@@ -28,11 +28,13 @@
     (str (url collection-type org sort-type) concat-str "start=" start (when direction (str "&direction=" (name direction)))))))

 (defn- contributor-url
-  ([org author-uuid {sort-type :sort-type}]
-  (url "contributors" org author-uuid sort-type))
+  ([{slug :slug :as org} author-uuid sort-type]
+  (let [sort-path (when (= sort-type :recent-activity) "?sort=activity")]
+    (str "/orgs/" slug "/contributors/" author-uuid sort-path)))
+
   ([{slug :slug :as org} author-uuid sort-type {start :start direction :direction}]
   (let [concat-str (if (= sort-type :recent-activity) "&" "?")]
-    (str (url "contributors" org author-uuid sort-type) concat-str "start=" start (when direction (str "&direction=" (name direction)))))))
+    (str (contributor-url org author-uuid sort-type) concat-str "start=" start (when direction (str "&direction=" (name direction)))))))

 (defn- is-inbox? [collection-type]
   (= collection-type "inbox"))
@@ -53,7 +55,7 @@
                      (is-inbox? collection-type)
                      (inbox-url collection-type org {:start last-activity-date :direction direction})
                      (is-contributor? collection-type)
-                     (contributor-url org author-uuid {:start last-activity-date :direction direction :sort-type sort-type})
+                     (contributor-url org author-uuid sort-type {:start last-activity-date :direction direction})
                      :else
                      (url collection-type org sort-type {:start last-activity-date :direction direction})))
         next-link (when next-url (hateoas/link-map "next" hateoas/GET next-url {:accept mt/entry-collection-media-type}))]


Tidy up

Tidy up

--- src/discuss/references/main.cljs
+++ src/discuss/references/main.cljs
@@ -39,9 +39,25 @@
   [reference]
   (lib/change-view! :reference-dialog)
   (rlib/save-selected-reference! reference)
-  #_(sidebar/show)
+  (sidebar/show)
   (lib/update-state-item! :layout :reference (fn [_] (:text reference))))

+
+;;;; Handlers
+(defn get-statement-handler
+  "Processes response and changes view with given url."
+  [response]
+  (let [res (com/process-response response)]
+    (com/ajax-get-and-change-view (:url res) :default)))
+
+(defn get-statement-url
+  "Given an issue-id, statement-id and attitude, query statement url inside the discussion."
+  [statement agree]
+  (let [issue-id (get-in statement [:issue :uid])
+        statement-id (get-in statement [:statement :uid])
+        pre-url (get-in config/api [:get :statement-url])
+        url (clojure.string/join "/" [pre-url issue-id statement-id agree])]
+    (com/ajax-get url {} get-statement-handler)))

 ;;;; Views
 (defn dialog-view
@@ -92,21 +108,6 @@
                           (apply dom/div nil
                                  (map #(om/build usage-view (lib/merge-react-key %)) usages))))))))

-(defn get-statement-handler
-  ""
-  [response]
-  (let [res (com/process-response response)]
-    (com/ajax-get-and-change-view (:url res) :default)))
-
-(defn get-statement-url
-  "Given an issue-id, statement-id and attitude, query statement url inside the discussion."
-  [statement agree]
-  (let [issue-id (get-in statement [:issue :uid])
-        statement-id (get-in statement [:statement :uid])
-        pre-url (get-in config/api [:get :statement-url])
-        url (clojure.string/join "/" [pre-url issue-id statement-id agree])]
-    (com/ajax-get url {} get-statement-handler)))
-
 (defn agree-disagree-view
   "Agree or disagree with the selected reference."
   []


Get off the clojure.contrib.sql.internal dependency, with thanks to Stephen Gilardi again.

--- clj_record/core.clj
+++ clj_record/core.clj
@@ -1,6 +1,5 @@
 (ns clj-record.core
   (:require [clojure.contrib.sql        :as sql]
-            [clojure.contrib.sql.internal :as sql.internal]
             [clojure.contrib.str-utils  :as str-utils])
   (:use (clj-record meta util config callbacks)))

@@ -30,7 +29,7 @@
   You're probably more interested in the 'transaction' macro."
   [& body]
   `(let [func# (fn [] ~@body)]
-    (if (sql.internal/*db* :connection) ; XXX: Bad evil sql.internal dependency.
+    (if (sql/find-connection)
       (func#)
       (sql/with-connection db (func#)))))


Tiny cleanup

Tiny cleanup

--- clj_record/core.clj
+++ clj_record/core.clj
@@ -2,6 +2,7 @@
   (:require [clojure.contrib.sql :as sql])
   (:use clojure.contrib.str-utils)
   (:use clojure.contrib.test-is))
+

 (defn singularize
   ([plural] (re-sub #"s$" "" plural))
@@ -11,12 +12,12 @@

 (defn table-name
   ([model-name]
-    (if (string? model-name) model-name (.getName model-name)))
+    (if (string? model-name) model-name (name model-name)))
   {:test (fn []
-    (are (= (table-name _1) _2)
+    (are (= _1 (table-name _2))
       "foo" "foo"
-      'foo "foo"
-      :foo "foo"))})
+      "foo" 'foo
+      "foo" :foo))})

 (defn find-record [model-name id]
   (sql/with-connection db
@@ -61,7 +62,7 @@

 (defmacro init-model [model-name & options]
   (let [optional-forms (defs-from-options model-name options)
-        model-name (.getName model-name)]
+        model-name (name model-name)]
     `(do
       (defn ~'table-name [] (table-name ~model-name))
       (defn ~'find-record [id#]


Fix a NullPointerException on JDK 11 (#241)

--- src/refactor_nrepl/ns/slam/hound/search.clj
+++ src/refactor_nrepl/ns/slam/hound/search.clj
@@ -108,9 +108,9 @@
    (StringTokenizer. path-str File/pathSeparator)))

 (defn all-classpath-entries []
-  (into (map #(System/getProperty %) ["sun.boot.class.path"
-                                      "java.ext.dirs"
-                                      "java.class.path"])
+  (into (keep #(System/getProperty %) ["sun.boot.class.path"
+                                       "java.ext.dirs"
+                                       "java.class.path"])
         (map #(.getName %) (orchard.classpath/classpath-jarfiles))))

 (defn- get-available-classes []


above gpu is expected

above gpu is expected

--- scheduler/src/cook/components.clj
+++ scheduler/src/cook/components.clj
@@ -90,7 +90,7 @@
                                                            :mesos-principal mesos-principal
                                                            :mesos-role mesos-role
                                                            :mesos-framework-name mesos-framework-name
-                                                           :gpus-enabled? mesos-gpu-enabled})
+                                                           :gpu-enabled? mesos-gpu-enabled})
                             get-mesos-utilization-fn (partial (util/lazy-load-var 'cook.mesos/get-mesos-utilization) mesos-master-hosts)
                             trigger-chans ((util/lazy-load-var 'cook.mesos/make-trigger-chans) rebalancer progress optimizer task-constraints)]
                         (try


Implements pattern recognition functions.

--- src/cadence/pattern_recognition.clj
+++ src/cadence/pattern_recognition.clj
@@ -1,6 +1,7 @@
 (ns cadence.pattern-recognition
-  (:require [noir.session :as sess])
-  (:use clj-ml.classifiers))
+  (:require [noir.session :as sess]
+            [clj-ml.data :as data])
+  (:use [clj-ml.classifiers]))

 (def training-min (atom 6))

@@ -32,22 +33,42 @@
 (defn gen-phrase-classifier
   "Creates a trained SVM classifier using the given dataset."
   [training-data]
-  (classifier-train (make-classifier :support-vector-machine :smo)
-                    training-data))
+  (classifier-train
+    (make-classifier :support-vector-machine :smo)
+    training-data))
+
+(defn cadence-to-vector [class cadence]
+  (vec (cons (name class) (map #(get % :timeDifference) (:timeline cadence)))))

 (defn create-dataset
   "Creates a dataset from the two sequences of bad and cadences."
-  [bad-cadences good-cadences]
+  [[bad-cadences good-cadences]]
   ; TODO Implement
-  nil)
+  (let [cadvecs (concat
+                  (map (partial cadence-to-vector :bad) bad-cadences)
+                  (map (partial cadence-to-vector :good) good-cadences))
+        attrs (cons {:kind [:good :bad]}
+                    (for [x (range (count (:timeline (first good-cadences))))]
+                      (keyword (str "c" x))))
+        dataset (data/make-dataset :Cadences
+                                   attrs
+                                   cadvecs
+                                   {:class :kind})]
+    dataset))

 (defn cadence-to-instance
   "Converts a cadence to an instance to be used with a classifier."
-  [cadence]
-  ; TODO Implement
-  nil)
+  [dataset class cadence]
+  (data/make-instance dataset (cadence-to-vector class cadence)))

-(defn cadence-matches?
+(defn evaluate-classifier
+  "Does a simple cross-valiadation on the given classifier map."
+  [{:keys [classifier dataset]}]
+  (classifier-evaluate classifier :cross-validation dataset 10))
+
+(defn classify-cadence
   "Returns whether the given cadence is authentic or not."
   [classifier cadence]
-  (= :authentic (classifier-classify classifier (cadence-to-instance cadence))))
+  (classifier-classify
+    (:classifier classifier)
+    (cadence-to-instance (:dataset classifier) :good cadence)))


Deal gracefully with FTP URLs. Change period to 5 days for 'recently published' to deal with API lag.

--- src/chronograph/import/resolver.clj
+++ src/chronograph/import/resolver.clj
@@ -32,7 +32,7 @@
     (let [url (crdoi/normalise-doi doi)
           result (try-try-again {:sleep 5000 :tries 2} #(client/head url
                                                          {:follow-redirects true
-                                                          :throw-exceptions false
+                                                          :throw-exceptions true
                                                           :socket-timeout 5000
                                                           :conn-timeout 5000
                                                           :headers {"Referer" "chronograph.crossref.org"}}))
@@ -44,7 +44,18 @@
           (locking *out* (prn "Finish resolve" doi ok))
           (when ok
             [first-redirect last-redirect (count redirects)]))
-    (catch Exception ex (do (prn "Ex" ex) nil))))
+    (catch Exception ex (let [message (.getMessage ex)]
+                          ; When it's FTP we can't follow, but we can say that we tried.
+                          ; Message is: Scheme 'ftp' not registered.
+                          (when (.contains message "ftp")
+                            (try
+                              (let [connection (.openConnection (new java.net.URL (crdoi/normalise-doi doi)))
+                                    first-redirect-url (.getHeaderField connection "Location")]
+                                ; We didn't actually follow, so record the number of redirects as zero.
+                                [first-redirect-url "" 0])
+
+                              ; It may still go wrong, in which case just return nothing.
+                              (catch Exception _ nil)))))))

 (defn insert-resolutions
   [doi first-direct last-redirect]
@@ -58,8 +69,8 @@
 (def num-return-chans 50)

 (defn run-doi-resolution []
-  ; Insert recently published.
-  (let [yesterday (t/minus (t/now) (t/days 1))
+  ; Insert recently published. There may be a delay in getting metdata
+  (let [yesterday (t/minus (t/now) (t/days 5))
         today (t/plus (t/now) (t/days 1))
         recently-published (k/select d/events-isam (k/where (and (= :type issued-type-id)
                                                              (>= :event (coerce/to-sql-date yesterday))


Fixed output vars

Fixed output vars

--- src/clj/forma/hadoop/jobs/forma.clj
+++ src/clj/forma/hadoop/jobs/forma.clj
@@ -168,7 +168,7 @@

 (defn prep-for-betas
   [dynamic-src static-src]
-  (<- [?s-res ?mod-h ?mod-v ?s ?l ?prob-series]
+  (<- [?s-res ?mod-h ?mod-v ?s ?l ?eco ?val ?neighbor-val]
         (dynamic-src ?s-res ?pd ?mod-h ?mod-v ?s ?l ?val ?neighbor-val)
         (static-src ?s-res ?mod-h ?mod-v ?s ?l _ _ ?eco _)))


acr couch client + cleanup #331

acr couch client + cleanup
#331

--- src/clj/swarmpit/couchdb/client.clj
+++ src/clj/swarmpit/couchdb/client.clj
@@ -140,11 +140,6 @@
    (find-doc {:username username
               :owner    owner} "dockerhub")))

-(defn dockerhub-exist?
-  [docker-user]
-  (some? (find-doc {:username {"$eq" (:username docker-user)}
-                    :owner    {"$eq" (:owner docker-user)}} "dockerhub")))
-
 (defn create-dockerhub
   [docker-user]
   (-> (assoc docker-user :type "dockerhub")
@@ -175,11 +170,6 @@
    (find-doc {:name  name
               :owner owner} "v2")))

-(defn registry-v2-exist?
-  [registry]
-  (some? (find-doc {:name  {"$eq" (:name registry)}
-                    :owner {"$eq" (:owner registry)}} "v2")))
-
 (defn create-v2-registry
   [registry]
   (-> (assoc registry :type "v2")
@@ -210,11 +200,6 @@
    (find-doc {:user  user
               :owner owner} "ecr")))

-(defn registry-ecr-exist?
-  [ecr]
-  (some? (find-doc {:user  {"$eq" (:user ecr)}
-                    :owner {"$eq" (:owner ecr)}} "ecr")))
-
 (defn create-ecr-registry
   [ecr]
   (-> (assoc ecr :type "ecr")
@@ -229,6 +214,36 @@
   [ecr]
   (delete-doc ecr))

+;; Registry Azure ACR
+
+(defn registries-acr
+  [owner]
+  (if (nil? owner)
+    (find-docs "acr")
+    (find-docs {"$or" [{:owner {"$eq" owner}}
+                       {:public {"$eq" true}}]} "acr")))
+
+(defn registry-acr
+  ([id]
+   (get-doc id))
+  ([user owner]
+   (find-doc {:user  user
+              :owner owner} "acr")))
+
+(defn create-acr-registry
+  [acr]
+  (-> (assoc acr :type "acr")
+      (create-doc)))
+
+(defn update-acr-registry
+  [acr delta]
+  (let [allowed-delta (dissoc delta :_id :_rev)]
+    (update-doc acr allowed-delta)))
+
+(defn delete-acr-registry
+  [acr]
+  (delete-doc acr))
+
 ;; User

 (defn users


simplify dodge-bar logic

simplify dodge-bar logic

--- src/cljc/gyptis/vega_templates.cljc
+++ src/cljc/gyptis/vega_templates.cljc
@@ -205,8 +205,7 @@
   []
   {:type "group",
    :from
-   {:data *table*,
-    :transform [{:type "facet", :groupby [*x*]}]},
+   {:transform [{:type "facet", :groupby [*x*]}]},
    :scales
    [{:name "x-dodge",
      :type "ordinal",
@@ -248,9 +247,8 @@
                              :domain {:data *table*, :field *fill*},
                              :range "category20"}]
                    :marks ^:replace [(dodged-bars-mark)]
-                   :legends [{:fill "fill"}]}
-        spec (if-not (contains? datum *fill*) spec
-                     (merge-spec spec fill-spec))]
+                   :legends (if (contains? datum *fill*) [{:fill "fill"}] [])}
+        spec (merge-spec spec fill-spec)]
     spec))

 (defn point


Default to tango theme

Default to tango theme

--- src/cljs/asciinema_player/view.cljs
+++ src/cljs/asciinema_player/view.cljs
@@ -107,7 +107,7 @@
     [:div.loader]])

 (defn player-class-name [theme-name]
-  (str "asciinema-theme-" theme-name))
+  (str "asciinema-theme-" (or theme-name "tango")))

 (defn player-style [] {})


rework views so we can change pages easier

--- src/cljs/early_vote_site/views.cljs
+++ src/cljs/early_vote_site/views.cljs
@@ -1,11 +1,16 @@
 (ns early-vote-site.views
   (:require [re-frame.core :as re-frame]
-            [early-vote-site.election.views :as election]))
+            [early-vote-site.election.views :as election]
+            [early-vote-site.flash.views :as flash]))

 (defmulti panel identity)
 (defmethod panel :election/main [] [election/main-panel])

 (defn main-panel []
-  (let [active-panel (re-frame/subscribe :active-panel)]
+  (let [active-panel (re-frame/subscribe [:active-panel])]
     (fn []
-      (panel @active-panel))))
+      [:div
+       [:div "Active panel: " (pr-str @active-panel)]
+       (flash/message)
+       (flash/error)
+       (panel :election/main)])))


minor

minor

--- src/cljs/server/service/github.cljs
+++ src/cljs/server/service/github.cljs
@@ -57,10 +57,10 @@
         author (-> config (.-github) (.-username))
         since  (time/ago (time/years 1))]
     (. RepoApi (getCommits (clj->js {:user      user
-                                      :repo      repo
-                                      :author    author
-                                      "per_page" 100
-                                      :since     (ctime/to-string since)})
+                                     :repo      repo
+                                     :author    author
+                                     "per_page" 100
+                                     :since     (ctime/to-string since)})
                            (paginate out-ch)))
     (conj acc out-ch)))


sync up font size from backend

sync up font size from backend

--- src/pc/svg.clj
+++ src/pc/svg.clj
@@ -26,7 +26,7 @@
    :fill "black"
    :stroke-width 0
    :font-family (:layer/font-family layer "Helvetica")
-   :font-size   (:layer/font-size layer 24)})
+   :font-size   (:layer/font-size layer 20)})

 (defn layer->svg-line [layer]
   {:x1          (:layer/start-x layer)


serve individual profiles as csv as well

--- src/kixi/hecuba/api/profiles.clj
+++ src/kixi/hecuba/api/profiles.clj
@@ -750,7 +750,7 @@

 (defresource resource [store]
   :allowed-methods #{:get :delete :putj}
-  :available-media-types #{"application/json"}
+  :available-media-types #{"text/csv" "application/json"}
   :authorized? (authorized? store)
   :exists? (partial resource-exists? store)
   :delete-enacted? (partial resource-delete-enacted? store)


Respond with put entity.

Respond with put entity.

--- src/kixi/hecuba/api/profiles.clj
+++ src/kixi/hecuba/api/profiles.clj
@@ -186,6 +186,11 @@
           response (profiles/delete session profile_id)]
       (empty? response))))

+(defn respond-with-entity? [ctx]
+  (let [request        (:request ctx)
+        method         (:request-method request)]
+    (if (= :put method) true false)))
+
 (defn resource-put! [store ctx]
   (db/with-session [session (:hecuba-session store)]
     (let [request (:request ctx)]
@@ -200,7 +205,7 @@
           (profiles/insert session (assoc body :user_id username))
           (-> (search/searchable-entity-by-id entity_id session)
               (search/->elasticsearch (:search-session store)))
-          (ring-response {:status 200 :body "OK"})) ;;TODO investigate why it returns 204
+          {::item body})
         (ring-response {:status 404 :body "Please provide valid entity_id and timestamp"})))))

 (defn resource-handle-ok [store ctx]
@@ -249,6 +254,7 @@
   :allowed? (resource-allowed? store)
   :exists? (partial resource-exists? store)
   :delete-enacted? (partial resource-delete-enacted? store)
+  :respond-with-entity? respond-with-entity?
   :new? (constantly false)
   :can-put-to-missing? (constantly false)
   :put! (partial resource-put! store)


s'more small-ish changes to make it more readable.

--- clojure/bob/bob.clj
+++ clojure/bob/bob.clj
@@ -1,18 +1,21 @@
 (ns bob
-  (:use [clojure.string :only [join blank?]]))
+  (:use [clojure.string :only [blank?]]))

-(defn- all-caps? [s]
-  (let [ascii-chars (join "" (re-seq #"[a-zA-Z]" s))]
+(def unresponsive? blank?)
+
+(defn- shouting? [s]
+  (let [ascii-chars (re-seq #"[a-zA-Z]" s)]
     (and
-     (not (blank? ascii-chars))
-     (every? #(Character/isUpperCase %) ascii-chars))))
+     ascii-chars
+     (every? #(Character/isUpperCase %)
+             (apply str ascii-chars)))))

 (defn- question? [s]
   (re-matches #".*\?\Z" s))

 (defn response-for [s]
   (cond
-   (blank? s) "Fine. Be that way!"
-   (all-caps? s) "Woah, chill out!"
+   (unresponsive? s) "Fine. Be that way!"
+   (shouting? s) "Woah, chill out!"
    (question? s) "Sure."
    :else "Whatever."))


improve error reporting

improve error reporting

--- dada-core/src/main/clojure/org/dada/core/SimpleModelView.clj
+++ dada-core/src/main/clojure/org/dada/core/SimpleModelView.clj
@@ -172,8 +172,10 @@
     (if (and (empty? insertions) (empty? alterations) (empty? deletions))
       (warn "empty event raised" (.getStackTrace (Exception.)))
       (dorun (map (fn [#^View view]	;dirty - side-effects
-		    (try (.update view insertions alterations deletions)
-			 (catch Throwable t (error "View notification failure" t))))
+		      (try (.update view insertions alterations deletions)
+			   (catch Throwable t
+				  (error "View notification failure" t)
+				  (.printStackTrace t))))
 		  (counted-set-vals views))))))

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


CMR-5037: Formatting change.

CMR-5037: Formatting change.

--- umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/dif9.clj
+++ umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/dif9.clj
@@ -92,9 +92,10 @@
  "Return a list of temporal extents from the XML doc"
  [doc sanitize?]
  (if-let [temporals (select doc "/DIF/Temporal_Coverage")]
-  [{:RangeDateTimes (doall (for [temporal temporals]
-                             {:BeginningDateTime (date/with-default (date-at-str temporal "Start_Date") sanitize?)
-                              :EndingDateTime (parse-dif-end-date (value-of temporal "Stop_Date"))}))}]
+  [{:RangeDateTimes (doall
+                     (for [temporal temporals]
+                       {:BeginningDateTime (date/with-default (date-at-str temporal "Start_Date") sanitize?)
+                        :EndingDateTime (parse-dif-end-date (value-of temporal "Stop_Date"))}))}]
   (when sanitize? su/not-provided-temporal-extents)))

 (defn- parse-collection-citation


Simplify unifier and update docs

Simplify unifier and update docs

--- src/micro_logic/core.clj
+++ src/micro_logic/core.clj
@@ -63,27 +63,40 @@
 (defn unify
   "Given two terms *u* and *v*, and an existing substitution map *s*,
   unify produces a new substitution map with mappings that will make u
-  and v equal."
+  and v equal.
+
+  This unifier is extensible, in the spirit of core.logic. Only
+  unification on basic types is directly implemented here. By
+  extending the IUnifyTerms protocol, special unification logic may be
+  supplied for any data type.
+
+  A *term* is, somewhat circularly, something you can pass to the
+  unifier.  this includes lvars, regular values, and values of any
+  type to which you have extended IUnifyTerms. "
   [u v s]
-  (let [u (walk u s),  v (walk v s)
-        ulv (lvar? u), vlv (lvar? v)]
+  (let [u (walk u s),        v (walk v s)
+        u-is-lvar (lvar? u), v-is-lvar (lvar? v)]
     (cond
-      (and ulv vlv (= u v)) s
-      ulv (assoc s u v)
-      vlv (assoc s v u)
-      (= u v) s
+      ;; Unifying two lvars adds no information
+      (and u-is-lvar v-is-lvar (= u v)) s
+
+      ;; Unifying an lvar with some other value creates a new substitution
+      u-is-lvar (assoc s u v)
+      v-is-lvar (assoc s v u)
+
+      ;; Unifying two non-lvars is delegated to the polymorphic
+      ;; `unify-terms` function.
       :default (unify-terms u v s))))

-;; This unifier is extensible, in the spirit of core.logic. Only
-;; unification on basic types is directly implemented here. By
-;; extending the IUnifyTerms protocol, special unification logic may
-;; be supplied for any data type.
-;;
-;; A *term* is, somewhat circularly, something you can pass to the unifier.
-;; this includes lvars, regular values, and values of any type to which
-;; you have extended IUnifyTerms.
+;; If there is no more specific definition, unificiation between two
+;; values should at least succeed if they are equal. Return nil if
+;; they are not, indiciating that the terms cannot be unified.
 (extend-protocol IUnifyTerms
   Object
+  (unify-terms [u v s]
+    (if (= u v) s))
+
+  nil
   (unify-terms [u v s]
     (if (= u v) s)))


adds defaults to raven-sidecar schema (#1496)

--- waiter/src/waiter/schema.clj
+++ waiter/src/waiter/schema.clj
@@ -106,11 +106,12 @@
   (nil? (s/check {(s/required-key :factory-fn) s/Symbol, s/Keyword s/Any} (get config kind))))

 (def valid-raven-sidecar-config
-  {:cmd [s/Str]
-   (s/optional-key :env-vars) {(s/optional-key :flags) [s/Str]
-                               (s/optional-key :features) [s/Str]
-                               (s/optional-key :tls-flags) [s/Str]}
-   :image s/Str
+  {:cmd [non-empty-string]
+   (s/optional-key :env-vars) {(s/optional-key :defaults) {non-empty-string non-empty-string}
+                               (s/optional-key :flags) [non-empty-string]
+                               (s/optional-key :features) [non-empty-string]
+                               (s/optional-key :tls-flags) [non-empty-string]}
+   :image non-empty-string
    :predicate-fn s/Symbol
    :resources {:cpu s/Num
                :mem s/Int}})


Curate uses util EDN reader and updated config map path

--- dev/curate.clj
+++ dev/curate.clj
@@ -3,9 +3,12 @@
   (:require [clojure.java.io :as io]
             [clojure.edn :as edn]
             [lcmap.aardvark.event :as event]
+            [lcmap.aardvark.server :as server]
             [lcmap.aardvark.source :as source]
             [lcmap.aardvark.tile :as tile]
             [lcmap.aardvark.tile-spec :as tile-spec]
+            [lcmap.aardvark.util :as util]
+            [lcmap.aardvark.worker :as worker]
             [mount.core :as mount]))

 (defn read-edn
@@ -16,19 +19,19 @@
 (defn save-tile-specs
   "Save all tile-specs in EDN at path."
   [path]
-  (->> path read-edn (map tile-spec/save)))
+  (->> path util/read-edn (map tile-spec/save)))

 (defn save-sources
   "Save all sources in EDN at path."
   ([path limit]
-   (->> path read-edn (take limit) (map source/save)))
+   (->> path util/read-edn (take limit) (map source/save)))
   ([path]
-   (->> path read-edn (map source/save))))
+   (->> path util/read-edn (map source/save))))

 (defn progress-report
   "Group sources together by most recent progress/state with count."
   [path]
-  (->> (read-edn path)
+  (->> (util/read-edn path)
        (map (comp :progress_name last source/search :id))
        (frequencies)))

@@ -36,28 +39,29 @@
   "Start enough of the system to work with Cassandra, Elasticsearch,
   and RabbitMQ without consuming messages or handling HTTP requests."
   []
-  (->> (mount/with-args {:config (read-edn "lcmap-landsat.edn")})
+  (->> (mount/with-args {:config (util/read-edn "lcmap.aardvark.edn")})
        (mount/start-without #'lcmap.aardvark.worker/worker-consumer
-                            #'lcmap.aardvark.server/server
+                            #_#'lcmap.aardvark.server/server
                             #'lcmap.aardvark.db/db-schema)))

 (comment
-  (start))
+  (start)
+  (mount/stop))

 (comment
-  (save-tile-specs "data/tile-specs/L4.edn")
-  (save-tile-specs "data/tile-specs/L5.edn")
-  (save-tile-specs "data/tile-specs/L7.edn")
-  (save-tile-specs "data/tile-specs/L8.edn"))
+  (save-tile-specs "tile-specs/L4.edn")
+  (save-tile-specs "tile-specs/L5.edn")
+  (save-tile-specs "tile-specs/L7.edn")
+  (save-tile-specs "tile-specs/L8.edn"))

 (comment
-  (save-sources "data/sources/washington/LT04046026.edn" 1)
-  (save-sources "data/sources/washington/LT05046026.edn" 1)
-  (save-sources "data/sources/washington/LE07046026.edn" 1)
-  (save-sources "data/sources/washington/LC8046026.edn"  1))
+  (save-sources "sources/washington/LT04046026.edn" 1)
+  (save-sources "sources/washington/LT05046026.edn" 1)
+  (save-sources "sources/washington/LE07046026.edn" 1)
+  (save-sources "sources/washington/LC8046026.edn"  1))

 (comment
-  (progress-report "data/sources/washington/LT04046026.edn")
-  (progress-report "data/sources/washington/LT05046026.edn")
-  (progress-report "data/sources/washington/LE07046026.edn")
-  (progress-report "data/sources/washington/LC8046026.edn"))
+  (progress-report "sources/washington/LT04046026.edn")
+  (progress-report "sources/washington/LT05046026.edn")
+  (progress-report "sources/washington/LE07046026.edn")
+  (progress-report "sources/washington/LC8046026.edn"))


Beautify.

Beautify.

--- src/kolmogorov_music/kolmogorov.clj
+++ src/kolmogorov_music/kolmogorov.clj
@@ -8,30 +8,31 @@
   (repeat 1000000000000 \A)
   )

-(defmacro description [expr]
+(defmacro description-length [expr]
   (-> expr str count))

-(fact "Kolmogorov description is how long its string representation is."
-  (description (repeat 65 \A)) => 14)
+(fact "Kolmogorov description length is how long its string representation is."
+  (description-length (repeat 65 \A)) => 14)

-(defn extension [value]
+(defn value-length [value]
   (->> value (apply str) count))

-(fact "Kolmogorov extension is how long the string representation of what it evaluates to is."
-  (extension (repeat 65 \A)) => 65)
+(fact "Kolmogorov value length is how long the string representation of what it evaluates to is."
+  (value-length (repeat 65 \A)) => 65)
+

 (defmacro randomness [expr]
-  `(/ (description ~expr) (extension ~expr)))
+  `(/ (description-length ~expr) (value-length ~expr)))

-(fact "Kolmogorov randomness is the compression ratio between the description and the extension."
+(fact "Kolmogorov randomness is the compression ratio between the description and the value."
   (randomness (repeat 65 \A)) => 14/65)

 (defmacro random? [expr]
   `(<= 1 (randomness ~expr)))

-(fact "A value is random if its description isn't shorter than its extension."
+(fact "A value is random if its description isn't shorter than its value."
   (random? (repeat 65 \A)) => false
   (random? (->> 66 char (repeat 14) (take 3))) => true)

@@ -40,38 +41,33 @@
   (->> (range 32 127)
        (map char)))

-(defn extend-with [elements strings]
-  (for [s strings e elements]
-    (conj s e)))
-
 (defn kleene* [elements]
-  (->> (lazy-seq (kleene* elements))
-       (extend-with elements)
-       (cons [])))
+  (letfn [(expand [strings] (for [s strings e elements] (conj s e)))]
+    (->>
+      (lazy-seq (kleene* elements))
+      expand
+      (cons []))))

 (defn lexicon []
   (->> ascii
        kleene*
        (map (partial apply str))))

-(defn subsequence [start end s]
-  (->> s (drop start) (take (- end start))))
-
 (fact "We can construct all strings as a lazy sequence."
-  (->> (lexicon) (subsequence 0 5)) => ["" " " "!" "\"" "#"]
-  (->> (lexicon) (subsequence 95 100)) => ["~" "  " " !" " \"" " #"]
+  (->> (lexicon) (take 5)) => ["" " " "!" "\"" "#"]
   (nth (lexicon) 364645) => "GEB")

 (defn complexity
-  "A hypothetical function that determines the Kolmogorov complexity of a value."
+  "A hypothetical function that determines the Kolmogorov complexity of any value."
   [string]
   (->> string (map int) (reduce + 0)))

 (defn enterprise
   "Calculate the shortest string that is more complicated than itself."
   []
-  (->> (lexicon)
-       (drop-while (fn [s] (< (complexity s) (-> 'enterprise repl/source-fn extension))))
-       first))
+  (let [its-own-source (repl/source-fn 'enterprise)]
+    (->> (lexicon)
+         (drop-while (fn [s] (<= (complexity s) (value-length its-own-source))))
+         first)))


third attempt

third attempt

--- src/mafia_votecount/routes/home.clj
+++ src/mafia_votecount/routes/home.clj
@@ -4,6 +4,7 @@
             [mafia-votecount.views.create-game :as create-game]
             [mafia-votecount.views.games :as games]
             [mafia-votecount.views.game :as game]
+            [mafia-votecount.views.player :as player]
             [mafia-votecount.scraper.team-liquid :as scraper]))

 (defroutes home-routes


implement encode function

implement encode function

--- src/main/clojure/telegenic/core.clj
+++ src/main/clojure/telegenic/core.clj
@@ -1,8 +1,12 @@
 (ns telegenic.core
-  (:import [org.jcodec.api FrameGrab])
   (:import [java.io File])
   (:import [java.awt.image BufferedImage])
-  (:import [org.jcodec.common.model Picture])
+  (:import [org.jcodec.api.awt FrameGrab]
+           [org.jcodec.codecs.h264 H264Encoder]
+           [org.jcodec.api SequenceEncoder]
+           [org.jcodec.common.model Picture]
+           [org.jcodec.scale AWTUtil])
+  (:require [mikera.image.core :as img])
   )

 (set! *warn-on-reflection* true)
@@ -16,6 +20,36 @@
     (get-frame [s frame-number] (get-frame (File. s) frame-number))
   File
     (get-frame [file frame-number]
-      (let [^Picture nf (FrameGrab/getNativeFrame file (int frame-number))
-            bi (.toBufferedImage nf)]
-        bi)))+      (let [^BufferedImage bi (FrameGrab/getFrame file (int frame-number))]
+        bi)))
+
+
+(defn encode
+  "Encodes a sequence of frames to a video file.
+
+   Returns a map decribing the encoding the result.
+
+   TODO: Options is a map that may include:
+     :filename   Filename to output the econded video to
+     :log        True if you want logging output
+     :framerate  Numeric number of frames per second"
+  ([frames]
+    (encode frames nil))
+  ([frames options]
+    (let [start-time (System/currentTimeMillis)
+          filename (str (or (:filename options "out.mp4")))
+          ^File file (or (:file options (File. filename)))
+          enc (SequenceEncoder. file)
+          ;; ^H264Encoder encoder (.getEncoder enc)
+          ;; framerate (or (:frame-rate options 30))
+          ;; _ (.setKeyInterval encoder (int framerate))
+          counter (atom 0)]
+      (doseq [frame frames]
+        (let [^BufferedImage frame frame
+              ^Picture picture (AWTUtil/fromBufferedImage frame)]
+          (.encodeNativeFrame enc picture))
+        (swap! counter inc))
+      (.finish enc)
+      {:filename filename
+       :frame-count @counter
+       :time (* 0.001 (- (System/currentTimeMillis) start-time))})))


Clear log-in field values when choosing to log in as different user

--- src/braid/client/gateway/user_auth/events.cljs
+++ src/braid/client/gateway/user_auth/events.cljs
@@ -38,7 +38,9 @@
 (reg-event-fx
   :gateway.user-auth/switch-account
   (fn [{state :db} _]
-    {:dispatch-n [[:gateway.user-auth/set-mode :log-in]
+    {:dispatch-n [[:gateway.user-auth/update-value :gateway.user-auth/email ""]
+                  [:gateway.user-auth/update-value :gateway.user-auth/password ""]
+                  [:gateway.user-auth/set-mode :log-in]
                   [:gateway.user-auth/remote-log-out]]}))


adding more debug (request -> response) messages

--- src/clojure/src/leela/blackbox/czmq/router.clj
+++ src/clojure/src/leela/blackbox/czmq/router.clj
@@ -30,8 +30,7 @@
       (.put queue [peer msg]))))

 (defn routing-loop [ifh ofh queue]
-  (trace "ENTER:routing-loop")
-  (let [[ifh-info ofh-info] (z/poll 1000 [ifh [ZMQ$Poller/POLLIN] ofh [ZMQ$Poller/POLLIN]])]
+  (let [[ifh-info ofh-info] (z/poll -1 [ifh [ZMQ$Poller/POLLIN] ofh [ZMQ$Poller/POLLIN]])]
     (when (.isReadable ifh-info)
       (enqueue ifh queue))
     (when (.isReadable ofh-info)
@@ -39,10 +38,13 @@

 (defn evaluate [worker [peer msg]]
   (try
-    (cons peer (cons "" ((:onjob worker) msg)))
+    (let [reply ((:onjob worker) msg)]
+      (debug (format "REQUEST/DONE: %s ~> %s" (pr-str (map f/bytes-to-str msg)) (pr-str reply)))
+      (cons peer (cons "" reply)))
     (catch Exception e
-      (error e "error evaluating worker")
-      (cons peer (cons "" (:onerr worker))))))
+      (let [reply (:onerr worker)]
+        (debug (format "REQUEST/FAIL: %s ~> %s" (pr-str (map f/bytes-to-str msg)) (pr-str reply)))
+        (cons peer (cons "" reply))))))

 (defn run-worker [ctx endpoint queue worker]
   (with-open [fh (.socket ctx ZMQ/PUSH)]


Use comment url for notifications if interaction-id is available.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -847,6 +847,7 @@
         uuid (:entry-id notification)
         secure-uuid (:secure-uuid notification)
         origin-url config/web-url
+        interaction-id (:interaction-id notification)
         token-claims {:org-uuid (:org-id notification)
                       :secure-uuid secure-uuid
                       :name (str first-name " " (:last-name msg))
@@ -856,12 +857,10 @@
                       :avatar-url (:avatar-url msg)
                       :team-id (:team-id org)} ;; Let's read the team-id from the org to avoid problems on multiple org users
         id-token (jwt/generate-id-token token-claims config/passphrase)
-        entry-url (s/join "/" [origin-url
-                               org-slug
-                               board-slug
-                               "post"
-                               uuid
-                               (str "?id=" id-token)])
+        base-url (if (seq interaction-id)
+                   (s/join "/" [origin-url org-slug board-slug "post" uuid])
+                   (s/join "/" [origin-url org-slug board-slug "post" uuid "comment" interaction-id]))
+        entry-url (str base-url "?id=" id-token)
         button-cta (if (or (not mention?) comment?)
                     "view_comment"
                     "view_post")


refactored duplicate code in v2routes

refactored duplicate code in v2routes

--- src/ontrail/v2routes.clj
+++ src/ontrail/v2routes.clj
@@ -4,50 +4,47 @@
   (:require [ontrail.auth :as auth]
             [ontrail.user :as user]))

-(defroutes v2routes
+(defn logout [params headers]
+  (let [redirect-location (if-let [param-referer (:referer params)]
+                            param-referer
+                            (if-let [referer (headers "referer")] referer "/m/index.html"))]
+    {:status  301
+     :headers {"Content-Type" "text/html"
+               "Location"     redirect-location}
+     :cookies {"authToken" {:value "" :max-age 0 :path "/"}
+               "authUser"  {:value "" :max-age 0 :path "/"}}
+     :body    ""}))
+
+(defroutes
+  v2routes

   (POST "/rest/v2/login" {params :params headers :headers}
         (let [username (:username params)
               password (:password params)
-              redirect-location (if-let [param-referer (:referer params)] param-referer
-                                         (if-let [referer (headers "referer")] referer "/m/index.html"))]
+              redirect-location (if-let [param-referer (:referer params)]
+                                  param-referer
+                                  (if-let [referer (headers "referer")] referer "/m/index.html"))]
           (if (auth/authenticate username password)
             (let [case-user (user/get-case-user username)
                   authToken (auth/auth-token case-user)
                   authUser (:username (user/get-case-user username))]
-              {:status 301
+              {:status  301
                :headers {"Content-Type" "text/html"
-                         "Location" redirect-location}
-               :cookies {"authToken" {:value authToken :max-age (* 60 60 24 2 365) :path "/" }
-                         "authUser" {:value authUser :max-age  (* 60 60 24 2 365) :path "/" }}
-               :body ""
+                         "Location"     redirect-location}
+               :cookies {"authToken" {:value authToken :max-age (* 60 60 24 2 365) :path "/"}
+                         "authUser"  {:value authUser :max-age (* 60 60 24 2 365) :path "/"}}
+               :body    ""
                })
-            {:status 301
-             :headers {"Content-Type" "text/html"
-                       "Location" (str redirect-location "?status=login_failed")
+            {:status  301
+             :headers {"Content-Type"     "text/html"
+                       "Location"         (str redirect-location "?status=login_failed")
                        "X-Ontrail-Status" "login-failed"}
-             :body ""
+             :body    ""
              })))

   (GET "/rest/v2/logout" {params :params headers :headers}
-        (let [redirect-location (if-let [param-referer (:referer params)] param-referer
-                                         (if-let [referer (headers "referer")] referer "/m/index.html"))]
-          {:status 301
-           :headers {"Content-Type" "text/html"
-                     "Location" redirect-location}
-           :cookies {"authToken" {:value "" :max-age 0 :path "/"}
-                     "authUser" {:value "" :max-age  0 :path "/"}}
-           :body ""}))
+       (logout params headers))

   (POST "/rest/v2/logout" {params :params headers :headers}
-        (let [redirect-location (if-let [param-referer (:referer params)] param-referer
-                                         (if-let [referer (headers "referer")] referer "/m/index.html"))]
-          {:status 301
-           :headers {"Content-Type" "text/html"
-                     "Location" redirect-location}
-           :cookies {"authToken" {:value "" :max-age 0 :path "/"}
-                     "authUser" {:value "" :max-age  0 :path "/"}}
-           :body ""}))
+        (logout params headers)))

-  ;; routes
-  )


Fix refer of util/partial

Fix refer of util/partial

--- src/re_view/routing.cljs
+++ src/re_view/routing.cljs
@@ -2,7 +2,7 @@
   (:require [goog.events]
             [goog.dom :as gdom]
             [secretary.core :as secretary :refer [*routes* add-route!]]
-            [re-view.core :as v])
+            [re-view.util :as util])
   (:import
     [goog.history Html5History EventType]
     [goog History]))
@@ -60,7 +60,7 @@
   (binding [*routes* (atom [])]
     (doseq [[path matched-view] (partition 2 route-pairs)]
       (add-route! path #(if (fn? matched-view)
-                         (v/partial matched-view %)
+                         (util/partial matched-view %)
                          matched-view)))
     @*routes*))


config cleanup

config cleanup

--- src/cljs/swarmpit/component/service/form_configs.cljs
+++ src/cljs/swarmpit/component/service/form_configs.cljs
@@ -13,11 +13,6 @@
 (def form-value-cursor (conj state/form-value-cursor :configs))

 (def form-state-cursor (conj state/form-state-cursor :configs))
-
-(def headers [{:name  "Name"
-               :width "35%"}
-              {:name  "Target"
-               :width "35%"}])

 (def undefined-info
   (html


Make where work for update, too

Make where work for update, too

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -83,9 +83,9 @@

   (extend-protocol WhereBuilder
     clojure.lang.IPersistentVector
-    (build-where [construct ^Select$Where query-builder]
+    (build-where [construct query-builder]
       (reduce
-       (fn [^Select$Where builder [query-type column value]]
+       (fn [builder [query-type column value]]
          (if-let [eq-type (query-type-map query-type)]
            (.and builder ((query-type-map query-type) (name column) value))
            (throw (IllegalArgumentException. (str query-type " is not a valid Clause")))
@@ -93,9 +93,9 @@
        query-builder
        construct))
     clojure.lang.IPersistentMap
-    (build-where [construct ^Select$Where query-builder]
+    (build-where [construct query-builder]
       (reduce
-       (fn [^Select$Where builder [column value]]
+       (fn [builder [column value]]
          (.and builder (eq (name column) value)))
        query-builder
        construct))))
@@ -201,7 +201,7 @@
 (defn where
   [m]
   [:where
-   (fn where-query [^Select query-builder]
+   (fn where-query [query-builder]
      (build-where m (.where query-builder)))])

 (defn order-by
@@ -251,12 +251,15 @@
        (sort-by #(get select-order (first %)))
        (map second)
        (reduce (fn [builder statement]
-                 (println builder statement)
                  (statement builder))
                (QueryBuilder/select)
                )
        (.toString)
        ))
+
+;;
+;; Insert Query
+;;

 (defn value
   [key value]


Formatting

Formatting

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -165,15 +165,16 @@
       (conj statements (all))
       statements)))

-(let [order     {:what-count   1
-                 :what-fcall   1
-                 :what-columns 1
-                 :what-column  1
-                 :from         2
-                 :where        3
-                 :order        4
-                 :limit        4
-                 :filtering    5}
+(let [order
+      {:what-count   1
+       :what-fcall   1
+       :what-columns 1
+       :what-column  1
+       :from         2
+       :where        3
+       :order        4
+       :limit        4
+       :filtering    5}
       renderers
       {:what-count   (fn count-all-query [query-builder _]
                        (.countAll query-builder))


Limit the size of supported text files to 512Kb

--- src-clj/acha/git_parser.clj
+++ src-clj/acha/git_parser.clj
@@ -92,7 +92,7 @@
         (AbbreviatedObjectId/fromObjectId obj-id)))))

 (def binary-file-threshold (* 2 1024))
-(def big-file-threshold (* 10 1024 1024))
+(def big-file-threshold (* 512 1024))
 (def empty-array (byte-array 0))

 (def raw-comparator RawTextComparator/DEFAULT)


Fixed issue #58, for real this time

Fixed issue #58, for real this time

--- src/clojure/alfresco_technical_validation/alfresco_public_api.clj
+++ src/clojure/alfresco_technical_validation/alfresco_public_api.clj
@@ -21,7 +21,7 @@
             [clojure.tools.logging :as log]))

-(def ^:private ^String api-page-url       "http://docs.alfresco.com/4.2/concepts/java-public-api-list.html")
+(def ^:private ^String api-page-url       "http://docs.alfresco.com/5.0/concepts/java-public-api-list.html")
 (def ^:private ^String api-list-open-tag  "
")
 (def ^:private ^String api-list-close-tag "
")


Minimise lookups in fast path.

Minimise lookups in fast path.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -751,7 +751,7 @@
   (next-replica! [this new-replica]
     (if (= replica new-replica)
       this
-      (let [{:keys [onyx.core/job-id onyx.core/task-id onyx.core/job-id onyx.core/id onyx.core/task-kill-flag]} event
+      (let [{:keys [onyx.core/job-id]} event
             old-version (get-in replica [:allocation-version job-id])
             new-version (get-in new-replica [:allocation-version job-id])]
         (cond (= old-version new-version)
@@ -759,20 +759,18 @@
                   (set-coordinator! (coordinator/next-state coordinator replica new-replica))
                   (set-replica! new-replica))

-              (let [allocated (common/peer->allocated-job (:allocations new-replica) id)]
+              (let [allocated (common/peer->allocated-job (:allocations new-replica) (:onyx.core/id event))]
                 (or (killed? this)
-                    (not= task-id (:task allocated))
-                    (not= job-id (:job allocated))))
+                    (not= (:onyx.core/task-id event) (:task allocated))
+                    (not= (:onyx.core/job-id event) (:job allocated))))
               ;; Manually hit the kill switch early since we've been
               ;; reallocated and we want to escape ASAP
               (do
-                (reset! task-kill-flag true)
+                (reset! (:onyx.core/task-kill-flag event) true)
                 this)

               :else
               (let [next-messenger (ms/next-messenger-state! messenger event replica new-replica)]
-                (assert (m/subscriber next-messenger) [:old-replica replica
-                                                       :new-replica new-replica])
                 (checkpoint/cancel! (:onyx.core/storage event))
                 (-> this
                     (set-sealed! false)


Korjaa update-unique ja delete-unique transaktiobugi

--- mtg-pairings-server/src/clj/mtg_pairings_server/util/sql.clj
+++ mtg-pairings-server/src/clj/mtg_pairings_server/util/sql.clj
@@ -1,5 +1,6 @@
 (ns mtg-pairings-server.util.sql
-  (:require [korma.core :as sql]))
+  (:require [korma.core :as sql]
+            [korma.db :as db]))

 (defn unique-or-nil
   [results]
@@ -36,25 +37,21 @@
 (defmacro update-unique
   "Wraps korma.core/update, updates exactly one row. Throws if row count is not 1. Returns the number of updated rows (1)."
   [entity & body]
-  `(let [count# (-> (sql/update* ~entity)
-                  ~@body
-                  (dissoc :results)
-                  sql/exec)
-         count# (if (sequential? count#) ;; JDBC:n vanha versio palauttaa vektorin, uusi pelkän luvun
-                  (first count#)
-                  count#)]
-     (assert (= count# 1) (str "Expected one updated row, got " count#))
-     count#))
+  `(db/transaction
+     (let [count# (-> (sql/update* ~entity)
+                      ~@body
+                      (dissoc :results)
+                      sql/exec)]
+       (assert (= count# 1) (str "Expected one updated row, got " count#))
+       count#)))

 (defmacro delete-unique
   "Wraps korma.core/delete, deletes exactly one row. Throws if row count is not 1. Returns the number of deleted rows (1)."
   [entity & body]
-  `(let [count# (-> (sql/delete* ~entity)
-                  ~@body
-                  (dissoc :results)
-                  sql/exec)
-         count# (if (sequential? count#) ;; JDBC:n vanha versio palauttaa vektorin, uusi pelkän luvun
-                  (first count#)
-                  count#)]
-     (assert (= count# 1) (str "Expected one deleted row, got " count#))
-     count#))
+  `(db/transaction
+     (let [count# (-> (sql/delete* ~entity)
+                      ~@body
+                      (dissoc :results)
+                      sql/exec)]
+       (assert (= count# 1) (str "Expected one deleted row, got " count#))
+       count#)))


small fix for metric macro expansion when there is no :aggregation clause !?

--- src/metabase/driver/query_processor/expand.clj
+++ src/metabase/driver/query_processor/expand.clj
@@ -298,7 +298,10 @@
     ["AND" base addtl]))

 (defn- macroexpand-metric [query-dict]
-  (if (non-empty-clause? (get-in query-dict [:query :aggregation]))
+  (if-not (non-empty-clause? (get-in query-dict [:query :aggregation]))
+    ;; aggregation is empty, so no METRIC to expand
+    query-dict
+    ;; we have an aggregation clause, so lets see if we are using a METRIC
     (if-let [metric-def (match (get-in query-dict [:query :aggregation])
                           ["METRIC" (metric-id :guard integer?)] (sel :one :field [metabase.models.metric/Metric :definition] :id metric-id)
                           other                                  nil)]


Namespace functions to -9, actually replace special chars, use suggested content-type

--- src/riemann/influxdb.clj
+++ src/riemann/influxdb.clj
@@ -14,26 +14,27 @@
   "A set of event fields in Riemann with special handling logic."
   #{:host :service :time :metric :tags :ttl})

-(defn replace-disallowed [field]
+(defn replace-disallowed-9 [field]
   (clojure.string/replace
     (clojure.string/replace
       (clojure.string/replace field " " "\\ ") "=" "\\=") "," "\\,"))
-(defn kv-encode [kv]
+
+(defn kv-encode-9 [kv]
   (clojure.string/join "," (map (fn [[key value]]
-   (str key "=" value)) kv)))
-
-(defn lineprotocol-encode [event]
-  (let [encoded_fields (kv-encode (get event "fields"))
-        encoded_tags  (kv-encode (get event "tags"))]
+   (str (replace-disallowed-9 key) "=" (replace-disallowed-9 value))) kv)))
+
+(defn lineprotocol-encode-9 [event]
+  (let [encoded_fields (kv-encode-9 (get event "fields"))
+        encoded_tags  (kv-encode-9 (get event "tags"))]

     (str (get event "name") "," encoded_tags " " encoded_fields  "\n")))

-(defn lineprotocol-encode-list [events]
+(defn lineprotocol-encode-list-9 [events]
   ; encode {"points" [{"name" "xyzzy", "time" "2015-06-26T07:06:45.000Z", "tags" {"host" "h"}, "fields" {"value" 0.6514667122989345, "state" "ok", "description" "at 2015-06-26 09:06:45 +0200"}}], "database" "foo"}
   ; [{"name" "xyzzy", "time" "2015-06-26T07:06:45.000Z", "tags" {"host" "h"}, "fields" {"value" 0.6514667122989345, "state" "ok", "description" "at 2015-06-26 09:06:45 +0200"}}]
   ; {"name" "xyzzy", "time" "2015-06-26T07:06:45.000Z", "tags" {"host" "h"}, "fields" {"value" 0.6514667122989345, "state" "ok", "description" "at 2015-06-26 09:06:45 +0200"}}
-  (clojure.string/join (pmap lineprotocol-encode (get events "points"))))
+  (clojure.string/join (pmap lineprotocol-encode-9 (get events "points"))))

 (defn event-tags
   "Generates a map of InfluxDB tags from a Riemann event. Any fields in the
@@ -180,7 +181,7 @@
         (cond->
           {:socket-timeout (:timeout opts 5000) ; ms
            :conn-timeout   (:timeout opts 5000) ; ms
-           :content-type   "application/x-www-form-urlencoded"}
+           :content-type   "text/plain"}
           (:username opts)
             (assoc :basic-auth [(:username opts)
                                 (:password opts)]))
@@ -193,7 +194,7 @@
         (when-not (empty? points)
           (->> points
                (assoc payload-base "points")
-               (lineprotocol-encode-list)
+               (lineprotocol-encode-list-9)
                (assoc http-opts :Ω)
                (http/post write-url)))))))


broken stop function.

broken stop function.

--- src/rosado/processing/applet.clj
+++ src/rosado/processing/applet.clj
@@ -1,73 +1,79 @@
-(ns rosado.processing.applet
-  (:use [rosado.processing :except (size)])
-  (:import (javax.swing JFrame)))
-
-(defn- with-binding
-  "Turn the method map into something one that update-proxy can use."
-  [methods [method-name f]]
-  (assoc methods (name method-name)
-         `(fn [this# & args#]
-            (binding [*applet* this#]
-              (apply ~f args#)))))
-
-(defn- fix-mname
-  "Changes :method-name to :methodName."
-  [[mname fun]]
-  (let [mname (name mname)
-        mr (re-matcher #"\-[a-zA-z]" mname)
-        replace-fn (comp #(.replaceFirst mr %) toupper #(.substring % 1))
-        fixed-name (if-let [matched (re-find mr)]
-                     (replace-fn matched)
-                     mname)]
-    [(keyword fixed-name) fun]))
-
-(defmacro defapplet
-  "Define an applet. Takes an app-name and a map of options."
-  [app-name & opts]
-  (let [options (assoc (apply hash-map opts) :name (str app-name))
-        fns (dissoc options :name :title :size)
-        methods (reduce with-binding {} (into {} (map fix-mname fns)))]
-    `(def ~app-name
-          (let [frame# (atom nil)
-                prx# (proxy [processing.core.PApplet
-                             clojure.lang.IMeta] []
-                       (meta [] (assoc ~options :frame frame#)))]
-            (update-proxy prx# ~methods)
-            prx#))))
-
-(def #^{:private true}
-     modes {:JAVA2D JAVA2D :OPENGL OPENGL
-            :P3D P3D :P2D P2D :PDF PDF})
-
-(defn run
-  "Launches the applet. If given the flag :interactive, it won't exit
-  on clicking the close button - it will only dispose the window."
-  [applet & interactive?]
-  (.init applet)
-  (let [m (.meta applet)
-        [width height & mode] (or (:size m) [200 200])
-        mode (if-let [kw (first mode)]
-               (modes (-> kw name toupper keyword))
-               JAVA2D)
-        close-op (if (first interactive?)
-                   JFrame/DISPOSE_ON_CLOSE
-                   JFrame/EXIT_ON_CLOSE)]
-    (.size applet width height mode)
-    (reset! (:frame m)
-            (doto (JFrame. (or (:title m) (:name m)))
-              (.setDefaultCloseOperation close-op)
-              (.setSize width height)
-              (.add applet)
-              (.pack)
-              (.show)))))
-
-(defn stop [applet]
-  (.destroy applet)
-  (.hide @(:frame ^applet)))
-
-(comment ;; Usage:
-  (defapplet growing-triangle
-    :draw (fn [] (line 10 10 (frame-count) 100)))
-
-  (run growing-triangle)
-  (stop growing-triangle))+(ns rosado.processing.applet
+  (:use [rosado.processing :except (size)])
+  (:import (javax.swing JFrame)))
+
+(defn- with-binding
+  "Turn the method map into something one that update-proxy can use."
+  [methods [method-name f]]
+  (assoc methods (name method-name)
+         `(fn [this# & args#]
+            (binding [*applet* this#]
+              (apply ~f args#)))))
+
+(defn- fix-mname
+  "Changes :method-name to :methodName."
+  [[mname fun]]
+  (let [mname (name mname)
+        mr (re-matcher #"\-[a-zA-z]" mname)
+        replace-fn (comp #(.replaceFirst mr %) toupper #(.substring % 1))
+        fixed-name (if-let [matched (re-find mr)]
+                     (replace-fn matched)
+                     mname)]
+    [(keyword fixed-name) fun]))
+
+(defmacro defapplet
+  "Define an applet. Takes an app-name and a map of options."
+  [app-name & opts]
+  (let [options (assoc (apply hash-map opts) :name (str app-name))
+        fns (dissoc options :name :title :size)
+        methods (reduce with-binding {} (into {} (map fix-mname fns)))]
+    `(def ~app-name
+          (let [frame# (atom nil)
+                prx# (proxy [processing.core.PApplet
+                             clojure.lang.IMeta] []
+                       (meta [] (assoc ~options :frame frame#)))]
+            (update-proxy prx# ~methods)
+            prx#))))
+
+(def #^{:private true}
+     modes {:JAVA2D JAVA2D :OPENGL OPENGL
+            :P3D P3D :P2D P2D :PDF PDF})
+
+(defn run
+  "Launches the applet. If given the flag :interactive, it won't exit
+  on clicking the close button - it will only dispose the window."
+  [applet & interactive?]
+  (.init applet)
+  (let [m (.meta applet)
+        [width height & mode] (or (:size m) [200 200])
+        mode (if-let [kw (first mode)]
+               (modes (-> kw name toupper keyword))
+               JAVA2D)
+        close-op (if (first interactive?)
+                   JFrame/DISPOSE_ON_CLOSE
+                   JFrame/EXIT_ON_CLOSE)]
+    (.size applet width height mode)
+    (reset! (:frame m)
+            (doto (JFrame. (or (:title m) (:name m)))
+              (.setDefaultCloseOperation close-op)
+              (.setSize width height)
+              (.add applet)
+              (.pack)
+              (.show)))))
+
+
+(defn stop [applet]
+  (let [closing-fn (fn []
+                     (let [frame @(:frame (meta applet))]
+                       (.destroy applet)
+                       (doto frame
+                         (.hide)
+                         (.dispose))))]
+    (javax.swing.SwingUtilities/invokeAndWait closing-fn)))
+
+(comment ;; Usage:
+  (defapplet growing-triangle
+    :draw (fn [] (line 10 10 (frame-count) 100)))
+
+  (run growing-triangle)
+  (stop growing-triangle))


nesting

nesting

--- test/celestial/fixtures.clj
+++ test/celestial/fixtures.clj
@@ -9,6 +9,8 @@
   (:use [celestial.common :only (slurp-edn)]))

 (def redis-prox-spec (slurp-edn "fixtures/redis-system.edn"))
+
+(def redis-bridged-prox-spec (slurp-edn "fixtures/redis-system-bridged.edn"))

 (def redis-type (slurp-edn "fixtures/redis-type.edn"))

@@ -24,9 +26,7 @@

 (defn clipboard-copy [s]
   (let [clp (.getSystemClipboard (Toolkit/getDefaultToolkit))]
-    (.setContents clp (StringSelection. s) nil)
-   )
-  )
+    (.setContents clp (StringSelection. s) nil)))

 ;; (clipboard-copy (clojure.data.json/write-str redis-type :escape-slash false))
 ;; (clipboard-copy (clojure.data.json/write-str redis-prox-spec :escape-slash false))