Implement ping framework

Implement ping framework

--- src-cljs/tranjlator/sockets.cljs
+++ src-cljs/tranjlator/sockets.cljs
@@ -3,7 +3,7 @@
             [chord.client :refer [ws-ch]]
             [goog.events :as evt]
             [cljs.reader :refer [read-string]])
-  (:require-macros [cljs.core.async.macros :refer [go-loop go]])
+  (:require-macros [cljs.core.async.macros :refer [go-loop go alt!]])
   (:import [goog.net WebSocket]
            [goog.net.WebSocket EventType]))

@@ -36,12 +36,17 @@
     (evt/listen ws (.-ERROR EventType )  #(println "WS Error:" %))

     (go-loop []
-      (when-some [msg (<! sender-ch)]
-        (.send ws (pr-str msg))
-        (recur))
-      (a/close! listener-ch)
-      (.close ws)
-      (.disposeInternal ws))
+      (let [timeout (a/timeout 15000)]
+        (alt!
+          timeout (do ;; ping
+                    (recur))
+          sender-ch ([msg]
+                       (if-not (nil? msg)
+                         (do (.send ws (pr-str msg))
+                             (recur))
+                         (do (a/close! listener-ch)
+                             (.close ws)
+                             (.disposeInternal ws)))))))

     ;; (when ws-channel
     ;;   (do


Add reread

Add reread

--- src/cljs/koeeoadi/components/colorpicker.cljs
+++ src/cljs/koeeoadi/components/colorpicker.cljs
@@ -83,7 +83,7 @@
               (om/transact! this `[(state/merge
                                      {:palette-widget/face-classes-by-color-type ~faces-to-colorize
                                       :mutate/name face/color-update
-                                      :faces/by-name ~faces-by-name'})])))
+                                      :faces/by-name ~faces-by-name'}) :palette])))

           color-update
           (fn [color]


Add first test case for approx-canonical-base

Signed-off-by: Daniel Borchmann <3d0f3b9ddcacec30c4008c5e030e6c13a478cb4f@algebra20.de>

--- src/test/clojure/conexp/fca/implications_test.clj
+++ src/test/clojure/conexp/fca/implications_test.clj
@@ -408,6 +408,19 @@
        (learn-implications-by-queries (attributes ctx)
                                       (membership-oracle-by-implications base)
                                       (equivalence-oracle-by-implications base))))))
+;;;
+
+(deftest test-approx-canonical-base
+  (let [ε 0.3
+        δ 1e-10]
+    (with-testing-data [ctx (random-contexts 10 15)]
+      (let [exact-base (canonical-base ctx)
+            approx-base (approx-canonical-base ctx ε δ)
+            exact-models (set (all-closed-sets (attributes ctx) (clop-by-implications exact-base)))
+            approx-models (set (all-closed-sets (attributes ctx) (clop-by-implications approx-base)))]
+        (<= (+ (count (difference exact-models approx-models))
+               (count (difference approx-models exact-models)))
+            (* ε (expt 2 (count (attributes ctx)))))))))

 ;;;


Look for :exit in the map, not :exit-status


expose model-session creation from an alia-session

--- src/er_cassandra/model/alia/model_session.clj
+++ src/er_cassandra/model/alia/model_session.clj
@@ -44,10 +44,14 @@
   (close [_]
     (s/close alia-session)))

+(defn create-session*
+  [alia-session]
+  (->AliaModelSession alia-session))
+
 (defnk create-session
   [contact-points keyspace {port nil} :as args]
   (let [alia-session (a/create-session args)]
-    (->AliaModelSession alia-session)))
+    (create-session* alia-session)))

 (defrecord AliaModelSpySession [alia-session model-spy-log-atom]
   ModelSession
@@ -117,7 +121,11 @@
     (reset! model-spy-log-atom [])
     (s/reset-spy-log alia-session)))

+(defn create-spy-session*
+  [alia-session]
+  (->AliaModelSpySession alia-session (atom [])))
+
 (defnk create-spy-session
   [contact-points keyspace {port nil} {truncate-on-close nil} :as args]
   (let [alia-session (a/create-spy-session args)]
-    (->AliaModelSpySession alia-session (atom []))))
+    (create-spy-session* alia-session)))


Small change to regex for parsing Amazon links.

--- src/hackerati_interval_web_app/views/util.clj
+++ src/hackerati_interval_web_app/views/util.clj
@@ -6,14 +6,14 @@

 (defn valid-link? [link]
   "Returns vector if successful of [link amzn-productid]"
-  (re-find #"[a-z/.]+amazon[a-z/.]+([a-z0-9]{10})[a-z/=_?&-]+" (lower-case link)))
+  (re-find #"[a-z:/.-]+amazon[a-z/.-]+([a-z0-9]{10})[a-z/=_?&-]*" (lower-case link)))

 (defn process-link [link]
   (if-let [valid-link (valid-link? link)]
     (let [mobile-stub "http://www.amazon.com/gp/aw/d/"
           productid (second valid-link)]
       (str mobile-stub productid))))
-
+(valid-link? "http://www.amazon.com/Let-Over-Lambda-Doug-Hoyte/dp/1435712757")
 (defn valid-username? [u]
   (re-find #"^\w{1,30}$" u))


*print-meta* true when emitting boot script, fixes #86

--- boot/core/src/boot/main.clj
+++ boot/core/src/boot/main.clj
@@ -116,7 +116,8 @@
                             (merge {} (:set-env opts)))
               import-ns   (export-task-namespaces initial-env)
               scriptforms (emit boot? args userforms bootforms import-ns)
-              scriptstr   (str (string/join "\n\n" (map pr-str scriptforms)) "\n")]
+              scriptstr   (binding [*print-meta* true]
+                            (str (string/join "\n\n" (map pr-str scriptforms)) "\n"))]

           (reset! util/*colorize?* (not (:no-colors opts)))
           (swap! util/*verbosity* + verbosity)


Add new fn buffer-mix-to-mono

Add new fn buffer-mix-to-mono

--- src/overtone/sc/buffer.clj
+++ src/overtone/sc/buffer.clj
@@ -498,6 +498,8 @@

 (def TWO-PI (* 2 Math/PI))

+
+
 (defn create-buffer-data
   "Create a sequence of floats for use as a buffer.  Result will contain
    values obtained by calling f with values linearly interpolated
@@ -546,3 +548,31 @@
 (defmethod write-wav ::sequence
   [data path frame-rate n-channels]
   (write-audio-file-from-seq data path frame-rate n-channels))
+
+(defn buffer-mix-to-mono
+  "Synchronously create a new buffer with only one channel by mixing
+   buffer b down. Mixing is implemented simply by summing successive
+   samples from each channel and dividing by the number of
+   channels. Therefore, for a stereo buffer, the first sample for the
+   left channel is added to the first sample for the right channel and
+   the result is divided by two - and so on for each sample.
+
+   Useful for creating buffers to use with the t-grains ugen.
+
+   Original buffer is left unaffected. Requires internal server."
+  [b]
+  (ensure-buffer-active! b)
+  (let [n-chans (:n-channels b)
+        rate    (:rate b)]
+    (cond
+     (= 1 n-chans) b
+     :else
+     (let [data          (buffer-data b)
+           partitioned   (partition n-chans (seq data))
+           mixed         (mapv (fn [samps] (/ (apply + samps) n-chans)) partitioned)
+           tmp-file-path (mk-path (mk-tmp-dir!) "mono-file.wav")]
+
+       (write-wav mixed tmp-file-path rate 1)
+       (let [new-b (buffer-alloc-read tmp-file-path)]
+         (future (rm-rf! tmp-file-path))
+         new-b)))))


Handle cached and loaded samples separately. Also allow users to force load a sample (overriding the cached version but adding to the loaded samples). Fixes #128.

--- src/overtone/sc/sample.clj
+++ src/overtone/sc/sample.clj
@@ -47,28 +47,29 @@
       (out out-bus (* vol
                       (scaled-v-disk-in 2 buf rate loop?))))))

-(defonce loaded-samples* (ref {}))
+(defonce loaded-samples* (atom {}))
+(defonce cached-samples* (atom {}))

 (defrecord Sample [id size n-channels rate allocated-on-server path args name])

 (defn- load-sample*
-  [path & args]
+  [path arg-map]
   (let [path (canonical-path path)
         f    (file path)]
     (when-not (.exists f)
       (throw (Exception. (str "Unable to load sample - file does not exist: " path))))
-    (let [arg-map  (apply hash-map args)
-          f-name   (or (:name args) (.getName f))
+    (let [f-name   (or (:name arg-map) (.getName f))
           start    (get arg-map :start 0)
           n-frames (get arg-map :size 0)
-          buf      (buffer-alloc-read path start n-frames)]
-      (let [sample (map->Sample
+          buf      (buffer-alloc-read path start n-frames)
+          sample   (map->Sample
                     (assoc buf
                       :path path
-                      :args args
+                      :args arg-map
                       :name f-name))]
-        (dosync (alter loaded-samples* assoc [path args] sample))
-        sample))))
+      (swap! cached-samples* assoc [path arg-map] sample)
+      (swap! loaded-samples* assoc (:id buf) sample)
+      sample)))

 (defn load-sample
   "Synchronously load a .wav or .aiff file into a memory buffer. Returns
@@ -81,15 +82,21 @@
   channels of file and number of samples requested (:size), or fewer if
   sound file is smaller than requested. Reads sound file data from the
   given starting frame in the file (:start). If the number of frames
-  argument is less than or equal to zero, the entire file is read."
+  argument is less than or equal to zero, the entire file is read.
+
+  If optional param :force is set to true, any previously create cache
+  of the sample will be removed and the sample will be forcibly
+  reloaded."
   [path & args]
-  (let [path (canonical-path path)]
-    (if-let [sample (get @loaded-samples* [path args])]
+  (ensure-connected!)
+  (let [args   (apply hash-map args)
+        force? (:force args)
+        args   (select-keys args [:start :size])
+        path   (canonical-path path)]
+    (if-let [sample (and (not force?)
+                         (get @cached-samples* [path args]))]
       sample
-      (do
-        (dosync (alter loaded-samples* assoc [path args] nil))
-        (if (server-connected?)
-          (apply load-sample* path args))))))
+      (load-sample* path args))))

 (defn load-samples
   "Takes a directoy path or glob path (see #'overtone.helpers.file/glob)
@@ -100,17 +107,18 @@
   (let [path  (apply mk-path path-glob)
         path  (resolve-tilde-path path)
         files (glob path)]
-    (doall
-     (map (fn [file]
-            (let [path (.getAbsolutePath file)]
-              (load-sample path)))
-          files))))
+    (doseq [file files]
+      (let [path (.getAbsolutePath file)]
+        (load-sample path))
+      files)))

-(defn- load-all-samples []
-  (doseq [[[path args] buf] @loaded-samples*]
-    (apply load-sample* path args)))
+(defn- reload-all-samples []
+  (reset! cached-samples* {})
+  (reset! loaded-samples* {})
+  (doseq [smpl (vals @loaded-samples*)]
+    (apply load-sample* (:path smpl) (:args smpl))))

-(on-deps :server-ready ::load-all-samples load-all-samples)
+(on-deps :server-ready ::load-all-samples reload-all-samples)

 (defn sample?
   "Returns true if s is a sample"
@@ -118,18 +126,19 @@
   (isa? (type s) ::sample))

 (defn- free-loaded-sample
-  [[[path args] buf]]
-  (if (server-connected?)
-    (do (buffer-free buf)
-        (dosync (alter loaded-samples*
-                       dissoc
-                       [path args])))))
+  [smpl]
+  (let [path (:path smpl)
+        args (:args smpl)]
+    (if (server-connected?)
+      (do (buffer-free smpl)
+          (swap! cached-samples* dissoc [path args])
+          (swap! loaded-samples* dissoc (:id smpl))))))

 (defn free-all-loaded-samples
   "Free all buffers associated with a loaded sample and the memory they
   consume. Also remove each sample from @loaded-samples once freed"
   []
-  (doseq [loaded-sample @loaded-samples*]
+  (doseq [loaded-sample (vals @loaded-samples*)]
     (free-loaded-sample loaded-sample)))

 (defn free-sample
@@ -139,11 +148,8 @@
    @loaded-samples."
   [smpl]
   (assert sample? smpl)
-  (let [path (:path smpl)
-        args (:args smpl)
-        buf  (get @loaded-samples* [path args])]
-    (free-loaded-sample [[path args] buf])
-    :sample-freed))
+  (free-loaded-sample smpl)
+  :sample-freed)

 (defn sample-player
   "Play the specified sample with either a mono or stereo player
@@ -152,7 +158,7 @@
    1]"
   [smpl & pargs] {:pre [(sample? smpl)]}
   (let [{:keys [path args]}     smpl
-        {:keys [id n-channels]} (get @loaded-samples* [path args])
+        {:keys [id n-channels]} (get @cached-samples* [path args])
         [target pos pargs]      (extract-target-pos-args pargs
                                                                (foundation-default-group)
                                                                :tail)]


Fixed the intermittent failure issue (problem with url encoding)


WIP: email digest for daily or weekly

WIP: email digest for daily or weekly

--- src/chat/server/email_digest.clj
+++ src/chat/server/email_digest.clj
@@ -26,6 +26,10 @@
   (db/with-conn
     (doall (filter thread-unseen? (db/get-open-threads-for-user user-id)))))

+(defn daily-update-users
+  "Find all users that want daily digest updates"
+  [])
+
 ; sending

 (defn send-message
@@ -38,24 +42,44 @@
                             :text text
                             :html html}}))

-; Scheduling
+;; Scheduling

-(defjob SendEmailsJob
+; daily digest
+(defjob DailyDigestJob
   [ctx]
-  (timbre/debugf "Starting email job")
-  )
+  (timbre/debugf "Starting daily email job"))

-(defn email-job
+(defn daily-digest-job
   []
   (j/build
-    (j/of-type SendEmailsJob)
-    (j/with-identity (j/key "jobs.email-send.1"))))
+    (j/of-type DailyDigestJob)
+    (j/with-identity (j/key "jobs.daily-email.1"))))

-(defn email-trigger
+(defn daily-digest-trigger
   []
   (t/build
-    (t/with-identity (t/key "triggers.email-send"))
+    (t/with-identity (t/key "triggers.daily-email"))
     (t/start-now)
     (t/with-schedule
       (cron/schedule
         (cron/daily-at-hour-and-minute 3 0)))))
+
+; weekly digest
+(defjob WeeklyDigestJob
+  [ctx]
+  (timbre/debugf "Starting weekly email job"))
+
+(defn weekly-digest-job
+  []
+  (j/build
+    (j/of-type WeeklyDigestJob)
+    (j/with-identity (j/key "jobs.weekly-email.1"))))
+
+(defn weekly-digest-trigger
+  []
+  (t/build
+    (t/with-identity (t/key "triggers.weekly-email"))
+    (t/start-now)
+    (t/with-schedule
+      (cron/schedule
+        (cron/weekly-on-day-and-hour-and-minute 0 2 30)))))


fix typo

fix typo

--- src/vip/data_processor/db/tree_statistics.clj
+++ src/vip/data_processor/db/tree_statistics.clj
@@ -77,7 +77,7 @@
        (reduce merge)))

 (defn prepare-temp-data-for-locality-stats
-  "Adds steet segment validation data to processing table for faster
+  "Adds street segment validation data to processing table for faster
    processing, only used for the locality stats computations and then
    deleted"
   [import-id]


implement Political Operative

implement Political Operative

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -572,6 +572,23 @@
                                     card nil)))}]
       :events {:runner-turn-begins remove-counter}})

+   "Political Operative"
+   {:req (req (some #{:hq} (:successful-run runner-reg)))
+    :abilities [{:prompt "Choose a rezzed card with a trash cost"
+                 :choices {:req #(and (:trash %) (rezzed? %))}
+                 :effect (req (let [c target]
+                                (trigger-event state side :pre-trash c)
+                                (let [cost (trash-cost state :runner c)]
+                                  (when (can-pay? state side nil [:credit cost])
+                                    (resolve-ability
+                                      state side
+                                      {:msg (msg "pay " cost " [Credit] and trash " (:title c))
+                                       :effect (effect (lose :credit cost)
+                                                       (trash card {:cause :ability-cost})
+                                                       (trash c))}
+                                     card nil)))
+                                (swap! state update-in [:bonus] dissoc :trash)))}]}
+
    "Power Tap"
    {:events {:trace {:msg "gain 1 [Credits]" :effect (effect (gain :runner :credit 1))}}}


Actually add the structure in the structure upload handler

--- src/clj/mdr2/routes/services.clj
+++ src/clj/mdr2/routes/services.clj
@@ -146,18 +146,23 @@
                           :multipart {:file multipart/temp-file-part}}
              :handler (fn [{{{:keys [file]} :multipart {:keys [id]} :path} :parameters}]
                         (let [tempfile (:tempfile file)
+                              path (.getPath tempfile)
                               production (db/get-production {:id id})
                               errors (concat
                                       ;; validate XML
-                                      (pipeline/validate (.getPath tempfile) :dtbook)
+                                      (pipeline/validate path :dtbook)
                                       ;; validate meta data
-                                      (validation/validate-metadata (.getPath tempfile) production)
+                                      (validation/validate-metadata path production)
                                       ;; make sure production is in the state that allows upload
                                       (when (not (#{"new" "structured"} (:state production)))
                                         ["Production not in state \"new\" or \"structured\""]))]
                           (if-not (seq errors)
-                            (no-content)
-                            (bad-request {:status-text "Upload of DTBook XML structure failed" :errors errors}))))}}]]
+                            (let [p (prod/add-structure production tempfile)]
+                              (if-not (nom/anomaly? p)
+                                (no-content)
+                                (internal-server-error)))
+                            (bad-request {:status-text "Upload of DTBook XML structure failed"
+                                          :errors errors}))))}}]]

    ["/abacus"
     {:swagger {:tags ["Abacus API"]}}


Whitespace fixes

Whitespace fixes

--- src/clj/mdr2/routes/services.clj
+++ src/clj/mdr2/routes/services.clj
@@ -152,8 +152,8 @@
                              ok
                              (content-type "text/xml")
                              (charset "UTF-8"))
-                         (not-found)))
-            }
+                         (not-found)))}
+
       :post {:summary "Upload the DTBook XML structure for a production"
              :parameters {:path {:id int?}
                           :multipart {:file multipart/temp-file-part}}


add int matcher for coercion

add int matcher for coercion

--- src/clj_money/models/helpers.clj
+++ src/clj_money/models/helpers.clj
@@ -40,6 +40,15 @@
                  (format "Unable to find a storage provider for config %s" config))))))

 ;; Validation
+(defn- int-matcher
+  [schema]
+  (when (= schema/Int schema)
+    (coerce/safe
+      (fn [value]
+        (if (and (string? value) (re-matches #"\d+" value))
+          (Integer. value)
+          value)))))
+
 (defn- nil-matcher
   [schema]
   (when (= schema/Str schema)
@@ -63,8 +72,9 @@
   "Coerces and validates the specified model using the specified schema"
   [model schema model-name]
   (let [coercer (coerce/coercer schema
-                                (coerce/first-matcher [coerce/json-coercion-matcher
-                                                       nil-matcher]))
+                                (coerce/first-matcher [int-matcher
+                                                       nil-matcher
+                                                       coerce/json-coercion-matcher]))
         result (coercer model)]
     (if (sutils/error? result)
      (throw-validation-exception (:error result) model schema model-name)


morph: fix changes->form

morph: fix changes->form

--- src/cljs/cljs_morphic/morph.cljs
+++ src/cljs/cljs_morphic/morph.cljs
@@ -42,18 +42,20 @@

 (declare add-morph add-morph-before without set-prop)

-(def LOOP_MAPPING true)
-
-(defmulti changes->form (fn [expr changes opts]
-                          (if LOOP_MAPPING
+(defn bi-lens? [x]
+  (and (satisfies? IFetch x) (satisfies? IPutback x)))
+
+; unpack the previously added changes (BUG: what if expression originally comes with a '-> ?)
+
+(defmulti changes->form* (fn [expr changes opts]
+                          (if (:loop-mapping opts)
                             (first expr)
                             :default)))

-; unpack the previously added changes (BUG: what if expression originally comes with a '-> ?)
-
-(defmethod changes->form '->
-  ([[_ expr _] changes opts]
-   (changes->form expr changes opts)))
+(defn changes->form
+  ([expr changes opts]
+   (let [expr (if (= '-> (first expr)) (second expr) expr)]
+     (changes->form* expr changes opts))))

 (defn modify-prototype [prototype-expr unbound-changes]
   (let [[self props & submorphs] prototype-expr]
@@ -61,7 +63,7 @@
       (merge props unbound-changes)
       submorphs)))

-(defmethod changes->form 'map
+(defmethod changes->form* 'map
   ([map-expr {struct-changes :structure
               id->prop-changes :properties} {expr-morphs :expanded-expression}]
    (let [[_ map-fn & rest-expr] map-expr
@@ -103,10 +105,10 @@
              (apply concat struct-changes
                (for [[morph prop-changes] id->prop-changes]
                  (apply concat (for [[prop value] prop-changes]
-                                 (list 'set-prop morph prop value))))))
+                                 (list '=> morph prop value))))))
        map-expr))))

-(defmethod changes->form 'for
+(defmethod changes->form* 'for
   ([for-expr {struct-changes :structurep
               id->prop-changes :properties} {loc :idx
                                              bound-props :bound-props}]
@@ -185,27 +187,30 @@

 ; default expression change preserving

-(defmethod changes->form :default
+(defmethod changes->form* :default
   ([expr {struct-changes :structure
           id->prop-changes :properties} _]
-   (apply list '-> expr
-     (concat struct-changes
-             (for [[morph prop-changes] id->prop-changes]
-               (apply concat (for [[prop value] prop-changes]
-                               (list 'set-prop morph prop value))))))))
+   (if (or (not-empty struct-changes) (-> id->prop-changes empty? not))
+     (apply list '-> expr
+       (apply concat struct-changes
+         (for [[morph prop-changes] id->prop-changes]
+           (concat (for [[prop value] prop-changes]
+                     (list '=> morph prop value))))))
+     expr)))

 (defmulti apply-changes
   "Applies the changes to the expression and also updates the change meta-data accordingly"
   (fn [expr changes] (ast-type expr)))

 (defmethod apply-changes :morph [morph changes]
-  (morph-eval (changes->form (-> morph meta :description) changes)))
+  (morph-eval (changes->form (-> morph meta :description) changes {})))

 (defmethod apply-changes :expr [expr changes]
   (let [new-description (changes->form (-> expr meta :description) changes {:expanded-expression expr})
         new-expansion (morph-eval new-description)]
     (vary-meta new-expansion merge
       {:expanded-expression? true
+       :init-description (expr meta :init-description)
        :description new-description})))

 ; SUBMORPH LENS
@@ -233,8 +238,7 @@
                                 (changes->form
                                   (-> expr meta :description)
                                   (fetch expr changes)
-                                  {:expanded-expression new-expansion}))
-                     ))))
+                                  {:expanded-expression new-expansion}))))))

 ; this will never happen, since (fetch [ vector ] [submorphs idx] == [idx])
 (defmethod putback-submorphs :vector [morphs new-submorphs]
@@ -281,16 +285,25 @@

 ; DESCRIPTION LENS

+(defn merge-meta-data [old-expr new-expr]
+  (putback (vary-meta new-expr #(merge (meta old-expr) %)) submorphs
+           (map merge-meta-data
+                (concat (fetch old-expr submorphs) (iterate identity {}))
+                (fetch new-expr submorphs))))
+
 (deflens description [expr new-description]
   :fetch
   (with-out-str
     (-> expr meta :description pprint))
   :putback
-  (let [new-expr (if (string? new-description) (morph-eval-str (str "'" new-description)) new-description)]
+  (let [new-expr (if (string? new-description)
+                   (morph-eval-str (str "'" new-description))
+                   new-description)]
     (if (morph? new-expr)
-      (vary-meta (morph-eval new-expr) #(merge (meta expr) %))
+      (merge-meta-data expr (morph-eval new-expr))
       (vary-meta (morph-eval new-expr) merge {:expanded-expression? true
                                               :description new-expr
+                                              :init-description new-expr
                                               :changes {}}))))

 ; CHANGES LENS


Wire up country selector

Wire up country selector

--- src/cljs/whatishistory/core.cljs
+++ src/cljs/whatishistory/core.cljs
@@ -359,7 +359,8 @@
                             (swap! app-atom assoc :profession evt.target.value))}]
       [:label {:for "country"} "Where are you at the moment?"]
       [:select {:on-change (fn [evt]
-                            (swap! app-atom assoc :definition evt.target.value))}
+                            (swap! app-atom assoc :country evt.target.value))}
+         [:option {:key "select"} "Select Country"]
        (for [country js/window.countries]
          [:option {:key (hash country)} country])]
       [:div
@@ -380,9 +381,10 @@
                :placeholder "Profession"
                :on-change (fn [evt]
                             (swap! app-atom assoc :profession evt.target.value))}]
-      [:label {:for "country"} "Where was the auth when she/he penned this definition?"]
+      [:label {:for "country"} "Where was the author when she/he penned this definition?"]
       [:select {:on-change (fn [evt]
-                            (swap! app-atom assoc :definition evt.target.value))}
+                            (swap! app-atom assoc :country evt.target.value))}
+       [:option {:key "select"} "Select Country"]
        (for [country js/window.countries]
          [:option {:key (hash country)} country])]
       [:div


Blacklist the pref! macro

Blacklist the pref! macro

--- src/clojure/nightmod/sandbox.clj
+++ src/clojure/nightmod/sandbox.clj
@@ -21,7 +21,7 @@
      System/out System/in System/err
      defscreen* defgame* defgame set-screen! setScreen set-screen-wrapper!
      app! app on-gl
-     loader loader! resolver
+     loader loader! resolver pref!
      asset-manager* asset-manager set-asset-manager!
      reify proxy gen-class})


CMR-563: Removed debug output.

CMR-563: Removed debug output.

--- src/cmr/transmit/metadata_db.clj
+++ src/cmr/transmit/metadata_db.clj
@@ -66,7 +66,6 @@
 (deftracefn get-concept-revisions
   "Search metadata db and return the concepts given by the concept-id, revision-id tuples."
   [context concept-tuples]
-  (println context)
   (let [conn (config/context->app-connection context :metadata-db)
         tuples-json-str (cheshire/generate-string concept-tuples)
         request-url (str (conn/root-url conn) "/concepts/search/concept-revisions")


Fix react key error

Fix react key error

--- src/discuss/utils/bootstrap.cljs
+++ src/discuss/utils/bootstrap.cljs
@@ -28,18 +28,21 @@
 (defn panel-wrapper
   "Wrap content into bootstrap's panel class."
   [& content]
-  (dom/div #js {:className "panel panel-default"}
+  (dom/div #js {:className "panel panel-default"
+                :key       (lib/get-unique-key)}
            (dom/div #js {:className "panel-body"}
                     content)))

 (defn callout-info
   "Wrap content into bootstrap callout."
   [& content]
-  (dom/div #js {:className "bs-callout bs-callout-info"}
+  (dom/div #js {:className "bs-callout bs-callout-info"
+                :key       (lib/get-unique-key)}
            content))

 (defn center
   "Use text-center to align text."
   [& content]
-  (dom/div #js {:className "text-center"}
+  (dom/div #js {:className "text-center"
+                :key       (lib/get-unique-key)}
            content))


Added other initialization modes.

Added other initialization modes.

--- src/dragon/components/system.clj
+++ src/dragon/components/system.clj
@@ -4,7 +4,7 @@
             [dragon.components.event :as event]
             [dragon.components.logging :as logging]))

-(defn initialize []
+(defn initialize-default []
   (component/system-map
    :config (config/create-config-component)
    :logging (component/using
@@ -13,6 +13,17 @@
    :event (component/using
            (event/create-event-component)
            [:config :logging])))
+
+(defn initialize-config-only []
+  (component/system-map
+   :config (config/create-config-component)))
+
+(defn initialize-with-no-events []
+  (component/system-map
+   :config (config/create-config-component)
+   :logging (component/using
+             (logging/create-logging-component)
+             [:config])))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;   Managment Functions   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -29,7 +40,7 @@

 (defn start
   ([]
-   (start (initialize)))
+   (start (initialize-default)))
   ([system]
    (component/start system))
   ([system component-key]


Implemented reading of test results

Implemented reading of test results

--- src/emender_service/rest_api.clj
+++ src/emender_service/rest_api.clj
@@ -13,6 +13,7 @@
 (ns emender-service.rest-api)

 (require '[ring.util.response     :as http-response])
+(require '[clojure.pprint         :as pprint])
 (require '[clojure.data.json      :as json])

 (require '[emender-service.file-utils :as file-utils])
@@ -21,10 +22,19 @@
     [request]
     (file-utils/slurp- (:body request)))

-(defn body->job-name
+(defn body->results
     [body]
-    (let [data (json/read-str body)]
-        (get data "name")))
+    (json/read-str body))
+
+(defn read-job-name-from-uri
+    [uri]
+    (-> uri
+        (subs (inc (.lastIndexOf uri "/")))
+        (clojure.string/replace "+" " ")))
+
+(defn read-job-name-from-request
+    [request]
+    (read-job-name-from-uri (:uri request)))

 (defn send-response
     [response]
@@ -47,13 +57,22 @@

 (defn job-started-handler
     [request]
-    (let [job-name (-> (read-request-body request) body->job-name)]
+    (let [job-name (read-job-name-from-request request)]
         (println "job started" job-name)
         (send-response {:status :ok})))

 (defn job-finished-handler
     [request]
-    (let [job-name (-> (read-request-body request) body->job-name)]
+    (let [job-name (read-job-name-from-request request)]
         (println "job finished" job-name)
         (send-response {:status :ok})))

+(defn job-results-handler
+    [request]
+    (let [job-name (read-job-name-from-request request)
+          results  (-> (read-request-body request) body->results)]
+        (println "job name" job-name)
+        (println "results:" results)
+        ;(pprint/pprint results)
+        (send-response {:status :ok})))
+


Fix map-traversal-dispatch-map

Fix map-traversal-dispatch-map

--- src/io/aviso/rook/dispatcher.clj
+++ src/io/aviso/rook/dispatcher.clj
@@ -403,18 +403,14 @@
                          (apply ef args)))
                   h  (apply-middleware mw sync? f)

-                  dispatch-path (conj
-                                  (mapv (fn [seg]
-                                          (if (variable? seg)
-                                            ::param-next
-                                            seg))
-                                    pathvec)
-                                  method)
+                  pathvec' (mapv #(if (variable? %) ::param-next %) pathvec)
+
+                  dispatch-path (conj pathvec' method)
                   binding-names (filter variable? pathvec)
                   binding-paths (keep-indexed
                                   (fn [i seg]
                                     (if (variable? seg)
-                                      (-> (subvec pathvec 0 i)
+                                      (-> (subvec pathvec' 0 i)
                                         (into [])
                                         (conj ::param-name))))
                                   pathvec)]


PUT entities as tall CSVs

PUT entities as tall CSVs

--- src/kixi/hecuba/api/entities.clj
+++ src/kixi/hecuba/api/entities.clj
@@ -292,13 +292,9 @@
       (when (and project_id property_code)
         (when-not (empty? (-> (db/execute session (hayt/select :projects (hayt/where [[= :id project_id]]))) first))
           (let [entity_id (sha1/gen-key :entity entity)
-                query-entity (-> entity
-                                 (assoc :user_id user_id
-                                        :id entity_id)
-                                 ;;(update-stringified-lists
-                                 ;;  [:documents :notes :photos])
-                                 ;;(update-in [:property_data] json/encode)
-                                 )]
+                query-entity (assoc entity
+                                    :user_id user_id
+                                    :id entity_id)]
             (entities/insert session query-entity)
             {::entity_id entity_id}))))))

@@ -342,11 +338,14 @@
 (defn resource-put! [store ctx]
   (db/with-session [session (:hecuba-session store)]
     (let [request   (:request ctx)
-          entity    (-> request decode-body)
+          decoded-body (decode-body request)
+          body      (if (= "text/csv" (:content-type request))
+                      (let [body-map (into {} decoded-body)]
+                        (parse-by-schema body-map entity-schema))
+                      decoded-body)
           entity_id (-> (::item ctx) :id)
-          username  (sec/session-username (-> ctx :request :session))
-          user_id   (:id (users/get-by-username session username))]
-      (entities/update session entity_id (assoc entity :user_id user_id)))))
+          username  (sec/session-username (-> ctx :request :session))]
+      (entities/update session entity_id (assoc body :user_id username)))))

 (defn resource-delete! [store ctx]
   (db/with-session [session (:hecuba-session store)]


Rename some of the record types used to store nodes

--- src/main/clojure/cascade/dom.clj
+++ src/main/clojure/cascade/dom.clj
@@ -99,7 +99,7 @@
   (doseq [node dom-nodes]
     (stream node strategy out)))

-(defrecord ElementNode [name attributes content]
+(defrecord Element [name attributes content]

   NodeStreaming
   (stream [node strategy out]
@@ -121,9 +121,9 @@
           (stream-nodes content strategy out)
           (write out "</" element-name ">"))))))

-; TODO: possibly don't need RawNode, instead extend NodeStreaming to String
-
-(defrecord RawNode [text]
+; TODO: possibly don't need Text, instead extend NodeStreaming to String
+
+(defrecord Text [text]

   NodeStreaming
   (stream [node strategy out]
@@ -139,12 +139,12 @@

 (defn element-node
   [name attributes content]
-  (ElementNode. name attributes content))
+  (Element. name attributes content))

 (defn raw-node
   "Wraps a string as a text DOM node, but does not do any filtering of the value."
   [s]
-  (RawNode. s))
+  (Text. s))

 (defn text-node
   "Creates a text node from the string. The string is encoded when the node is constructed."
@@ -185,15 +185,15 @@
   (stream-nodes dom-nodes html-strategy out))

 (defn element?
-  "Is the node a DOM ElementNode?"
+  "Is the node a DOM Element?"
   [node]
-  (instance? ElementNode node))
+  (instance? Element node))

 (defn dom-node?
   "Is the object some kind of DOM node?"
   [node]
   (or (element? node)
-    (instance? RawNode node)
+    (instance? Text node)
     (instance? Comment node)))

 (defn dom-zipper


counter-devcards: fix "Warning: setState(...): Cannot update during an existing state transition" by starting the app after view is mounted

--- examples/counter-devcards/src/app/core.cljs
+++ examples/counter-devcards/src/app/core.cljs
@@ -13,20 +13,21 @@

 (devcards.core/start-devcard-ui!)

-(defn -div-with-unmount-callback
-  [_body unmount-cb]
-  (r/create-class {:reagent-render         (fn [body _unmount-cb] (into [:div] body))
-                   :component-will-unmount (fn [_this] (unmount-cb))}))
+(defn -with-mount-callbacks
+  [_component did-mount-cb will-unmount-cb]
+  (r/create-class {:reagent-render         (fn [component _did-mount-cb _will-unmount-cb] component)
+                   :component-did-mount    (fn [_this] (did-mount-cb))
+                   :component-will-unmount (fn [_this] (will-unmount-cb))}))

 (defcard-rg
   counter
   (let [app (carry/app (-> counter/spec
                            (logging/add "[counter] ")))
         [_ app-view] (carry-reagent/connect app counter/view-model counter/view)]
-    ((:dispatch-signal app) :on-start)

-    [-div-with-unmount-callback
-     [app-view]
+    [-with-mount-callbacks
+     app-view
+     #((:dispatch-signal app) :on-start)
      #((:dispatch-signal app) :on-stop)]))

 (defcard-rg
@@ -44,12 +45,12 @@

                              (logging/add "[counter-with-history] ")))
           [_ app-view] (carry-reagent/connect app counter/view-model counter/view)]
-      ; Start the app.
-      ((:dispatch-signal app) :on-start)
+      ; Render app view.
+      [-with-mount-callbacks
+       app-view

-      ; Render app view.
-      [-div-with-unmount-callback
-       [app-view]
+       ; Start the app after mounting.
+       #((:dispatch-signal app) :on-start)

        ; Stop the app on umount/hot-reload.
        #((:dispatch-signal app) :on-stop)]))


counter: fix min build compilation warning

--- examples/counter/src-spec/counter/core.cljs
+++ examples/counter/src-spec/counter/core.cljs
@@ -1,6 +1,7 @@
 ; namespace is extracted into a separate src folder in order to be reused in elm-ish architecture examples
 (ns counter.core
-  (:require [cljs.core.match :refer-macros [match]])
+  (:require [reagent.core]                                  ; is needed for reaction macro
+            [cljs.core.match :refer-macros [match]])
   (:require-macros [reagent.ratom :refer [reaction]]))

 (def -initial-model {:val 0})


Wrap up basic Launchpad Mini/S support

Wrap up basic Launchpad Mini/S support

--- src/afterglow/controllers/launchpad_mini.clj
+++ src/afterglow/controllers/launchpad_mini.clj
@@ -120,6 +120,16 @@
   (when (not= origin @(:origin controller))
     (reset! (:origin controller) origin)
     (doseq [f @(:move-listeners controller)] (f @(:grid-controller-impl controller) :moved))))
+
+(defn show-round-buttons
+  "Illuminates all round buttons."
+  ([controller]
+   (show-round-buttons controller button-available-color))
+  ([controller color]
+   (doseq [[_ control] control-buttons]
+     (midi/midi-control (:port-out controller) control color))
+   (doseq [note (range 8 121 16)]
+     (midi/midi-note-on (:port-out controller) note color))))

 (defn clear-interface
   "Clears all illuminated buttons and pads."
@@ -480,59 +490,38 @@
   the main interface update thread, and terminate the task running the
   animation."
   [controller counter task]
-  (try
-    (cond
-      true  ; TODO: For now we have no animation; remove this entry once the below is finished.
-      (do
-        (start-interface controller)
-        (at-at/kill @task))
-
-      (< @counter 8)
-      (doseq [y (range 0 (inc @counter))]
-        (let [color (colors/create-color
-                     :h 0 :s 0 :l (max 10 (- 75 (/ (* 50 (- @counter y)) 6))))]
-          (set-pad-color controller 3 y color)
-          (set-pad-color controller 4 y color)))
-
-      (< @counter 12)
-      (doseq [x (range 0 (- @counter 7))
-              y (range 0 8)]
-        (let [color (colors/create-color
-                     :h 340 :s 100 :l (- 75 (* (- @counter 8 x) 20)))]
-          (set-pad-color controller (- 3 x) y color)
-          (set-pad-color controller (+ 4 x) y color)))
-
-      (< @counter 15)
-      (doseq [y (range 0 8)]
-        (let [color (colors/create-color
-                     :h (* 13 (- @counter 11)) :s 100 :l 50)]
-          (set-pad-color controller (- @counter 7) y color)
-          (set-pad-color controller (- 14 @counter) y color)))
-
-      #_(= @counter 15)
-      #_(show-labels controller (colors/create-color :cyan))
-
-      (< @counter 24)
-      (doseq [x (range 0 8)]
-        (let [lightness-index (if (> x 3) (- 7 x) x)
-              lightness ([10 30 50 70] lightness-index)
-              color (colors/create-color
-                     :h (+ 60 (* 40 (- @counter 18))) :s 100 :l lightness)]
-          (set-pad-color controller x (- 23 @counter) color)))
-
-      #_(= @counter 24)
-      #_(show-labels controller (colors/create-color :blue))
-
-      (< @counter 33)
-      (doseq [x (range 0 8)]
-        (set-pad-color controller x (- 32 @counter) button-off-color))
-
-      :else
-      (do
-        (start-interface controller)
-        (at-at/kill @task)))
-    (catch Throwable t
-      (warn t "Animation frame failed")))
+  (let [gradient [0x3c 0x3e 0x3f 0x2f 0x1f 0x0f 0x0e 0x0d]]
+    (try
+      (cond
+        (< @counter 8)
+        (doseq [y (range 0 (inc @counter))]
+          (let [color (gradient (- @counter y))]
+            (set-pad-color controller 3 y color)
+            (set-pad-color controller 4 y color)))
+
+        (< @counter 12)
+        (doseq [x (range 0 (- @counter 7))
+                y (range 0 8)]
+          (let [color (gradient (- @counter 8 x))]
+            (set-pad-color controller (- 3 x) y color)
+            (set-pad-color controller (+ 4 x) y color)))
+
+        (= @counter 12)
+        (show-round-buttons controller 0x3e)
+
+        (= @counter 20)
+        (show-round-buttons controller 0x1f)
+
+        (< @counter 29)
+        (doseq [x (range 0 8)]
+          (set-pad-color controller x (- 28 @counter) button-off-color))
+
+        :else
+        (do
+          (start-interface controller)
+          (at-at/kill @task)))
+      (catch Throwable t
+        (warn t "Animation frame failed"))))

   (swap! counter inc))

@@ -606,9 +595,11 @@
   assigned device ID if the identity is correct, or logs an error and
   returns nil if it is not."
   [port-in port-out]
-  (let [ident (controllers/identify port-in port-out)]
-    (if (= (take 5 (drop 4 (:data ident))) '(0 32 41 54 0))
-      (aget (:data ident) 1)
+  (let [ident-msg (controllers/identify port-in port-out)
+        ident (take 5 (drop 4 (:data ident-msg)))]
+    (if (or (= ident '(0 32 41 54 0))   ; Launchpad Mini
+            (= ident '(0 32 41 32 0)))  ; Launchpad S
+      (aget (:data ident-msg) 1)
       (timbre/error "Device does not identify as a Launchpad Mini:" port-in))))

 (defn bind-to-show


Fix display of embeds in read messages

Fix display of embeds in read messages

Fixes #124

--- src/braid/core/client/ui/styles/message.cljs
+++ src/braid/core/client/ui/styles/message.cljs
@@ -29,7 +29,7 @@
      ; causing hover-cards to display under subsequent messages
      ["> .info"
       "> .avatar img"
-      "> .embed"
+      "> .post-message"
       "> .content > img"
       "> .content > .dummy > .user > .pill"
       "> .content > .dummy > .tag > .pill"


Hook plan editing UI up with dangerzone API

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -970,7 +970,9 @@
     (go
      (let [api-result (<! (ajax/managed-ajax
                            :put
-                           (gstring/format "/api/v1/organization/%s/%s" org-name "plan")
+                           (gstring/format "/api/dangerzone/organization/%s/%s/plan"
+                                           vcs-type
+                                           org-name)
                            :params {:containers containers}))]
        (put! api-ch [:update-plan
                      (:status api-result)
@@ -986,7 +988,9 @@
     (go
       (let [api-result (<! (ajax/managed-ajax
                              :put
-                             (gstring/format "/api/v1/organization/%s/%s" org-name "plan")
+                             (gstring/format "/api/dangerzone/organization/%s/%s/plan"
+                                             vcs-type
+                                             org-name)
                              :params {:osx plan-type}))]
         (put! api-ch [:update-plan
                       (:status api-result)
@@ -1189,7 +1193,9 @@
     (go
       (let [api-result (<! (ajax/managed-ajax
                               :put
-                              (gstring/format "/api/v1/organization/%s/plan" org-name)
+                              (gstring/format "/api/dangerzone/organization/%s/%s/plan"
+                                              vcs-type
+                                              org-name)
                               :params {:billing-email (:billing_email settings)
                                        :billing-name (:billing_name settings)
                                        :extra-billing-data (:extra_billing_data settings)}))]


renaming

renaming

--- src/clj/algorithms_clj/macro_initiation.clj
+++ src/clj/algorithms_clj/macro_initiation.clj
@@ -414,7 +414,8 @@
     (remove keyword?)
     (vec)))

-(defn log-prefix
+(defn function-log-prefix
+  "Return the prefix of the log entry for a function"
   [fct-name]
   (str "[TRACE] Call to \"" fct-name "\" with arguments: "))

@@ -422,7 +423,7 @@
   [fct-name binding-vec]
   (let [bindings (bindings->bound-vars binding-vec)]
     `(log-symbol-values
-       ~(log-prefix fct-name)
+       ~(function-log-prefix fct-name)
        (quote ~bindings)
        ~bindings)))


Use more generic message for in-request

Use more generic message for in-request

--- src/com/puppetlabs/puppetdb/query/facts.clj
+++ src/com/puppetlabs/puppetdb/query/facts.clj
@@ -121,7 +121,7 @@
           (string? (:where %))]}
   (let [{:keys [where params] :as query} (compile-term subselect)]
     (when-not (fact-columns field)
-      (throw (IllegalArgumentException. (format "Can't match on unknown fact field '%s' for 'in-result'" field))))
+      (throw (IllegalArgumentException. (format "Can't match on unknown %s field '%s' for 'in-result'" type field))))
     (assoc query :where (format "%s IN (%s)" field where))))

 (defmethod compile-term :numeric-comparison


(PDB-1363) Revert "(maint) applied-migrations: don't ignore exceptions"

We can't assume that we'll have access to the public schema.

This reverts commit 53210f67eb8b2223cfb719ae484313b8cec55042.

--- src/com/puppetlabs/puppetdb/scf/migrate.clj
+++ src/com/puppetlabs/puppetdb/scf/migrate.clj
@@ -1025,14 +1025,12 @@
   {:post  [(sorted? %)
            (set? %)
            (apply < 0 %)]}
-  (sql/transaction
-   (if-not (some #(= (string/lower-case %) "schema_migrations")
-                 (scf-utils/sql-current-connection-table-names))
-     (sorted-set)
-     (apply sorted-set
-            (map :version
-                 (query-to-vec
-                  "SELECT version FROM schema_migrations ORDER BY version"))))))
+  (try
+    (let [query   "SELECT version FROM schema_migrations ORDER BY version"
+          results (sql/transaction (query-to-vec query))]
+      (apply sorted-set (map :version results)))
+    (catch java.sql.SQLException e
+      (sorted-set))))

 (defn pending-migrations
   "Returns a collection of pending migrations, ordered from oldest to latest."


The order of (keys m) and (vals m) is not guaranteed to be the same

See http://dev.clojure.org/jira/browse/CLJ-1302 for more info

--- src/com/puppetlabs/puppetdb/scf/storage.clj
+++ src/com/puppetlabs/puppetdb/scf/storage.clj
@@ -624,8 +624,9 @@
     timestamp :- pls/Timestamp]

      (let [refs-to-hashes (time! (:resource-hashes metrics)
-                                 (zipmap (keys resources)
-                                         (map shash/resource-identity-hash (vals resources))))
+                                 (reduce-kv (fn [acc k v]
+                                              (assoc acc k (shash/resource-identity-hash v)))
+                                            {} resources))
            hash           (time! (:catalog-hash metrics)
                                  (shash/catalog-similarity-hash catalog))
            {id :id


Boolean implementation should return request

It shouldn't be returning true, as per the HttpRequestAuthorizer
protocol semantics.

--- modules/entrance/src/modular/entrance.clj
+++ modules/entrance/src/modular/entrance.clj
@@ -27,7 +27,8 @@

 (extend-protocol HttpRequestAuthorizer
   Boolean
-  (authorized-request? [this request] this))
+  (authorized-request? [this request]
+    (when this request)))

 (defprotocol UserPasswordAuthorizer
   (authorized-user? [_ user password]))


This should stop killing everything

This should stop killing everything

--- src/doctopus/storage/impls/permanent_fs.clj
+++ src/doctopus/storage/impls/permanent_fs.clj
@@ -13,8 +13,7 @@
   (do (log/error "Configuration couldn't be correctly loaded. Most"
               "often, this is caused by an unset NOMAD_ENV"
               "environment variable; make sure NOMAD_ENV=dev,"
-              "and try again.")
-      (System/exit 1)))
+              "and try again. Until then, behavior may be very odd")))

 (if-not (fs/exists? root) (fs/mkdirs root))


[PDOK-1579] no join between timeline and delta when query for action 'D'elete in delta

--- src/main/clojure/pdok/featured/timeline.clj
+++ src/main/clojure/pdok/featured/timeline.clj
@@ -127,21 +127,16 @@
 (defn versions-deleted-in-delta
   ([timeline dataset collection] (versions-deleted-in-delta timeline {:dataset dataset :collection collection}))
   ([timeline selector]
-   (let [history (qualified-history)
-         history-delta (qualified-history-delta)
+   (let [history-delta (qualified-history-delta)
          clause-history (map->where-clause selector history-delta)
-         current (qualified-current)
          current-delta (qualified-current-delta)
          clause-current (map->where-clause selector current-delta)
-         query (str "SELECT " history-delta ".version as version "
-                    "FROM " history ", " history-delta " "
-                    "WHERE " history-delta ".action = 'D' "
-                    "AND " history ".version = " history-delta ".version "
+         query (str "SELECT version FROM " history-delta " "
+                    "WHERE action = 'D' "
                     "AND " clause-history
                     " UNION ALL "
-                    "SELECT " current-delta ".version as version FROM " current ", " current-delta " "
-                    "WHERE " current-delta ".action = 'D' "
-                    "AND " current ".version = " current-delta ".version "
+                    "SELECT version FROM " current-delta " "
+                    "WHERE action = 'D' "
                     "AND " clause-current)]
      (query-with-results-on-channel timeline query :version))))


removed legacy contracts

removed legacy contracts

--- src/name_bazaar/shared/smart_contracts.cljs
+++ src/name_bazaar/shared/smart_contracts.cljs
@@ -4,9 +4,6 @@
 {:auction-offering-factory
  {:name "AuctionOfferingFactory",
   :address "0x287631d399e08b917403986a949084877d2f39a5"},
- :buy-now-offering-library
- {:name "BuyNowOfferingLibrary",
-  :address "0x367decc92cbc3054d597c8314475c2f9c9aab47a"},
  :buy-now-offering-factory
  {:name "BuyNowOfferingFactory",
   :address "0x6815ad140b152157634be9ffc8c51d57e02da38e"},
@@ -16,9 +13,6 @@
  :buy-now-offering
  {:name "BuyNowOffering",
   :address "0xaf8a60b8d53f0563abadc3b33d0bf28517a6b696"},
- :auction-offering-library
- {:name "AuctionOfferingLibrary",
-  :address "0x132e4c91077eca527a4c8136e2c51e13379fd741"},
  :deed
  {:name "Deed", :address "0x0000000000000000000000000000000000000000"},
  :ens
@@ -32,9 +26,6 @@
  :offering-requests
  {:name "OfferingRequests",
   :address "0x016bdfcf49ecdd9592e493cd4a75048ce09d6d75"},
- :offering-library
- {:name "OfferingLibrary",
-  :address "0x8936ff910fc6244573d5b19683c5423e38cdfd49"},
  :auction-offering
  {:name "AuctionOffering",
   :address "0x24b6ee04740ce5051539117409660f15e29ea329"}})


correct test errors

correct test errors

--- test/clj_money/models/transactions_test.clj
+++ test/clj_money/models/transactions_test.clj
@@ -499,7 +499,7 @@
           "The groceries account balance should be correct after update"))
     (testing "transaction is updated"
       (is (= (t/local-date 2016 3 10)
-             (:transaction-date (transaction/reload storage-spec t3)))
+             (:transaction-date (transactions/reload storage-spec t3)))
           "The transaction should be updated"))))

 (def short-circuit-context
@@ -652,7 +652,7 @@
          rent
          groceries] (:accounts context)
         [t1 t2 t3 t4] (:transactions context)
-        _ (transactions/update storage-spec (assoc t3 :account-id (:id rent)))
+        _ (transactions/update storage-spec (assoc-in t3 [:items 0 :account-id] (:id rent)))
         groceries-items (transactions/items-by-account storage-spec (:id groceries))
         rent-items (transactions/items-by-account storage-spec (:id rent))
         expected-groceries [{:index 1
@@ -666,26 +666,24 @@
                         :balance (bigdec 102)}]
         actual-groceries (map #(select-keys % [:index :amount :balance])
                               groceries-items)]
-
-    (pprint {:expected expected-groceries
-             :actual actual-groceries
-             :diff (diff expected-groceries actual-groceries)})
-
     (testing "accounts have the correct items"
       (is (= expected-groceries actual-groceries)
           "Groceries should have the correct items after update")
-      #_(is (= expected-rent
+      (is (= expected-rent
              (map #(select-keys % [:index :amount :balance]) rent-items))))
-    #_(testing "accounts have the correct balances"
+    (testing "accounts have the correct balances"
       (is (= (bigdec 204)
-             (:balance (accounts/reload storage-spec groceries))))
+             (:balance (accounts/reload storage-spec groceries)))
+          "The groceries account has the correct balance after update")
       (is (= (bigdec 102)
-             (:balance (accounts/reload storage-spec rent)))))))
+             (:balance (accounts/reload storage-spec rent)))
+          "The rend account has the correct balance after update"))))

 ; update a transaction

 ; change account
 ;  old account balance and items are recalculated
 ;  new account balance and items are recalculated
+; change action
 ; add a transaction item
 ; remove a transaction item


fix cljs tests

fix cljs tests

--- test/citrus/core_test.cljs
+++ test/citrus/core_test.cljs
@@ -82,7 +82,7 @@

   (testing "dispatch-sync! a non-existing event fails"
     (is (thrown-with-msg? js/Error
-                          #"No method .* for dispatch value: :non-existing-event"
+                          #"Assert failed: Controller :test doesn't declare :non-existing-event method"
                           (citrus/dispatch-sync! r :test :non-existing-event)))))

@@ -101,7 +101,7 @@

   (testing "broadcast-sync! a non-existing event fails"
     (is (thrown-with-msg? js/Error
-                          #"No method .* for dispatch value: :non-existing-event"
+                          #"Assert failed: Controller :test doesn't declare :non-existing-event method"
                           (citrus/broadcast-sync! r :non-existing-event)))))

@@ -123,13 +123,9 @@
                                             (done)))))

   (testing "dispatch! an non-existing event fails"
-    (let [err-handler (fn [err]
-                        (is (re-find #"No method .* for dispatch value: :non-existing-dispatch" (.toString err))))]
-      (obj/set js/window "onerror" err-handler)
-      (citrus/dispatch! r :test :non-existing-dispatch)
-      (async done (js/requestAnimationFrame (fn []
-                                                (obj/set js/window "onerror" nil)
-                                                (done)))))))
+    (is (thrown-with-msg? js/Error
+                          #"Assert failed: Controller :test doesn't declare :non-existing-dispatch method"
+                          (citrus/dispatch! r :test :non-existing-dispatch)))))

 (deftest broadcast!
@@ -154,13 +150,9 @@
                                             (done)))))

   (testing "broadcast! an non-existing event fails"
-    (let [err-handler (fn [err]
-                        (is (re-find #"No method .* for dispatch value: :non-existing-broadcast" (.toString err))))]
-      (obj/set js/window "onerror" err-handler)
-      (citrus/broadcast! r :non-existing-broadcast)
-      (async done (js/requestAnimationFrame (fn []
-                                              (obj/set js/window "onerror" nil)
-                                              (done)))))))
+    (is (thrown-with-msg? js/Error
+                          #"Assert failed: Controller :test doesn't declare :non-existing-broadcast method"
+                          (citrus/broadcast! r :non-existing-broadcast)))))

 (deftest dispatch-nil-state-issue-20
   ;https://github.com/roman01la/citrus/issues/20
@@ -253,7 +245,7 @@
       (is (nil? @sub))))

   (testing "an asynchronous scheduler updates state asynchronously"
-    (let [async-delay 50 ;; in ms
+    (let [async-delay 50                                    ;; in ms
           r (citrus/reconciler {:state           (atom {:test :initial-state})
                                 :controllers     {:test test-controller}
                                 :batched-updates {:schedule-fn (fn [f] (js/setTimeout f async-delay)) :release-fn (fn [id] (js/clearTimeout id))}})


extra test in :exec-string-iterate, per Tom


Fix shadowing.

Fix shadowing.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -184,7 +184,7 @@
             (>!! (:onyx.core/complete-ch event) true))))
       (recur))))

-(defrecord TaskLifeCycle [id log queue job-id task-id outbox-ch err-ch seal-ch opts]
+(defrecord TaskLifeCycle [id log queue job-id task-id outbox-ch err-ch seal-resp-ch opts]
   component/Lifecycle

   (start [component]
@@ -238,7 +238,7 @@
                          :onyx.core/queue queue
                          :onyx.core/log log
                          :onyx.core/outbox-ch outbox-ch
-                         :onyx.core/seal-response-ch seal-ch
+                         :onyx.core/seal-response-ch seal-resp-ch
                          :onyx.core/peer-opts opts
                          :onyx.core/pipeline-state (atom {})}

@@ -503,7 +503,7 @@
 (defn task-lifecycle [args {:keys [id log queue job task outbox-ch err-ch seal-ch opts]}]
   (map->TaskLifeCycle {:id id :log log :queue queue :job-id job
                        :task-id task :outbox-ch outbox-ch
-                       :err-ch err-ch :seal-ch seal-ch :opts opts}))
+                       :err-ch err-ch :seal-resp-ch seal-ch :opts opts}))

 (dire/with-post-hook! #'munge-start-lifecycle
   (fn [{:keys [onyx.core/id onyx.core/lifecycle-id onyx.core/start-lifecycle?] :as event}]


Drop dependency on me.raynes.fs

Drop dependency on me.raynes.fs

--- test/mdr2/test/archive.clj
+++ test/mdr2/test/archive.clj
@@ -4,7 +4,8 @@
             [environ.core :refer [env]]
             [mdr2.archive :as archive]
             [mdr2.production :as prod]
-            [me.raynes.fs :as fs]))
+            [org.tobereplaced.nio.file :as nio]
+            [mdr2.util :as util]))

 (def mock-db (atom []))

@@ -22,16 +23,16 @@
 (defn mock-set-state-archived! [production])

 (defn setup-spool-dirs [test-fn]
-  (fs/mkdirs (env :archive-spool-dir))
-  (fs/mkdirs (env :archive-periodical-spool-dir))
-  (fs/mkdirs (env :archive-other-spool-dir))
+  (nio/create-directories! (env :archive-spool-dir))
+  (nio/create-directories! (env :archive-periodical-spool-dir))
+  (nio/create-directories! (env :archive-other-spool-dir))
   (reset! mock-db [])
   (with-redefs [clojure.java.jdbc/insert! mock-jdbc-insert
                 mdr2.production/set-state-archived! mock-set-state-archived!]
     (test-fn))
-  (fs/delete-dir (env :archive-spool-dir))
-  (fs/delete-dir (env :archive-periodical-spool-dir))
-  (fs/delete-dir (env :archive-other-spool-dir)))
+  (util/delete-directory! (env :archive-spool-dir))
+  (util/delete-directory! (env :archive-periodical-spool-dir))
+  (util/delete-directory! (env :archive-other-spool-dir)))

 (use-fixtures :each setup-spool-dirs)

@@ -84,17 +85,17 @@
                        (merge {:verzeichnis ds-number
                                :sektion "cdimage"}
                               default-container-entry)]))
-      (are [file] (fs/exists? file)
+      (are [f] (nio/exists? f)
            ;; check if the master has been copied
-           (fs/file spool-dir dam-number "produkt" dam-number "aud001.wav")
-           (fs/file spool-dir dam-number "produkt" dam-number "ncc.html")
-           (fs/file spool-dir dam-number "produkt" dam-number "master.smil")
+           (file spool-dir dam-number "produkt" dam-number "aud001.wav")
+           (file spool-dir dam-number "produkt" dam-number "ncc.html")
+           (file spool-dir dam-number "produkt" dam-number "master.smil")
            ;; check if the master has an rdf
-           (fs/file spool-dir dam-number (str dam-number ".rdf"))
+           (file spool-dir dam-number (str dam-number ".rdf"))
            ;; check if the distmaster has been copied...
-           (fs/file spool-dir ds-number "produkt" iso-name)
+           (file spool-dir ds-number "produkt" iso-name)
            ;; ...and that it has an rdf
-           (fs/file spool-dir ds-number (str ds-number ".rdf"))))))
+           (file spool-dir ds-number (str ds-number ".rdf"))))))

 (deftest book-multiple
   (testing "archiving a book with multiple volumes"
@@ -111,18 +112,18 @@
                        (merge {:verzeichnis ds-number
                                :sektion "cdimage"}
                               default-container-entry)]))
-      (are [file] (fs/exists? file)
+      (are [f] (nio/exists? f)
            ;; check if the master has been copied
-           (fs/file spool-dir dam-number "produkt" dam-number "aud001.wav")
-           (fs/file spool-dir dam-number "produkt" dam-number "ncc.html")
-           (fs/file spool-dir dam-number "produkt" dam-number "master.smil")
+           (file spool-dir dam-number "produkt" dam-number "aud001.wav")
+           (file spool-dir dam-number "produkt" dam-number "ncc.html")
+           (file spool-dir dam-number "produkt" dam-number "master.smil")
            ;; check if the master has an rdf
-           (fs/file spool-dir dam-number (str dam-number ".rdf"))
+           (file spool-dir dam-number (str dam-number ".rdf"))
            ;; check if all the distmasters have been copied...
-           (fs/file spool-dir ds-number "produkt" (str ds-number "_1.iso"))
-           (fs/file spool-dir ds-number "produkt" (str ds-number "_2.iso"))
+           (file spool-dir ds-number "produkt" (str ds-number "_1.iso"))
+           (file spool-dir ds-number "produkt" (str ds-number "_2.iso"))
            ;; ...and that it has an rdf
-           (fs/file spool-dir ds-number (str ds-number ".rdf"))))))
+           (file spool-dir ds-number (str ds-number ".rdf"))))))

 (deftest periodicals-single
   (testing "archiving of periodical single volume"
@@ -133,9 +134,9 @@
           iso-name (str dam-number ".iso")
           spool-dir (env :archive-periodical-spool-dir)]
       (archive/archive production)
-      (are [file] (fs/exists? file)
-           (fs/file spool-dir dam-number "produkt" iso-name)
-           (fs/file spool-dir dam-number rdf-name)))))
+      (are [f] (nio/exists? f)
+           (file spool-dir dam-number "produkt" iso-name)
+           (file spool-dir dam-number rdf-name)))))

 (deftest periodicals-multiple
   (testing "archiving of periodical multi volume"
@@ -146,9 +147,9 @@
           rdf-name (str dam-number ".rdf")
           spool-dir (env :archive-periodical-spool-dir)]
       (archive/archive production)
-      (are [file] (fs/exists? file)
-           (fs/file spool-dir dam-number "produkt" iso-name)
-           (fs/file spool-dir dam-number rdf-name)))))
+      (are [f] (nio/exists? f)
+           (file spool-dir dam-number "produkt" iso-name)
+           (file spool-dir dam-number rdf-name)))))

 (deftest other-single
   (testing "archiving of other production single volume"
@@ -161,9 +162,9 @@
           rdf-name (str dam-number ".rdf")
           spool-dir (env :archive-other-spool-dir)]
       (archive/archive production)
-      (are [file] (fs/exists? file)
-           (fs/file spool-dir dam-number "produkt" iso-name)
-           (fs/file spool-dir dam-number rdf-name)))))
+      (are [f] (nio/exists? f)
+           (file spool-dir dam-number "produkt" iso-name)
+           (file spool-dir dam-number rdf-name)))))

 (deftest other-multiple
   (testing "archiving of other production multi volume"
@@ -175,7 +176,7 @@
           dam-number (prod/dam-number production)
           rdf-name (str dam-number ".rdf")]
       (archive/archive production)
-      (are [file] (fs/exists? file)
-           (fs/file spool-dir dam-number "produkt" (str dam-number "_1.iso"))
-           (fs/file spool-dir dam-number "produkt" (str dam-number "_2.iso"))
-           (fs/file spool-dir dam-number rdf-name)))))
+      (are [f] (nio/exists? f)
+           (file spool-dir dam-number "produkt" (str dam-number "_1.iso"))
+           (file spool-dir dam-number "produkt" (str dam-number "_2.iso"))
+           (file spool-dir dam-number rdf-name)))))


Extract method for building a package config

--- src/radicalzephyr/boot_junit.clj
+++ src/radicalzephyr/boot_junit.clj
@@ -25,14 +25,16 @@
    :failed  (.getFailureCount result)
    :failures (map failure->map (.getFailures result))})

-(defn find-tests-in-package [^String package]
-  (let [^Configuration config
-        (.. (ConfigurationBuilder.)
-            (setUrls (ClasspathHelper/forPackage package (into-array ClassLoader [])))
-            (setScanners (into-array Scanner [(TypeAnnotationsScanner.)
-                                              (MethodAnnotationsScanner.)]))
-            (filterInputsBy (.. (FilterBuilder.)
-                                (includePackage (into-array String [package])))))
+(defn build-package-config [^String package]
+  (.. (ConfigurationBuilder.)
+      (setUrls (ClasspathHelper/forPackage package (into-array ClassLoader [])))
+      (setScanners (into-array Scanner [(TypeAnnotationsScanner.)
+                                        (MethodAnnotationsScanner.)]))
+      (filterInputsBy (.. (FilterBuilder.)
+                          (includePackage (into-array String [package]))))))
+
+(defn find-tests-in-package [package]
+  (let [^Configuration config (build-package-config package)
         reflections (Reflections. config)
         test-methods (.getMethodsAnnotatedWith reflections
                                                org.junit.Test)]


Improve doc

Improve doc

--- src/ruuvi/database/migration.clj
+++ src/ruuvi/database/migration.clj
@@ -2,6 +2,13 @@
   "Database migrations are a way to create and update database structure
   (e.g table and indices). Migration system keeps track what migrations
   are already applied to database.
+
+  Migrations are implemented as *.sql files in resources/ directory
+  from where they are loaded via classpath.
+
+  Each migration consist of foo.up.sql and foo.down.sql. *.up.sql is
+  executed to execute database change, *.down.sql is executed to rollback
+  the change.
   "
   (:require
    [clojure.tools.logging :refer [debug info]]


Added process, parse-and-process, and slurp-csv.

--- src/semantic_csv/transducers.clj
+++ src/semantic_csv/transducers.clj
@@ -102,3 +102,59 @@
 ;;         ([results input]
 ;;          (if @fst
 ;;            (rf results)))))))
+
+(defn process
+  "This function wraps together the most frequently used input processing capabilities,
+  controlled by an `opts` hash with opinionated defaults:
+
+  * `:mappify` - bool; transform rows from vectors into maps using `mappify`.
+  * `:keyify` - bool; specify whether header/column names should be turned into keywords (default: `true`).
+  * `:header` - specify header to be used in mappify; as per `mappify`, first row will not be consumed as header
+  * `:structs` - bool; use structs instead of array-maps or hash-maps in mappify.
+  * `:remove-comments` - bool; remove comment lines, as specified by `:comment-re` or `:comment-char`. Also
+     removes empty lines. Defaults to `true`.
+  * `:comment-re` - specify a regular expression to use for commenting out lines.
+  * `:comment-char` - specify a comment character to use for filtering out comments; overrides comment-re.
+  * `:cast-fns` - optional map of `colname | index -> cast-fn`; row maps will have the values as output by the
+     assigned `cast-fn`.
+  * `:cast-exception-handler` - If cast-fn raises an exception, this function will be called with args
+    `colname, value`, and the result used as the parse value.
+  * `:cast-only` - Only cast the specified column(s); can be either a single column name, or a vector of them."
+  ([{:keys [mappify keyify header remove-comments comment-re comment-char structs cast-fns cast-exception-handler cast-only]
+     :or   {mappify         true
+            keyify          true
+            remove-comments true
+            comment-re      #"^\#"}
+     :as opts}]
+   (let [map-fn (when mappify
+                  (if structs
+                    (semantic-csv.transducers/structify {:keyify keyify :header header})
+                    (semantic-csv.transducers/mappify {:keyify keyify :header header}))) ;; use mappify or structify
+         remove-fn (when remove-comments
+                     (semantic-csv.transducers/remove-comments {:comment-re comment-re :comment-char comment-char}))
+         cast-with-fn (when cast-fns
+                        (semantic-csv.transducers/cast-with cast-fns {:exception-handler cast-exception-handler :only cast-only}))
+         ]
+     (apply comp (remove nil? [remove-fn map-fn cast-with-fn]))))
+  ; Use all defaults
+  ([]
+   (process {})))
+
+(defn parse-and-process
+  "This is a convenience function for reading a csv file using `clojure/data.csv` and passing it through `process`
+  with the given set of options (specified _last_ as kw_args, in contrast with our other processing functions).
+  Note that `:parser-opts` can be specified and will be passed along to `clojure-csv/parse-csv`"
+  [csv-readable & {:keys [parser-opts]
+                   :or   {parser-opts {}}
+                   :as   opts}]
+  (let [rest-options (dissoc opts :parser-opts)]
+    (transduce (process rest-options) conj []
+     (impl/apply-kwargs csv/parse-csv csv-readable parser-opts))))
+
+(defn slurp-csv
+  "This convenience function let's you `parse-and-process` csv data given a csv filename. Note that it is _not_
+  lazy, and must read in all data so the file handle can be closed."
+  [csv-filename & {:as opts}]
+  (let [rest-options (dissoc opts :parser-opts)]
+    (with-open [in-file (io/reader csv-filename)]
+       (impl/apply-kwargs parse-and-process in-file opts))))


Add a failed decryption test

Add a failed decryption test

--- test/caesium/crypto/box_test.clj
+++ test/caesium/crypto/box_test.clj
@@ -3,6 +3,7 @@
             [caesium.crypto.scalarmult :as s]
             [caesium.util :as u]
             [caesium.vectors :as v]
+            [caesium.randombytes :as r]
             [clojure.test :refer [are deftest is testing]]))

 (deftest const-tests
@@ -47,4 +48,8 @@
     (is (u/array-eq ptext (b/decrypt bob-pk alice-sk nonce ctext)))
     (let [pk (u/hexify alice-pk)
           sk (u/hexify bob-sk)]
-      (is (thrown? ClassCastException (b/encrypt pk sk nonce ptext))))))
+      (is (thrown? ClassCastException (b/encrypt pk sk nonce ptext))))
+    (let [forgery (r/randombytes (alength ctext))]
+      (is (thrown-with-msg?
+           RuntimeException #"Ciphertext validation failed"
+           (b/decrypt bob-pk alice-sk nonce forgery))))))


Added 24 tests into irc-bot-test module

Added 24 tests into irc-bot-test module

--- test/clj_mrazik/irc_bot_test.clj
+++ test/clj_mrazik/irc_bot_test.clj
@@ -23,3 +23,146 @@
     [function-name]
     (clojure.test/function? function-name))

+(deftest test-load-data-file-existence
+    "Check that the clj-mrazik.irc-bot/load-data-file definition exists."
+    (testing "if the clj-mrazik.irc-bot/load-data-file definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/load-data-file))))
+
+
+(deftest test-load-vocabulary-existence
+    "Check that the clj-mrazik.irc-bot/load-vocabulary definition exists."
+    (testing "if the clj-mrazik.irc-bot/load-vocabulary definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/load-vocabulary))))
+
+
+(deftest test-message-to-channel?-existence
+    "Check that the clj-mrazik.irc-bot/message-to-channel? definition exists."
+    (testing "if the clj-mrazik.irc-bot/message-to-channel? definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/message-to-channel?))))
+
+
+(deftest test-message-for-me?-existence
+    "Check that the clj-mrazik.irc-bot/message-for-me? definition exists."
+    (testing "if the clj-mrazik.irc-bot/message-for-me? definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/message-for-me?))))
+
+
+(deftest test-create-reply-existence
+    "Check that the clj-mrazik.irc-bot/create-reply definition exists."
+    (testing "if the clj-mrazik.irc-bot/create-reply definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/create-reply))))
+
+
+(deftest test-format-schedule-existence
+    "Check that the clj-mrazik.irc-bot/format-schedule definition exists."
+    (testing "if the clj-mrazik.irc-bot/format-schedule definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/format-schedule))))
+
+
+(deftest test-random-message-existence
+    "Check that the clj-mrazik.irc-bot/random-message definition exists."
+    (testing "if the clj-mrazik.irc-bot/random-message definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/random-message))))
+
+
+(deftest test-primefactors-existence
+    "Check that the clj-mrazik.irc-bot/primefactors definition exists."
+    (testing "if the clj-mrazik.irc-bot/primefactors definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/primefactors))))
+
+
+(deftest test-factorial-existence
+    "Check that the clj-mrazik.irc-bot/factorial definition exists."
+    (testing "if the clj-mrazik.irc-bot/factorial definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/factorial))))
+
+
+(deftest test-gcd-existence
+    "Check that the clj-mrazik.irc-bot/gcd definition exists."
+    (testing "if the clj-mrazik.irc-bot/gcd definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/gcd))))
+
+
+(deftest test-print-factorial-existence
+    "Check that the clj-mrazik.irc-bot/print-factorial definition exists."
+    (testing "if the clj-mrazik.irc-bot/print-factorial definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/print-factorial))))
+
+
+(deftest test-s-expression-existence
+    "Check that the clj-mrazik.irc-bot/s-expression definition exists."
+    (testing "if the clj-mrazik.irc-bot/s-expression definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/s-expression))))
+
+
+(deftest test-is-s-expression?-existence
+    "Check that the clj-mrazik.irc-bot/is-s-expression? definition exists."
+    (testing "if the clj-mrazik.irc-bot/is-s-expression? definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/is-s-expression?))))
+
+
+(deftest test-print-prime-factors-existence
+    "Check that the clj-mrazik.irc-bot/print-prime-factors definition exists."
+    (testing "if the clj-mrazik.irc-bot/print-prime-factors definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/print-prime-factors))))
+
+
+(deftest test-print-gcd-existence
+    "Check that the clj-mrazik.irc-bot/print-gcd definition exists."
+    (testing "if the clj-mrazik.irc-bot/print-gcd definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/print-gcd))))
+
+
+(deftest test-is-number?-existence
+    "Check that the clj-mrazik.irc-bot/is-number? definition exists."
+    (testing "if the clj-mrazik.irc-bot/is-number? definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/is-number?))))
+
+
+(deftest test-is-two-numbers?-existence
+    "Check that the clj-mrazik.irc-bot/is-two-numbers? definition exists."
+    (testing "if the clj-mrazik.irc-bot/is-two-numbers? definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/is-two-numbers?))))
+
+
+(deftest test-is-factorial?-existence
+    "Check that the clj-mrazik.irc-bot/is-factorial? definition exists."
+    (testing "if the clj-mrazik.irc-bot/is-factorial? definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/is-factorial?))))
+
+
+(deftest test-is-word-from-dictionary?-existence
+    "Check that the clj-mrazik.irc-bot/is-word-from-dictionary? definition exists."
+    (testing "if the clj-mrazik.irc-bot/is-word-from-dictionary? definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/is-word-from-dictionary?))))
+
+
+(deftest test-return-words-from-dictionary-existence
+    "Check that the clj-mrazik.irc-bot/return-words-from-dictionary definition exists."
+    (testing "if the clj-mrazik.irc-bot/return-words-from-dictionary definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/return-words-from-dictionary))))
+
+
+(deftest test-prepare-reply-text-existence
+    "Check that the clj-mrazik.irc-bot/prepare-reply-text definition exists."
+    (testing "if the clj-mrazik.irc-bot/prepare-reply-text definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/prepare-reply-text))))
+
+
+(deftest test-on-incoming-message-existence
+    "Check that the clj-mrazik.irc-bot/on-incoming-message definition exists."
+    (testing "if the clj-mrazik.irc-bot/on-incoming-message definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/on-incoming-message))))
+
+
+(deftest test-send-message-existence
+    "Check that the clj-mrazik.irc-bot/send-message definition exists."
+    (testing "if the clj-mrazik.irc-bot/send-message definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/send-message))))
+
+
+(deftest test-start-irc-bot-existence
+    "Check that the clj-mrazik.irc-bot/start-irc-bot definition exists."
+    (testing "if the clj-mrazik.irc-bot/start-irc-bot definition exists."
+        (is (callable? 'clj-mrazik.irc-bot/start-irc-bot))))
+


Sort the test values so everyone agrees on orders

--- test/herder/web/events_tests.clj
+++ test/herder/web/events_tests.clj
@@ -69,7 +69,7 @@
       (is (= {:body {:id (str event_uuid)
                      :name "Foo"
                      :convention_id str_con_uuid
-                     :persons [(str person_uuid) (str second_person)]
+                     :persons (-> [(str person_uuid) (str second_person)] sort vec)
                      :preferred_slot_id nil
                      :event_count 1}
               :status 200}


Update to latest parinfer dep

Update to latest parinfer dep

--- ClojureScript/replete/project.clj
+++ ClojureScript/replete/project.clj
@@ -2,7 +2,7 @@
   :dependencies [[org.clojure/clojure "1.7.0"]
                  [org.clojure/clojurescript "1.7.170"]
                  [tailrecursion/cljson "1.0.7"]
-                 [parinfer "0.2.0"]]
+                 [parinfer "0.2.3"]]
   :clean-targets ["out" "target"]
   :plugins [[lein-cljsbuild "1.1.1"]]
   :cljsbuild {:builds {:test {:source-paths ["src" "test"]


adjust :react-native target so release mode works

--- src/main/shadow/build/targets/react_native.clj
+++ src/main/shadow/build/targets/react_native.clj
@@ -24,7 +24,7 @@
   (s/keys
     :req-un
     [::init-fn
-     ::shared/output-to]
+     ::shared/output-dir]
     ))

 (defmethod config/target-spec :react-native [_]
@@ -46,17 +46,17 @@
       [:compiler-options :closure-defines 'shadow.cljs.devtools.client.env/server-host]
       (str server-addr))))

-(defn configure [state mode {:keys [build-id init-fn output-to] :as config}]
-  (let [output-file
-        (io/file output-to)
+(defn configure [state mode {:keys [build-id init-fn output-dir] :as config}]
+  (let [output-dir
+        (io/file output-dir)
+
+        output-file
+        (io/file output-dir "index.js")

         dev?
-        (= :dev mode)
+        (= :dev mode)]

-        output-dir
-        (if dev?
-          (io/file (.getParentFile output-file) "cljs-dev" (name build-id))
-          (io/file (.getParentFile output-file)))]
+    (io/make-parents output-file)

     (-> state
         (build-api/with-build-options {:output-dir output-dir})
@@ -84,14 +84,14 @@
                 '[cljs.user
                   shadow.cljs.devtools.client.react-native]))))))

-(defn flush-dev-index [{::keys [output-file] :as state} {:keys [build-id init-fn] :as config}]
+(defn flush-dev-index [{::keys [output-file] :as state} {:keys [init-fn] :as config}]
   (spit output-file
-    (str "var CLJS = require(\"./cljs-dev/" (name build-id) "/cljs_env.js\");\n"
+    (str "var CLJS = require(\"./cljs_env.js\");\n"
          (->> (:build-sources state)
               (remove #{output/goog-base-id})
               (map #(data/get-source-by-id state %))
               (map :output-name)
-              (map #(str "require(\"./cljs-dev/" (name build-id) "/" % "\");" ))
+              (map #(str "require(\"./" % "\");" ))
               (str/join "\n"))
          "\nCLJS." (cljs-comp/munge init-fn) "();")))


Implement tcrawley's awesome idea to verify retries for rollback and exception

--- integration-tests/apps/tx/src/tx/listen.clj
+++ integration-tests/apps/tx/src/tx/listen.clj
@@ -11,6 +11,8 @@
   (imsg/publish "/queue/test" "kiwi")
   (imsg/publish "/queue/remote-test" "starfruit" :host "localhost" :port 5445)
   (ic/put core/cache :a 1)
+  (tx/not-supported
+   (ic/put core/cache :deliveries (inc (or (:deliveries core/cache) 0))))
   (if (:throw? m) (throw (Exception. "rollback")))
   (if (:rollback? m) (tx/set-rollback-only)))

@@ -32,10 +34,12 @@
   (trigger-listener :throw? true)
   (is (nil? (imsg/receive "/queue/test" :timeout 2000)))
   (is (nil? (imsg/receive "/queue/remote-test" :timeout 2000)))
-  (is (nil? (:a core/cache))))
+  (is (nil? (:a core/cache)))
+  (is (= 10 (:deliveries core/cache))))

 (deftest transactional-writes-in-listener-should-fail-on-rollback
   (trigger-listener :rollback? true)
   (is (nil? (imsg/receive "/queue/test" :timeout 2000)))
   (is (nil? (imsg/receive "/queue/remote-test" :timeout 2000)))
-  (is (nil? (:a core/cache))))
+  (is (nil? (:a core/cache)))
+  (is (= 10 (:deliveries core/cache))))


fix typo

fix typo

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -1069,7 +1069,7 @@

 (defmethod control-event :layers-pasted
   [browser-state message {:keys [layers height width min-x min-y canvas-size] :as layer-data} state]
-  (let [{:keys [entity-ids frontend]} (frontend.db/get-entity-ids state (count layers))
+  (let [{:keys [entity-ids state]} (frontend.db/get-entity-ids state (count layers))
         doc-id (:document/id state)
         camera (:camera state)
         zoom (:zf camera)


STORM-853 Handles no topologyMainClassArgs presented

--- storm-core/src/clj/backtype/storm/ui/core.clj
+++ storm-core/src/clj/backtype/storm/ui/core.clj
@@ -525,8 +525,9 @@
         storm-cmd (str storm-home file-path-separator "bin" file-path-separator "storm")
         tplg-cmd-response (apply sh
                             (flatten
-                              [storm-cmd "jar" tplg-jar-file tplg-main-class tplg-main-class-args
-                                (if (not= user "unknown") (str "-c storm.doAsUser=" user) "")]))]
+                              [storm-cmd "jar" tplg-jar-file tplg-main-class
+                                (if (not-nil? tplg-main-class-args) tplg-main-class-args [])
+                                (if (not= user "unknown") (str "-c storm.doAsUser=" user) [])]))]
     (log-message "tplg-cmd-response " tplg-cmd-response)
     (cond
      (= (tplg-cmd-response :exit) 0) {"status" "success"}


Keyword searching is now faster, as n-grams are maintained in a sorted-set.

--- Spraff/src/spraff/core.clj
+++ Spraff/src/spraff/core.clj
@@ -24,7 +24,7 @@
 (def empty-state {
     :forwardtable {}
     :backwardtable {}
-    :n-grams []
+    :n-grams (sorted-set)
 })

@@ -77,8 +77,13 @@
             (reverse (take 500 (stream-of-shite (reverse seed) backward))))
         (take 500 (stream-of-shite seed forward))))

+(defn extend-vec [v e n] (vec (concat v (take (- n (count v)) (repeat e)))))
+(defn append-null [s] (join (concat (seq s) [(char 0)])))
+
 (defn generate-sentence [state keywords]
-    (println "keywords: " keywords "\n")
+    {
+        :pre [(or (empty? keywords) (sorted? (:n-grams state)))]
+    }
     (if (empty? keywords)
         (remove keyword? (map first
             (apply max-key #(count (filter true? (map second %)))
@@ -87,11 +92,13 @@
                     (:backwardtable state)
                     (:forwardtable state)))))))
         (let [filtered-grams
-                (remove
-                    (fn [s] (empty? (remove
-                        (fn [k] (empty? (filter #(.contains % k) (remove keyword? s))))
-                        keywords)))
-                    (:n-grams state))]
+                (apply concat
+                    (map
+                        (fn [k]
+                            (subseq (:n-grams state)
+                                >= (extend-vec [k] "" prefix-length)
+                                < (extend-vec [(append-null k)] "" prefix-length)))
+                        keywords))]
             (if (empty? filtered-grams)
                 (generate-sentence state [])
                 (generate-sentence
@@ -136,7 +143,7 @@
             :backwardtable
                 (update-table (:backwardtable state) (reverse words))
             :n-grams
-                (update-ngrams (:n-grams state) words))))
+                (update-ngrams (:n-grams state) (remove keyword? words)))))
 (defn log-sentence! [message]
     (with-open [out (writer corpus-file :append true)]
         (.write out (str message "\n"))))
@@ -215,10 +222,9 @@
     (update-state! message state-ref)
     (if (and (not (= nick (:name @irc))) (.contains message (:name @irc)))
         (send-message irc channel
-            (join " " (generate-sentence
+            (join (take 450 (join " " (generate-sentence
                 @state-ref
-                (let [keywords (set (remove #(.contains % (:name @irc)) (split-sentence-to-words message)))]
-                    (if (<= (count keywords) 3) keywords #{}))))))
+                (set (remove #(.contains % (:name @irc)) (split-sentence-to-words message)))))))))
     (if (.startsWith message "!burrito")
         (send-message irc channel
             (generate-burrito)))


make flaky execute-steps-inheritance-test more robust, don't rely on Thread/sleep

--- test/clj/lambdacd/internal/execution_test.clj
+++ test/clj/lambdacd/internal/execution_test.clj
@@ -250,13 +250,12 @@
                      (some-ctx-with :step-results-channel step-results-channel
                                     :step-id [0]
                                     :build-number 2))
-      (Thread/sleep 500) ; result-channel is now filled async, wait a bit to make sure it's filled
       (is (= [{:build-number 2 :step-id [1 0] :step-result {:status :running}}
               {:build-number 2 :step-id [1 0] :step-result {:foo :baz :status :success}}
               {:build-number 2 :step-id [2 0] :step-result {:status :running}}
               {:build-number 2 :step-id [2 0] :step-result {:status :success}}
               {:build-number 2 :step-id [3 0] :step-result {:status :running}}
-              {:build-number 2 :step-id [3 0] :step-result {:status :failure}}] (slurp-chan step-results-channel))))))
+              {:build-number 2 :step-id [3 0] :step-result {:status :failure}}] (slurp-chan-with-size 6 step-results-channel))))))

 (defn some-control-flow [&] ; just a mock, we don't actually execute this
   (throw (IllegalStateException. "This shouldn't be called")))