working multi-get using promises

working multi-get using promises

--- elephantdb-server/src/clj/elephantdb/keyval/core.clj
+++ elephantdb-server/src/clj/elephantdb/keyval/core.clj
@@ -100,10 +100,7 @@
                                                      domain-name
                                                      suffix
                                                      key-seq)))]
-
-      (->> (for [[k v] results-map]
-                  {:key k :value v})
-                (map (fn [m1 m2] (into m1 m2)) indexed-keys)))))
+      results-map)))

 ;; TODO: Fix this with a macro that lets us specify these behaviours
 ;; by default, but replace as necessary.
@@ -142,26 +139,20 @@

 (defn multi-get
   [get-fn database domain-name key-seq]
-  (loop [results []
-         indexed-keys (-> (db/domain-get database domain-name)
-                          (dom/index-keys key-seq))]
+  (let [indexed-keys (-> (db/domain-get database domain-name)
+                         (dom/index-keys key-seq))]
     (if-let [bad-key (some (comp empty? :hosts) indexed-keys)]
       (throw (thrift/hosts-down-ex (:all-hosts bad-key)))
-      (let [host-map   (group-by (comp first :hosts) indexed-keys)
-            rets       (u/do-pmap (fn [[host indexed-keys]]
-                                    [host (get-fn host indexed-keys)])
-                                  host-map)
-            successful (into {} (filter second rets))
-            results    (->> (vals successful)
-                            (apply concat results))
-            fail-map   (apply dissoc host-map (keys successful))]
-        (if (empty? fail-map)
-          (update-keys (into {} (map (juxt :key :value) results)) #(ByteBuffer/wrap %))
-          (recur results
-                 (map (fn [m]
-                        (update-in m [:hosts]
-                                   dom/trim-hosts (keys fail-map)))
-                      (apply concat (vals fail-map)))))))))
+      (let [host-map (group-by :hosts indexed-keys)
+            promises (u/do-pmap
+                      (fn [[hosts indexed-keys]]
+                        (let [p (promise)]
+                          (u/do-pmap (fn [host]
+                                       (when-not (realized? p)
+                                         (deliver p (get-fn host indexed-keys)))) hosts)
+                          p))
+                      host-map)]
+        (update-keys (apply into {} (map deref promises)) #(ByteBuffer/wrap %))))))

 (defn kv-get-fn
   [service domain-name database]
@@ -178,7 +169,7 @@
     (directMultiGet [_ domain-name key-set]
       (thrift/assert-domain database domain-name)
       (let [key-seq (byte-buffer-unwrap key-set)]
-        (try (if-let [results-map (direct-multiget database domain-name key-seq)]
+()        (try (if-let [results-map (direct-multiget database domain-name key-seq)]
                results-map
                (throw (thrift/domain-not-loaded-ex)))
              (catch RuntimeException _


Include docstring in the attrs map

Include docstring in the attrs map

--- src/detritus/variants.clj
+++ src/detritus/variants.clj
@@ -107,18 +107,21 @@
         kw-members        (mapv (comp keyword name) members)
         kw-tag            (keyword (name (ns-name *ns*))
                                    (name vname))
-        ?attr-map         (assoc ?attr-map
-                                 :variants/tag true
-                                 :tag/members  kw-members
-                                 :tag/tag      kw-tag)]
-    `(do (def ~vname
-           ~?docstring
-           (quote ~(merge ?attr-map ?pre-map)))
-         (defn ~(symbol (str "->" (name vname)))
+        ?attr-map         (merge ?attr-map
+                                 ?pre-map
+                                 (when ?docstring
+                                   {:doc ?docstring}))]
+    `(do (defn ~(symbol (str "->" (name vname)))
            ~(str "Generated constructor for the " vname " type.")
-           ~?attr-map ~members
+           ~members
            ~?pre-map
            (->ATaggedVal ~kw-tag (hash-map ~@(interleave kw-members members))))
+         (def ~vname
+           ~?docstring
+           (detritus.variants/->TagDescriptor
+            ,,(quote ~?attr-map)
+            ,,(quote ~kw-members)
+            ,,(quote ~kw-tag)))
          (defn ~(symbol (str (name vname) "?"))
            ~(str "Generated predicate for the " vname " type.")
            ([x#]
@@ -130,6 +133,8 @@
                    (and ~@(:pre ?pre-map))))))
          nil)))

+(deftag TagDescriptor [attrs members tag])
+
 ;; FIXME: def closed variant?
 ;; FIXME: def open variant?
 ;; FIXME: variant dispatch?


better way: avoid thread/sleep, and encapsulate the concept of a generator as a function make of separately called thunks

--- docs/sc-book/sc-three.clj
+++ docs/sc-book/sc-three.clj
@@ -1,5 +1,7 @@
 (ns sc-three
   (:use [overtone.live]))
+
+;; Helpers

 ;; This is the default synth. Is it accessible from Overtone?
 (comment
@@ -19,8 +21,21 @@
              (linen:kr gate 0.01 0.7 0.3 2))]
     (offset-out out (pan2 z pan amp))))

-(defn release [x releaseTime]
-  (ctl x :gate (- releaseTime)))
+(defn wait-release
+  ([x releaseTime] (if @x (release @x releaseTime) (recur x releaseTime)))
+  ([x] (wait-release x 0.0)))
+
+(defn release
+  ([x releaseTime] (ctl x :gate (- releaseTime)))
+  ([x] (release x 0.0)))
+
+(defn generator [& thunks]
+  (let [r (agent thunks)]
+    #(if (seq @r)
+       (do
+         (send-off r (fn [ts] (when (seq ts) ((first ts))) (rest ts)))
+         'ok)
+       'done)))

 ;; Page 83
 ;; "foo" repeats every second
@@ -61,28 +76,22 @@
   )
 )

-;; Is there a better way?
-(do
-  (def cont (atom 0))
-  (defn go []
-    (swap! cont inc))
-  (loop []
-    (case @cont
-      0 (recur)
-      1 (do
-          (s :freq (midi->hz 76))
-          (Thread/sleep 1000)
-          (stop)
-          (s :freq (midi->hz 73))
-          (go)
-          (recur))
-      2 (recur)
-      3 (do
-          (stop)
-          (s :freq (midi->hz 69))
-          (Thread/sleep 2000)
-          (stop)))))
-
+(def go
+  (let [y (atom nil)]
+   (generator
+    (fn []
+      (let [x (s :freq (midi->hz 76))]
+        (after-delay
+         1000
+         #(do
+            (release x 0.1)
+            (reset! y (s :freq (midi->hz 73)))))))
+    (fn []
+      (wait-release y 0.1)
+      (let [z (s :freq (midi->hz 69))]
+        (after-delay
+         2000
+         #(release z)))))))
 (go)
 (go)

@@ -132,30 +141,33 @@
   (def t (atom 1))

   (defn go1 []
-   (loop []
-     (when (not (nil? @x)) (release @x 0.1))
-     (when @cont
-       (reset! x (s :freq (midi->hz 61) :amp 0.2))
-       (Thread/sleep (/ 200 @t))
-       (release @x 0.1)
-       (reset! x (s :freq (midi->hz 67) :amp 0.2))
-       (Thread/sleep (/ (ranged-rand 75 250) @t))
-       (recur))))
+    (when @x (release @x 0.1))
+    (when @cont
+      (reset! x (s :freq (midi->hz 61) :amp 0.2))
+      (after-delay
+       (/ 200 @t)
+       #(do
+          (release @x 0.1)
+          (reset! x (s :freq (midi->hz 67) :amp 0.2))
+          (after-delay
+           (/ (ranged-rand 75 250) @t)
+           #'go1)))))

   (defn go2 []
     (reset! y (s :freq (midi->hz 73) :amp 0.3)))

   (defn go3 []
-    (when (not (nil? @y)) (release @y 0.1))
+    (release @y 0.1)
     (reset! y (s :freq (midi->hz 79) :amp 0.3))
     (reset! t 2))

   (defn go4 []
-    (when (not (nil? @y)) (release @y 0.1))
+    (release @y 0.1)
     (reset! cont false))
+
+  (def go (generator go1 go2 go3 go4))
 )
-
-(go1)
-(go2)
-(go3)
-(go4)
+(go)
+(go)
+(go)
+(go)


Fix namespace for noembed.clj

Fix namespace for noembed.clj

--- src/braid/lib/noembed.clj
+++ src/braid/lib/noembed.clj
@@ -1,8 +1,7 @@
-(ns braid.core.server.api.noembed
-  (:require
-    [clojure.data.json :as json]
-    [org.httpkit.client :as http]
-    [taoensso.timbre :as timbre]))
+(ns braid.lib.noembed
+  (:require [clojure.data.json :as json]
+            [org.httpkit.client :as http]
+            [taoensso.timbre :as timbre]))

 (defn get-oembed
   [url]


yay multiple signatures

yay multiple signatures

--- src/tenbytenbot/matrix.clj
+++ src/tenbytenbot/matrix.clj
@@ -16,9 +16,11 @@

 (defn mcreate
-  [dims]
   "creates a matrix of m by n dims, with false values"
-  {:dims dims :values (-create (reduce * dims))})
+  ([dims]
+    {:dims dims :values (-create (reduce * dims))})
+  ([dims positions]
+    (msets (mcreate dims) positions true)))

 (defn mget [matrix pos]
@@ -61,6 +63,8 @@
 ;(msets (mcreate [3 2]) '([0 0]) true)
 ;(msets (mcreate [3 2]) '([0 0] [0 1]) true)

+;(mcreate [3 2] '([0 0] [1 0]))
+
 ;(mget (mcreate [3 2]) [0 0])
 ;(mget (mset (mcreate [3 2]) [0 0] true) [0 0])


add contact and clear text afterwards

add contact and clear text afterwards

--- fe/src/cljs/fe/core.cljs
+++ fe/src/cljs/fe/core.cljs
@@ -28,11 +28,14 @@
         (>= c 2) (assoc :middle middle)))))

 (defn add-contact [app owner]
-  (let [new-contact (-> (om/get-node owner "new-contact")
+  (let [input (om/get-node owner "new-contact")
+        new-contact (-> input
                         .-value
                         parse-contact)]
     (when new-contact
-      (om/transact! app :contacts #(conj % new-contact)))))
+      (om/transact! app :contacts #(conj % new-contact))
+      (set! (.-value input) "")
+      )))

 (defn middle-name [{:keys [middle middle-initial]}]
   (cond
@@ -54,7 +57,7 @@
   (reify
     om/IInitState
     (init-state [_]
-      {:delete (chan)})
+      {:delete (chan) :text ""})
     om/IWillMount
     (will-mount [_]
       (let [delete (om/get-state owner :delete)]
@@ -69,7 +72,11 @@
         (dom/h2 nil "Contact list")
         (apply dom/ul nil
           (om/build-all contact-view (:contacts app)
-            {:init-state {:delete delete}}))))))
+            {:init-state {:delete delete}}))
+        (dom/div nil
+          (dom/input #js {:type "text" :ref "new-contact"})
+          (dom/button #js {:onClick #(add-contact app owner)} "Add contact"))
+        ))))

 (defn main []
 (om/root


[#2437] Restrict js to match one column only

--- backend/src/akvo/lumen/lib/transformation/derive.clj
+++ backend/src/akvo/lumen/lib/transformation/derive.clj
@@ -65,10 +65,18 @@
                                                          (:columnName (first (filter (fn [c]
                                                                            (and (= column-ref1 (:groupName c))
                                                                                (= column-ref2 (:title c)))) columns)))
-                                                         (try
-                                                          (:columnName
-                                                           (dataset.utils/find-column columns column-ref1 :title))
-                                                          (catch Exception e nil)))})))))
+                                                         (let [results (filter (fn [c] (= column-ref1 (:title c))) columns)]
+                                                           (if (> (count results) 1)
+                                                             (throw (ex-info (format "There is more than one column with this name: '%s', Js code needs to reference the column with the group. Eg: row['Transformations']['%s']" column-ref1 column-ref1)
+                                                                             {:code code
+                                                                              :columns columns
+                                                                              :reference m}
+                                                                             ))
+
+                                                             (try
+                                                               (:columnName
+                                                                (dataset.utils/find-column columns column-ref1 :title))
+                                                               (catch Exception e nil)))))})))))
             {"template" code
              "references" []}
             (parse-row-object-references code))))


[#3081] Reuse logic to adapt data-groups-to-be-created

--- backend/src/akvo/lumen/lib/transformation/engine.clj
+++ backend/src/akvo/lumen/lib/transformation/engine.clj
@@ -192,6 +192,19 @@
      :previous-columns previous-columns
      :data-group data-group}))

+(defn adapt [data-groups-to-be-created data-groups]
+  (let [max-group-order (apply max (conj (map :group-order data-groups) 1000))]
+    (map-indexed (fn [i item]
+                   (let [idx        (inc (+ i max-group-order))
+                         group-name (str (:group-name item) " [merge]")]
+                                                 (-> item
+                                                     (assoc :group-order idx)
+                                                     (assoc :group-id idx)
+                                                     (assoc :group-name group-name)
+                                                     (update :columns (fn [cols]
+                                                                        (mapv #(assoc % "groupId" idx "groupName" group-name) cols))))))
+                                             data-groups-to-be-created)))
+
 (defn post-try-apply-operation-2
   "
   1. create dataset-version(-2) with new transformation in transformations
@@ -216,23 +229,12 @@
                                                                                "changedColumns" (diff-columns previous-columns
                                                                                columns))))})
     (when (seq data-groups-to-be-created)
-      (let [max-group-order     (apply max (conj (map :group-order data-groups) 1000))
-            adapted-data-groups (map-indexed (fn [i item]
-                                               (let [idx        (inc (+ i max-group-order))
-                                                     group-name (str (:group-name item) " [merge]")]
-                                                 (-> item
-                                                     (assoc :group-order idx)
-                                                     (assoc :group-id idx)
-                                                     (assoc :group-name group-name)
-                                                     (update :columns (fn [cols]
-                                                                        (mapv #(assoc % "groupId" idx "groupName" group-name) cols))))))
-                                             data-groups-to-be-created)]
-        (doseq [dg adapted-data-groups]
-          (db.data-group/new-data-group tenant-conn
-                                        (merge
-                                         dg
-                                         {:id                 (util/squuid)
-                                          :dataset-version-id new-dataset-version-id})))))
+      (doseq [dg (adapt data-groups-to-be-created data-groups)]
+        (db.data-group/new-data-group tenant-conn
+                                      (merge
+                                       dg
+                                       {:id                 (util/squuid)
+                                        :dataset-version-id new-dataset-version-id}))))
     (db.data-group/new-data-group tenant-conn
                                   (merge
                                    (select-keys data-group
@@ -401,15 +403,18 @@
                     (log/debug "Job executionid: " job-execution-id)
                     (throw (ex-info (str "Failed to undo transformation index:" tx-index ". Tx message:" (.getMessage e))
                                     {:transformation-result (:transformation-result (ex-data e))
-                                     :transformation        transformation})))))]
+                                     :transformation        transformation})))))
+              data-groups-to-be-created (adapt data-groups-to-be-created data-groups)]
           (log/error :data-group data-group)
           (log/error :data-groups data-groups)
           (log/error :data-groups-to-be-created data-groups-to-be-created)
           (recur (reduce (fn [c dg]
                            (if (= (:id dg) (:id data-group ))
                              (conj c (assoc dg :columns columns))
-                             (conj c dg)
-                             )) data-groups-to-be-created data-groups) (rest transformations) (inc tx-index)))))))
+                             (conj c dg)))
+                         data-groups-to-be-created data-groups)
+                 (rest transformations)
+                 (inc tx-index)))))))

 (defn execute-undo [{:keys [tenant-conn] :as deps} dataset-id job-execution-id]
   (if (get (env/all tenant-conn) "data-groups")


improve dragging by shifting the piece under the cursor

--- src/chessground/drag.cljs
+++ src/chessground/drag.cljs
@@ -6,7 +6,18 @@

 (def over-class "drag-over")

-(defn- drag-move [draggie event pointer]
+(defn- on-start [_ event _]
+  "Shift piece right under the cursor"
+  (let [$el ($ (.-target event))
+        pos (.offset $el)
+        center-x (+ (.-left pos) (/ (.width $el) 2))
+        center-y (+ (.-top pos) (/ (.height $el) 2))
+        decay-x (- (.-pageX event) center-x)
+        decay-y (- (.-pageY event) center-y)]
+    (jq/css $el {:left (str decay-x "px") :top (str decay-y "px")})))
+
+(defn- on-move [_ event _]
+  "Highlight the square under the dragged piece"
   (let [$el ($ (common/square-element (.-target event)))]
     (when (not (jq/has-class $el over-class))
       (jq/remove-class (jq/siblings $el) over-class)
@@ -14,12 +25,15 @@

 (defn make [channels component]
   "Make a react component draggable"
-  (q/wrapper component :onMount (fn [node] (-> (new js/Draggabilly node)
-                                               (.on "dragStart" (push-args! (:drag-start channels)))
-                                               (.on "dragMove" drag-move)
-                                               (.on "dragEnd" (push-args! (:drag-end channels)))))))
+  (q/wrapper component
+             :onMount (fn [node]
+                        (-> (new js/Draggabilly node)
+                            (.on "dragStart" on-start)
+                            (.on "dragStart" (push-args! (:drag-start channels)))
+                            (.on "dragMove" on-move)
+                            (.on "dragEnd" (push-args! (:drag-end channels)))))))

-(defn end [[draggie event pointer]]
+(defn end [[draggie event _]]
   "Undo damages done by dragging and return origin and destination square keys"
   (jq/css ($ (.-element draggie)) {:top 0 :left 0})
   (when-let [orig (square-key (.-element draggie))]


Added temp level to logging

Added temp level to logging

--- src/chicken_coop/core.clj
+++ src/chicken_coop/core.clj
@@ -138,7 +138,7 @@
     (loop [timer timer]
       (Thread/sleep 1000)
       (let [light-level (safe-read! light-ain)]
-        (log "Current light-level:" light-level)
+        (log "Current levels:: light:" light-level "temp:" (safe-read! temp-ain))
         (recur (trans-sm! timer light-level))))))


more consistens warning defaults

more consistens warning defaults

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -40,8 +40,8 @@
 (def ^:dynamic *cljs-warnings*
   {:preamble-missing true
    :unprovided true
-   :undeclared-var false
-   :undeclared-ns false
+   :undeclared-var true
+   :undeclared-ns true
    :undeclared-ns-form true
    :redef true
    :dynamic true


removed container from banner div

removed container from banner div

--- src/cljs/memoria/app.cljs
+++ src/cljs/memoria/app.cljs
@@ -48,7 +48,8 @@
                 :on-change #(reset! search-term (-> %1 .-target .-value))}]]]]))

 (defn index-page-component []
-  [:div {:class "banner"}
+  [:div
+  [:div {:class "banner" :key "banner"}]
    [:div {:class "ui container main-content" :key "index-page-component"}
     [search-box-component]
     [cards-list-component @cards]]])


set locale to ENGLISH

set locale to ENGLISH

--- src/clojure/hebo/main.clj
+++ src/clojure/hebo/main.clj
@@ -159,6 +159,7 @@

 (defn -main [& args]
   (init-logging)
+  (java.util.Locale/setDefault java.util.Locale/ENGLISH)
   (let [{:keys [options arguments errors summary]} (parse-opts args cli-opts)]
     (cond
       (:help options) (exit 0 (usage summary))


a couple of destructuring examples

a couple of destructuring examples

--- src/clojure_noon/core.clj
+++ src/clojure_noon/core.clj
@@ -254,3 +254,20 @@

 ;;now onto restructuring

+(defn my-first
+  [[first-thing]]
+  first-thing)
+
+(my-first ["oven" "bike" "war-axe"])
+
+(defn chooser
+  [[first-choice second-choice & unimportant-choices]]
+  (println (str "Your first choice is " first-choice))
+  (println (str "Your second choice is " second-choice))
+  (println (str "We're ignore the rest of your choices. "
+                "Here they are in case you need to cry over them. "
+                (clojure.string/join ", " unimportant-choices))))
+
+(chooser ["pi", "arduino", "beagle-bone", "esp2866"])
+
+


That's a method, not a field, dummy [IMMUTANT-435]

--- namespaces/common/src/main/clojure/immutant/util.clj
+++ namespaces/common/src/main/clojure/immutant/util.clj
@@ -49,7 +49,7 @@
 (defn classpath
   "Returns the effective classpath for the app"
   []
-  (dp/all-classpath-urls clojure.lang.RT/baseLoader))
+  (dp/all-classpath-urls (clojure.lang.RT/baseLoader)))

 (defn at-exit
   "Registers a function to be called when the application is undeployed.


Don't require debug namespace

Don't require debug namespace

--- src/devtools/format.cljs
+++ src/devtools/format.cljs
@@ -1,5 +1,4 @@
-(ns devtools.format
-  (:require [devtools.debug :as debug]))
+(ns devtools.format)

 (def max-header-elements 5)
 (def more-marker "…")


destroy-track now checks if current-sound is nil before attempting to destroy

--- src/frontend/player.cljs
+++ src/frontend/player.cljs
@@ -83,7 +83,8 @@
       (swap! app-state assoc :tracks-to-delete (conj (:tracks-to-delete @app-state) sound-id))
       (.destruct sound)))

-  (if (= sound-id (.-id (:current-sound @app-state)))
+  (if (and (not (nil? (:current-sound @app-state)))
+           (= sound-id (.-id (:current-sound @app-state))))
     (swap! app-state assoc :current-sound-id nil)
     (swap! app-state assoc :current-sound nil)))


Convolver

Convolver

--- src/fugue/convolver.cljs
+++ src/fugue/convolver.cljs
@@ -14,9 +14,9 @@
     (oset! node "buffer" (get buffer-cache buffer-name))
     node))

-(defn convolver [buffer-name]
+(defn convolver [in buffer-name]
   (synthdef/synthdef
     {::synthdef/node-type ::audio/audio-node
      ::audio/audio-node-type ::convolver
      ::buffer/buffer-name buffer-name}
-    {}))
+    {::audio/input [in]}))


RR: use map-page data for map page single submission view

--- src/hatti/views/map.cljs
+++ src/hatti/views/map.cljs
@@ -115,7 +115,7 @@
                   new-data  (first
                              (filter
                               #(= rank (get % _rank))
-                              (get-in @app-state [:data])))]
+                              (get-in @app-state [:map-page :data])))]
               (om/update! app-state [:map-page :submission-clicked]
                           {:data new-data
                            :marker (get (get-id-marker-map)
@@ -126,7 +126,7 @@
                   new-data (first
                             (filter
                              #(= id (get % _id))
-                             (get-in @app-state [:data])))]
+                             (get-in @app-state [:map-page :data])))]
               (om/update! app-state [:map-page :submission-clicked]
                           {:data new-data
                            :id id


Added comments to handler to remember where things go

--- src/hphelper/handler.clj
+++ src/hphelper/handler.clj
@@ -21,64 +21,78 @@
             )
   (:gen-class))

-(defroutes app-routes
+(defroutes
+  app-routes
   ;; CHARACTERS
+  ;; Show page to select from list or create new character
   (GET "/char/" {params :params baseURL :context}
-       (if (:char_id params)
-         (cprint/html-print-sheet-one-page (sl/load-char-from-db (:char_id params)))
-         (csel/print-select-page baseURL)))
+    (if (:char_id params)
+      (cprint/html-print-sheet-one-page (sl/load-char-from-db (:char_id params)))
+      (csel/print-select-page baseURL)))
+  ;; Select options to create a new character
   (GET "/char/gen/" {baseURL :context}
-       (cform/html-select-page))
+    (cform/html-select-page))
+  ;; Create a new character from the options above and save it
   (POST "/char/gen/"
         {params :params}
-        (html [:div
-               (-> params
-                   (cform/convert-to-char)
-                   (cgen/create-character)
-                   (sl/save-char-to-db)
-                   (sl/load-char-from-db)
-                   (cprint/html-print-sheet-one-page))
-               ]))
+    (html [:div
+           (-> params
+               (cform/convert-to-char)
+               (cgen/create-character)
+               (sl/save-char-to-db)
+               (sl/load-char-from-db)
+               (cprint/html-print-sheet-one-page))
+           ]))
+  ;; Display a character
   (GET "/char/print/" {params :params}
-       (cprint/html-print-sheet-one-page (sl/load-char-from-db (:char_id params))))
+    (cprint/html-print-sheet-one-page (sl/load-char-from-db (:char_id params))))

   ;; SCENARIOS
-  (GET "/scen/" {params :params baseURL :context}
-       (if (params :scen_id)
-         (ssel/print-crisis-page (params :scen_id) baseURL)
-         (ssel/print-select-page baseURL)))
+  ;; Show page to create a new scenario, or select a partially completed or fully completed scenario
+  ;; If contains a :scen_id, loads completed scenario and allows options for printing parts or all
+  (GET "/scen/" {params :params baseURL :context}
+    (if (params :scen_id)
+      (ssel/print-crisis-page (params :scen_id) baseURL)
+      (ssel/print-select-page baseURL)))
+  ;; Show page to create a new scenario
   (GET "/scen/gen/" {baseURL :context} (sform/html-select-page baseURL))
+  ;; Create a brand new scenario without programmers picked
   (POST "/scen/gen/"
         {params :params baseURL :context}
-        (-> params
-            (sform/from-select-to-scenmap)
-            (sgen/create-scenario)
-            (sl/save-scen-to-db)
-            ((partial sform/html-scen-to-full-page baseURL))))
+    (-> params
+        (sform/from-select-to-scenmap)
+        (sgen/create-scenario)
+        (sl/save-scen-to-db)
+        ((partial sform/html-scen-to-full-page baseURL))))
+  ;; Get scenario without programmers in order to pick programmers
   (GET "/scen/full/" {params :params baseURL :context}
-       (sform/html-scen-to-full-page baseURL (:scen_id params)))
+    (sform/html-scen-to-full-page baseURL (:scen_id params)))
+  ;; Add programmers to scenario and create a new record
   (POST "/scen/full/" {params :params baseURL :context}
-        (-> params
-            (sform/from-scenmap-to-full)
-            (sl/save-fullscen-to-db)
-            (ssel/print-crisis-page baseURL)))
+    (-> params
+        (sform/from-scenmap-to-full)
+        (sl/save-fullscen-to-db)
+        (ssel/print-crisis-page baseURL)))
+  ;; Prints an entire scenario with options, including sheets for each character if desired
   (GET "/scen/print/" {params :params}
-       (sprint/html-print-optional (sl/load-fullscen-from-db (params :scen_id)) (keys params)))
+    (sprint/html-print-optional (sl/load-fullscen-from-db (params :scen_id)) (keys params)))
+  ;; Prints a single session sheet for a character for a specific character
   (GET "/scen/print/char/" {params :params}
-       (println params)
-       (let [scen (sl/load-fullscen-from-db (Integer/parseInt (:scen_id params)))]
-         (println (:hps scen))
-         (sprint/html-print-player-sheet scen ((:hps scen) (Integer/parseInt (:p_id params))))))
+    (println params)
+    (let [scen (sl/load-fullscen-from-db (Integer/parseInt (:scen_id params)))]
+      (println (:hps scen))
+      (sprint/html-print-player-sheet scen ((:hps scen) (Integer/parseInt (:p_id params))))))

   ;; OTHER
+  ;; Simple directs to the above
   (GET "/" {baseURL :context}
-       (html [:html
-              [:body
-               [:a {:href (str baseURL "/scen/")} "Scenario Generator"][:br]
-               [:a {:href (str baseURL "/char/")} "Character Generator"][:br]
-               [:br]
-               [:a {:href "https://github.com/lsenjov/hphelper"} "Source Code"][:br]
-               ]]))
+    (html [:html
+           [:body
+            [:a {:href (str baseURL "/scen/")} "Scenario Generator"][:br]
+            [:a {:href (str baseURL "/char/")} "Character Generator"][:br]
+            [:br]
+            [:a {:href "https://github.com/lsenjov/hphelper"} "Source Code"][:br]
+            ]]))
   (route/not-found
     "Not Found.")
   )


update query in client app state

update query in client app state

--- iwaswhere-web/src/cljs/iwaswhere_web/store.cljs
+++ iwaswhere-web/src/cljs/iwaswhere_web/store.cljs
@@ -92,12 +92,13 @@
     (update-local-storage new-state)
     {:new-state new-state}))

-(defn assoc-in-store
-  "Sets the value under path-in-store in the app state with the path-in-msg in the msg-payload."
-  [path-in-store path-in-msg]
-  (fn [{:keys [current-state msg-payload]}]
-    (let [new-state (assoc-in current-state path-in-store (get-in msg-payload path-in-msg))]
-      {:new-state new-state})))
+(defn update-query-fn
+  "Update query in client state, with resetting the active entry in the linked entries view."
+  [{:keys [current-state msg-payload]}]
+  (let [new-state (-> current-state
+                    (assoc-in [:current-query] msg-payload)
+                    (assoc-in [:active] nil))]
+    {:new-state new-state}))

 (defn show-more-fn
   "Runs previous query but with more results. Also updates the number to show in the UI."
@@ -122,7 +123,7 @@
   {:cmp-id      cmp-id
    :state-fn    initial-state-fn
    :handler-map {:state/new          new-state-fn
-                 :state/get          (assoc-in-store [:current-query] [])
+                 :state/get          update-query-fn
                  :show/more          show-more-fn
                  :entry/new          new-entry-fn
                  :entry/geo-enrich   geo-enrich-fn


(SERVER-977) fix indentation in handle-delete-cert.-req.-test

--- test/unit/puppetlabs/services/ca/certificate_authority_core_test.clj
+++ test/unit/puppetlabs/services/ca/certificate_authority_core_test.clj
@@ -148,35 +148,35 @@
               (is (logged? msg-matcher :debug)))
             (finally
               (fs/delete expected-path))))))
-      (testing "Attempted deletion of a non-existant CSR"
-        (logutils/with-test-logging
-          (let [subject "not-found-agent"
-                response (handle-delete-certificate-request! subject settings)
-                expected-path (ca/path-to-cert-request (:csrdir settings) subject)
-                msg-matcher (re-pattern
-                              (str "No cert.*request for " subject " at.*" expected-path))]
-            (is (false? (fs/exists? expected-path)))
-            (is (= 404 (:status response)))
-            (is (re-matches msg-matcher (:body response)))
-            (is (= "text/plain" (get-in response [:headers "Content-Type"])))
-            (is (logged? msg-matcher :warn)))))
-      (testing "Error during deletion of a CSR"
-        (logutils/with-test-logging
-          (let [subject "err-agent"
-                csr-stream (gen-csr-input-stream! subject)
-                expected-path (ca/path-to-cert-request (:csrdir settings) subject)]
-            (try
-              (handle-put-certificate-request! subject csr-stream settings)
-              (is (true? (fs/exists? expected-path)))
-              (fs/chmod "-w" (fs/parent expected-path))
-              (let [response (handle-delete-certificate-request! subject settings)
-                     msg-matcher (re-pattern (str "Path " expected-path " exists but.*"))]
-                 (is (= 500 (:status response)))
-                 (is (re-matches msg-matcher (:body response)))
-                 (is (= "text/plain" (get-in response [:headers "Content-Type"])))
-                 (is (logged? msg-matcher :error)))
-              (finally
-                (fs/chmod "+w" (fs/parent expected-path)))))))))
+    (testing "Attempted deletion of a non-existant CSR"
+      (logutils/with-test-logging
+        (let [subject "not-found-agent"
+              response (handle-delete-certificate-request! subject settings)
+              expected-path (ca/path-to-cert-request (:csrdir settings) subject)
+              msg-matcher (re-pattern
+                            (str "No cert.*request for " subject " at.*" expected-path))]
+          (is (false? (fs/exists? expected-path)))
+          (is (= 404 (:status response)))
+          (is (re-matches msg-matcher (:body response)))
+          (is (= "text/plain" (get-in response [:headers "Content-Type"])))
+          (is (logged? msg-matcher :warn)))))
+    (testing "Error during deletion of a CSR"
+      (logutils/with-test-logging
+        (let [subject "err-agent"
+              csr-stream (gen-csr-input-stream! subject)
+              expected-path (ca/path-to-cert-request (:csrdir settings) subject)]
+          (try
+            (handle-put-certificate-request! subject csr-stream settings)
+            (is (true? (fs/exists? expected-path)))
+            (fs/chmod "-w" (fs/parent expected-path))
+            (let [response (handle-delete-certificate-request! subject settings)
+                   msg-matcher (re-pattern (str "Path " expected-path " exists but.*"))]
+               (is (= 500 (:status response)))
+               (is (re-matches msg-matcher (:body response)))
+               (is (= "text/plain" (get-in response [:headers "Content-Type"])))
+               (is (logged? msg-matcher :error)))
+            (finally
+              (fs/chmod "+w" (fs/parent expected-path)))))))))

 (deftest handle-put-certificate-request!-test
   (let [settings   (assoc (testutils/ca-sandbox! cadir)


fixed apprendre and appeler

fixed apprendre and appeler

--- src/babel/francais/lexicon.cljc
+++ src/babel/francais/lexicon.cljc
@@ -50,9 +50,9 @@
    "annoncer" {:synsem {:cat :verb
                        :sem {:pred :announce}}}

-   "appeler" {:synsem {:cat :verb
-                       :boot-stem "appell"
-                       :future-stem "appell"
+   "appeler" {:français {:boot-stem "appell"
+                         :future-stem "appell"}
+              :synsem {:cat :verb
                        :sem {:pred :call}}}

    "apporter" [{:synsem {:cat :verb
@@ -61,8 +61,8 @@
                          :sem {:pred :carry}}}]

    ;;  CONJUGATES LIKE TENIR
-   "apprendre" {:synsem {:cat :verb
-                         :past-participle "appris"
+   "apprendre" {:français {:past-participle "appris"}
+                :synsem {:cat :verb
                          :sem {:pred :learn}}}

    "rester" {:synsem {:cat :verb


added nascere

added nascere

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1568,6 +1568,15 @@

     "muovere" {:synsem {:cat :verb
                         :sem {:pred :move}}}
+
+    "nascere"
+   {:italiano {:passato "nato"}
+    :synsem {:cat :verb
+             :essere true
+             :sem {:discrete false
+                   :pred :be-born
+                   :subj {:human true}
+                   :obj {:legible true}}}}

    ;; non-comparative
    ;; TODO: add comparative


s/ipos/it-pos/

s/ipos/it-pos/

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -2208,11 +2208,11 @@
                     (get universals (get-in val [:synsem :sem :pred]))))

                  ;; TODO: refactor this; it's very monolithic currently:
-                 ipos/intransitivize
+                 it-pos/intransitivize

                  ;; if verb does specify a [:sem :obj], then fill it in with subcat info.
                  ;; TODO: refactor this; it's very monolithic currently:
-                 ipos/transitivize
+                 it-pos/transitivize

                  (constrain-vals-if
                   (fn [val]
@@ -2241,7 +2241,7 @@
                   ;; in such cases, don't apply agreement-noun.

                   (fn [val]
-                    (unify val ipos/agreement-noun)))
+                    (unify val it-pos/agreement-noun)))

                  (constrain-vals-if
                   (fn [val]


initialize function added to component protocol.

--- src/clj/hellhound/component.clj
+++ src/clj/hellhound/component.clj
@@ -1,12 +1,17 @@
 (ns hellhound.component
-  (:require [clojure.spec.alpha :as s]
-            [clojure.spec.gen.alpha :as gen])
+  (:require [clojure.spec.alpha     :as s]
+            [clojure.spec.gen.alpha :as gen]
+            [manifold.stream        :as stream]
+            [hellhound.core :as core])
   (:import (clojure.lang PersistentArrayMap)))

 ;; Protocols
 (defprotocol IComponent
   "This protocol defines a very basic component for hellhound system."
+  (initialize [component]
+    "Returns the initialized component.")
+
   (start! [component context]
     "Starts the component.")

@@ -24,6 +29,20 @@

 (extend-type PersistentArrayMap
   IComponent
+  (initialize [component]
+    (let [default-io-buffer-size (core/get-config :components :io-buffer-size)
+          default-stream-fn #(stream/stream default-io-buffer-size)
+          input-stream-fn   (get component
+                                 :input-stream-fn
+                                 default-stream-fn)
+          output-stream-fn  (get component
+                                 :output-stream-fn
+                                 default-stream-fn)]
+      (assoc component
+             :input (input-stram-fn)
+             :outpu (output-stream-fn))))
+
+
   (start! [this context]
     (let [start-fn (::start-fn this)]
       (assoc (start-fn this context)
@@ -41,7 +60,6 @@
   (dependencies [this]
      (::depends-on this)))

-
 ;; SPECS ---------------------------------------------------
 (s/def ::name qualified-keyword?)
 (s/def ::start-fn
@@ -50,11 +68,22 @@
                         :fn #(= (::name (:ret %))
                                 (::name (:this (:args %)))))))

-(s/def ::stop-fn (s/fspec :args (s/cat :this map? :context map?)
-                          :ret map?
-                          :fn #(= (::name (:ret %))
-                                  (::name (:this (:args %))))))
+(s/def ::stop-fn
+  (s/fspec :args (s/cat :this map? :context map?
+                        :ret map?
+                        :fn #(= (::name (:ret %))
+                                (::name (:this (:args %)))))))
+
+(s/def ::stream stream/stream?)
+
+(s/def ::input-stream-fn
+  (s/fspec :args (s/cat) :ret ::stream))
+
+
+(s/def ::output-stream-fn ::input-stream-fn)

 (s/def ::depends-on (s/coll-of keyword? :kind vector? :distinct true))
 (s/def ::component (s/keys :req [::name ::start-fn ::stop-fn]
-                           :opt [::depends-on]))
+                           :opt [::depends-on
+                                 ::input-stream-fn
+                                 ::output-stream-fn]))


Fixed reference to old function name.

Fixed reference to old function name.

--- src/cljs/cmr/client/ingest.cljs
+++ src/cljs/cmr/client/ingest.cljs
@@ -1,7 +1,6 @@
 (ns cmr.client.ingest
   "The ClojureScript implementation of the CMR ingest client."
   (:require
-   [cmr.client.base :refer [make-options]]
    [cmr.client.base.impl :as base-impl]
    [cmr.client.base.protocol :refer [CMRClientAPI]]
    [cmr.client.common.const :as const]


Use time-ago for showing time

Use time-ago for showing time

--- src/cljs/hacker_agent/core.cljs
+++ src/cljs/hacker_agent/core.cljs
@@ -6,7 +6,8 @@
             [goog.history.EventType :as EventType]
             [weasel.repl :as ws-repl]
             [cljs.core.async :as async :refer [put! chan <! >! close! merge]]
-            [hacker-agent.hacker-base :as base :refer [reset-item-sync!]])
+            [hacker-agent.hacker-base :as base :refer [reset-item-sync!]]
+            [hacker-agent.time :as t])
   (:import goog.History))

 ;; -------------------------
@@ -43,7 +44,7 @@
                :style {:cursor "pointer"}}
               [:li
                [:p
-                (str by " " time " | ")
+                (str by " | " (t/time-ago time) " | ")
                 [:a {:href (str "/#/items/" id)} "link"]
                 [:p {:dangerouslySetInnerHTML {:__html text}}]]]
               (when kids


Microcosmetics

Microcosmetics

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/fca/implications.clj
+++ src/conexp/fca/implications.clj
@@ -213,10 +213,9 @@
 (defn- intersection-set?
   "Tests whether set has non-empty intersection with every set in sets."
   [set sets]
-  (boolean
-   (forall [other-set sets]
-     (exists [x set]
-       (contains? other-set x)))))
+  (forall [other-set sets]
+    (exists [x set]
+      (contains? other-set x))))

 (defn- minimal-intersection-sets
   "Returns for a sequence set-sqn of sets all subsets of base-set which have non-empty intersection


Add position keys

Add position keys

--- minimal-3d/desktop/src-common/minimal_3d/core.clj
+++ minimal-3d/desktop/src-common/minimal_3d/core.clj
@@ -23,8 +23,9 @@
           model-mat (material :set attr)
           model-attrs (bit-or (usage :position) (usage :normal))
           builder (model-builder)]
-      (model (model-builder! builder :create-box 2 2 2 model-mat model-attrs)
-             (vector-3 0 0 0))))
+      (-> (model-builder! builder :create-box 2 2 2 model-mat model-attrs)
+          model
+          (assoc :x 1 :y 0 :z 0))))
   :on-render
   (fn [screen entities]
     (clear! 1 1 1 1)


upgrade to clojure 1.8

upgrade to clojure 1.8

--- ext/chrome/project.clj
+++ ext/chrome/project.clj
@@ -1,7 +1,7 @@
 (defproject owl-web "0.0.1"
   :description "Owl web front"
   :source-paths ["src/clj" "src/cljs" "src/brepl"]
-  :dependencies [[org.clojure/clojure "1.6.0"]
+  :dependencies [[org.clojure/clojure "1.8.0"]
                  [org.clojure/clojurescript "0.0-2816"
                   :exclusions [org.apache.ant/ant]]
                  [compojure "1.2.1"]


Fix pagination

Fix pagination

--- src-cljs/frontend/components/pages/workflow.cljs
+++ src-cljs/frontend/components/pages/workflow.cljs
@@ -60,7 +60,7 @@
   (render [this]
     (component
       (let [props (om-next/props this)
-            page-num (get-in props ['[:app/route-params _] :page/number])
+            page-num (get-in props [:app/route-params :page/number])
             {project-name :project/name
              {vcs-type :organization/vcs-type
               org-name :organization/name} :project/organization} props]
@@ -177,7 +177,7 @@
               {vcs-type :organization/vcs-type
                org-name :organization/name} :project/organization} :branch/project} props
             page (:routed/page props)
-            page-num (get-in props ['[:app/route-params _] :page/number])]
+            page-num (get-in props [:app/route-params :page/number])]
         (run-list (om-next/computed
                    page
                    {:prev-page-href
@@ -260,7 +260,7 @@
             {vcs-type :organization/vcs-type
              org-name :organization/name} props
             page (:routed/page props)
-            page-num (get-in props ['[:app/route-params _] :page/number])]
+            page-num (get-in props [:app/route-params :page/number])]
         (run-list (om-next/computed
                    page
                    {:prev-page-href


Only show cancel for running runs

Only show cancel for running runs

--- src-cljs/frontend/components/pages/workflow.cljs
+++ src-cljs/frontend/components/pages/workflow.cljs
@@ -28,6 +28,11 @@
     :run-status/succeeded :status-class/succeeded
     :run-status/failed :status-class/failed
     :run-status/canceled :status-class/stopped))
+
+(defn- running? [run-status]
+  (contains? #{:run-status/not-run
+               :run-status/running}
+             run-status))

 (defn run-prs
   "A om-next compatible version of
@@ -166,7 +171,8 @@
                    :status-class/running (icon/status-running)
                    :status-class/waiting (icon/status-queued))]
                 [:.status-string (string/replace (name status) #"-" " ")]]]
-              (if (feature/enabled? :cancel-below-status)
+              (if (and (feature/enabled? :cancel-below-status)
+                       (running? status))
                 [:div.cancel-button {:on-click #(transact-run-cancel this id vcs-type org-name project-name)}
                  (icon/status-canceled)
                  [:span "cancel"]])]


Storm 344. (Security) nimbus renew-credentials not calling ICredentialsRenewer.renew

--- storm-core/src/clj/backtype/storm/daemon/nimbus.clj
+++ storm-core/src/clj/backtype/storm/daemon/nimbus.clj
@@ -869,7 +869,8 @@
             (if orig-creds
               (let [new-creds (HashMap. orig-creds)]
                 (doseq [renewer renewers]
-                  (log-message "Renewing Creds For " id " with " renewer))
+                  (log-message "Renewing Creds For " id " with " renewer)
+		  (.renew renewer new-creds))
                 (when-not (= orig-creds new-creds)
                   (.set-credentials! storm-cluster-state id new-creds)
               )))))))))


[clean]

[clean]

--- src/ombs/handler/eventacts.clj
+++ src/ombs/handler/eventacts.clj
@@ -7,7 +7,6 @@
     [ombs.funcs :refer [parse-int]]
     [ombs.handler.pages :as pages]
     [noir.session :as sess]
-    [noir.response :refer [redirect] ]
     ))

 (defn- finish [ename date] (db/set-status ename date :finished))


Adds else to cond.

Adds else to cond.

--- src/onyx/peer/virtual_peer.clj
+++ src/onyx/peer/virtual_peer.clj
@@ -26,7 +26,8 @@
                 (<!! status-ch)

                 (let [new-pipeline (task-pipeline id payload sync queue payload-ch complete-ch fn-params)]
-                  (recur (component/start new-pipeline)))))))
+                  (recur (component/start new-pipeline))))
+              :else (recur nil))))
     (>!! dead-ch true)))

 (defrecord VirtualPeer [fn-params]


Log total retry count on core.async input plugin stop

--- src/onyx/plugin/core_async.clj
+++ src/onyx/plugin/core_async.clj
@@ -2,14 +2,20 @@
   (:require [clojure.core.async :refer [chan >!! <!! alts!! timeout go <!]]
             [onyx.peer.pipeline-extensions :as p-ext]
             [onyx.static.default-vals :refer [defaults]]
-            [taoensso.timbre :refer [debug] :as timbre]))
+            [taoensso.timbre :refer [debug info] :as timbre]))

 (defn inject-reader
   [event lifecycle]
   (assert (:core.async/chan event) ":core.async/chan not found - add it using a :before-task-start lifecycle")
   {:core.async/pending-messages (atom {})
    :core.async/drained? (atom false)
-   :core.async/retry-ch (chan 10000)})
+   :core.async/retry-ch (chan 10000)
+   :core.async/retry-count (atom 0)})
+
+(defn log-retry-count
+  [event lifecycle]
+  (info "core.async input plugin stopping. Retry count:" @(:core.async/retry-count event))
+  {})

 (defn inject-writer
   [event lifecycle]
@@ -17,7 +23,8 @@
   {})

 (def reader-calls
-  {:lifecycle/before-task-start inject-reader})
+  {:lifecycle/before-task-start inject-reader
+   :lifecycle/after-task-stop log-retry-count})

 (def writer-calls
   {:lifecycle/before-task-start inject-writer})
@@ -57,9 +64,11 @@
   (swap! pending-messages dissoc message-id))

 (defmethod p-ext/retry-message :core.async/read-from-chan
-  [{:keys [core.async/pending-messages core.async/retry-ch]} message-id]
+  [{:keys [core.async/pending-messages core.async/retry-count core.async/retry-ch]} message-id]
   (when-let [msg (get @pending-messages message-id)]
     (swap! pending-messages dissoc message-id)
+    (when-not (= msg :done)
+      (swap! retry-count inc))
     (>!! retry-ch msg)))

 (defmethod p-ext/pending? :core.async/read-from-chan


change core to use new re-frame.core/console and not re-frame.loggers

--- src/re_frame_http_fx/core.cljs
+++ src/re_frame_http_fx/core.cljs
@@ -1,8 +1,7 @@
 (ns re-frame-http-fx.core
   (:require
     [goog.net.ErrorCode :as errors]
-    [re-frame.core      :refer [def-fx dispatch]]
-    [re-frame.loggers   :refer [console]]
+    [re-frame.core      :refer [def-fx dispatch console]]
     [ajax.core          :as ajax]))

 ;; I provide the :http effect handler leveraging cljs-ajax lib


with-repo-sandbox: throw the original exception after cleanup

--- test/clj_git/test_util.clj
+++ test/clj_git/test_util.clj
@@ -11,13 +11,16 @@
       (list 'assert (list '.mkdir (list 'clojure.java.io/as-file sandbox-pathname)))
       (list 'ok-sh "cp" "-rf" bare-repo-path (str sandbox-pathname "/.git/"))
       (list 'with-redefs ['clj-git.repo/repo-root (list 'fn [] (str sandbox-pathname "/"))]
-        (list 'clojure.java.shell/with-sh-dir (list 'clj-git.repo/repo-root)
-          (cons 'do (concat
-            (list (list 'ok-sh "git" "checkout" "."))
-            (list (list 'try
-              (cons 'do body)
-              (list 'catch 'Exception 'e)
-              (list 'finally (list 'ok-sh "rm" "-rf" (str "../" sandbox-pathname)))))))))))
+        (list 'let (vector 'err '(atom nil))
+          (list 'clojure.java.shell/with-sh-dir (list 'clj-git.repo/repo-root)
+            (cons 'do (concat
+              (list (list 'ok-sh "git" "checkout" "."))
+              (list (list 'try
+                (cons 'do body)
+                (list 'catch 'Exception 'e '(reset! err e))
+                (list 'finally
+                  (list 'ok-sh "rm" "-rf" (str "../" sandbox-pathname))
+                  '(if @err (throw @err))))))))))))

 (deftest t-with-repo-sandbox
   (with-repo-sandbox "fixtures/base_repo.git" "t-with-repo-sandbox"
@@ -33,9 +36,9 @@

 (deftest t-with-repo-sandbox-cleanup
   (testing "with-repo-sandbox cleanups up dir after exception"
-    (is (thrown? Exception
+    (is (thrown-with-msg? Exception #"throw from test"
       (with-repo-sandbox "fixtures/base_repo.git" "t-with-repo-sandbox-cleanup"
-        (throw (Exception.)))))
+        (throw (Exception. "throw from test")))))
     (is (not (.exists (clojure.java.io/as-file "t-with-repo-sandbox-cleanup"))))
   )
 )


Tests would prevent this kinda thing

Tests would prevent this kinda thing

--- modules/messaging/src/main/clojure/immutant/messaging/core.clj
+++ modules/messaging/src/main/clojure/immutant/messaging/core.clj
@@ -148,7 +148,7 @@
      (join-current-transaction session)
      (f))
     ;; Close the sessions used for nested tx's, if any
-    (doseq [s (remove #(= session) (vals *sessions*))] (.close s))))
+    (doseq [s (remove (partial = session) (vals *sessions*))] (.close s))))


make session-get safer

make session-get safer

--- src/server/nodejs/express.cljs
+++ src/server/nodejs/express.cljs
@@ -9,7 +9,8 @@
 (defn use [app middleware] (.use app middleware))

 (defn session-get [req k]
-  (some-> (gobj/get (.-session req) (pr-str k))
+  (some-> (.-session req)
+          (gobj/get (pr-str k))
           (str)
           (read-string)))


Fixed drop-down bug reported by Perry Trolard

--- lib/compojure/html/form_functions.clj
+++ lib/compojure/html/form_functions.clj
@@ -66,7 +66,8 @@
   ([name options]
     (drop-down name options nil))
   ([name options selected]
-    [:select (select-options options selected)]))
+    [:select {:name (str* name) :id (str* name)}
+      (select-options options selected)]))

 (defn text-area
   "Creates a text area element."


Remove file from old location.

Remove file from old location.

--- src/tryclojure/interpreter.clj
+++ src/tryclojure/interpreter.clj
@@ -1,72 +0,0 @@
-(ns isla.interpreter
-  (:use [clojure.pprint])
-  (:use [isla.library])
-  (:require [clojure.string :as str]))
-
-(declare run-sequence first-content lookup nreturn)
-
-(defmulti interpret (fn [& args] (:tag (first args))))
-
-(defmethod interpret :root [node & args]
-  (let [content (:content node)]
-    (if (not= nil args)
-      (run-sequence content (first args))
-      (run-sequence content (get-initial-context)))))
-
-(defmethod interpret :block [node ctx]
-  (run-sequence (:content node) ctx))
-
-(defmethod interpret :expression [node ctx]
-  (interpret (first (:content node)) ctx))
-
-(defmethod interpret :assignment [node ctx]
-  (def content (:content node))
-  (def identifier (interpret (first content) ctx))
-  (def value (interpret (nth content 2) ctx))
-  (let [new-ctx (conj ctx [identifier value])]
-    new-ctx))
-
-(defmethod interpret :invocation [node ctx]
-  (throw (Exception. "here!"))
-
-  (def content (vec (:content node)))
-  (def function (lookup (interpret (first content) ctx) ctx))
-  (def param (interpret (nth content 1) ctx))
-  (let [return-val (function ctx param)] ;; call fn
-    (nreturn ctx return-val)))
-
-(defmethod interpret :value [node ctx]
-  (if (= :identifier (:tag (first-content node)))
-    (lookup (first-content (first-content node)) ctx) ;; sub is identifier - lookup+return
-    (interpret (first-content node) ctx)))
-
-(defmethod interpret :identifier [node ctx]
-  (first-content node))
-
-(defmethod interpret :assignee [node ctx]
-  (first-content node))
-
-(defmethod interpret :integer [node ctx]
-  (first-content node))
-
-(defmethod interpret :string [node ctx]
-  (str/replace (first-content node) "'" ""))
-
-
-(defn nreturn
-  (pprint "return!")
-  (pprint return)
-  ([ctx] {:ctx ctx :return-val nil})
-  ([ctx return] {:ctx ctx :ret return}))
-
-(defn lookup [identifier ctx]
-  (get ctx identifier))
-
-(defn first-content [node]
-  (first (:content node)))
-
-(defn run-sequence [nodes ctx]
-  (if (empty? nodes)
-    ctx ;; return context
-    ;; interpret next node, get back context, pass that and remaining nodes back around
-    (run-sequence (rest nodes) (interpret (first nodes) ctx))))


removing large comment.

removing large comment.

--- src/metabase/api/user.clj
+++ src/metabase/api/user.clj
@@ -7,13 +7,6 @@
                              [user :refer [User]])
             [metabase.util :refer [select-non-nil-keys]]))

-;; RE stripping fields and calculating fields:
-;; -  Instead of stripping fields it makes more sense to just not select them in the first place.
-;;    The default fields selected for any entity can be set by implementing `metabase.db/default-fields`.
-;;    In fact, `User` is already doing this inside `metabase.models.user`.
-;; -  Calculating fields can be done with `assoc` in `post-select`. You can give it an actual value, which
-;;    means it will always be returned, or set it to a function or delay, which means it will only be returned
-;;    if specified in a call to `hydrate`.

 (defendpoint GET "/" []
   ;; TODO - permissions check


Place try/catch around aeron closes Should improve recoverability for GCs

--- src/onyx/messaging/aeron/publication_manager.clj
+++ src/onyx/messaging/aeron/publication_manager.clj
@@ -50,9 +50,13 @@
   (stop [this]
     (cleanup-fn)
     (future-cancel (:write-fut this))
-    (.close ^Publication publication)
-    (.close ^Aeron connection)
     (close! pending-ch)
+    (try (.close ^Publication publication)
+         (catch Throwable t
+           (info "Could not close publication:" t)))
+    (try (.close ^Aeron connection)
+         (catch Throwable t
+           (info "Could not close connection" t)))
     this)

   (connect [this]


(PE-5888) Default Content-Type in response to text/pson if not set

This commit forces the Content-Type in the certificate_status*
responses to be "text/pson" if the Content-Type is not already set at the
point the representation is converted into a Ring response.  This is
needed because Liberator by default would have added an empty
Content-Type if the Accept header in the request were "pson".

--- src/clj/puppetlabs/services/ca/certificate_authority_core.clj
+++ src/clj/puppetlabs/services/ca/certificate_authority_core.clj
@@ -6,6 +6,7 @@
             [slingshot.slingshot :as sling]
             [clojure.tools.logging :as log]
             [clojure.java.io :as io]
+            [clojure.string :as string]
             [schema.core :as schema]
             [cheshire.core :as cheshire]
             [compojure.core :as compojure :refer [GET ANY PUT]]
@@ -98,10 +99,17 @@
   liberator does not know how to serialize a map as PSON (as it does with JSON),
   so we have to tell it how."
   [x context]
-  (-> (cheshire/generate-string x)
-      (representation/as-response context)
-      (assoc :status 200)
-      (representation/ring-response)))
+  (let [context-with-media-type (if (string/blank? (get-in context
+                                                           [:representation
+                                                            :media-type]))
+                                  (assoc-in context
+                                            [:representation :media-type]
+                                            "text/pson")
+                                  context)]
+    (-> (cheshire/generate-string x)
+        (representation/as-response context-with-media-type)
+        (assoc :status 200)
+        (representation/ring-response))))

 (liberator/defresource certificate-status
   [subject settings]


set --go_out and --proto_path parameters properly for PB compilation

Signed-off-by: Gregory Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- src/obcc/build/golang.clj
+++ src/obcc/build/golang.clj
@@ -66,10 +66,10 @@
     (.add template "consumes" consumes)
     (.render template)))

-(defn protoc [proto]
+(defn protoc [path proto]
   (let [protoc (conch/programs protoc)]
-    (println "protoc")
-    (println (:stderr (protoc "--go_out=./" (str proto) {:verbose true})))))
+    (println "[PB]" (.getAbsolutePath proto))
+    (println (:stderr (protoc (str "--go_out=" path) (str "--proto_path=" path) (str proto) {:verbose true})))))

 (def cwd (System/getProperty "user.dir"))
 (defn fqpath [path] (.getAbsolutePath (io/file cwd path)))
@@ -103,7 +103,7 @@
       (gofmt "-w" (.getAbsolutePath shimpath)))

     ;; generate protobuf output
-    (protoc protofile)
+    (protoc (str path "/build") protofile)

     ;; install dependencies
     (go path {} "get" "-d" "-v" "chaincode")


work on repl

work on repl

--- src/overtone/gui/repl.clj
+++ src/overtone/gui/repl.clj
@@ -15,7 +15,8 @@
    )

   (:import
-   (javax.swing JEditorPane JScrollPane  SwingUtilities)
+   (java.awt.BorderLayout)
+   (javax.swing JEditorPane JScrollPane JPanel SwingUtilities)
    )

   (:require [clojure.main :as r])
@@ -339,9 +340,19 @@

 (defn repl-panel []
-  (let [panel (JPanel.)]
+  (let [panel (javax.swing.JPanel.)
+
+        history (javax.swing.JEditorPane.)
+        input (javax.swing.JEditorPane.)
+        scroll (javax.swing.JScrollPane. history)
+
+        println-history #(in-swing (let [ doc (.getDocument history)
+                                         length (.getLength doc)]
+                                     (.insertString doc length % nil)))
+
+        ]

     panel))
-
+


remove debug statement

remove debug statement

--- src/overtone/sc/synth.clj
+++ src/overtone/sc/synth.clj
@@ -338,7 +338,6 @@
                        (or (string? (first args))
                            (symbol? (first args))) [(str (first args)) (rest args)]
                            :default                    [(gen-synth-name) args])
-                _ (println "howdy " args)

         [params ugen-form] (if (vector? (first args))
                              [(first args) (rest args)]


Use the correct parameter key

Use the correct parameter key

--- modules/core/src/main/clojure/immutant/repl.clj
+++ modules/core/src/main/clojure/immutant/repl.clj
@@ -84,7 +84,7 @@
                "at" (str interface-address ":" port))
      (when-let [server ((util/try-resolve 'clojure.tools.nrepl.server/start-server)
                         :handler ((util/try-resolve 'clojure.tools.nrepl.server/default-handler) #'nrepl-init-handler)
-                        :port (fix-port port) :host interface-address)]
+                        :port (fix-port port) :bind interface-address)]
        (log/info "Bound to " (str interface-address ":" (-> server deref :ss .getLocalPort)))
        (util/at-exit (partial stop-nrepl server))
        server))


All validations now set map entries (albeit redundantly, in some cases).

--- src/alfresco_technical_validation/validation.clj
+++ src/alfresco_technical_validation/validation.clj
@@ -72,7 +72,6 @@
                                                      ", alfresco-public-java-api)
         res                      (cy/tquery cypher-query)
         message                  (if (empty? res) "" (s/join "\n" (map #(str (get % "UsedBy") " uses " (s/join ", " (get % "BlacklistedAlfrescoAPIs"))) res)))]
-    (println "API01 =" message)  ;####TEST!
     { "API01" message }))

 (defn- api06-service-locator
@@ -87,10 +86,11 @@
                                                                 'org.springframework.context.ApplicationContextAware',
                                                                 'org.springframework.context.ApplicationContext'
                                                               ]
-                                             RETURN m.name AS BlacklistedSpringAPI, COLLECT(DISTINCT n.name) AS UsedBy
-                                              ORDER BY m.name
-                                            ")]
-    (println "API06 =" res)))  ;####TEST
+                                             RETURN n.name as UsedBy, COLLECT(DISTINCT m.name) AS BlacklistedSpringAPIs
+                                              ORDER BY n.name
+                                            ")
+        message                  (if (empty? res) "" (s/join "\n" (map #(str (get % "UsedBy") " uses " (s/join ", " (get % "BlacklistedSpringAPIs"))) res)))]
+    { "API06" message }))

 (defn- com06-compiled-jvm-version
   []
@@ -101,8 +101,9 @@
                            AND n.`class-version` < 50
                         RETURN n.name AS ClassName, n.`class-version-str` AS ClassVersion
                          ORDER BY n.name
-                       ")]
-    (println "COM06 =" res)))    ;####TEST
+                       ")
+        message        (if (empty? res) "" (s/join "\n" (map #(str (get % "ClassName") " is compiled for JVM version " (get % "ClassVersion"))) res))]
+    { "COM06" message }))

 (defn- sec04-stb03-stb04-stb05-stb06-stb10-stb12-java-apis
   []
@@ -137,10 +138,19 @@
                                               'javax.transaction',
                                               'javax.transaction.xa'
                                             ]))
-                        RETURN m.name AS BlacklistedJavaAPI, COLLECT(DISTINCT n.name) AS UsedBy
-                         ORDER BY m.name
-                       ")]
-    (println "SEC04/STB03/STB04/STB05/STB06/STB10/STB12 =" res)))    ;####TEST
+                        RETURN n.name as UsedBy, COLLECT(DISTINCT m.name) AS BlacklistedJavaAPIs
+                         ORDER BY n.name
+                       ")
+        message        (if (empty? res) "" (s/join "\n" (map #(str (get % "UsedBy") " uses " (s/join ", " (get % "BlacklistedJavaAPIs"))) res)))]
+    {
+      "SEC04" message
+      "STB03" message
+      "STB04" message
+      "STB05" message
+      "STB06" message
+      "STB10" message
+      "STB12" message
+     }))

 (defn- stb07-stb14-search-apis
   []
@@ -153,10 +163,14 @@
                                            'org.alfresco.service.cmr.search.SearchService',
                                            'org.alfresco.service.cmr.search.ResultSet'
                                          ]
-                        RETURN m.name AS SearchAPI, COLLECT(DISTINCT n.name) AS UsedBy
-                         ORDER BY m.name
-                       ")]
-    (println "STB07/STB14 =" res)))    ;####TEST
+                        RETURN n.name as UsedBy, COLLECT(DISTINCT m.name) AS SearchAPIs
+                         ORDER BY n.name
+                       ")
+        message        (if (empty? res) "" (s/join "\n" (map #(str (get % "UsedBy") " uses " (s/join ", " (get % "SearchAPIs"))) res)))]
+    {
+      "STB07" message
+      "STB14" message
+    }))

 (defn- sec02-minimise-manual-authentication
   []
@@ -166,27 +180,31 @@
                          WHERE HAS(n.name)
                            AND HAS(m.name)
                            AND m.name = 'org.alfresco.repo.security.authentication.AuthenticationUtil'
-                        RETURN n.name AS Class, m.name AS AuthenticationUtil
-                         ORDER BY n.name
-                       ")]
-    (println "SEC02 =" res)))    ;####TEST
+                        RETURN n.name AS UsedBy, m.name AS AuthenticationUtilAPI
+                         ORDER BY n.name
+                       ")
+        message        (if (empty? res) "" (s/join "\n" (map #(str (get % "UsedBy") " uses " (get % "AuthenticationUtilAPI")) res)))]
+    { "SEC02" message }))

 (defn- stb06-stb18-manual-transactions
   []
   (let [res (cy/tquery "
- START n=NODE(*)
- MATCH (n)-->(m)
- WHERE HAS(n.name)
-   AND HAS(m.name)
-   AND m.name IN [
-                  'org.alfresco.repo.transaction.RetryingTransactionHelper',
-                  'org.alfresco.service.transaction.TransactionService'
-                 ]
-RETURN n.name AS Class, COLLECT(DISTINCT m.name) AS TransactionClass
- ORDER BY n.name
-                       ")]
-    (println "STB06/STB18 =" res)))    ;####TEST
-
+                         START n=NODE(*)
+                         MATCH (n)-->(m)
+                         WHERE HAS(n.name)
+                           AND HAS(m.name)
+                           AND m.name IN [
+                                          'org.alfresco.repo.transaction.RetryingTransactionHelper',
+                                          'org.alfresco.service.transaction.TransactionService'
+                                         ]
+                        RETURN n.name as UsedBy, COLLECT(DISTINCT m.name) AS TransactionAPIs
+                         ORDER BY n.name
+                       ")
+        message        (if (empty? res) "" (s/join "\n" (map #(str (get % "UsedBy") " uses " (s/join ", " (get % "TransactionAPIs"))) res)))]
+    {
+      "STB06" message
+      "STB18" message
+    }))

 (defn- validate-criteria
   [neo4j-url
@@ -210,6 +228,4 @@
     (dn/write-dependencies! neo4j-url dependencies)
     (let [bookmarks (validate-criteria neo4j-url source-index)]
       (println "bookmarks =" bookmarks)   ; ####TEST!!!!
-      (comment
       (bw/populate-bookmarks! report-template report-filename bookmarks))))
-      )


Simplify run-callbacks a bit.

Simplify run-callbacks a bit.

--- clj_record/callbacks.clj
+++ clj_record/callbacks.clj
@@ -12,8 +12,8 @@
         (merge-with concat callbacks {hook [func]})))))

 (defn run-callbacks [record model-name & hooks]
-  (let [callbacks (model-metadata-for model-name :callbacks)]
+  (let [callback-map (or (model-metadata-for model-name :callbacks) {})]
     (loop [r record
-           funcs (reduce #(concat %1 (%2 callbacks)) [] hooks)]
+           funcs (apply concat (map callback-map hooks))]
       (if (empty? funcs) r
         (recur ((first funcs) r) (rest funcs))))))


added declaration helper vhost (for marcxml2mods service)

--- test/edeposit/amqp/kramerius/components_test.clj
+++ test/edeposit/amqp/kramerius/components_test.clj
@@ -11,6 +11,7 @@
             [langohr.consumers :as lc]
             [langohr.exchange :as le]
             [langohr.channel :as lch]
+            [langohr.queue :as lq]
             [clojure.java.shell :as sh]
             )
   )
@@ -33,6 +34,9 @@
                                          (.start))
                            }
               ]
+          (let [ch (-> :marcxml2mods connection :ch)]
+            (lq/declare ch "converter" {:durable true :auto-delete false})
+            (lq/bind ch "converter"  "convert-to-mods" {:routing-key "request" :durable true}))
           (let [
                 marcxml2mods (-> (c/amqp-middleware
                                   {:exchanges [:convert-to-mods]


remove upload from lists when it is finished uploading

--- src/frontend/uploads.cljs
+++ src/frontend/uploads.cljs
@@ -107,10 +107,11 @@
       (fn []
         (remove-watch app-state/app-state upload-id)
         (swap! app-state/app-state
-               assoc
-               :uploads
-               (dissoc (:uploads @app-state/app-state)
-                       upload-id))))
+               merge
+               {:uploads (dissoc (:uploads @app-state/app-state)
+                         upload-id)
+                :active-uploads (remove @app-state/app-state #{upload-id})
+                :inactive-uploads (remove @app-state/app-state #{upload-id})})))

     (add-watch app-state/app-state
                upload-id


Use non-deprecated jmDNS getHostAddresses

--- Clojure/src/ambly/core.clj
+++ Clojure/src/ambly/core.clj
@@ -164,7 +164,7 @@
                   name (.getName service-event)]
               (when (and (= reg-type type) (is-ambly-bonjour-name? name))
                 (let [entry {name (let [info (.getInfo service-event)]
-                                    {:address (.getHostAddress (.getAddress info))
+                                    {:address (first (.getHostAddresses info))
                                      :port    (.getPort info)})}]
                   (swap! name-endpoint-map merge entry))))))]
     (.addServiceListener mdns-service reg-type service-listener)


Autoselect ephemeral port if none specified.

Closes #24.

--- src/gorilla_repl/core.clj
+++ src/gorilla_repl/core.clj
@@ -97,7 +97,7 @@
   [conf]
   ;; get configuration information from parameters
   (let [version (or (:version conf) "develop")
-        webapp-port (or (:port conf) 8990)
+        webapp-requested-port (or (:port conf) 0)
         ip (or (:ip conf) "127.0.0.1")
         nrepl-requested-port (or (:nrepl-port conf) 0)  ;; auto-select port if none requested
         project (or (:project conf) "no project")
@@ -113,10 +113,11 @@
     ;; first startup nREPL
     (nrepl/start-and-connect nrepl-requested-port)
     ;; and then the webserver
-    (server/run-server #'app-routes {:port webapp-port :join? false :ip ip})
-    (spit (doto (io/file ".gorilla-port") .deleteOnExit) webapp-port)
-    (println (str "Running at http://localhost:" webapp-port "/worksheet.html ."))
-    (println "Ctrl+C to exit.")))
+    (let [s (server/run-server #'app-routes {:port webapp-requested-port :join? false :ip ip})
+          webapp-port (:local-port (meta s))]
+      (spit (doto (io/file ".gorilla-port") .deleteOnExit) webapp-port)
+      (println (str "Running at http://localhost:" webapp-port "/worksheet.html ."))
+      (println "Ctrl+C to exit."))))

 (defn -main
   [& args]


A few repl improvements.

A few repl improvements.

--- repl/user.clj
+++ repl/user.clj
@@ -4,15 +4,24 @@
       [core :as time]
       [format :as ftime])
     [clojure.java.io :as io]
+    [clojure.repl :refer :all]
     [clojure.string :as str]
     [clojure.tools.namespace.repl :refer [refresh]]
-    [puget.printer :as puget]
+    (puget
+      [data]
+      [printer :as puget])
     [vault.blob.core :as blob]
     [vault.data.core :as data]
     [vault.entity.core :as entity]
     [vault.index.core :as index]
     (vault.tool
       [config :as tool-conf])))
+
+
+;; GENERAL CONFIG
+
+(puget.data/extend-tagged-map vault.blob.store.Blob 'vault.repl/blob)
+

 ;; VAULT SYSTEM


Add resize handlers to element options.

Add resize handlers to element options.

--- frontend/uxbox/ui/workspace/options.cljs
+++ frontend/uxbox/ui/workspace/options.cljs
@@ -1,11 +1,15 @@
 (ns uxbox.ui.workspace.options
   (:require [sablono.core :as html :refer-macros [html]]
             [rum.core :as rum]
+            [uxbox.rstore :as rs]
             [uxbox.shapes :as shapes]
+            [uxbox.data.workspace :as dw]
             [uxbox.ui.icons :as i]
             [uxbox.ui.util :as util]
             [uxbox.ui.mixins :as mx]
-            [uxbox.ui.workspace.base :as wb]))
+            [uxbox.ui.dom :as dom]
+            [uxbox.ui.workspace.base :as wb]
+            [uxbox.util.data :refer (parse-int)]))

 (def +menus-map+
   {:builtin/icon [:menu/measures :menu/fill]
@@ -70,41 +74,56 @@

 (defmethod -render-menu :menu/measures
   [menu own shape]
-  (html
-   [:div.element-set {:key (str (:id menu))}
-    [:div.element-set-title (:name menu)]
-    [:div.element-set-content
-     ;; SLIDEBAR FOR ROTATION AND OPACITY
-     [:span "Size"]
-     [:div.row-flex
-      [:input#width.input-text
-       {:placeholder "Width"
-        :type "number"
-        :value (:width shape)
-        :on-change (constantly nil)}]
-      [:div.lock-size i/lock]
-      [:input#width.input-text
-       {:placeholder "Height"
-        :type "number"
-        :value (:height shape)
-        :on-change (constantly nil)}]]
+  (letfn [(on-width-change [event]
+            (let [value (dom/event->value event)
+                  value (parse-int value 0)
+                  sid (:id shape)]
+              (-> (dw/update-shape-size sid {:width value})
+                  (rs/emit!))))
+          (on-height-change [event]
+            (let [value (dom/event->value event)
+                  value (parse-int value 0)
+                  sid (:id shape)]
+              (println value)
+              (-> (dw/update-shape-size sid {:height value})
+                  (rs/emit!))))]
+    (html
+     [:div.element-set {:key (str (:id menu))}
+      [:div.element-set-title (:name menu)]
+      [:div.element-set-content
+       ;; SLIDEBAR FOR ROTATION AND OPACITY
+       [:span "Size"]
+       [:div.row-flex
+        [:input#width.input-text
+         {:placeholder "Width"
+          :type "number"
+          :min "0"
+          :value (:width shape)
+          :on-change on-width-change}]
+        [:div.lock-size i/lock]
+        [:input#width.input-text
+         {:placeholder "Height"
+          :type "number"
+          :min "0"
+          :value (:height shape)
+          :on-change on-height-change}]]

-     [:span "Position"]
-     [:div.row-flex
-      [:input#width.input-text
-       {:placeholder "x"
-        :type "number"
-        :value (:x shape)
-        :on-change (constantly nil)}]
-      [:input#width.input-text
-       {:placeholder "y"
-        :type "number"
-        :value (:x shape)
-        :on-change (constantly nil)}]]
+       [:span "Position"]
+       [:div.row-flex
+        [:input#width.input-text
+         {:placeholder "x"
+          :type "number"
+          :value (:x shape)
+          :on-change (constantly nil)}]
+        [:input#width.input-text
+         {:placeholder "y"
+          :type "number"
+          :value (:x shape)
+          :on-change (constantly nil)}]]

-     [:span "Rotation"]
-     [:div.row-flex
-      [:input.slidebar {:type "range"}]]]]))
+       [:span "Rotation"]
+       [:div.row-flex
+        [:input.slidebar {:type "range"}]]]])))

 (defn element-opts-render
   [own shape]


show where reloading code ends

show where reloading code ends

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

--- plugins/DLLAutoReloader/src/DLLAutoReloader/core.clj
+++ plugins/DLLAutoReloader/src/DLLAutoReloader/core.clj
@@ -128,6 +128,10 @@
    Then load and restart again with the original settings."
   [module & housekeeping]
   `(reload-module-fn ~module (fn [] ~@housekeeping)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Plugin code.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn file-dates
   "Maps each file in path to its last modification date."


use hiccup form-to macro instead of normal vector elements

--- src/greybear/pages/new_game.clj
+++ src/greybear/pages/new_game.clj
@@ -31,12 +31,13 @@
                 [:div.row
                  [:div.col-md-3]
                  [:div.col-md-6
-                  [:form {:method "post" :action "/new-game"}
-                   [:input {:type "hidden" :name "my-id"
-                            :value (get-user-id request)}]
-                   (label "opponent-id" "Invite a player:")
-                   [:input {:type "text" :name "opponent-id"}]
-                   [:button.btn.btn-success "New Game"]]]
+                  (form-to [:post "/new-game"]
+                           [:input {:type "hidden" :name "my-id"
+                                     :value (get-user-id request)}]
+                            (label "opponent-id" "Invite a player:")
+                            [:input {:type "text" :name "opponent-id"}]
+                            [:button.btn.btn-success "New Game"])
+                  ]
                  [:div.col-md-3]]
                 [:div.row
                  (games-partial)])))


fix #1397 - two sent messages instead of one in group chat, only recipient's wallet updated

--- src/status_im/chat/handlers/receive_message.cljs
+++ src/status_im/chat/handlers/receive_message.cljs
@@ -28,13 +28,14 @@
               message-id timestamp clock-value]
        :as   message
        :or   {clock-value 0}}]
-  (let [same-message     (messages/get-by-id message-id)
-        current-identity (get-current-identity db)
-        chat-id'         (or group-id chat-id from)
-        exists?          (chats/exists? chat-id')
-        active?          (chats/is-active? chat-id')
-        local-clock      (messages/get-last-clock-value chat-id')
-        clock-new        (clocks/receive clock-value local-clock)]
+  (let [same-message      (messages/get-by-id message-id)
+        current-identity  (get-current-identity db)
+        chat-id'          (or group-id chat-id from)
+        exists?           (chats/exists? chat-id')
+        active?           (chats/is-active? chat-id')
+        local-clock       (messages/get-last-clock-value chat-id')
+        clock-new         (clocks/receive clock-value local-clock)
+        recipient-pub-key (get-in message [:content :params :bot-db :public :recipient :whisper-identity])]
     (when (and (not same-message)
                (not= from current-identity)
                (or (not exists?) active?))
@@ -55,6 +56,7 @@
           (dispatch [:add-request chat-id' message']))
         (dispatch [:add-unviewed-message chat-id' message-id]))
       (if (and
+            (= recipient-pub-key current-identity)
             (= (:content-type message) content-type-command)
             (not= chat-id' wallet-chat-id)
             (= "send" (get-in message [:content :command])))
@@ -64,10 +66,11 @@
   (let [ct       (if (= content-type c/content-type-command)
                    c/content-type-wallet-command
                    c/content-type-wallet-request)
-        message' (assoc message :clock-value 0
-                                :message-id (random/id)
-                                :chat-id wallet-chat-id
-                                :content-type ct)]
+        message' (-> (assoc message :clock-value 0
+                                    :message-id (random/id)
+                                    :chat-id wallet-chat-id
+                                    :content-type ct)
+                     (dissoc :group-id))]
     (add-message db message')))

 (register-handler :received-protocol-message!


PDOK-1025: add performance-test for replace template

--- src/test/clojure/pdok/featured/geometry_test.clj
+++ src/test/clojure/pdok/featured/geometry_test.clj
@@ -1,6 +1,7 @@
 (ns pdok.featured.geometry-test
    (:require [clojure.java.io :as io]
              [clojure.test :refer :all]
+             [cheshire.core :as json]
              [pdok.featured.geometry :refer :all]))

 (def testMapping {:begin "eerste stap", :eind "tweede stap"})
@@ -54,6 +55,9 @@

 (def example-features (list example-feature-bgt-wegdeel example-feature-bgt-wegdeel another-example-feature-bgt-wegdeel))

+
+(defn example-features [n] (repeat n example-feature-bgt-wegdeel))
+
 (deftest replace-template-with-different-templates-and-mappings
   (is (= resultTemplateMapping (replace-template testTemplate (->MapProxy testMapping))))
   (is (= resultTemplate2Mapping2 (replace-template testTemplate2 (->MapProxy testMapping2))))
@@ -64,16 +68,17 @@
    (println (template-to-pattern (read-template "pdok/featured/templates/bgt-wegdeel.template")))
   )

- (defn geo-test []
+ (defn geo-test [n]
    (replace-features-in-template
      "pdok/featured/templates/bgt-wegdeel.template"
-     example-features))
+     (example-features n)))

-  (deftest replace-bgt geo-test)
-
-
-
-
+  (deftest replace-bgt (geo-test (example-features 4)))
+
+  (defn write-gml-files []
+    (time (with-open [w (clojure.java.io/writer "target/features.gml.json")
+                ]
+       (json/generate-stream {:features (geo-test 100000)} w))))


Tweak tactics to get a little further, but still not quite there.

--- src/ha/z3.clj
+++ src/ha/z3.clj
@@ -145,28 +145,24 @@
                                             (.mkTactic ctx "propagate-values")
                                             (.mkTactic ctx "solve-eqs")
                                             (.mkTactic ctx "tseitin-cnf")
-                                            ;todo: can we set the verbosity argument so we can see which tactics are being applied/failing?
-                                            (.orElse ctx
-                                                     (.mkTactic ctx "smt")
-                                                     (.cond ctx (.mkProbe ctx "is-lia")
-                                                            (.mkTactic ctx "qflia")
-                                                            (.cond ctx (.mkProbe ctx "is-nra")
-                                                                   (.orElse ctx
-                                                                            (.mkTactic ctx "qfnra")
-                                                                            (.mkTactic ctx "qfnra-nlsat"))
-                                                                   (.fail ctx))))]))
+                                            (.cond ctx (.mkProbe ctx "is-lia")
+                                                   (.mkTactic ctx "qflia")
+                                                   (.cond ctx (.mkProbe ctx "is-nra")
+                                                          (.orElse ctx
+                                                                   (.mkTactic ctx "qfnra")
+                                                                   (.mkTactic ctx "qfnra-nlsat"))
+                                                          (.fail ctx)))]))
         s (.mkSolver ctx stacs)
         oparams (.mkParams ctx)
         o nil #_(.mkOptimize ctx)
         z3 (assoc z3 :optimizer o :solver s :last-t nil :prev-last-t nil)
         ret (func z3)]
     (Global/setParameter "pp.decimal" "true")
+    (Global/setParameter "verbose" "9")
     (when s
       (.setParameters s (map->params ctx
-                                     {"smt.arith.nl"        true
-                                      "smt.arith.nl.rounds" 4096
-                                      "smt.mbqi"            true
-                                      })))
+                                     {"smt.arith.nl"        false
+                                      "smt.mbqi"            true})))
     (when o
       (.setParameters o oparams))
     (when (seq? ret)
@@ -1379,8 +1375,17 @@
                           (map (fn [ha]
                                  [(:id ha) (:ha-type ha)])
                                (vals ha-vals))))
+          ;todo: two more things to try before linearizing:
+          ; 1. verbose output to see if something dumb is happening in tactics
+          ; 2. symbolic domain to symx only one time step at a time, removing a lot of nonlinearity at the cost of some precision. shortest path to each symbolic domain refinement can be saved and used as the witness.
+          ;    2a. doing 2. will help with doing backwards symx as well, right?
+          ; 3. lazy linearization using flow constraints and chained ITEs
+
           ;ha-defs (ha/spy "linearize time" (time (desugar/linearize ha-defs)))
           ;z3 (update-ha-defs z3 ha-defs)
+
+          ;todo: translate target edges and states to (disjunction among) linearized edges and states
+
           entry-time (apply max (map :entry-time (vals ha-vals)))
           [ha-vals tr-caches] (heval/init-has ha-defs (vals ha-vals) entry-time)
           config {:objects    ha-vals
@@ -1418,6 +1423,7 @@
                                         (let [moves-per-t (map
                                                             (fn [[tprev [tprevval _mprev]]
                                                                  [tnext [tnextval mnext]]]
+                                                              ;todo: translate witness edges and states back to their original versions
                                                               [[tprev tprevval] [tnext tnextval] mnext])
                                                             (butlast all-steps)
                                                             (rest all-steps))]


add delay to ensure test condition

add delay to ensure test condition

--- test/keypin/store_test.clj
+++ test/keypin/store_test.clj
@@ -24,6 +24,7 @@
   (testing "Fixed store, not initialized"
     (let [fetch-fixed (constantly {:foo 10})
           fixed-store (ks/make-dynamic-store fetch-fixed nil)]
+      (Thread/sleep 100)
       (is (= 10 (get fixed-store :foo)) "recovers waiting to initialize store")
       (try (Thread/sleep 1000) (catch InterruptedException _))
       (is (= 10 (get fixed-store :foo)) "timed out waiting to update stale data")))


Add test for byte order changing.

Add test for byte order changing.

--- test/octet/tests/core.cljc
+++ test/octet/tests/core.cljc
@@ -193,7 +193,7 @@
                  (buf/ubyte)    (short 255)
                  (buf/double)   (double 4.3)
                  (buf/float)    (float 3.2)
-                 (buf/uint64)    18446744073709551615N
+                 (buf/uint64)   18446744073709551615N
                  (buf/byte)     (byte 32)]]
        ;; (buf/bytes 5)  (bytes/random-bytes 5)]]
        (doseq [[spec data] (partition 2 data)]
@@ -218,7 +218,7 @@
                  (buf/bool)     false
                  (buf/double)   (double 4.3)
                  (buf/float)    (float 3.5)
-              (buf/byte)     (byte 32)
+                 (buf/byte)     (byte 32)
                  (buf/bytes 5)  (random-bytes 5)]]
        (doseq [[spec data] (partition 2 data)]
          (let [buffers [(buf/allocate (buf/size spec) {:impl :es6})]]
@@ -263,10 +263,20 @@
   (let [spec (buf/spec buf/int32 buf/int32)
         result (buf/into spec [1 3])]
     (t/is (= (impl/get-capacity result) 8)))
-
   (let [spec (buf/spec buf/string* buf/string*)
         result (buf/into spec ["hello" "world!"])]
     (t/is (= (impl/get-capacity result) 19))))
+
+(t/deftest endianness
+  (let [spec (buf/spec buf/int32 buf/int32)
+        buff (buf/with-byte-order :little-endian
+               (buf/into spec [1 3]))
+        res1 (buf/read buff spec)
+        res2 (buf/with-byte-order :little-endian
+               (buf/read buff spec))]
+    (t/is (= res1 [16777216 50331648]))
+    (t/is (= res2 [1 3]))))
+

 (t/deftest vector-buffer
   (let [spec (buf/spec buf/short buf/int32)


API and protocol tests.

API and protocol tests.

--- test/poky/kv/jdbc_test.clj
+++ test/poky/kv/jdbc_test.clj
@@ -63,6 +63,41 @@
                                         (clear-testing-bucket @S bucket)
                                         ?form
                                         (kv/close @S)))]
-    (facts :integration
-           (kv.jdbc/jdbc-set (kv/connection @S) bucket "key" "value") => (contains {:key "key" :data "value"})
-           (kv.jdbc/jdbc-set (kv/connection @S) bucket "key" "value") => '(1)))
+  (facts :integration :jdbc-set
+         (kv.jdbc/jdbc-set (kv/connection @S) bucket "key" "value") => (contains {:key "key" :data "value"})
+         (kv.jdbc/jdbc-set (kv/connection @S) bucket "key" "value") => '(1))
+
+  (facts :integration :jdbc-get
+         (kv.jdbc/jdbc-get (kv/connection @S) bucket "key") => falsey
+         (kv.jdbc/jdbc-set (kv/connection @S) bucket "key" "value") => (contains {:key "key" :data "value"})
+         (kv.jdbc/jdbc-get (kv/connection @S) bucket "key") => (contains {:key "key" :data "value"}))
+
+  (facts :integration :jdbc-delete
+         (kv.jdbc/jdbc-set (kv/connection @S) bucket "key" "value") => (contains {:key "key" :data "value"})
+         (kv.jdbc/jdbc-delete (kv/connection @S) bucket "key") => '(1)
+         (kv.jdbc/jdbc-delete (kv/connection @S) bucket "key") => '(0)))
+
+
+
+(with-state-changes [(around :facts (do (reset! S (kv.jdbc/create (env :database-url)))
+                                        ; alternatively, use sql/transaction
+                                        ; and rollback. that's possible, but
+                                        ; would require some refactoring of
+                                        ; kv.jdbc to support in nested within
+                                        ; sql/connection.
+                                        (clear-testing-bucket @S bucket)
+                                        ?form
+                                        (kv/close @S)))]
+  (facts :integration :set
+         (kv/set* @S bucket "key" "value") => :inserted
+         (kv/set* @S bucket "key" "value") => :updated)
+
+  (facts :integration :get
+         (kv/get* @S bucket "key") => falsey
+         (kv/set* @S bucket "key" "value") => :inserted
+         (kv/get* @S bucket "key") => (contains {"key" "value"}))
+
+  (facts :integration :delete
+         (kv/set* @S bucket "key" "value") => :inserted
+         (kv/delete* @S bucket "key") => truthy
+         (kv/delete* @S bucket "key") => falsey))


Removed unneeded reagent.

Removed unneeded reagent.

--- src/cljs/wombats_web_client/components/join_button.cljs
+++ src/cljs/wombats_web_client/components/join_button.cljs
@@ -1,8 +1,7 @@
-(ns wombats-web-client.components.join-button
-  (:require [reagent.core :as reagent]))
+(ns wombats-web-client.components.join-button)

 (defn join-button
   [{:keys [is-private on-click]}]
   [:button.join-button {:class (when is-private "private")
                         :on-click on-click}
-   "JOIN"])+   "JOIN"])


Fixed redirect after creating new project

--- src/cljs/mycotrack_reagent/pages/new-project-page.cljs
+++ src/cljs/mycotrack_reagent/pages/new-project-page.cljs
@@ -70,7 +70,7 @@
 (defn save-project [value]
   (fn [] (go (let [response (<! (http/post "/api/projects" {:json-params (:doc @state) :basic-auth {:username "test@mycotrack.com" :password "test"}}))]
     (when (= (:status response) 201 )
-      (go (>! echo-chan "projects")))))))
+      (aset (.-location js/window) "href" "/"))))))

 (defn species-input []
   [:div.form-group


Remove side nav from merge

Remove side nav from merge

--- src-cljs/frontend/components/app.cljs
+++ src-cljs/frontend/components/app.cljs
@@ -162,10 +162,6 @@
                                   (flash/flash-notification {:react-key number} message))})]]

             [:.below-top
-             (when (and (not outer?) logged-in?)
-               [:.left-nav
-                (build-legacy aside/aside-nav (dissoc app-without-container-data :current-build-data))])
-
              [:.main
               (factory props)]]]))))))


remove debugging println

remove debugging println

--- src/lambdacd_artifacts/core.clj
+++ src/lambdacd_artifacts/core.clj
@@ -25,7 +25,6 @@
         build-number  (:build-number ctx)
         step-id       (:step-id ctx)
         output-file   (io/file home-dir (str build-number) (s/join "-" step-id) (first patterns))]
-    (println step-id output-file)
     (io/make-parents output-file)
     (io/copy (io/file working-directory (first patterns)) output-file)
     {:status :success


New versions of HFS: bfs rather than ID-DFS, new-hfs goes back to recursive, adds options to turn off descrs.

--- src/edu/berkeley/ai/angelic/hierarchies/offline_algorithms.clj
+++ src/edu/berkeley/ai/angelic/hierarchies/offline_algorithms.clj
@@ -15,7 +15,7 @@
    (reduce + 0 (map second sols))])

 (defn make-singleton-pq [n]
-  (let [pq (queues/make-stack-pq)]
+  (let [pq (queues/make-queue-pq)]
     (queues/pq-add! pq (assoc n :depth 0) 0)
     pq))

@@ -23,33 +23,34 @@
   ([node]
      (assert (= false (:graph? (:alt node))))
      (assert (= false (:cache? (:alt node))))
-     (hierarchical-forward-search node 0 (make-singleton-pq node) [] [] 0 #{}))
-  ([cur-node d pq rest-nodes-with-blacksets prims rew blackset]
+     (hierarchical-forward-search (make-singleton-pq node) [] [] 0 #{}))
+  ([pq rest-nodes-with-blacksets prims rew blackset]
      (util/timeout)
-     (if (queues/pq-empty? pq)
-         (recur cur-node (inc d) (make-singleton-pq cur-node) rest-nodes-with-blacksets prims rew blackset)
+     (when-not (queues/pq-empty? pq)
        (let [next          (queues/pq-remove-min! pq)
 	     succeeds-opt? (> (search/upper-reward-bound next) Double/NEGATIVE_INFINITY)]
-	 (if (or (not succeeds-opt?) (> (:depth next) d))
-	     (recur cur-node d pq rest-nodes-with-blacksets prims rew blackset)
+;	 (print (queues/pq-size pq) " ")
+;	 	 (println "consider " (map hla-name (search/node-plan next)))
+	 (if (not succeeds-opt?)
+	     (recur pq rest-nodes-with-blacksets prims rew blackset)
 	   (if-let [[acts acts-rew] (search/extract-a-solution next)]
 	       (if (empty? rest-nodes-with-blacksets)
-;		   (do (println "SOL!" prims acts rew acts-rew)
-		       [(concat prims acts) (+ rew acts-rew)];)
+		   [(concat prims acts) (+ rew acts-rew)];)
 		 (let [[[next-node next-blackset] & more-nbs] rest-nodes-with-blacksets]
-		   (recur next-node 0 (make-singleton-pq next-node) more-nbs (concat prims acts) (+ rew acts-rew) next-blackset)))
+		   (recur (make-singleton-pq next-node) more-nbs (concat prims acts) (+ rew acts-rew) next-blackset)))
 	     (let [succeeds-pess? (> (search/lower-reward-bound next) Double/NEGATIVE_INFINITY)
 		   key            (util/safe-get next :plan)] ;; TODO: specific to ALTs)]
 	       (if (and succeeds-pess? (not (contains? blackset key)))
 		   (let [[first-part & rest-parts] (alts/decompose-plan next)]
-		     (recur first-part 0 (make-singleton-pq first-part)
+;		     (println "decompose! " (map hla-name (search/node-plan next)))
+		     (recur (make-singleton-pq first-part)
 			    (concat
 			     (map #(vector % (conj blackset key (util/safe-get % :plan))) rest-parts)
 			     rest-nodes-with-blacksets)
 			    prims rew (conj blackset key (util/safe-get first-part :plan))))
 		 (do (doseq [ref (search/immediate-refinements next)]
 		       (queues/pq-add! pq (assoc ref :depth (inc (:depth next))) 0))
-		     (recur cur-node d pq rest-nodes-with-blacksets prims rew blackset))))))))))
+		     (recur pq rest-nodes-with-blacksets prims rew blackset))))))))))

 (defn plan-max-level [node hla-map]
@@ -58,34 +59,29 @@

 (defn new-hierarchical-forward-search
   "New version of HFS that only commits when an HLA has been refined to a lower level.  This eliminates the
-   need for blacksets, and ensures that progress is made when a commitment happens."
-  ([node hla-map]
+   need for blacksets, and ensures that progress is made when a commitment happens.  Only commits when
+   hla-map is non-nil."
+  ([node prune? hla-map]
      (assert (= false (:graph? (:alt node))))
      (assert (= false (:cache? (:alt node))))
-     (new-hierarchical-forward-search node 0 (make-singleton-pq node) [] [] 0  hla-map))
-  ([cur-node d pq rest-nodes prims rew hla-map]
      (util/timeout)
-     (if (queues/pq-empty? pq)
-         (recur cur-node (inc d) (make-singleton-pq cur-node) rest-nodes prims rew hla-map)
-       (let [next          (queues/pq-remove-min! pq)]
+     (let [pq (make-singleton-pq node)]
+       (loop []
+	 (when-not (queues/pq-empty? pq)
+	   (let [next          (queues/pq-remove-min! pq)]
 ;	 (println "consider " (map hla-name (search/node-plan next)))
-	 (if (or (not (> (search/upper-reward-bound next) Double/NEGATIVE_INFINITY)) (> (:depth next) d))
-	     (recur cur-node d pq rest-nodes prims rew hla-map)
-	   (if-let [[acts acts-rew] (search/extract-a-solution next)]
-  	       (if (empty? rest-nodes)
-		   [(concat prims acts) (+ rew acts-rew)];)
-		 (let [[next-node & more-nodes] rest-nodes]
-		   (recur next-node 0 (make-singleton-pq next-node) more-nodes (concat prims acts) (+ rew acts-rew) hla-map)))
-	     (if (and (< (plan-max-level next hla-map) (plan-max-level cur-node hla-map))
-		      (> (search/lower-reward-bound next) Double/NEGATIVE_INFINITY))
-	         (let [[first-part & rest-parts] (alts/decompose-plan next)]
-;		   (println "commit!" (map hla-name (search/node-plan next)))
-		   (recur first-part 0 (make-singleton-pq first-part)
-			  (concat rest-parts rest-nodes)
-			  prims rew hla-map))
-	       (do (doseq [ref (search/immediate-refinements next)]
-		     (queues/pq-add! pq (assoc ref :depth (inc (:depth next))) 0))
-		   (recur cur-node d pq rest-nodes prims rew hla-map)))))))))
+	     (if (and prune? (not (> (search/upper-reward-bound next) Double/NEGATIVE_INFINITY)))
+	         (recur)
+	       (or (search/extract-a-solution next)
+		   (when (and hla-map (< (plan-max-level next hla-map) (plan-max-level node hla-map))
+			      (> (search/lower-reward-bound next) Double/NEGATIVE_INFINITY))
+		     (println "commit " (map hla-name (search/node-plan next)))
+		     (concat-solutions
+		      (map #(new-hierarchical-forward-search % prune? hla-map)
+			   (alts/decompose-plan next))))
+		   (do (doseq [ref (search/immediate-refinements next)]
+			 (queues/pq-add! pq ref 0))
+		       (recur))))))))))

 ; (let [h (get-hierarchy *warehouse-hierarchy* (constant-predicate-simplify (make-warehouse-strips-env 3 4 [1 2] false {0 '[b a] 2 '[c]} nil ['[a b c]]))) rlm {(first (hla-name (first h))) 11 'act 10 'move-blocks 9 'move-block 8 'move-to 7 'navigate 6 'nav 5}   n (alt-node h {:ref-choice-fn (make-first-maximal-choice-fn rlm) :cache? false :graph? false})]   (time-limit (map :name (first (new-hierarchical-forward-search n rlm))) 30))


Päivitetty Clojess-versio

Päivitetty Clojess-versio

--- mtg-pairings-wer/project.clj
+++ mtg-pairings-wer/project.clj
@@ -4,4 +4,5 @@
   :license {:name "MIT License"
             :url "http://www.opensource.org/licenses/mit-license.php"}
   :dependencies [[org.clojure/clojure "1.5.1"]
-                 [clojess "0.2"]])
+                 [clojess "0.3"]])
+