Test data creator pre-populates an hour of sane-looking readings

--- src/brew_monitor/test_data_creator.clj
+++ src/brew_monitor/test_data_creator.clj
@@ -2,21 +2,36 @@
   (:require [clojurewerkz.elastisch.rest :as es]
             [clojurewerkz.elastisch.rest.document :as esd]
             [clj-time.core :as time]
-            [clj-time.format :as time-f]))
+            [clj-time.format :as time-f]
+            [clj-time.local :as local]
+            [clj-time.periodic :as periodic]
+            [clj-time.coerce :as coerce]))

-(def temps [20.0, 20.1, 20.2, 20.3, 20.5, 20.7, 21.0, 22.0, 21.9, 21.9, 21.8, 19.0, 19.5, 19.8, 19.9])
+(def short-temps [20.0, 20.1, 20.2, 20.3, 20.5, 20.7, 21.0, 22.0, 21.9, 21.9, 21.8, 19.0, 19.5, 19.8, 19.9])

-(def repeated-temps (cycle temps))
+(def hour-temps [20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
+                 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 80, 79, 79, 78, 78, 77, 77, 76, 76,
+                 75, 75, 78, 82, 86, 90, 93, 96, 98, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100])
+
+(defn create-reading [time temp]
+  {:time (coerce/to-long time), :temp temp})
+
+(defn readings-for-last-hour []
+  (let [one-hour-ago (time/minus (local/local-now) (time/hours 1))
+        times (periodic/periodic-seq one-hour-ago (time/minutes 1))]
+    (map create-reading times hour-temps)))
+
+(def repeated-temps (cycle short-temps))

 (defn get-iso-time []
   (time-f/unparse (time-f/formatters :date-time) (time/now)))

-(defn send-temp [temp]
-  (let [conn (es/connect "http://localhost:9200")
-        doc { :time (get-iso-time), :temp temp }]
-    (esd/create conn "temp_gauge" "reading" doc)))
+(defn send-temp [reading]
+  (esd/create (es/connect "http://localhost:9200") "temp_gauge" "reading" reading))

 (defn -main []
+  (doseq [reading (readings-for-last-hour)]
+    (send-temp reading))
   (doseq [temp repeated-temps]
-    (send-temp temp)
+    (send-temp { :time (get-iso-time), :temp temp })
     (Thread/sleep 1000)))


Put attachments first

Put attachments first

Looks like that comment was spot-on and some email clients are showing
the attachment (and not even inline; just a link) instead of
displaying either of the actual email parts.

--- src/clj/runbld/notifications/email.clj
+++ src/clj/runbld/notifications/email.clj
@@ -68,15 +68,17 @@
    plain    :- s/Str
    html     :- (s/maybe s/Str)
    attachments :- [s/Any]]
-  (let [body (concat
-              [:alternative
-               ;; With multipart/alternative, the earlier the part, the lower
-               ;; the priority, so place the plaintext first and the HTML last
-               {:type "text/plain; charset=utf-8"
-                :content plain}
-               {:type "text/html; charset=utf-8"
-                :content html}]
-              attachments)]
+  (let [body
+        ;; With multipart/alternative, the earlier the part, the lower
+        ;; the priority, so place attachments first, plain text next,
+        ;; and the HTML last
+        (concat
+         [:alternative]
+         attachments
+         [{:type "text/plain; charset=utf-8"
+           :content plain}
+          {:type "text/html; charset=utf-8"
+           :content html}])]
     (mail/send-message
      conn
      {:from from


Rewrite item-binder using custom

Rewrite item-binder using custom

--- src/cljs/hacker_agent/hacker-base.cljs
+++ src/cljs/hacker_agent/hacker-base.cljs
@@ -189,10 +189,8 @@
         (.log js/console (clj->js [event key val]))))))

 (defn item-binder [& {:keys [levels]}]
-  (fn [data path msg]
-    (let [[event key val] msg
-          child-path (conj path key)
-          add-change-fn (fn []
+  (let [add-change-fn (fn [data path [event key val]]
+                        (let [child-path (conj path key)]
                           (if (= key :kids)
                             (when (or (> levels 0) (not levels))
                               (swap! data
@@ -204,13 +202,9 @@
                                 (bind! data (conj child-path id)
                                        (id->fbref id)
                                        (item-binder :levels (and levels (dec levels))))))
-                            (swap! data assoc-in child-path val)))]
-      (case event
-        :child_added (add-change-fn)
-        :child_changed (add-change-fn)
-        :child_removed (swap! data update-in path dissoc key)
-        :value nil
-        (.log js/console (clj->js [event key val]))))) )
+                            (swap! data assoc-in child-path val))))]
+    (custom-binder :add-fn add-change-fn
+                   :change-fn add-change-fn)))

 (defn unbind! [data path]
   (close-channel! data path)


refactoring color output

refactoring color output

--- src/control/core.clj
+++ src/control/core.clj
@@ -4,10 +4,19 @@
         [clojure.walk :only [walk]]
 		[clojure.contrib.def :only [defvar- defvar]]))

-(def bash-reset "\033[0m")
-(def bash-bold "\033[1m")
-(def bash-redbold "\033[1;31m")
-(def bash-greenbold "\033[1;32m")
+(def {^private: true} bash-reset "\033[0m")
+(def {^private: true} bash-bold "\033[1m")
+(def {^private: true} bash-redbold "\033[1;31m")
+(def {^private: true} bash-greenbold "\033[1;32m")
+
+(defmacro cli-bash-bold [& content]
+  `(str bash-bold ~@content bash-reset))
+
+(defmacro cli-bash-redbold [& content]
+  `(str bash-redbold ~@content bash-reset))
+
+(defmacro cli-bash-greenbold [& content]
+  `(str bash-greenbold ~@content bash-reset))

 (defvar- *runtime* (Runtime/getRuntime))

@@ -36,7 +45,7 @@
 	(.waitFor process)))
 (defn gen-log
   [host tag content]
-  (str bash-redbold host ":" bash-greenbold tag ": " bash-reset (join " " content)))
+  (str (cli-bash-redbold host ":")  (cli-bash-greenbold tag ": ")  (join " " content)))

 (defn log-with-tag
   [host tag & content]
@@ -127,7 +136,7 @@
 (defn- perform
   [host user cluster task taskName arguments]
   (do
-	(println (str bash-bold "Performing " (name taskName) " for " host bash-reset))
+	(println (cli-bash-bold "Performing " (name taskName) " for " host))
 	(apply task host user cluster arguments)))

 (defn- arg-count [f] (let [m (first (.getDeclaredMethods (class f))) p (.getParameterTypes m)] (alength p)))
@@ -149,7 +158,7 @@
 			   (let [task-arg-count (- (arg-count task) 3)]
 				 (when-exit (not= task-arg-count (count args)) (str "Task " (name taskName) " just needs " task-arg-count " arguments")))
 			   (let [map-fn (if parallel pmap map)]
-				 (println  (str bash-bold "Performing " (name clusterName) bash-reset (if parallel " in parallel")))
+				 (println  (cli-bash-bold "Performing " (name clusterName) (if parallel " in parallel")))
 				 (dorun (pmap #(perform % user cluster task taskName args) addresses))
 				 (dorun (pmap #(perform (:host %) (:user %) cluster task taskName args) clients))
 				 (shutdown-agents)))))


Fix building-prop for gen-action

Fix building-prop for gen-action

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -185,9 +185,13 @@
                    (.split! this max-keys)
                    (if (and (< (alength keys) min-keys) (instance? Node parent))
                      (.rotate-left! this max-keys)
-                     (do
-                       (.update-lower! this (if (nil? children) (aget keys 0) (.-lower (aget children 0))))
-                       (.update-upper! this (if (nil? children) (aget keys (- (alength keys) 1)) (.-upper (aget children (- (alength children) 1)))))))))))
+                     (if (== 0 (alength keys))
+                       (do
+                         (set! lower nil)
+                         (set! upper nil))
+                       (do
+                         (.update-lower! this (if (nil? children) (aget keys 0) (.-lower (aget children 0))))
+                         (.update-upper! this (if (nil? children) (aget keys (- (alength keys) 1)) (.-upper (aget children (- (alength children) 1))))))))))))
   (update-lower! [this new-lower]
                  (when (or (nil? lower) (key-not= lower new-lower))
                    (set! lower new-lower)
@@ -284,7 +288,7 @@
                 (str "(" parent-ix ")" "|" (pr-str lower) " " (pr-str (vec keys)) " " (pr-str upper) "|")))

 (defn tree [min-keys key-len]
-  (let [node (Node. nil nil #js [] #js [] nil (greatest-key key-len) (least-key key-len))
+  (let [node (Node. nil nil #js [] #js [] nil nil nil)
         tree (Tree. (* 2 min-keys) key-len node)]
     (set! (.-parent node) tree)
     (set! (.-parent-ix node) 0)
@@ -622,8 +626,8 @@
   (dc/quick-check 1000 (anti-symmetric-prop 2))
   (dc/quick-check 1000 (total-prop 1))
   (dc/quick-check 1000 (total-prop 2))
-  (dc/quick-check 1000 (building-prop gen-assoc 1))
-  (dc/quick-check 10000 (building-prop gen-action))
+  (dc/quick-check 10000 (building-prop gen-assoc 1))
+  (dc/quick-check 10000 (building-prop gen-action 1))
   ;; cljs.core.pr_str(cemerick.double_check.quick_check(1000, aurora.btree.building_prop(aurora.btree.gen_action)))
   (dc/quick-check 10000 (lookup-prop gen-action))
   (dc/quick-check 10000 iterator-prop)


handled disconnects wrongly

handled disconnects wrongly

--- src/c4_arena/core.clj
+++ src/c4_arena/core.clj
@@ -48,6 +48,7 @@
         turn (atom 0)
         winner (atom nil)
         moves (atom [])
+        disconnect (atom false)
         process-move (fn [move]
                        ;; This function enforces the rules of
                        ;; connect-4. If a move is not valid, returns
@@ -102,7 +103,8 @@
                        :when (not= ch-out ch-out0)]
                  (notify ch-out0 i)
                  (put! ch-out0 {:type "disconnected"})
-                 (initial-loop player0)))
+                 (initial-loop player0))
+               (reset! disconnect true))
              (when (= type "state_request")
                (notify ch-out actor))
              (when-let [reason (cond
@@ -120,7 +122,7 @@
                  (notify observer))
                (dotimes [i 2]
                  (notify (ch-outs i) i))))
-            (if-not @winner
+            (if-not (or @winner @disconnect)
               (recur)
               ;; Cleanup because someone won
               (doseq [{ch-out0 :ch-out :as player0} players]


Added cvt-cond.

Added cvt-cond.

--- src/cbfg/zgo/core.clj
+++ src/cbfg/zgo/core.clj
@@ -80,6 +80,12 @@
    "\n} else {\n"
    (cvt-expr scope else)
    "\n}"])
+
+(defn cvt-cond [scope op test-expr-forms]
+  [(interpose "else"
+              (map (fn [[test expr]]
+                     ["if (" (cvt-expr scope test) ") {\n" (cvt-expr scope expr) "\n}"])
+                   (partition 2 test-expr-forms)))])

 (defn cvt-ago [scope op [self-actx actx body]]
   ["go {" body "}"])
@@ -102,10 +108,11 @@
    "return result })()"])

 (def cvt-special-fns
-  {"ago" cvt-ago
+  {"ago"      cvt-ago
    "ago-loop" cvt-ago-loop
-   "if"  cvt-if
-   "let" cvt-let})
+   "cond" cvt-cond
+   "if"   cvt-if
+   "let"  cvt-let})

 (defn cvt-normal-fn [scope name args]
   [name "(" args ")"])


Declare an actual implementation instance that can be imported

--- src/doctopus/storage/storage_impls.clj
+++ src/doctopus/storage/storage_impls.clj
@@ -1,4 +1,5 @@
-(ns doctopus.storage-impls)
+(ns doctopus.storage-impls
+  (:require [doctopus.storage-impls.temp-fs :as temp-fs-impl]))

 ;; ## Backend Implementations
 ;; A backend implementation needs to expose two functions: one for load, and one
@@ -18,3 +19,7 @@
 ;;  ["/foo" foo-fn]]

 (defrecord BackendImplementation [name load-fn save-fn])
+
+(def temp-fs-backend (BackendImplementation. "temp-fs"
+                                             temp-fs-impl/load-fn
+                                             temp-fs-impl/save-fn))


Switch to using require instead of use

Switch to using require instead of use

--- src/cheshire/core.clj
+++ src/cheshire/core.clj
@@ -1,7 +1,8 @@
 (ns cheshire.core
-  (:use [cheshire.factory]
-        [cheshire.generate :only [generate]]
-        [cheshire.parse :only [parse]])
+  "Main encoding and decoding namespace."
+  (:require [cheshire.factory :as factory]
+            [cheshire.generate :as gen]
+            [cheshire.parse :as parse])
   (:import (com.fasterxml.jackson.core JsonParser JsonFactory
                                        JsonGenerator$Feature)
            (com.fasterxml.jackson.dataformat.smile SmileFactory)
@@ -19,14 +20,15 @@
   ([obj opt-map]
      (let [sw (StringWriter.)
            generator (.createJsonGenerator
-                      ^JsonFactory (or *json-factory* json-factory) sw)]
+                      ^JsonFactory (or factory/*json-factory*
+                                       factory/json-factory) sw)]
        (when (:pretty opt-map)
          (.useDefaultPrettyPrinter generator))
        (when (:escape-non-ascii opt-map)
          (.enable generator JsonGenerator$Feature/ESCAPE_NON_ASCII))
-       (generate generator obj
-                 (or (:date-format opt-map) default-date-format)
-                 (:ex opt-map))
+       (gen/generate generator obj
+                     (or (:date-format opt-map) factory/default-date-format)
+                     (:ex opt-map))
        (.flush generator)
        (.toString sw))))

@@ -40,12 +42,14 @@
      (generate-stream obj writer nil))
   ([obj ^BufferedWriter writer opt-map]
      (let [generator (.createJsonGenerator
-                      ^JsonFactory (or *json-factory* json-factory) writer)]
+                      ^JsonFactory (or factory/*json-factory*
+                                       factory/json-factory) writer)]
        (when (:pretty opt-map)
          (.useDefaultPrettyPrinter generator))
        (when (:escape-non-ascii opt-map)
          (.enable generator JsonGenerator$Feature/ESCAPE_NON_ASCII))
-       (generate generator obj (or (:date-format opt-map) default-date-format)
+       (gen/generate generator obj (or (:date-format opt-map)
+                                       factory/default-date-format)
                  (:ex opt-map))
        (.flush generator)
        writer)))
@@ -60,9 +64,11 @@
   ([obj opt-map]
      (let [baos (ByteArrayOutputStream.)
            generator (.createJsonGenerator ^SmileFactory
-                                           (or *smile-factory* smile-factory)
+                                           (or factory/*smile-factory*
+                                               factory/smile-factory)
                                            baos)]
-       (generate generator obj (or (:date-format opt-map) default-date-format)
+       (gen/generate generator obj (or (:date-format opt-map)
+                                       factory/default-date-format)
                  (:ex opt-map))
        (.flush generator)
        (.toByteArray baos))))
@@ -77,8 +83,9 @@
   and returning the collection to be used for array values."
   [^String string & [key-fn array-coerce-fn]]
   (when string
-    (parse
-     (.createJsonParser ^JsonFactory (or *json-factory* json-factory)
+    (parse/parse
+     (.createJsonParser ^JsonFactory (or factory/*json-factory*
+                                         factory/json-factory)
                         (StringReader. string))
      key-fn nil array-coerce-fn)))

@@ -93,8 +100,9 @@
   If laziness is needed, see parsed-seq."
   [^BufferedReader rdr & [key-fn array-coerce-fn]]
   (when rdr
-    (parse
-     (.createJsonParser ^JsonFactory (or *json-factory* json-factory) rdr)
+    (parse/parse
+     (.createJsonParser ^JsonFactory (or factory/*json-factory*
+                                         factory/json-factory) rdr)
      key-fn nil array-coerce-fn)))

 (defn parse-smile
@@ -106,8 +114,9 @@
   and returning the collection to be used for array values."
   [^bytes bytes & [key-fn array-coerce-fn]]
   (when bytes
-    (parse
-     (.createJsonParser ^SmileFactory (or *smile-factory* smile-factory) bytes)
+    (parse/parse
+     (.createJsonParser ^SmileFactory (or factory/*smile-factory*
+                                          factory/smile-factory) bytes)
      key-fn nil array-coerce-fn)))

 (def ^{:doc "Object used to determine end of lazy parsing attempt."}
@@ -118,7 +127,7 @@
   "Internal lazy-seq parser"
   [^JsonParser parser key-fn array-coerce-fn]
   (lazy-seq
-   (let [elem (parse parser key-fn eof array-coerce-fn)]
+   (let [elem (parse/parse parser key-fn eof array-coerce-fn)]
      (when-not (identical? elem eof)
        (cons elem (parsed-seq* parser key-fn array-coerce-fn))))))

@@ -132,7 +141,8 @@
   [^BufferedReader reader & [key-fn array-coerce-fn]]
   (when reader
     (parsed-seq* (.createJsonParser ^JsonFactory
-                                    (or *json-factory* json-factory) reader)
+                                    (or factory/*json-factory*
+                                        factory/json-factory) reader)
                  key-fn array-coerce-fn)))

 (defn parsed-smile-seq
@@ -144,7 +154,8 @@
   [^BufferedReader reader & [key-fn array-coerce-fn]]
   (when reader
     (parsed-seq* (.createJsonParser ^SmileFactory
-                                    (or *smile-factory* smile-factory) reader)
+                                    (or factory/*smile-factory*
+                                        factory/smile-factory) reader)
                  key-fn array-coerce-fn)))

 ;; aliases for clojure-json users


add register for flags on the current run

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -93,6 +93,17 @@
     (if (= (last r) :all)
       (swap! state assoc-in [side (first r)] 0)
       (deduce state side r))))
+
+;Register a flag for the current run only
+;Example: Blackmail flags the current run as not allowing rezzing of ICE
+(defn register-run-flag! [state flag value]
+  (swap! state assoc-in [:register :current-run flag] value)
+  )
+
+;Clear the current run register
+(defn clear-run-register! [state]
+  (swap! state assoc-in [:register :current-run] nil)
+  )

 (defn register-suppress [state side events card]
   (doseq [e events]
@@ -467,7 +478,8 @@
               (resolve-ability state side end-run-effect (:card run-effect) [(first server)]))))
         (swap! state update-in [:runner :credit] - (get-in @state [:runner :run-credit]))
         (swap! state assoc-in [:runner :run-credit] 0)
-        (swap! state assoc :run nil))))
+        (swap! state assoc :run nil)
+        (clear-run-register! state))))

 (defn add-prop
   ([state side card key n] (add-prop state side card key n nil))


WIP: moving data up to the server

WIP: moving data up to the server

--- src/clj/virt/core.clj
+++ src/clj/virt/core.clj
@@ -8,11 +8,30 @@
             [ring.util.response :as resp]))

-(defn chat-init [ch]
-  (receive-all ch #(println "message: " %)))
+(def app-state
+  (atom {0x001 {:title "Cosm1"
+                :app :chat
+                :channels
+                {0x001 {:title "hi" :node-type :branch :children #{0xAA0 0xAA1 0xAA2}}
+                 0xAA0 {:title "hi1" :node-type :leaf :messages []}
+                 0xAA1 {:title "hi2" :node-type :leaf}
+                 0xAA2 {:title "hi3" :node-type :leaf}
+                 0x002 {:title "howdy" :node-type :branch}
+                 0x003 {:title "how's it goin" :node-type :branch}}}
+         0x002 {:title "Cosm2"
+                :app :chat
+                :channels
+                {0x101 {:title "one" :node-type :branch :children #{0xBA0}}
+                 0xBA0 {:title "another one!" :node-type :branch :children #{0xBA1}}
+                 0xBA1 {:title "another nother one!" :node-type :leaf :messages ["works?" "works."]}}}
+         0x003 {:title "Cosm3"
+                :app :chat
+                :channels {}}}))
+

 (defn chat-handler [ch id]
-  (let [chat (named-channel id chat-init)]
+  (let [chat (named-channel id nil)]
+    (enqueue ch "hi")
     (siphon chat ch)
     (siphon ch chat)))


[#1441] Fix compilation

[#1441] Fix compilation

--- backend/specs/akvo/lumen/specs/import.clj
+++ backend/specs/akvo/lumen/specs/import.clj
@@ -17,7 +17,7 @@
                               (if (sequential? t)
                                 (lumen.s/sample-with-gen (kw->column-spec (first t)) (if (map? (last t))
                                                                                (last t)
-                                                                                {(adapt-spec (last t)) (last t)})  1)
+                                                                                {(adapt-spec (first t)) (last t)})  1)
                                 (lumen.s/sample (kw->column-spec t) 1))) types-gens-tuple)
                        (mapv #(assoc (first %2)
                                      :id (str "c" %)


jquery fx handler improved

jquery fx handler improved

--- src/hell_hound/frontend/fx/jquery.cljs
+++ src/hell_hound/frontend/fx/jquery.cljs
@@ -17,6 +17,7 @@
 (r/reg-fx
  :jquery
  (fn [{:keys [method values selector]}]
-   (let [elem (js/$ (clj->js selector))
-         method (clj->js method)]
-     (.call (aget elem  method) elem values))))
+   (let [elem   (js/$ (clj->js selector))
+         method (clj->js method)
+         args   (concat [elem] values)]
+     (.apply (aget elem method) elem (clj->js values)))))


fixed filename and prefix index exception

--- src/crawler/model.clj
+++ src/crawler/model.clj
@@ -189,15 +189,20 @@
         _ (println remove)

         prefix-match (fn [prefix x]
-                       (let [rx (reverse x)]
-                        (reduce
-                         #(and %1 %2)
-                         (map
-                          (fn [i]
-                            (= (nth prefix i)
-                               (nth rx i)))
-                          (range
-                           (count prefix))))))
+                       (and
+                        x
+                        (<=
+                         (count prefix)
+                         (count x))
+                        (let [rx (reverse x)]
+                          (reduce
+                           #(and %1 %2)
+                           (map
+                            (fn [i]
+                              (= (nth prefix i)
+                                 (nth rx i)))
+                            (range
+                             (count prefix)))))))
         pruned (if-not remove
                  model
                  (filter
@@ -219,8 +224,10 @@
   (let [fixed-model (planned-model a-model-file
                                    a-corpus-file)

-        filename    (first
-                     (clojure.string/split a-model-file #"\."))
+        filename    (clojure.string/join
+                     "."
+                     (drop-last
+                      (clojure.string/split a-model-file #"\.")))

         wrtr (io/writer (str filename ".pruned-model"))]
     (pprint fixed-model wrtr)))


add No More Issues alert box

add No More Issues alert box

--- src/cljs/ninety_nine_issues/views.cljs
+++ src/cljs/ninety_nine_issues/views.cljs
@@ -39,10 +39,19 @@

     [:div.row
      [:div.medium-8.large-8.columns
-      [:div.row
-       [:div.columns
-        [:h3 (:title @issue)]]] ]
+      (if @issue
+        [:div
+         [:div.row
+          [:div.columns
+           [:h3 (:title @issue)]]]]

+        ;; if there are no more issues in the queue for user
+        [:div.row
+         [:div.columns
+          [:div.callout.warning
+           [:p "We've ran out of issues for you. Refresh the page to restart."]]]])]
+
+     ;; Swipe action button for next issue
      [:div.medium-2.large-2.columns.align-middle
       [:span {:on-click #(dispatch [:next-issue])
               ;; TODO put this in CSS


Add bytebuf coersion to ByteBuf and nio ByteBuffer.

--- src/clojure/catacumba/impl/helpers.clj
+++ src/clojure/catacumba/impl/helpers.clj
@@ -33,9 +33,11 @@
            ratpack.exec.Downstream
            ratpack.exec.Blocking
            ratpack.handling.Context
+           java.nio.ByteBuffer
            java.nio.file.Path
            java.nio.file.Paths
            java.util.concurrent.CompletableFuture
+           io.netty.buffer.ByteBuf
            io.netty.buffer.Unpooled))

 ;; --- Java 8 Interop
@@ -139,6 +141,13 @@
   (bytebuffer [_] "Coerce to byte buffer."))

 (extend-protocol IByteBuffer
+  ByteBuf
+  (bytebuffer [s] s)
+
+  ByteBuffer
+  (bytebuffer [s]
+    (Unpooled/wrappedBuffer s))
+
   String
   (bytebuffer [s]
     (Unpooled/wrappedBuffer (.getBytes s "UTF-8"))))


CMR-1296: Add new profile for generating search documentation quickly

--- search-app/project.clj
+++ search-app/project.clj
@@ -33,6 +33,7 @@
          :source-paths ["src" "dev" "test"]
          :injections [(require 'pjstadig.humane-test-output)
                       (pjstadig.humane-test-output/activate!)]}
+   :docs {:dependencies [[markdown-clj "0.9.63"]]}
    :uberjar {:aot :all
              :dependencies [[markdown-clj "0.9.63"]]
              :prep-tasks ["generate-docs"]}}


Update skip api

Update skip api

--- src/airhead_frontend/requests.cljs
+++ src/airhead_frontend/requests.cljs
@@ -29,7 +29,8 @@
         (update-state! :library (get-in response [:body :tracks])))))

 (defn playlist-skip! [id]
-  (http/get "/api/playlist/skip"))
+  (http/delete (str "/api/playlist/"
+                    (-> @app-state :now-playing :uuid))))

 (defn upload! [form]
   (let [progress-chan (chan 1


added auto-parse to read-bq options

added auto-parse to read-bq options

--- src/datasplash/bq.clj
+++ src/datasplash/bq.clj
@@ -28,14 +28,24 @@
         (cond-> (instance? Pipeline p) (PBegin/in))
         (apply-transform ptrans named-schema opts))))

+(defn auto-parse-val
+  [v]
+  (cond
+    (and (string? v) (re-find #"^\d+$" v)) (Long/parseLong v)
+    :else v))
+
 (defn table-row->clj
-  [^TableRow row]
-  (let [keyset (.keySet row)]
-    (persistent!
-     (reduce
-      (fn [acc k]
-        (assoc! acc (keyword k) (.get row k)))
-      (transient {}) keyset))))
+  ([{:keys [auto-parse]} ^TableRow row]
+   (let [keyset (.keySet row)]
+     (persistent!
+      (reduce
+       (fn [acc k]
+         (assoc! acc (keyword k)
+                 (if auto-parse
+                   (auto-parse-val (.get row k))
+                   (.get row k))))
+       (transient {}) keyset))))
+  ([row] (table-row->clj {} row)))

 (defn coerce-by-bq-val
   [v]
@@ -91,7 +101,7 @@
      [pcoll]
      (->> pcoll
           (read-bq-raw safe-opts)
-          (dmap table-row->clj safe-opts)))))
+          (dmap (partial table-row->clj safe-opts) safe-opts)))))

 (defn read-bq
   [options ^Pipeline p]


Added more App Engine service mappings.

Added more App Engine service mappings.

--- src/appengine_magic/core_local.clj
+++ src/appengine_magic/core_local.clj
@@ -28,11 +28,46 @@
 (defn start* [appengine-app & {:keys [port join?]}]
   (let [handler-servlet (servlet (:handler appengine-app))]
     (appengine-init (:war-root appengine-app))
-    (jetty/start {"/" handler-servlet
-                  "/_ah/login" (com.google.appengine.api.users.dev.LocalLoginServlet.)
-                  "/_ah/logout" (com.google.appengine.api.users.dev.LocalLogoutServlet.)}
-                 :port port
-                 :join? join?)))
+    (jetty/start
+     {"/" handler-servlet
+      ;; App Engine services
+      "/_ah/login" (com.google.appengine.api.users.dev.LocalLoginServlet.)
+      "/_ah/logout" (com.google.appengine.api.users.dev.LocalLogoutServlet.)
+      "/_ah/upload/*" (com.google.appengine.api.blobstore.dev.UploadBlobServlet.)
+      "/_ah/img/*" (com.google.appengine.api.images.dev.LocalBlobImageServlet.)
+      "/_ah/channel/jsapi" (com.google.appengine.api.channel.dev.ServeScriptServlet.)
+      "/_ah/channel/dev" (com.google.appengine.api.channel.dev.LocalChannelServlet.)
+      ;; These other mappings are in webdefault.xml in in
+      ;; appengine-local-runtime-*.jar, but they required jars are not packaged
+      ;; in a Maven-friendly manner. They are only available in the SDK's own
+      ;; messy library structure.
+      ;; "/_ah/sessioncleanup" (com.google.apphosting.utils.servlet.SessionCleanupServlet.)
+      ;; "/_ah/admin" (com.google.apphosting.utils.servlet.DatastoreViewerServlet.)
+      ;; "/_ah/admin/" (com.google.apphosting.utils.servlet.DatastoreViewerServlet.)
+      ;; "/_ah/admin/datastore" (com.google.apphosting.utils.servlet.DatastoreViewerServlet.)
+      ;; "/_ah/admin/taskqueue" (com.google.apphosting.utils.servlet.TaskQueueViewerServlet.)
+      ;; "/_ah/admin/xmpp" (com.google.apphosting.utils.servlet.XmppServlet.)
+      ;; "/_ah/admin/inboundmail" (com.google.apphosting.utils.servlet.InboundMailServlet.)
+      ;; "/_ah/resources" (com.google.apphosting.utils.servlet.AdminConsoleResourceServlet.)
+      ;; "/_ah/adminConsole" (org.apache.jsp.ah.adminConsole_jsp.)
+      ;; "/_ah/datastoreViewerHead" (org.apache.jsp.ah.datastoreViewerHead_jsp.)
+      ;; "/_ah/datastoreViewerBody" (org.apache.jsp.ah.datastoreViewerBody_jsp.)
+      ;; "/_ah/datastoreViewerFinal" (org.apache.jsp.ah.datastoreViewerFinal_jsp.)
+      ;; "/_ah/entityDetailsHead" (org.apache.jsp.ah.entityDetailsHead_jsp.)
+      ;; "/_ah/entityDetailsBody" (org.apache.jsp.ah.entityDetailsBody_jsp.)
+      ;; "/_ah/entityDetailsFinal" (org.apache.jsp.ah.entityDetailsFinal_jsp.)
+      ;; "/_ah/taskqueueViewerHead" (org.apache.jsp.ah.taskqueueViewerHead_jsp.)
+      ;; "/_ah/taskqueueViewerBody" (org.apache.jsp.ah.taskqueueViewerBody_jsp.)
+      ;; "/_ah/taskqueueViewerFinal" (org.apache.jsp.ah.taskqueueViewerFinal_jsp.)
+      ;; "/_ah/xmppHead" (org.apache.jsp.ah.xmppHead_jsp.)
+      ;; "/_ah/xmppBody" (org.apache.jsp.ah.xmppBody_jsp.)
+      ;; "/_ah/xmppFinal" (org.apache.jsp.ah.xmppFinal_jsp.)
+      ;; "/_ah/inboundmailHead" (org.apache.jsp.ah.inboundMailHead_jsp.)
+      ;; "/_ah/inboundmailBody" (org.apache.jsp.ah.inboundMailBody_jsp.)
+      ;; "/_ah/inboundmailFinal" (org.apache.jsp.ah.inboundMailFinal_jsp.)
+      }
+     :port port
+     :join? join?)))

 (defn stop* [server]


Add new readLine method that uses UTF-8

Add new readLine method that uses UTF-8

--- src/demogorgon/nh.clj
+++ src/demogorgon/nh.clj
@@ -1,5 +1,5 @@
 (ns demogorgon.nh
-  (:import [java.io File FilenameFilter RandomAccessFile]
+  (:import [java.io File FilenameFilter RandomAccessFile ByteArrayOutputStream]
            [org.apache.log4j Logger]
            [java.nio.file FileSystems StandardWatchEventKind])
   (:require [clj-stacktrace.repl :as stacktrace]
@@ -240,7 +240,7 @@
                         (race (:race data))
                         (role (:role data))
                         (if (= (:death data) "ascended")
-                          " ascended to demigod-good."
+                          " ascended to demigod-hood."
                           (format ", left this world %s on level %s, %s."
                                   (zone (:deathdnum data))
                                   (:deathlev data)
@@ -366,6 +366,22 @@
         (if out
           (announce irc out))))))

+; read a line from a RandomAccessFile, in utf-8
+(defn read-line-ra [ra]
+  (let [buffer (ByteArrayOutputStream.)]
+    (loop [b (.read ra)]
+      (if (= b -1)
+        (if (= (.size buffer) 0)
+          nil
+          (String. (.toByteArray buffer) "UTF-8"))
+        (do
+          (if (= b 0x0a)
+            (String. (.toByteArray buffer) "UTF-8")
+            (do
+              (.write buffer b)
+              (recur (.read ra)))))))))
+
+
 (defn run-watcher [watcher]
   (with-local-vars [files {"livelog"   {:length (.length (File. (str (:un-dir config) "livelog")))
                                         :callback #'handle-livelog-line}
@@ -385,14 +401,14 @@
                (.debug logger (str "file modified: " fn))
                (let [ra (RandomAccessFile. (str (:un-dir config) fn) "r")]
                  (.seek ra (:length file))
-                 (loop [line (.readLine ra)]
+                 (loop [line (read-line-ra ra)]
                    (if line
                      (do
                        ((:callback file) (:irc @watcher) line)
                        (var-set files (assoc (var-get files)
                                         fn
                                         (assoc (get (var-get files) fn) :length (.getFilePointer ra))))
-                       (recur (.readLine ra)))))
+                       (recur (read-line-ra ra)))))
                  (.close ra)))))
          (.reset key))))))


remove unnecessary test

remove unnecessary test

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -271,8 +271,7 @@
        (string? (get-in word [:italiano]))
        (= (get-in word '(:agr :gender)) :fem)
        (= (get-in word '(:agr :number)) :plur)
-       (= (get-in word '(:cat)) :noun)
-       (get-in word [:italiano]))
+       (= (get-in word '(:cat)) :noun))
       (string/replace (get-in word [:italiano])
                       #"[aà]$" "e") ;; donna => donne


display time in correct time zone, also, don't use 24 hour clock

--- src/chat/client/views/helpers.cljs
+++ src/chat/client/views/helpers.cljs
@@ -3,7 +3,7 @@
             [clojure.string :as string]
             [cljs-utils.core :refer [flip]]
             [cljs-time.format :as f]
-            [cljs-time.coerce :as c]))
+            [cljs-time.core :as t]))

 (defn tag->color [tag]
   ; normalized is approximately evenly distributed between 0 and 1
@@ -48,4 +48,4 @@
 (defn format-date
   "Turn a Date object into a nicely formatted string"
   [date]
-  (f/unparse (f/formatter "H:mm A") (c/from-date date)))
+  (f/unparse (f/formatter "H:mm A") (t/to-default-time-zone date)))


define decode

define decode

--- src/synthesis_crawlers/core.clj
+++ src/synthesis_crawlers/core.clj
@@ -1,7 +1,7 @@
 (ns synthesis-crawlers.core
   (:require [clojure.spec :as s]
             [synthesis-crawlers.page :as page]
-            [clojure.string :refer [starts-with? ends-with?]]
+            [clojure.string :refer [starts-with? ends-with? join]]
             [org.httpkit.client :as http]
             [clojure.data :refer [diff]])
   (:import (org.jsoup Jsoup)
@@ -268,12 +268,17 @@
             []
             (into [node] (.parents node)))))

-#_(s/fdef decode-node-path
+(s/fdef decode-node-path
         :args (s/cat :encoded-node
-                     (s/coll-of (s/keys :req [:tag :class :id]))))
+                     (s/coll-of (s/keys :req-un [::tag ::class ::id]))))
 (defn decode-node-path
   [encoded-node]
-  nil)
+  (join " > " (map (fn [{:keys [tag class id]}]
+                     (str tag
+                          (when (seq id) (str "#" id))
+                          (when (seq class)
+                            (str "." (join "." (sort (vec class)))))))
+                   encoded-node)))

 (defn create-relative-path
   ([prefix node]


Fix region parameter of logstash user-data

--- src/terraboot/elasticsearch.clj
+++ src/terraboot/elasticsearch.clj
@@ -53,7 +53,7 @@
                                          units)
                           }}))

-(defn logstash-user-data-coreos [es-endpoint]
+(defn logstash-user-data-coreos [es-endpoint region]
   (let [logstash (docker-systemd-unit "mastodonc" "logstash-ng"
                                       {:options [(str "--env " "ES_HOST=" es-endpoint)
                                                  (str "--env " "REGION=" region)
@@ -179,7 +179,7 @@
                                                                               (vpc-id-of "aws_security_group" "all-servers")
                                                                               (vpc-id-of "aws_security_group" "elb-kibana")
                                                                               ]
-                                                     :user_data (logstash-user-data-coreos es-endpoint)
+                                                     :user_data (logstash-user-data-coreos es-endpoint region)
                                                      :associate_public_ip_address true
                                                      :subnet_id (vpc-id-of "aws_subnet" "public-a")
                                                      :iam_instance_profile (vpc-id-of "aws_iam_instance_profile" "logstash")})


run callbacks on the select-upsert record before extracting uberkey

so that :before-save callbacks which default a column in the
uberkey can work

--- src/er_cassandra/model/alia/upsert.clj
+++ src/er_cassandra/model/alia/upsert.clj
@@ -322,11 +322,23 @@
               (not-empty
                (t/all-maintained-foreign-key-cols entity))]

+        ;; need to run :before-save on the record in case
+        ;; it defaults something in the uberkey
+        record-ser (t/run-save-callbacks
+                    session
+                    entity
+                    :before-save
+                    record
+                    record
+                    opts)
+
         raw-old-record (r/select-one
                         session
                         (get-in entity [:primary-table :name])
                         (get-in entity [:primary-table :key])
-                        (t/extract-uber-key-value entity record))
+                        (t/extract-uber-key-value
+                         entity
+                         record-ser))

         old-record (monad/when raw-old-record
                      (t/run-callbacks


response only by 202 in case of valid event received -> no need for broadcasting info in ec

--- src/clj/swarmpit/event/handler.clj
+++ src/clj/swarmpit/event/handler.clj
@@ -23,10 +23,7 @@
 (defmethod dispatch :event-push [_]
   (fn [{:keys [params]}]
     (if (some? params)
-      (let [event (-> (keywordize-keys params) :Message)
-            event-channels (channel/list event)]
+      (let [event (-> (keywordize-keys params) :Message)]
         (channel/broadcast-memo event)
-        (if (not-empty event-channels)
-          (resp-accepted (str "Broadcasted to " (count event-channels) " clients"))
-          (resp-accepted "No clients subscribed")))
+        (resp-accepted))
       (resp-error 400 "No data sent"))))


so that it stops when there's no more tracks to play

--- src/cljs/apollo/client/player.cljs
+++ src/cljs/apollo/client/player.cljs
@@ -68,7 +68,7 @@
                     ]
                 (om/set-state! owner :ctrl ctrl)
                 (cond
-                  (and (= ctrl :next) (> next-offset (count track-src)))
+                  (and (= ctrl :next) (> next-offset (dec (count track-src))))
                   (ctrl-audio-node :stop)
                   (and (= ctrl :next) (not (nil? next-track)))
                   (set-track next-track next-offset owner)


todos

todos

--- src/cljs/tictactoe/logic/game.cljs
+++ src/cljs/tictactoe/logic/game.cljs
@@ -24,5 +24,10 @@
     game-state))

 (def get-board (comp :board peek))
-(def get-player (comp :player peek))                        ;; TODO - only for tests
-(def game-over? (comp turn/game-over? peek))                ;; TODO - only for tests
+
+
+
+;; ---- TODO - remove (only there for the tests, but could be done better)
+
+(def get-player (comp :player peek))
+(def game-over? (comp turn/game-over? peek))


board simplification

board simplification

--- src/cljs/triboard/logic/board.cljs
+++ src/cljs/triboard/logic/board.cljs
@@ -17,11 +17,8 @@
 (defn pick-n-cells-for-each-player
   "Pick N initial positions for each player and the walls"
   [n positions]
-  (let [elements (conj player/all :wall)]
-    (map vector
-      positions
-      (mapcat #(repeat n %) elements))
-    ))
+  (let [tiles (conj player/all :wall)]
+    (map vector positions (mapcat #(repeat n %) tiles))))

 ;; -----------------------------------------
@@ -58,16 +55,17 @@
 (defn new-board
   "Creates a new board with initial positions of each players"
   []
-  (update-cells empty-board
-    (pick-n-cells-for-each-player cst/init-block-count (shuffle cst/all-positions))))
+  (->>
+    (shuffle cst/all-positions)
+    (pick-n-cells-for-each-player cst/init-block-count)
+    (update-cells empty-board)))

 (def get-cell-at get-in)

 (defn to-iterable
   "Access to the board as a list of coordinates with corresponding owner"
   [board]
-  (for [coord cst/all-positions]
-    [coord (get-cell-at board coord)]))
+  (for [coord cst/all-positions] [coord (get-cell-at board coord)]))

 (defn empty-cells
   "Access to the empty cells of the board as a list of coordinates"


Replace if check documentations for NDArray zerodimensionaccess with 'with-check-ndims 0'

--- src/clojure/gpu/matrix/ndarray.clj
+++ src/clojure/gpu/matrix/ndarray.clj
@@ -359,11 +359,9 @@
 (extend-protocol mp/PZeroDimensionAccess
   NDArray
   (get-0d [^NDArray m]
-    (if (= (mp/dimensionality m) 0)
-      (.get m 0)
-      (error "todo: error message for get-0d")))
+    (with-check-ndims 0 m
+      (.get m 0)))
   (set-0d! [^NDArray m v]
-    (if (= (mp/dimensionality m) 0)
-      (.set m 0 (double v))
-      (error "TODO: Error message for set-od!"))))
-
+    (with-check-ndims 0 m
+      (.set m 0 (double v)))))
+


simplify3d.clj: fixed function local-1-cuts

--- clojure/org/gavrog/clojure/simplify3d.clj
+++ clojure/org/gavrog/clojure/simplify3d.clj
@@ -35,7 +35,7 @@
         orientation (partial-orientation ds)
         pairs (multi-map (for [D (elements ds) :when (pos? (orientation D))]
                            [[(face-rep D) (vert-rep D)] D]))]
-    (filter (fn [xs] (< 1 (count xs))) pairs)))
+    (for [[_ Ds] pairs :when (< 1 (count Ds))] (vec Ds))))

 (defn- pinch-face [ds D E]
   (let [[F G] (map (partial s ds 3) [D E])


simplify3d.clj: working towards 2-cut lifting code

--- clojure/org/gavrog/clojure/simplify3d.clj
+++ clojure/org/gavrog/clojure/simplify3d.clj
@@ -60,7 +60,9 @@
           j (range (inc i) (count faces))
           :let [cut (filter #(and (marked %) (pos? (ori %))) (faces j))]
           :when (<= 2 (count cut))]
-      [f cut])))
+      (apply concat (for [D cut]
+                      [D (first (filter #(and (f %) (pos? (ori %)))
+                                        (orbit-elements ds [1 2] D)))])))))

 (defn- pinch-tile [ds D E]
   (let [[D* E*] (map (partial s ds 0) [D E])
@@ -70,9 +72,10 @@
                                      [F G*] [G F*] [F* G] [G* F]))]
     (make-dsymbol 3 (size ds) ops* (vs ds))))

-(defn- cut-face [ds D E])
+(def ^{:private true} wedge
+  (dsymbol "8:2 4 6 8,3 4 7 8,3 4 7 8,5 6 7 8:2 2,1 1 1 1,2 2"))

-(defn- cut-conditionally [ds D]
-  (if (< 3 (m ds 0 1 D))
-    (cut-face ds (walk ds D 0) (walk ds D 1 0))
-    ds))
+(defn- cut-face [ds D E]
+  (if (#{(walk ds D 1 0) (walk ds D 0 1)} E)
+    ds
+    (let [tmp (append ds wedge)])))


CMR-1700: Changed are2 string slightly

CMR-1700: Changed are2 string slightly

--- system-int-test/test/cmr/system_int_test/bootstrap/virtual_products_test.clj
+++ system-int-test/test/cmr/system_int_test/bootstrap/virtual_products_test.clj
@@ -78,7 +78,7 @@
       nil
       nil

-      "bad provider-id"
+      "invalid provider-id"
       400
       ["No virtual product configuration found for provider [FOO] and entry-title [ASTER L1A Reconstructed Unprocessed Instrument Data V003]"]
       "FOO"


CMR-1699 Updates tests based on PR feedback.

Now creating and deleting more source granules, and running bootstrap
several times to test idempotent operation.

--- system-int-test/test/cmr/system_int_test/bootstrap/virtual_products_test.clj
+++ system-int-test/test/cmr/system_int_test/bootstrap/virtual_products_test.clj
@@ -70,7 +70,7 @@
         source-granules (doall (for [source-coll source-collections
                                      :let [{:keys [provider-id entry-title]} source-coll]
                                      granule-ur (vp-config/sample-source-granule-urs
-                                                  [provider-id entry-title])]
+                                                 [provider-id entry-title])]
                                  (d/ingest provider-id (dg/granule source-coll {:granule-ur granule-ur}))))
         all-expected-granule-urs (concat (mapcat vp/source-granule->virtual-granule-urs source-granules)
                                          (map :granule-ur source-granules))]
@@ -85,8 +85,8 @@

     (testing "Find all granules"
       (assert-matching-granule-urs
-        all-expected-granule-urs
-        (search/find-refs :granule {:page-size 50})))
+       all-expected-granule-urs
+       (search/find-refs :granule {:page-size 50})))

     (testing "Find all granules in virtual collections"
       (doseq [vp-coll vp-colls
@@ -94,30 +94,40 @@
                     source-short-name (get-in source-collection [:product :short-name])
                     vp-short-name (get-in vp-coll [:product :short-name])]]
         (assert-matching-granule-urs
-          (map #(vp-config/generate-granule-ur provider-id source-short-name vp-short-name %)
-               (vp-config/sample-source-granule-urs
-                 [provider-id (:entry-title source-collection)]))
-          (search/find-refs :granule {:entry-title (:entry-title vp-coll)
-                                      :page-size 50}))))))
+         (map #(vp-config/generate-granule-ur provider-id source-short-name vp-short-name %)
+              (vp-config/sample-source-granule-urs
+               [provider-id (:entry-title source-collection)]))
+         (search/find-refs :granule {:entry-title (:entry-title vp-coll)
+                                     :page-size 50}))))))

 ;; Verify that latest revision ids of virtual granules and the corresponding source granules
 ;; are in sync as various ingest operations are performed on the source granules
 (deftest deleted-virtual-granules
-  (let [ast-coll      (d/ingest "LPDAAC_ECS"
-                                (dc/collection
-                                 {:entry-title "ASTER L1A Reconstructed Unprocessed Instrument Data V003"}))
-        vp-colls      (vp/ingest-virtual-collections [ast-coll])
-        granule       (dg/granule ast-coll {:granule-ur "SC:AST_L1A.003:2006227720" :revision-id 5})
-        ingest-result (d/ingest "LPDAAC_ECS" granule)]
-    (bootstrap-and-index)
-    (let [v-granules (mapcat #(:refs
-                               (search/find-refs :granule
-                                                 {:entry-title (:entry-title %)
-                                                  :page-size 50}))
-                             vp-colls)]
-      (is (not (empty? v-granules)))
-      (ingest/delete-concept (d/item->concept ingest-result) {:revision-id 12})
+  (let [ast-coll   (d/ingest "LPDAAC_ECS"
+                             (dc/collection
+                              {:entry-title "ASTER L1A Reconstructed Unprocessed Instrument Data V003"}))
+        vp-colls   (vp/ingest-virtual-collections [ast-coll])
+        s-granules (doall
+                    (for [n (range 10)]
+                      (d/ingest "LPDAAC_ECS"
+                                (dg/granule ast-coll {:granule-ur (format "SC:AST_L1A.003:%d" n)
+                                                      :revision-id 5}))))
+        _          (bootstrap-and-index)
+        v-granules (mapcat #(:refs
+                             (search/find-refs :granule
+                                               {:entry-title (:entry-title %)
+                                                :page-size 50}))
+                           vp-colls)
+        verify     (fn []
+                     (doseq [gran v-granules]
+                       (is (:deleted (ingest/get-concept (:id gran) 12)))))]
+
+    (testing "after deleting source granules"
+      (doseq [granule s-granules]
+        (ingest/delete-concept (d/item->concept granule) {:revision-id 12}))
       (bootstrap-and-index)
-      (doseq [gran v-granules]
-        (println "Virtual granule:" (ingest/get-concept (:id gran) 12))
-        (is (:deleted (ingest/get-concept (:id gran) 12)))))))
+      (verify))
+
+    (testing "bootstrapping should be idempotent"
+      (bootstrap-and-index)
+      (verify))))


(SERVER-1196) Add time out to the class-info-cache-flush test

This commit adds a timeout to the initial wait that the
`class-info-updated-after-cache-flush-during-prior-request` does to see
that the getClassInfoForEnvironment method in a JRubyPuppet instance has
been invoked.  The current code waits indefinitely for that action,
which may never happen in the case that some higher-level failure has
occurred, e.g., the client fails to connect to the server, in which case
the test could hang.

--- test/integration/puppetlabs/services/master/environment_classes_int_test.clj
+++ test/integration/puppetlabs/services/master/environment_classes_int_test.clj
@@ -682,7 +682,9 @@
              _ (reset! wait-atom {:continue-promise continue-promise
                                   :wait-promise wait-promise})
              initial-response-future (future (get-env-classes "production"))]
-         @wait-promise
+         (is (true? (deref wait-promise 10000 :timed-out))
+             (str "timed out waiting for get class info call to be reached "
+                  "in mock jrubypuppet instance"))
          (reset! class-info-atom [{"name" "updatedclass"
                                    "params" []}])
          (purge-env-cache "production")


Fixed typo.

Fixed typo.

--- src/hxgm30/event/components/pubsub.clj
+++ src/hxgm30/event/components/pubsub.clj
@@ -153,7 +153,7 @@
   (log/debug "Started pub-sub component.")
   (let [dataflow (pubsub/create-dataflow-pubsub
                   (config/event-system-type this))
-        world (pubsub/create-dataflow-pubsub
+        world (pubsub/create-world-pubsub
                (config/event-system-type this))
         component (assoc this :dataflow dataflow
                               :world world)]


updating figwheel dep

updating figwheel dep

--- src/leiningen/new/devcards/project.clj
+++ src/leiningen/new/devcards/project.clj
@@ -12,7 +12,7 @@
                  #_[reagent "0.5.1"]]

   :plugins [[lein-cljsbuild "1.1.1"]
-            [lein-figwheel "0.5.0"]]
+            [lein-figwheel "0.5.0-1"]]

   :clean-targets ^{:protect false} ["resources/public/js/compiled"
                                     "target"]


A little more clarification

A little more clarification

--- src/io/aviso/rook.clj
+++ src/io/aviso/rook.clj
@@ -80,7 +80,7 @@
   "Returns paths for <namespace> using DEFAULT_MAPPINGS and by scanning for functions :path-spec metadata.
    Each path returned is a tuple of [path-spec function-key] where:
      path-spec is a tuple of [method path]
-     function-key is a a keyword with the same name as a function in <namespace>"
+     function-key is a keyword derived from the simple name of the function with the namespace"
   [namespace]
   (when-not (find-ns namespace)
     (require namespace))
@@ -154,6 +154,8 @@
   (l/debugf "Scanning %s for mappable functions" namespace)
   (->> (get-available-paths namespace)
        (map (fn [[[request-method path] fun]]
+              ;; It would be nice if there was a way to qualify the path for when we are nested
+              ;; inside a Compojure context, but we'd need the request to do that.
               (l/debugf "Mapping %s `%s' to %s" (-> request-method name .toUpperCase) path fun)
               [[request-method (clout/route-compile path)] fun]))
        (remove nil?)
@@ -184,7 +186,7 @@
   middleware filters will typically sit between identifying the function and actually invoking it."
   [handler namespace]
   (let [compiled-paths (get-compiled-paths namespace)]
-    (fn namespace-service-identifier [request]
+    (fn [request]
       (if-let [rook-data (identify-rook-data request namespace compiled-paths)]
         (handler (merge request rook-data))
         (handler request)))))


set heartbeat to 10 seconds

set heartbeat to 10 seconds

--- src/jepsen/voltdb.clj
+++ src/jepsen/voltdb.clj
@@ -74,7 +74,7 @@
        ; isolated nodes with requests *before* they kill themselves
        ; but low enough that a new majority is elected and performs
        ; some operations.
-       [:heartbeat {:timeout 4}] ; seconds
+       [:heartbeat {:timeout 10}] ; seconds
        [:commandlog {:enabled true, :synchronous true, :logsize 128}
         [:frequency {:time 2}]]]))) ; milliseconds


Fix extension

Fix extension

--- src/grimoire/api.clj
+++ src/grimoire/api.clj
@@ -118,7 +118,7 @@
         handle    (thing->handle config :else namespace)]
     (for [d     (.listFiles handle)
           :when (.isFile d)]
-      (->T :def namespace (string/replace (.getName d) #".clj" "")))))
+      (->T :def namespace (string/replace (.getName d) #".edn" "")))))

 (declare read-meta)


working on keep-word?

working on keep-word?

--- src/hangman/core.clj
+++ src/hangman/core.clj
@@ -28,15 +28,46 @@
   "cat" "car" "can" "cob" "con" "cop" "cup"
   "work" "love" "hate" "jobs" "able" "ball" ] )

-(defn guess-matches?
-  "Returns true if a guess matches the target word (a string). The guess value is a vector
-  of the same length with elements that are either a character or nil, where nil indicates
-  a wildcard that matches any character in the target word."
-  [word guess]
-  { :pre  [ (= (count word) (count guess))
+(defn format-clue
+  "Format the clue vector into a nice-looking string."
+  [clue]
+  (str/join
+    (map  #(if (nil? %) "-" % )  clue) ))
+
+(defn make-clue
+  "Generate a clue given the target word and a vec of guessed letters. The clue is a
+  vector the length of the target word consisting of either letters (for correctly guessed
+  letters) or nil (for incorrect guesses)."
+  [tgt-word guessed-chars]
+  (vec (for [ letter tgt-word ] (guessed-chars letter)) ))
+
+(defn complement-char-class
+  "Generate the regex for the complement of a set of characters."
+  [not-chars]
+  (if (< 0 (count not-chars))
+    (str "[^" (str/join not-chars) "]" )  ;normal case
+    "."    ; degenerate case of no chars guessed yet - anything matches
+  ))
+
+(defn clue-to-regex
+  "Convert a clue string and set of guessed chars into a regex for filtering possible
+  matching words."
+  [clue-str guessed-chars]
+  (let [not-guessed-class   (complement-char-class guessed-chars)
+        patt-str   (str/join
+                     (for [clue-ch clue-str]
+                       (if (= clue-ch \-) not-guessed-class clue-ch) ))
+    ] patt-str ))
+
+(defn keep-word?
+  "Returns true if a clue matches the target word (a string). The clue value is a seq the
+  same length as the test word with elements that are either a character or nil, where nil
+  indicates a wildcard that matches any character in the target word."
+  [word clue guessed-chars]
+  { :pre  [ (= (count word) (count clue))
             (not-any? nil? word) ]
     :post [] }
-  (let [ pair-seq   (map vector guess word)  ; a sequence of pairs
+  (let [ pair-seq   (map vector clue word)  ; a sequence of pairs
          result     (every? #(or (=    (first %) (second %))
                                  (nil? (first %)) )
                       pair-seq) ]
@@ -86,37 +117,6 @@
         char-bits     (zipmap avail-chars (map #(calc-info-bits words %) avail-chars) )
         best-char     (apply max-key char-bits avail-chars) ]
     best-char ) )
-
-(defn make-clue
-  "Generate a clue given the target word and a vec of guessed letters. The clue is a
-  vector the length of the target word consisting of either letters (for correctly guessed
-  letters) or nil (for incorrect guesses)."
-  [tgt-word guessed-chars]
-  (vec (for [ letter tgt-word ] (guessed-chars letter)) ))
-
-(defn complement-char-class
-  "Generate the regex for the complement of a set of characters."
-  [not-chars]
-  (if (< 0 (count not-chars))
-    (str "[^" (str/join not-chars) "]" )  ;normal case
-    "."    ; degenerate case of no chars guessed yet - anything matches
-  ))
-
-(defn clue-to-regex
-  "Convert a clue string and set of guessed chars into a regex for filtering possible
-  matching words."
-  [clue-str guessed-chars]
-  (let [not-guessed-class   (complement-char-class guessed-chars)
-        patt-str   (str/join
-                     (for [clue-ch clue-str]
-                       (if (= clue-ch \-) not-guessed-class clue-ch) ))
-    ] patt-str ))
-
-(defn format-clue
-  "Format the clue vector into a nice-looking string."
-  [clue]
-  (str/join
-    (map  #(if (nil? %) "-" % )  clue) ))

 (defn do-tests []

@@ -141,19 +141,21 @@
     (assert      (re-find (re-pattern patt-str) "xbcd" ))
     (assert (not (re-find (re-pattern patt-str) "xxcd" )))
     (assert (not (re-find (re-pattern patt-str) "xxxd" )))
+
+    ; Test if keep word
+    (assert      (keep-word? "abcd" "abcd"             #{}            )  )
+    (assert      (keep-word? "abcd" [\a  nil nil nil]  #{}            )  )
+    (assert      (keep-word? "abcd" [\a  \b  nil nil]  #{}            )  )
+    (assert      (keep-word? "abcd" [nil nil nil nil]  #{}            )  )
+    (assert      (keep-word? "abcd" [\a  \b  nil nil]   guessed-chars )  )
+    (assert (not (keep-word? "abcd" [\a  nil nil nil]   guessed-chars ) ))
+
   )
-
-  ; Match guesses
-  (assert (guess-matches? "abcd" "abcd") )
-  (assert (guess-matches? "abcd" [\a \b \c \d]) )
-  (assert (guess-matches? "abcd" [nil nil nil nil]) )
-  (assert (guess-matches? "abcd" [\a nil nil nil]) )
-
   (let [tst-words       [ "abcd" "xbcd" "xxcd" "xxxd" ]
         words-map       (group-by count tst-words)
         word-list       (words-map 4)
         clue            [ nil \b  nil nil ]
-        keep-words      (filter #(guess-matches? % clue ) word-list)
+        keep-words      (filter #(keep-word? % clue #{} ) word-list)
   ]
     (assert (= words-map   {4 ["abcd" "xbcd" "xxcd" "xxxd"]} ))
     (assert (= word-list      ["abcd" "xbcd" "xxcd" "xxxd"]  ))
@@ -178,7 +180,7 @@
             ]
         (println )
         (let [
-          keep-words      (filter #(guess-matches? % clue) word-list) ]
+          keep-words      (filter #(keep-word? % clue #{} ) word-list) ]
             (print "clue: " (format-clue clue) "  ")
             (show-info "keep-words" keep-words)
             (if (= 1 (count keep-words))


Add newline back in

Add newline back in

--- src/net/sekao/nightcode/controller.clj
+++ src/net/sekao/nightcode/controller.clj
@@ -285,7 +285,7 @@
 (defn reload! [^Scene scene]
   (when-let [webview (.lookup scene "#webview")]
     (let [text (.executeScript (.getEngine webview) "getTextContent()")
-          text (str "(do" \newline text \newline ")")
+          text (str "(do" \newline text \newline ")" \newline)
           builder-webview (b/get-builder-webview @pref-state @runtime-state)
           builder-bridge (-> (.getEngine builder-webview) (.executeScript "window") (.getMember "java"))]
       (.onenter builder-bridge text))))


Distribute query to ensure normalisation

--- src/om_chat/core.cljs
+++ src/om_chat/core.cljs
@@ -7,6 +7,7 @@
             [cljs-time.coerce :as dt2]))

 (enable-console-print!)
+
 (def raw-data [
                {
                 :id "m_1"
@@ -93,10 +94,29 @@
       ))
   )

+(defui MessageSection
+  static om/Ident
+  (ident [this {:keys [message/id]}]
+         [:messages/by-id id])
+  static om/IQuery
+  (query [this]
+         [:message/id :message/author-name :message/date :message/text])
+  Object
+  (render [this]
+          (dom/div #js{:className "message-section"}
+                   "Message section...")))
+
+(def message-section (om/factory MessageSection))
+
 (defui ThreadSection
   static om/Ident
   (ident [this {:keys [thread/id]}]
          [:threads/by-id id])
+  static om/IQuery
+  (query [this]
+         [:thread/id :thread/name :thread/read :thread/selected
+                     {:thread/last-message [:message/date :message/text]}
+                     {:thread/messages (om/get-query MessageSection)}])
   Object
   (render [this]
           (dom/div #js{:className "thread-section"}
@@ -105,38 +125,26 @@

 (def thread-section (om/factory ThreadSection))

-(defui MessageSection
-  static om/Ident
-  (ident [this {:keys [message/id]}]
-         [:messages/by-id id])
-  Object
-  (render [this]
-          (dom/div #js{:className "message-section"}
-                   "Message section...")))
-
-(def message-section (om/factory MessageSection))
-
-
 (defui ChatApp
   static om/IQuery
   (query [this]
-         [{:threads [:thread/id :thread/name :thread/read :thread/selected
-                     {:thread/last-message [:message/date :message/text]}
-                     {:thread/messages [:message/id :message/author-name :message/date :message/text]}]}])
+         [{:threads (om/get-query ThreadSection)}])
   Object
   (render [this]
           (let [{:keys [threads]} (om/props this)]
             (dom/div #js{:className "chatapp"}
-                     (thread-section)
-                     (message-section)))))
+                     (thread-section threads)
+                     (message-section (last threads))))))

 (defmulti read om/dispatch)
+
 (defmethod read :default
   [{:keys [state] :as env} k _]
   (let [st @state]
     (if (contains? st k)
       {:value (get st k)}
       {:remote true})))
+

 (def reconciler
   (om/reconciler {:state {:threads (reduce threads [] raw-data)}


Allow create event without participants.

--- src/ombs/validate.clj
+++ src/ombs/validate.clj
@@ -43,7 +43,6 @@
   (create-rule :event [ (vld/greater-than? price 0)             (get-in errors [:event :zero-price]) ])
   (create-rule :event [ (vld/has-value? date)                   (get-in errors [:event :empty-date]) ])
   (create-rule :event [ (empty? (db/get-event eventname date))  (get-in errors [:event :duplicate-event]) ])
-  (create-rule :event [ (not (nil? users))                      (get-in errors [:event :no-participants]) ])
   (not (vld/errors? :event)))

 (defn new-user? [username pass1 pass2]


Fixing up corner cases and error messages.

--- src/onyx/static/helpful_job_errors.clj
+++ src/onyx/static/helpful_job_errors.clj
@@ -14,21 +14,22 @@
    :windows :window-entry
    :triggers :trigger-entry})

+(def vec-of-maps-depth
+  {1 1
+   2 2
+   3 2
+   4 3})
+
 (def contextual-depth
   {:workflow
    {1 1
     2 1
     3 1}
-   :catalog
-   {1 1
-    2 2
-    3 2
-    4 3}
-   :windows
-   {1 1
-    2 2
-    3 2
-    4 3}})
+   :catalog vec-of-maps-depth
+   :lifecycles vec-of-maps-depth
+   :flow-conditions vec-of-maps-depth
+   :windows vec-of-maps-depth
+   :triggers vec-of-maps-depth})

 (def semantic-error-msgs
   {:min-peers-gt-max-peers
@@ -84,22 +85,22 @@
     ([k v] (= k (:error-key error-data)))
     ([x] (= x (:error-value error-data)))))

+(defn print-multi-line-error [[msg & more :as all] left]
+  (when (seq all)
+    (println (a/magenta (str (pad (+ left)) "^-- " msg)))
+    (doseq [m more]
+      (println (a/magenta (str (pad (+ left)) "    " m))))))
+
 (defn display-err-map-or-val
   ([msgs] (display-err-map-or-val msgs 0))
-  ([[msg & more :as all] extra]
+  ([all extra]
    (fn
      ([left k v]
       (println (str (pad left) (a/bold-red (str (pr-str k) " " (pr-str v)))))
-      (when (seq all)
-        (println (a/magenta (str (pad (+ left extra)) "^-- " msg)))
-        (doseq [m more]
-          (println (a/magenta (str (pad (+ left extra)) "    " m))))))
+      (print-multi-line-error all left))
      ([left x]
       (println (str (pad left) (a/bold-red (str (pr-str x)))))
-      (when (seq all)
-        (println (a/magenta (str (pad (+ left extra)) "^-- " msg)))
-        (doseq [m more]
-          (println (a/magenta (str (pad (+ left extra)) "    " m)))))))))
+      (print-multi-line-error all left)))))

 (defn matches-faulty-key? [k v elements faulty-key]
   (some #{k v} #{faulty-key}))
@@ -137,18 +138,19 @@
     (str (apply str result) raw)))

 (defn closest-match [choices faulty-key]
-  (let [faulty-str (name faulty-key)
-        distances
-        (map
-         (fn [k]
-           [k (levenshtein faulty-str (name k))])
-         choices)]
-    (when (seq distances)
-      (let [candidate (apply min-key second distances)]
-        ;; Don't guess wildly. Make sure it's at least
-        ;; a guess within reason.
-        (when (<= (second candidate) 5)
-          (first candidate))))))
+  (when (keyword? faulty-key)
+    (let [faulty-str (name faulty-key)
+          distances
+          (map
+           (fn [k]
+             [k (levenshtein faulty-str (name k))])
+           choices)]
+      (when (seq distances)
+        (let [candidate (apply min-key second distances)]
+          ;; Don't guess wildly. Make sure it's at least
+          ;; a guess within reason.
+          (when (<= (second candidate) 5)
+            (first candidate)))))))

 (defn show-header [structure-type faulty-key]
   (println "------ Onyx Job Error -----")
@@ -349,11 +351,10 @@
     (:predicate error-data)))

 (defn type-error-msg [err-val found-class req-class]
-  [(str (pr-str err-val) " isn't of the expected type.")
-   (str "Found " (.getName found-class) ", requires " (.getName req-class))])
+  [(str "of type " (.getName found-class) " (found " (.getName req-class) ")")])

 (defn restricted-value-error-msg [err-val]
-  [(a/magenta (str "^-- Task name " (pr-str err-val) " is reserved by Onyx and cannot be used."))])
+  [(str "Task name " (pr-str err-val) " is reserved by Onyx and cannot be used.")])

 (defn chain-phrases [phrases]
   (case (count phrases)
@@ -370,19 +371,19 @@
         (restricted-value-error-msg error-value)

         :else
-        [(str "^-- Task " (pr-str error-value) " is invalid.")]))
+        [(str "Task " (pr-str error-value) " is invalid.")]))

 (defmethod predicate-error-msg 'keyword?
-  [entry error-data] "a keyword")
+  [entry error-data] ["a keyword"])

 (defmethod predicate-error-msg 'keyword-namespaced?
-  [entry error-data] "a namespaced keyword")
+  [entry error-data] ["a namespaced keyword"])

 (defmethod predicate-error-msg 'integer?
-  [entry error-data] "an integer")
+  [entry error-data] ["an integer"])

 (defmethod predicate-error-msg 'anything?
-  [entry error-data] "any value")
+  [entry error-data] ["any value"])

 (defmethod predicate-error-msg 'edge-two-nodes?
   [entry {:keys [error-value]}]
@@ -410,15 +411,15 @@

 (defmethod predicate-error-msg 'pos?
   [entry error-data]
-  [(str " ^-- " (last (:path error-data)) " must be positive.")])
+  [(str (last (:path error-data)) " must be positive.")])

 (defmethod predicate-error-msg 'deprecated-key?
   [entry error-data]
-  [(str " ^-- " (last (:path error-data)) " has been deprecated and removed from the Onyx API.")])
+  [(str (last (:path error-data)) " has been deprecated and removed from the Onyx API.")])

 (defmethod predicate-error-msg 'range-defined-for-fixed-and-sliding?
   [entry error-data]
-  [(str " ^-- " (semantic-error-msgs :sliding-window-needs-range-and-slide))])
+  [(str (semantic-error-msgs :sliding-window-needs-range-and-slide))])

 (defn missing-required-key* [job context error-data structure-type]
   (let [faulty-key (:missing-key error-data)
@@ -446,7 +447,7 @@
         context (get-in job (take n-deep (:path error-data)))
         entry (get-in model [(structure-names structure-type) :model faulty-key])
         match-f (match-map-or-val error-data)
-        msgs (type-error-msg faulty-val found-type expected-type)
+        msgs [(join " " (into ["Value must be"] (type-error-msg faulty-val found-type expected-type)))]
         error-f (display-err-map-or-val msgs)]
     (show-header structure-type faulty-key)
     (show-value context (- path-len n-deep) match-f error-f)
@@ -456,12 +457,13 @@
 (defn value-predicate-error* [job error-data structure-type]
   (let [faulty-key (last (:path error-data))
         faulty-val (:error-value error-data)
+        error-data (assoc error-data :error-key faulty-key)
         path-len (count (:path error-data))
         n-deep (get-in contextual-depth [structure-type path-len])
         context (get-in job (take n-deep (:path error-data)))
         entry (get-in model [(structure-names structure-type) :model faulty-key])
         match-f (match-map-or-val error-data)
-        error-f (display-err-map-or-val (predicate-error-msg context error-data))]
+        error-f (display-err-map-or-val [(join " " (into ["Value must be"] (predicate-error-msg context error-data)))])]
     (show-header (first (:path error-data)) faulty-key)
     (show-value context (- path-len n-deep) match-f error-f)
     (show-docs entry faulty-key)
@@ -498,16 +500,19 @@
     (show-footer)))

 (defn map-conditional-failed*
-  [job error-data structure-type faulty-key context pred]
-  (let [entry (get-in model [(structure-names structure-type) :model faulty-key])
-        msg (predicate-error-msg context (assoc error-data :predicate pred))
-        error-f
-        (fn [k v]
-          (println "  " (a/bold-red (str (pr-str k) " " (pr-str v))))
-          (doseq [m msg]
-            (println (str "   " (a/magenta m)))))]
-    (show-header structure-type faulty-key)
-    (show-map context faulty-key matches-map-key? error-f)
+  [job error-data structure-type faulty-key pred]
+  (let [err-key (relevant-key pred)
+        error-data (assoc error-data :error-key err-key)
+        error-data (assoc error-data :error-value (get-in job (conj (:path error-data) err-key)))
+        path-len (count (:path error-data))
+        n-deep (get-in contextual-depth [structure-type path-len])
+        context (get-in job (take n-deep (:path error-data)))
+        entry (get-in model [(structure-names structure-type) :model faulty-key])
+        msgs (predicate-error-msg context (assoc error-data :predicate pred))
+        match-f (match-map-or-val error-data)
+        error-f (display-err-map-or-val msgs)]
+    (show-header structure-type faulty-key)
+    (show-value context (inc (- path-len n-deep)) match-f error-f)
     (show-docs entry faulty-key)
     (show-footer)))

@@ -516,19 +521,21 @@
    (chain-predicates job error-data preds []))
   ([job error-data preds result]
    (cond (not (seq preds))
-         (first (into #{} result))
-
+         (reduce into #{} result)
+
+         (set? (first preds))
+         (chain-predicates
+          job error-data (rest preds)
+          (conj result [(first preds)]))
+
          (coll? (first preds))
          (chain-predicates
-          job
-          error-data
-          (rest preds)
+          job error-data (rest preds)
           (conj result (chain-predicates job error-data (first preds) [])))
+
          :else
          (chain-predicates
-          job
-          error-data
-          (rest preds)
+          job error-data (rest preds)
           (conj result
                 (predicate-error-msg (get-in job (butlast (:path error-data)))
                                      (assoc error-data :predicate (first preds))))))))
@@ -559,7 +566,7 @@
         pred (first (:predicates error-data))
         faulty-key (relevant-key pred)]
     (cond (and (map? context) (context faulty-key))
-          (map-conditional-failed* job error-data structure-type faulty-key context pred)
+          (map-conditional-failed* job error-data structure-type faulty-key pred)

           (map? context)
           (missing-required-key* job
@@ -632,7 +639,7 @@
         (fn [k v]
           (println "  " (a/bold-red (str (pr-str k) " " (pr-str v))))
           (when (= k faulty-key)
-            (println (a/magenta (str "    ^-- " (semantic-error-msgs (:semantic-error error-data)))))))]
+            (print-multi-line-error (semantic-error-msgs (:semantic-error error-data)) 4)))]
     (show-header structure-type faulty-key)
     (show-map context faulty-key match-f error-f)
     (show-docs entry faulty-key)


No need for restartable? now using lifecycles

--- src/onyx_peers/functions/functions.clj
+++ src/onyx_peers/functions/functions.clj
@@ -3,6 +3,3 @@

 (defn add-job-num [job-num segment]
   (assoc segment :job-num job-num))
-
-(defn restartable? [e]
-  true)


Remove unit constraint on division.

Remove unit constraint on division.

--- src/kixi/hecuba/data/calculate.clj
+++ src/kixi/hecuba/data/calculate.clj
@@ -397,9 +397,8 @@
                   (= unit   (:unit %))) sensors)))

 (defmethod should-calculate? :divide [ds sensors]
-  (let [{:keys [period unit]} (first sensors)]
-    (every? #(and (= period (:period %))
-                  (= unit (:unit %))) sensors)))
+  (let [{:keys [period]} (first sensors)]
+    (every? #(= period (:period %)) sensors)))

 (defmethod should-calculate? :subtract [ds sensors]
   (let [{:keys [period]} (first sensors)]


Log errors with clojure.tools.logging/error

--- src/asciinema/yada.clj
+++ src/asciinema/yada.clj
@@ -1,5 +1,6 @@
 (ns asciinema.yada
   (:require [clojure.java.io :as io]
+            [clojure.tools.logging :as log]
             [yada.yada :as yada]))

 (def not-found-model
@@ -13,7 +14,13 @@
                     "text/html" (io/input-stream (io/resource "asciinema/errors/404.html"))
                     "Not found")))})

+(defn logger [ctx]
+  (when-let [error (:error ctx)]
+    (when (= (-> ctx :response :status) 500)
+      (log/error error))))
+
 (defn resource [model]
   (-> model
+      (assoc :logger logger)
       (update-in [:responses 404] #(or % not-found-model))
       yada/resource))


:construction: TG-269 Restore bullet for now

--- frontend/src/uxbox/view/ui/viewer/shapes.cljs
+++ frontend/src/uxbox/view/ui/viewer/shapes.cljs
@@ -63,16 +63,16 @@
          :style {:cursor "pointer"}}
      (factory shape)
      (when show-itx?
-       [:rect {:class "interaction-hightlight"
-                 :x (:x1 rect)
-                 :y (:y1 rect)
-                 :width (:width rect)
-                 :height (:height rect)}]))
+       [:circle {:class "interaction-bullet"
+                 :cx (:x1 rect)
+                 :cy (:y1 rect)
+                 :r 5}])]))

-;;       [:circle {:class "interaction-bullet"
-;;                 :cx (:x1 rect)
-;;                 :cy (:y1 rect)
-;;                 :r 5}])]
+;;       [:rect {:class "interaction-hightlight"
+;;                 :x (:x1 rect)
+;;                 :y (:y1 rect)
+;;                 :width (:width rect)
+;;                 :height (:height rect)}]

 ;; --- Image Shape Wrapper
 ;;


initial version of `drv` mixin taking multiple ids

--- src/org/martinklepsch/derivatives.cljc
+++ src/org/martinklepsch/derivatives.cljc
@@ -111,9 +111,9 @@

 (let [get-k     "org.martinklepsch.derivatives/get"
       release-k "org.martinklepsch.derivatives/release"
-      class-properties #?(:cljs {:childContextTypes {get-k     js/React.PropTypes.func
-                                                     release-k js/React.PropTypes.func}}
-                          :clj {})]
+      context-types #?(:cljs {get-k     js/React.PropTypes.func
+                              release-k js/React.PropTypes.func}
+                       :clj  {})]

   (defn rum-derivatives
     "Given the passed spec add get!/release! derivative functions to
@@ -121,7 +121,7 @@
     mixin."
     [spec]
     #?(:cljs
-       {:class-properties class-properties
+       {:class-properties {:childContextTypes context-types}
         :child-context    (fn [_] (let [{:keys [release! get!]} (derivatives-pool spec)]
                                     {release-k release! get-k get!}))}))

@@ -129,36 +129,36 @@
     "Like rum-derivatives but get the spec from the arguments passed to the components (`:rum/args`) using `get-spec-fn`"
     [get-spec-fn]
     #?(:cljs
-       {:class-properties class-properties
+       {:class-properties {:childContextTypes context-types}
         :init             (fn [s _] (assoc s ::spec (get-spec-fn (:rum/args s))))
         :child-context    (fn [s] (let [{:keys [release! get!]} (derivatives-pool (::spec s))]
                                     {release-k release! get-k get!}))}))

   (defn drv
-    "Rum mixin to retrieve a derivative for `:drv-k` using the functions in the component context
+    "Rum mixin to retrieve derivatives for `drv-ks` using the functions in the component context
      To get the derived-atom use `get-ref` for swappable client/server behavior"
-    [drv-k]
+    [& drv-ks]
     #?(:cljs
        (let [token (rand-int 10000)] ; TODO think of something better here
-         {:class-properties class-properties
+         (assert (seq drv-ks) "The drv mixin needs at least one derivative ID")
+         {:class-properties {:contextTypes context-types}
           :will-mount    (fn [s]
                            (let [get-drv! (-> s :rum/react-component (gobj/get "context") (gobj/get get-k))]
                              (assert get-drv! "No get! derivative function found in component context")
-                             (assoc-in s [::derivatives drv-k] (get-drv! drv-k token))))
+                             (reduce #(assoc-in %1 [::derivatives %2] (get-drv! %2 token)) s drv-ks)))
           :will-unmount  (fn [s]
                            (let [release-drv! (-> s :rum/react-component (gobj/get "context") (gobj/get release-k))]
                              (assert release-drv! "No release! derivative function found in component context")
-                             (release-drv! drv-k token)
-                             (update s ::derivatives dissoc drv-k)))})))
-
-  (defn drvs
+                             (reduce #(do (release-drv! %2 token) (update %1 ::derivatives dissoc %2)) s drv-ks)))})))
+
+  #_(defn drvs
     "Rum mixin similar to `drv` except that you can supply multiple derivative identifiers"
     [& drv-ks]
     #?(:cljs
        (let [ds           (map drv drv-ks)
              will-mount   (rutil/collect :will-mount ds)
              will-unmount (rutil/collect :will-unmount ds)]
-         {:class-properties class-properties
+         {:class-properties {:contextTypes context-types}
           :will-mount (fn [s]
                         (assoc
                          (rutil/call-all s will-mount)
@@ -182,8 +182,9 @@
   [state drv-k]
   (rum/react (get-ref state drv-k)))

-(defn react-drvs [state]
-  (map #(react state %) (::drvs state)))
+(defn react-drvs [state & ks]
+  (->> (if (seq ks) ks (-> state ::derivatives keys))
+       (map #(react state %))))

 (comment
   (def base (atom 0))


getting warmer, probably going about this all wrong

--- src/jsx_fun/core.clj
+++ src/jsx_fun/core.clj
@@ -70,9 +70,14 @@
     (transform-jsx jsx-eng
       (slurp (io/file "resources/ScrollResponder.js"))))

+  ;; NOTE: wasted some time processing the wrong thing!
+  ;; need to process the JSX compiled thing
+
+  ;; getting warmer!
+
   (let [js      [(SourceFile/fromCode
-                   "ScrollResponder.js"
-                   (slurp (io/file "resources/ScrollResponder.js")))]
+                   "ScrollResponder.out.js"
+                   (slurp (io/file "resources/ScrollResponder.out.js")))]
         options (set-options
                   {:lang-in :es5 :type :commonjs}
                   (CompilerOptions.))
@@ -83,15 +88,13 @@
         ;          (doseq [x js]
         ;             (.add module x))
         ;          (first (.getInputs module)))
-        ]
-    (.parse comp)
-    #_(.setCompiler input comp)
-    #_(.process
+        root (.parse comp
+               (first js))]
+    (.process
       (ProcessCommonJSModules. comp
-        (ES6ModuleLoader. comp "resources/")
+        (ES6ModuleLoader. comp "./")
         false)
       nil root)
-    (.toSource comp)
-    )
+    (.toSource comp root))

 )


put '$' within-dates

put '$' within-dates

--- src/karras/sugar.clj
+++ src/karras/sugar.clj
@@ -51,7 +51,7 @@
 (defn gte          [field y]   {field {:$gte y}})
 (defn eq           [field y]   {field y})
 (defn within       [field y z] {field {:$gte y :$lte z}})
-(defn within-dates [field y z] {field {:gte y :lt (through-date z)}})
+(defn within-dates [field y z] {field {:$gte y :$lt (through-date z)}})
 (defn ne           [field y]   {field {:$ne y}})
 (defn in           [field ys]  {field {:$in ys}})
 (defn not-in       [field ys]  {field {:$nin ys}})


Introduce intermediate parsed files

Introduce intermediate parsed files

--- src/kevin/loader.clj
+++ src/kevin/loader.clj
@@ -121,16 +121,18 @@
         (map (fn [[actor movie]]
                [:db/retract actor :actor/movies movie])))))

-(defn parse-genre [db ^String line]
-  (let [[title genre] (map #(.trim ^String %) (clojure.string/split line #"\t+"))]
+(defn parse-genre [^String line]
+  (map #(.trim ^String %) (clojure.string/split line #"\t+")))
+
+(defn genre-tx [line]
+  (let [[title genre] (parse-genre line)]
     (when-let [g (genres genre)]
       {:db/id (d/tempid :db.part/user)
        :movie/title title
        :movie/genre g})))

 (defn parse-genres [lines]
-  (let [db (db conn)
-        tx-data (filter identity (map (partial parse-genre db) (filter movie-line? lines)))]
+  (let [tx-data (filter identity (map genre-tx (filter movie-line? lines)))]
      (doseq [batch (partition-all *batch-size* tx-data)]
        (print ".")
        (flush)
@@ -219,6 +221,68 @@
             (recur lines { :header (not= line start-at) })
             (parser lines))))))

+(defn ensure-transformed-movies [file out]
+  (when-not (.exists (io/as-file out))
+    (with-open [in (io/reader
+                     (java.util.zip.GZIPInputStream. (io/input-stream file))
+                     :encoding "ISO-8859-1")
+                out (io/writer out)]
+      (loop [[line & lines] (drop-while #(not= % "MOVIES LIST") (line-seq in))]
+        (when line
+          (when (movie-line? line)
+            (when-let [title (movie-title line)]
+              (.write out title)
+              (.newLine out)))
+          (recur lines))))))
+
+(defn ensure-transformed-actors [file out & {:keys [start-at]}]
+  (when-not (.exists (io/as-file out))
+    (with-open [in (io/reader
+                     (java.util.zip.GZIPInputStream. (io/input-stream file))
+                     :encoding "ISO-8859-1")
+                out (io/writer out)]
+      (loop [lines (drop 3 (drop-while #(not= % start-at) (line-seq in)))]
+        (let [[actor-lines lines] (split-with (complement empty?) (rest lines))]
+          (when (seq actor-lines)
+            (when-let [actor-data (try (parse-actor actor-lines) (catch Throwable t nil))]
+              (let [{:keys [actor movies]} actor-data]
+                (doseq [movie movies]
+                  (doto out
+                    (.write actor)
+                    (.write char-tab)
+                    (.write movie)
+                    (.newLine)))))
+            (recur lines)))))))
+
+(defn ensure-transformed-genres [file out]
+  (when-not (.exists (io/as-file out))
+    (with-open [in (io/reader
+                     (java.util.zip.GZIPInputStream. (io/input-stream file))
+                     :encoding "ISO-8859-1")
+                out (io/writer out)]
+      (loop [[line & lines] (drop 3 (drop-while #(not= % "8: THE GENRES LIST") (line-seq in)))]
+        (when line
+          (when (movie-line? line)
+            (let [[title genre] (parse-genre line)]
+              (doto out
+                (.write title)
+                (.write char-tab)
+                (.write genre)
+                (.newLine ))))
+          (recur lines))))))
+
+(defn load-movies []
+  (ensure-transformed-movies "data/movies.list.gz" "data/movies.transformed"))
+
+(defn load-actors []
+  (ensure-transformed-actors "data/actors.list.gz" "data/actors.transformed" :start-at "THE ACTORS LIST"))
+
+(defn load-actresses []
+  (ensure-transformed-actors "data/actresses.list.gz" "data/actresses.transformed" :start-at "THE ACTRESSES LIST"))
+
+(defn load-genres []
+  (ensure-transformed-genres "data/genres.list.gz" "data/genres.transformed"))
+
 (defn -main [& args]
   (let [system (system/start (system/system))]
     (alter-var-root #'conn (constantly (:conn (:db system))))


Include year in intial import

Include year in intial import

--- src/kevin/loader.clj
+++ src/kevin/loader.clj
@@ -54,7 +54,11 @@
     (filter remove-sep (partition-by pred coll))))

 (defn store-movies [batch]
-  (let [titles (map (fn [b] { :db/id (d/tempid :db.part/user) :movie/title b }) batch)]
+  (let [titles (map (fn [b]
+                      {:db/id (d/tempid :db.part/user)
+                       :movie/title b
+                       :movie/year (extract-year b)})
+                    batch)]
     @(d/transact conn titles)))

 (defn actor-tx-data


handle multi-page tiff data sets

handle multi-page tiff data sets

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


tiny changes

tiny changes

--- src/cake/tasks/new.clj
+++ src/cake/tasks/new.clj
@@ -12,7 +12,6 @@
 ")

 (def template-dir (file "~" ".cake" "templates"))
-(def default-template-dir (file template-dir "default"))

 (defn rename-dirs [root project]
   (log "Renaming directories with +project+ in their name")
@@ -36,19 +35,20 @@
             (spit f (.replace (slurp f) "+project+" project))))))))

 (defn create-template [template]
-  (log (str "Creating template directory: ~/.cake/templates/" (last (.split (str template) "/"))))
-  (ant Mkdir {:dir template})
-  (ant Mkdir {:dir (file template "src" "+project+")})
-  (spit (file template "src" "+project+" "core.clj") "(ns +project+.core)")
-  (log "Created template file: src/+project+/core.clj")
-  (ant Mkdir {:dir (file template "test")})
-  (spit (file template "project.clj") default-template)
-  (log "Created template file: project.clj")
-  (spit (file template ".gitignore")
-        (apply str (interleave [".cake" "pom.xml" "*.jar" "*.war" "lib" "classes" "build" "+project+"] (repeat "\n"))))
-  (log "Created template file: .gitignore")
-  (extract-resource "LICENSE" template)
-  (log "Created template LICENSE file (Eclipse Public License)"))
+  (log (str "Creating template directory: ~/.cake/templates/" template))
+  (let [template (file template-dir template)]
+    (ant Mkdir {:dir template})
+    (ant Mkdir {:dir (file template "src" "+project+")})
+    (spit (file template "src" "+project+" "core.clj") "(ns +project+.core)")
+    (log "Created template file: src/+project+/core.clj")
+    (ant Mkdir {:dir (file template "test")})
+    (spit (file template "project.clj") default-template)
+    (log "Created template file: project.clj")
+    (spit (file template ".gitignore")
+          (apply str (interleave [".cake" "pom.xml" "*.jar" "*.war" "lib" "classes" "build" "+project+"] (repeat "\n"))))
+    (log "Created template file: .gitignore")
+    (extract-resource "LICENSE" template)
+    (log "Created template LICENSE file (Eclipse Public License)")))

 (deftask new
   "Create scaffolding for a new project."
@@ -60,8 +60,8 @@
    New project based on a specified template:  cake new mytemplate aproj
    New template based on the default template: cake new template mytemplate"
   {[one two] :new}
-  (when-not (.exists default-template-dir)
-    (create-template default-template-dir))
+  (when-not (.exists (file template-dir "default"))
+    (create-template "default"))
   (if (and two (= one "template"))
-    (create-template (file template-dir two))
-    (apply template-new (or (and two [two one]) [one "default"]))))
+    (create-template two)
+    (apply template-new (if two [two one] [one "default"]))))


add :integer number format

add :integer number format

--- src/clj_money/util.clj
+++ src/clj_money/util.clj
@@ -1,13 +1,15 @@
 (ns clj-money.util
   (:refer-clojure :exclude [update])
   (:require [clojure.pprint :refer [pprint]]
+            [clojure.tools.logging :as log]
             [clj-time.core :as t])
   (:import java.text.DecimalFormat
            org.joda.time.format.DateTimeFormat))

 (def number-formats
   {:standard (DecimalFormat. "#,##0.00")
-   :no-comma (DecimalFormat. "0.00")})
+   :no-comma (DecimalFormat. "0.00")
+   :integer  (DecimalFormat. "0")})

 (defn format-number
   "Format a number with 2 decimal places and groups separated with commas"


Make random-plush-instruction-map obey new flag

--- src/clojush/random.clj
+++ src/clojush/random.clj
@@ -66,13 +66,16 @@
    (random-plush-instruction-map atom-generators false argmap))
   ([atom-generators random-insertion {:keys [epigenetic-markers
                                              close-parens-probabilities
-                                             silent-instruction-probability]
+                                             silent-instruction-probability
+                                             track-instruction-maps]
                                       :or {epigenetic-markers []
                                            close-parens-probabilities [0.772 0.206 0.021 0.001]
                                            silent-instruction-probability 0}}]
-   (let [markers (concat epigenetic-markers
-                         [:instruction :uuid]
-                         (if random-insertion [:random-insertion]))]
+   (let [markers (conditional-thread epigenetic-markers
+                                     #(conj % :instruction)
+                                     #(when track-instruction-maps (conj % :uuid))
+                                     #(when (and track-instruction-maps
+                                               random-insertion) (conj % :random-insertion)))]
      (zipmap markers
              (map (fn [marker]
                     (case marker


add schroeder-reverb example which works with a microphone input

--- src/overtone/examples/synthesis/fx.clj
+++ src/overtone/examples/synthesis/fx.clj
@@ -102,5 +102,22 @@
         ]
     (out 0 output)))

+
+(defsynth schroeder-reverb-mic
+  [rate 1 dec 1 del 10 out-bus 0]
+  (let [input    (pan2 (allpass-c (sound-in) 10  dec del))
+        delrd    (local-in 4)
+        output   (+ input [(first delrd) (second delrd)])
+        sig      [(+ (first output) (second output)) (- (first output) (second output))
+                  (+ (nth delrd 2) (nth delrd 3)) (- (nth delrd 2) (nth delrd 3))]
+        sig      [(+ (nth sig 0) (nth sig 2)) (+ (nth sig 1) (nth sig 3))
+                  (- (nth sig 0) (nth sig 2)) (- (nth sig 0) (nth sig 2))]
+        sig      (* sig [0.4 0.37 0.333 0.3])
+        deltimes (- (* [101 143 165 177] 0.001) (control-dur))
+        lout     (local-out (delay-c sig deltimes deltimes))
+        ]
+    (out out-bus output)))
+
 ;;Spooky!
-;;(schroeder-reverb :rate 0.8)
+;;(schroeder-reverb-mic :rate 0.8 :dec 0.8 :del 10)
+;; (stop)


macros shadow functions

macros shadow functions

--- src/main/clojure/clojure/tools/analyzer/js.clj
+++ src/main/clojure/clojure/tools/analyzer/js.clj
@@ -144,7 +144,7 @@
           form
           (let [clj-macro (maybe-macro op env)]
             (if (and clj-macro
-                     (not (resolve-var op env))
+                     ;; (not (resolve-var op env))
                      (not (-> env :locals (get op))))
               (with-bindings (merge {#'c.c/*ns* (create-ns *ns*)}
                                     (when-not (thread-bound? #'*ns*)


Now expects string keys for parameters, rather than keywords

--- src/compojure/core.clj
+++ src/compojure/core.clj
@@ -41,7 +41,7 @@
   "Create the bindings for a vector of parameters."
   [request bindings body]
   (let [[args [_ more]] (split-with #(not= % '&) bindings)]
-    `(let [{:keys ~(vec args)} (~request :params)
+    `(let [{:strs ~(vec args)} (~request :params)
           ~@(if more [more `(dissoc (~request :params) ~@(map keyword args))])]
        ~@body)))


[Fix #51] False positives when detecting aliases

Fully qualified vars were being wrongly labeled as aliased vars.  If
updated the code to check if the var and the alias are the same and if
so the var clearly isn't aliased.

--- src/refactor_nrepl/ns/dependencies.clj
+++ src/refactor_nrepl/ns/dependencies.clj
@@ -126,15 +126,19 @@
                    class))]
     {:name (.getName ^Class c)}))

+(defn- get-var-alias [node var-name]
+  (let [alias? (some->>
+                node
+                :form
+                str
+                (re-matches
+                 (re-pattern (str "[A-Za-z0-9_.?$%!-]+/" (suffix var-name)))))]
+    (when (not= alias? var-name) alias?)))
+
 (defn- get-var-name-and-alias [node]
-  (when-let [variable (some-> node :var str (str/replace "#'" ""))]
-    {:name variable
-     :alias (some->>
-             node
-             :form
-             str
-             (re-matches
-              (re-pattern (str "[A-Za-z0-9_.?$%!-]+/" (suffix variable)))))}))
+  (when-let [var-name (some-> node :var str (str/replace "#'" ""))]
+    {:name var-name
+     :alias (get-var-alias node var-name)}))

 (defn- get-interface-name [{:keys [op interface]}]
   (when (and interface
@@ -248,7 +252,7 @@
 (defn extract-dependencies [path ns-form]
   (let [libspecs (get-libspecs ns-form)
         file-content (slurp path)
-        symbols-in-use (-> file-content ns-ast used-vars)
+        symbols-in-use (-> file-content ns-ast used-vars set)
         macros-in-use (used-macros file-content libspecs)]
     {:require (->> libspecs
                    (remove-unused-requires (concat macros-in-use symbols-in-use))


Fixed regex

Fixed regex

--- src/clojurescript_css_modules_demo/js/core.cljs
+++ src/clojurescript_css_modules_demo/js/core.cljs
@@ -13,12 +13,12 @@
   "Helper fn that takes Reagent's hiccup syntax and replaces .CSS>x classes with their respective CSS module name(s). See usage in header below."
   [i]
   (let [stringified (str i)
-        class-lookup (re-find #"(?:CSS>)[^\s]+" stringified)
+        class-lookup (re-find #"(?:CSS>)[^\s][a-zA-Z>-]+" stringified)
         tree (rest (string/split class-lookup #">"))
         class-names (apply aget (js* "cssModules") tree)
         joined-class-names (string/replace-all class-names #" " ".")
-        output (reader/read-string (string/replace-first stringified #"(?:CSS>)[^\s]+" joined-class-names))
-        finished? (nil? (re-find #"(?:CSS>)[^\s]+" (str output)))]
+        output (reader/read-string (string/replace-first stringified #"(?:CSS>)[^\s][a-zA-Z>-]+" joined-class-names))
+        finished? (nil? (re-find #"(?:CSS>)[^\s][a-zA-Z>-]+" (str output)))]

     (if finished?
       output


Doubled max points

Doubled max points

--- src/clojush/problems/integer_regression/tg8.clj
+++ src/clojush/problems/integer_regression/tg8.clj
@@ -51,7 +51,7 @@
    ;:crossover-probability 0.3
    ;:simplification-probability 0.3
    ;:reproduction-simplifications 10
-   :max-points 200
+   :max-points 400
    :max-genome-size-in-initial-program 100
    :population-size 5000
    })


CMR-3223: Catching Throwable instead of Exception to catch AssertionErrors.

--- search-app/src/cmr/search/data/metadata_retrieval/metadata_transformer.clj
+++ search-app/src/cmr/search/data/metadata_retrieval/metadata_transformer.clj
@@ -146,7 +146,7 @@
                (if ignore-exceptions?
                  (try
                    (transform-with-strategy context concept k v)
-                   (catch Exception e
+                   (catch Throwable e
                      ;; Namespace used to reference error here to allow redefing in tests
                      (log/error e "Ignoring exception while trying to transform metadata:" (.getMessage e))))
                  (transform-with-strategy context concept k v))))


Message queue: add TODO for possible integration with 2.8+ Pub/Sub notification

--- src/taoensso/carmine/message_queue.clj
+++ src/taoensso/carmine/message_queue.clj
@@ -19,6 +19,14 @@
   (:require [clojure.string   :as str]
             [taoensso.carmine :as car :refer (wcar)]
             [taoensso.timbre  :as timbre]))
+
+;; TODO Redis 2.8+ Pub/Sub notifications could be used to more efficiently
+;; coordinate worker backoffs. This'd allow us to essentially go from a polling
+;; design to an evented design even w/o the need for a Lua brpoplpush.
+;;
+;; Note that we'd want the Pub/Sub notifier _in addition to_ the current
+;; rpoplpush design: both for atomicity and reliability (Pub/Sub doesn't
+;; currently have reliability guarantees).

 ;;;; Public utils


Make $ and $$ multi arity

Make $ and $$ multi arity

Reduces the number of warnings generated by the cljs compiler.

--- src/lt/util/dom.cljs
+++ src/lt/util/dom.cljs
@@ -37,15 +37,13 @@
 (defn text-node [text]
   (js/document.createTextNode text))

-(defn $$ [query elem]
-  (let [elem (or elem js/document)
-        res (.querySelectorAll elem (name query))]
-    res))
-
-(defn $ [query elem]
-  (let [elem (or elem js/document)
-        res (.querySelector elem (name query))]
-    res))
+(defn $$
+  ([query] ($$ query js/document))
+  ([query elem] (.querySelectorAll elem (name query))))
+
+(defn $
+  ([query]  ($ query js/document))
+  ([query elem] (.querySelector elem (name query))))

 (defn append [parent child]
   (.appendChild parent child)


Require GET /matrices/:id to use fixed-length valid id.

--- src/mtrx9/controllers/matrices.clj
+++ src/mtrx9/controllers/matrices.clj
@@ -11,5 +11,5 @@
                       (apply str (repeatedly 42 #(rand-nth "0123456789-SLATF"))))))

 (defroutes routes
-  (GET  "/matrices/:id" [id] (show id))
+  (GET  ["/matrices/:id" :id #"[0-9-SLATF]{42}"] [id] (show id))
   (POST "/matrices" [] (create)))


GAWB-1818: Changing message

GAWB-1818: Changing message

--- src/cljs/main/broadfcui/page/workspace/method_configs/launch_analysis.cljs
+++ src/cljs/main/broadfcui/page/workspace/method_configs/launch_analysis.cljs
@@ -82,7 +82,7 @@
    [:div {:style {:marginTop "1em"}}
     [comps/Checkbox
     {:ref "callCache-check"
-     :label [:span {:style {:marginBottom "0.8em"}} "Use " [:a {:href (config/call-caching-guide-url) :target "_blank"} "Call Caching"]]
+     :label [:span {:style {:marginBottom "0.8em"}} "Use Call Caching. " [:a {:href (config/call-caching-guide-url) :target "_blank"} "Learn More"]]
      :initial-checked? true
      :disabled-text (case (:protected-option @state)
                       :not-loaded "Call Caching status has not finished loading."


Make sure add-to-db returns the production

so that we can use it with the threading macro

--- src/mdr2/archive.clj
+++ src/mdr2/archive.clj
@@ -86,7 +86,8 @@
          ;; archived
          :sektion (if (:iso-path production) "cdimage" "master")}
         job (merge default-job new-job)]
-    (jdbc/insert! db :container job)))
+    (jdbc/insert! db :container job)
+    production))

 (defn encode-production
   "Encode a production, i.e. convert the wav files to mp3"