Clean up namespace declaration.

Clean up namespace declaration.

--- src/midje/midje_forms/translating.clj
+++ src/midje/midje_forms/translating.clj
@@ -2,14 +2,13 @@

 (ns midje.midje-forms.translating
   (:use clojure.contrib.def
-        [midje.checkers.defining :only [checker? checker-makers]])
-  (:use [clojure.contrib.seq :only [separate]])
-  (:use [midje.util thread-safe-var-nesting wrapping form-utils laziness form-utils]
-        [midje.util.file-position :only [arrow-line-number]])
-  (:use midje.metaconstants)
-  (:require [clojure.zip :as zip])
-  (:use [midje.midje-forms building recognizing dissecting moving-around editing])
-  (:use [midje.util.debugging]))
+        [clojure.contrib.seq :only [separate]]
+        midje.metaconstants
+        [midje.util thread-safe-var-nesting wrapping form-utils laziness form-utils]
+        [midje.util.file-position :only [arrow-line-number]]
+        [midje.midje-forms building recognizing dissecting moving-around editing]
+        [midje.util.debugging])
+  (:require [clojure.zip :as zip]))

 ;; Translating a form into an equivalent form with all arrow sequences given
 ;; line numbers.


hide favourites functionality

hide favourites functionality

--- src/cljs/salava/extra/application/ui/issuer.cljs
+++ src/cljs/salava/extra/application/ui/issuer.cljs
@@ -146,11 +146,11 @@
                 :on-click #(do (reset! show-favourites-atom (if @show-favourites-atom false true))
                              (swap! state assoc :issuer-search false :issuer ""))}
        (t :core/All)]
-      [:button {:class (str "btn btn-default " (if @show-favourites-atom "btn-active"))
-                :id "btn-all"
-                :on-click #(do (reset! show-favourites-atom (if @show-favourites-atom false true))
-                             (swap! state assoc :issuer-search false :issuer ""))}
-       [:i {:class "fa fa-bookmark"}] (str " " (t :extra-application/Favourites))]]]]
+      (when (session/get :user) [:button {:class (str "btn btn-default " (if @show-favourites-atom "btn-active"))
+                                          :id "btn-all"
+                                          :on-click #(do (reset! show-favourites-atom (if @show-favourites-atom false true))
+                                                       (swap! state assoc :issuer-search false :issuer ""))}
+                                 [:i {:class "fa fa-bookmark"}] (str " " (t :extra-application/Favourites))])]]]
    [:div {:style {:margin-top "5px"}}
     [issuer-search :issuer  nil (t :extra-application/Searchissuer) state]]])


working on using a local deftest macro

working on using a local deftest macro

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -11,13 +11,16 @@
    [babel.italiano.morphology.verbs :as verbs]
    #?(:cljs [babel.logjs :as log])
    [babel.over :as over]
-   #?(:clj [clojure.test :refer [deftest is]])
+   #?(:clj [clojure.test :as realtest :refer [is]])
    #?(:cljs [cljs.test :refer-macros [deftest is]])
    #?(:clj [clojure.tools.logging :as log])
    #?(:clj [clojure.repl :refer [doc]])
    [clojure.string :as string]
    [clojure.set :as set]
    [dag_unify.core :refer [copy fail? get-in strip-refs unify]]))
+
+(defmacro deftest [test-name stuff]
+  `(apply realtest/deftest ~@[test-name stuff]))

 (deftest analyze-1
   (let [singular (analyze "compito")
@@ -189,7 +192,7 @@
                                   parsed (reduce concat (map :parses
                                                              (parse surface (np-grammar))))]
                               (if (not (empty? parsed))
-                                (log/info (str "parse OK:" surface))
+                                (log/info (str "roundtrip-np-grammar: " surface))
                                 (log/error (str "parse failed: " surface)))
                               (is (not (empty? parsed)))))
                           expressions))))))
@@ -252,7 +255,7 @@
                           (let [surface (morph expr)
                                 parsed (reduce concat (map :parses (parse surface)))]
                             (if (not (empty? parsed))
-                              (log/info (str "parse OK:" surface))
+                              (log/info (str "roundtrip-past:" surface))
                               (log/error (str "parse failed: " surface)))
                             (is (not (empty? parsed)))))
                         expressions))))))
@@ -271,8 +274,11 @@
                             (let [surface (morph expr)
                                   parsed (reduce concat (map :parses (parse surface)))]
                               (if (not (empty? parsed))
-                                (log/info (str "parse OK:" surface))
-                                (log/error (str "parse failed: " surface)))
+                                (log/info (str "roundtrip-present: " surface))
+                                (log/error (str "parse failed: " surface ": italiano:"
+                                                (dag_unify.core/strip-refs
+                                                 (get-in expr
+                                                         [:italiano])))))
                               (is (not (empty? parsed)))))
                           expressions))))))

@@ -289,8 +295,11 @@
                           (let [surface (morph expr)
                                 parsed (reduce concat (map :parses (parse surface)))]
                             (if (not (empty? parsed))
-                              (log/info (str surface))
-                              (log/error (str "parse failed: " surface)))
+                              (log/info (str "roundtrip-future: " surface))
+                              (log/error (str "parse failed: " surface ": italiano:"
+                                              (dag_unify.core/strip-refs
+                                               (get-in expr
+                                                       [:italiano])))))
                             (is (not (empty? parsed)))))
                         expressions))))))

@@ -315,6 +324,7 @@
                           expressions))))))

 (deftest the-red-cat-woke-up
+  (log/info (str "starting test: the-red-cat-woke-up"))
   (let [result (:parses (first (parse "il gatto rosso si è alzato")))]
     ;; should find at least one structure:
     (is (not (empty? result)))
@@ -323,7 +333,8 @@
     (is (or (= "il gatto rosso si è alzato"
                (morph (first result)))
             (= "il rosso gatto si è alzato"
-               (morph (first result)))))))
+               (morph (first result))))))
+  (log/info (str "ending test: the-red-cat-woke-up")))

 ;; tricky tokenization of 'la sua' and 'la loro' as lexemes.
 (deftest parsing


Add required :subcat '() as input to English generation in order to generate complete sentences with both a subject and a verb.

--- test/babel/test/la.cljc
+++ test/babel/test/la.cljc
@@ -66,8 +66,15 @@

         source (->
                 spec
+
+                ;; This is required for English in order
+                ;; to generate complete sentences with both a subject
+                ;; and a verb.
+                (unify {:synsem {:subcat '()}})
+
                 source-generate-fn
                 source-format-fn)
+
         target (->
                 spec
                 generate


got rid of old ext package, we don't need it

--- src/duffel/ext.clj
+++ src/duffel/ext.clj
@@ -1,122 +0,0 @@
-(ns duffel.ext
-    (:use massage.json)
-    (:use duffel.ext-protocol)
-    (:require [duffel.fs-util :as dfs-util]
-              [duffel.util    :as dutil]))
-
-(def extensions (atom {}))
-
-(defn is-extension [suffix]
-    (contains? @extensions suffix))
-
-(defn ext-instance [file-struct]
-    (@extensions (file-struct :extension)))
-
-(defn register-ext [ext ext-inst]
-    (swap! extensions assoc ext ext-inst))
-
-; Preprocessing - used basically just for apply recursively and stuff, before
-;                 the templates are applied. Can also be used to forcefully
-;                 exclude files/dirs from having an extension applied on them
-;                 (throw an exception here)
-;
-; Template-processing - Used to apply the file and dir templates where
-;                       necessary. Not implemented by extension itself, only
-;                       used tpl structs given by extension
-;
-; Postprocessessing - Same thing as preprocessing. I'm not actually using it,
-;                     but someone else might
-;
-; Actual processessing - Where the magic happens
-
-(defn gen-process-structs
-    "Goes through the dir-tree and, using tree-map, calls dir-fn on all
-    directories and file-fn on all files"
-    [dir-tree dir-fn file-fn]
-    [dir-tree]
-    (dfs-util/tree-map (fn [d _ _]
-        (let [ext (ext-instance (first d))
-              processed-d (dir-fn ext d)
-              processed-root (first processed-d)]
-            (cons processed-root
-                (map
-                  #(if (seq? %) % (file-fn (ext-instance %) %))
-                  (rest processed-d))))
-    ) dir-tree))
-
-(defn pre-process
-    "Goes through the dir-tree and, using tree-map, calls preprocess-dir on all
-    directories and preprocess-file on all files"
-    [dir-tree]
-    (gen-process-structs dir-tree preprocess-dir preprocess-file))
-
-(defn post-template-process
-    "Goes through the dir-tree and, using tree-map, calls postprocess-dir on all
-    directories and preprocess-file on all files"
-    [dir-tree]
-    (gen-process-structs dir-tree postprocess-dir postprocess-file))
-
-(defn process
-    [app dir-tree]
-    (dfs-util/tree-map
-        (fn [d abs-prefix local-prefix]
-            (let [ d-root         (first d)
-                   d-root-ext     (ext-instance d-root)
-                   d-abs          (str abs-prefix   (d-root :base-name))
-                   d-local        (str local-prefix (d-root :full-name))
-                   d-abs-prefix   (dutil/append-slash d-abs)
-                   d-local-prefix (dutil/append-slash d-local) ]
-                (when-not (d-root :is-root?)
-                  (process-dir d-root-ext app (d-root :meta) d-abs d-local))
-                (doseq [f (rest d)] (when-not (seq? f)
-                  (process-file
-                    (ext-instance f)
-                    app
-                    (f :meta)
-                    (str d-abs-prefix   (f :base-name))
-                    (str d-local-prefix (f :full-name))))))
-        d)
-        dir-tree))
-
-(defn _try-apply-template
-    "Given a file-struct and a template, tries to run the metadata of the
-    file-struct through massage to populate all defaults and make sure
-    everything is ok. If there's any errors it throws an exception, which is
-    what the local-prefix is needed for.
-
-    There's some defmulti stuff below to make it easy to pick a template
-    depending on whether the file-struct is for a directory or not"
-    [file-struct local-prefix tpl]
-    (let [processed-meta (parse-json (file-struct :meta {}) tpl)]
-        (if (processed-meta :error)
-            (throw (Exception. (str "Invalid metadata on: "
-                                    local-prefix
-                                    (file-struct :full-name)
-                                    " -> " processed-meta)))
-            (assoc file-struct :meta processed-meta))))
-
-(defmulti try-apply-template (fn [file-struct _] (file-struct :is-dir?)))
-(defmethod try-apply-template false [file-struct local-prefix]
-    (_try-apply-template file-struct local-prefix
-      (file-meta-tpl (ext-instance file-struct))))
-(defmethod try-apply-template true [file-struct local-prefix]
-    (_try-apply-template file-struct local-prefix
-      (dir-meta-tpl (ext-instance file-struct))))
-
-(defn process-templates
-    "Goes through the dir-tree and, using tree-map, sends all file and directory
-    meta objects through their massage template to make sure they're good to go
-    and populate defaults"
-    [dir-tree]
-    (dfs-util/tree-map
-      (fn [d _ local-prefix]
-        (let [dir-root (first d)
-              dir-rest (rest d)
-              full-local-prefix (str
-                                   local-prefix
-                                   (dutil/append-slash (dir-root :full-name)))]
-            (cons
-              (try-apply-template dir-root full-local-prefix)
-              (map
-                #(if (seq? %) % (try-apply-template % full-local-prefix))
-                dir-rest)))) dir-tree))


84 headless? fix

84 headless? fix

--- src/etaoin/api.clj
+++ src/etaoin/api.clj
@@ -1553,7 +1553,7 @@
 (defn headless?
   "Returns true if a driver is run in headless mode (without UI window)."
   [driver]
-  (drv/is-headless? driver))
+  (drv/is-headless? @driver))

 (defn exists?
   "Returns true if an element exists on the page.


lengthen the blues

lengthen the blues

--- test/examples/blues.clj
+++ test/examples/blues.clj
@@ -36,7 +36,7 @@
           (play synth pitch))
       (at (+ time (* 0.5 dur))
           (c-hat 0.1))
-      (apply-at n-time #'play-seq
+      (apply-at n-time #'play-seq
                 [(mod (inc count) 4) synth (next notes) (next durs) n-time odds]))))

 ; TODO: Strum the chord
@@ -66,13 +66,14 @@
            octave)))

 (defn blue-beep []
-  (play-seq beep
-            (cycle (map sort (progression blues-chords :a 3 :ionian)))
+  (play-seq 0 beep
+            (cycle (mapcat #(repeat 4 %) (map sort (progression blues-chords :a 3 :ionian))))
             (cycle [1200 1204 1195 1206])
             (now)
             0.2))

-;(blue-beep)
+                                        ;(blue-beep)
+(stop)

 ; Be sure to try moving the mouse around...
 (defn blue-ks1 []


RS | #89 | Use tail-recursion when applying translations for efficiency

--- src/objective8/templates/template_functions.clj
+++ src/objective8/templates/template_functions.clj
@@ -36,9 +36,10 @@
       :else node)))

 (defn- apply-translations [[translation-string & more] node translations]
-  (if more
-    (apply-translation translation-string (apply-translations more node translations) translations)
-    (apply-translation translation-string node translations)))
+  (let [translated-node (apply-translation translation-string node translations)]
+    (if more
+      (recur more translated-node translations)
+      translated-node)))

 (defn- translate-node  [node  {:keys  [translations] :as context}]
   (let [translation-strings (clojure.string/split (get-in node [:attrs :data-l8n]) #"\s+")]


Populate LRUD button events

Populate LRUD button events

--- src/org/playasophy/wonderdome/input/gamepad.clj
+++ src/org/playasophy/wonderdome/input/gamepad.clj
@@ -96,7 +96,7 @@
    :y-axis 0.0})

 (def ^:private snes-buttons
-  #{:X :A :B :Y :L :R :select :start})
+  #{:X :A :B :Y :L :R :select :start :left :right :up :down})

 (def ^:private snes-bits
   {:X      [3 0]
@@ -123,10 +123,16 @@
       (str "Incomplete data read from SNES controller: "
            (apply str (map (partial format "%02X") (take len buffer)))))
     ; TODO: virtual d-pad buttons
-    (assoc
-      (read-buttons snes-bits buffer)
-      :x-axis (byte-axis (aget buffer 0))
-      :y-axis (- (byte-axis (aget buffer 1))))))
+    (let [x-axis (byte-axis (aget buffer 0))
+          y-axis (- (byte-axis (aget buffer 1)))]
+      (assoc
+        (read-buttons snes-bits buffer)
+        :x-axis x-axis
+        :y-axis y-axis
+        :left (neg? x-axis)
+        :right (pos? x-axis)
+        :down (neg? y-axis)
+        :up (pos? y-axis)))))

 (defn- snes-state-events


CMR-3048: Removed debug ouptput

CMR-3048: Removed debug ouptput

--- message-queue-lib/src/cmr/message_queue/queue/sqs.clj
+++ message-queue-lib/src/cmr/message_queue/queue/sqs.clj
@@ -114,15 +114,13 @@
       (try
         (u/while-let [rec-result (.receiveMessage sqs-client rec-req)]
           (when-let [msg (first (.getMessages rec-result))]
-            (do
-              (debug "Message is: " msg)
-              (let [msg-body (.getBody msg)
-                    msg-content (json/decode msg-body true)]
-                (try
-                  (handler msg-content)
-                  (.deleteMessage sqs-client queue-url (.getReceiptHandle msg))
-                  (catch Throwable e
-                    (error e "Message processing failed for message" (pr-str msg) "on queue" queue-name)))))))
+            (let [msg-body (.getBody msg)
+                  msg-content (json/decode msg-body true)]
+              (try
+                (handler msg-content)
+                (.deleteMessage sqs-client queue-url (.getReceiptHandle msg))
+                (catch Throwable e
+                  (error e "Message processing failed for message" (pr-str msg) "on queue" queue-name))))))
         (catch Throwable e
           (error  e "Async handler for queue" queue-name "completing."))))))


some refactoring in briefing

some refactoring in briefing

--- src/cljs/iwaswhere_web/ui/entry/briefing.cljs
+++ src/cljs/iwaswhere_web/ui/entry/briefing.cljs
@@ -45,6 +45,37 @@
                  {:style {:background-color (cc/item-color book-name)}}]
                 [:strong.name book-name] (u/duration-string v)]))])))))

+(defn waiting-habits-list
+  [tab-group put-fn]
+  (let [cfg (subscribe [:cfg])
+        results (subscribe [:results])
+        options (subscribe [:options])
+        entries-map (subscribe [:entries-map])
+        waiting-habits (reaction
+                         (let [entries-map @entries-map
+                               entries (map (fn [ts] (get entries-map ts))
+                                            (:waiting-habits @results))
+                               conf (merge @cfg @options)]
+                           (if (:show-pvt @cfg)
+                             entries
+                             (filter (u/pvt-filter conf entries-map) entries))))]
+    (fn waiting-habits-list-render [tab-group put-fn]
+      (let [waiting-habits @waiting-habits]
+        (when (seq waiting-habits)
+          [:div.habits
+           [:h5 "Waiting habits:"]
+           [:ul
+            (for [waiting-habit waiting-habits]
+              (let [ts (:timestamp waiting-habit)]
+                ^{:key ts}
+                [:li.habit
+                 {:on-click (up/add-search ts tab-group put-fn)}
+                 [:strong (some-> waiting-habit
+                                  :md
+                                  (s/replace "#habit" "")
+                                  s/split-lines
+                                  first)]]))]])))))
+
 (defn briefing-view
   [entry put-fn edit-mode? local-cfg]
   (let [chart-data (subscribe [:chart-data])
@@ -55,22 +86,13 @@
         results (subscribe [:results])
         cfg (subscribe [:cfg])

-        waiting-habits
-        (reaction
-          (let [entries-map @entries-map
-                conf (merge @cfg @options)
-                entries (map (fn [ts] (get entries-map ts))
-                             (:waiting-habits @results))]
-            (if (:show-pvt @cfg)
-              entries
-              (filter (u/pvt-filter conf entries-map) entries))))
-
         input-fn
         (fn [entry]
           (fn [ev]
             (let [day (-> ev .-nativeEvent .-target .-value)
                   updated (assoc-in entry [:briefing :day] day)]
               (put-fn [:entry/update-local updated]))))
+
         time-alloc-input-fn
         (fn [entry book]
           (fn [ev]
@@ -81,8 +103,7 @@
     (fn briefing-render [entry put-fn edit-mode? local-cfg]
       (when (contains? (:tags entry) "#briefing")
         (let [books @books
-              {:keys [pomodoro-stats activity-stats task-stats wordcount-stats
-                      daily-summary-stats media-stats]} @chart-data
+              {:keys [pomodoro-stats  task-stats wordcount-stats]} @chart-data
               day (-> entry :briefing :day)
               day-stats (get pomodoro-stats day)
               word-stats (get wordcount-stats day)
@@ -92,19 +113,8 @@
               remaining (cd/remaining-times (:time-by-book day-stats) allocation)
               past-7-days (cd/past-7-days pomodoro-stats :time-by-book)
               tab-group (:tab-group local-cfg)]
-          [:div.habits
-           [:h5 "Waiting habits:"]
-           [:ul
-            (for [waiting-habit @waiting-habits]
-              (let [ts (:timestamp waiting-habit)]
-                ^{:key ts}
-                [:li.habit
-                 {:on-click (up/add-search ts tab-group put-fn)}
-                 [:strong (some-> waiting-habit
-                                  :md
-                                  (s/replace "#habit" "")
-                                  s/split-lines
-                                  first)]]))]
+          [:div
+           [waiting-habits-list tab-group put-fn]
            [:form.briefing-details
             [:fieldset
              [:legend (or day "date not set")]


Fixed bug in data watcher

Fixed bug in data watcher

was calling functions on the UI instead of the data

--- src/webapp/framework/client/system_globals.cljs
+++ src/webapp/framework/client/system_globals.cljs
@@ -62,10 +62,10 @@
                   (cond
                    (= (:type ui-watch) "path equals")
                    (if (= (get-in new-val (:path ui-watch)) (:value ui-watch) )
-                     ((:fn ui-watch) app))
+                     ((:fn ui-watch) data-state))

                    (= (:type ui-watch) "value change")
-                   ((:fn ui-watch) app)
+                   ((:fn ui-watch) data-state)
                    :else
                    nil ))))))


Layout manager #41

Layout manager #41

--- src/flatgui/samples/forms/layoutdemopanel.clj
+++ src/flatgui/samples/forms/layoutdemopanel.clj
@@ -19,32 +19,17 @@
             [flatgui.widgets.button :as button]
             [flatgui.widgets.scrollpanel :as scrollpanel]))

-;[[:name-label       [:name-editor :-]]
-; [:password-label   [:password-textfield :-]                  :show-chars-btn]
-; [:position-label   [:x :y :-]                                :edit-pos-btn] ;[:x :y :-] actually means [[:x :-] [:y :-] :-]
-; [:dimensions-label [:w-label [:w :---] :h-label [:h :--] :-] :edit-dim-btn]
-; [[:one :two :']    [:notes-entry :-|]]
-; [[:upper-ed :-']   [:notes-entry]]     <--- :notes-entry takes more than one row
-; [[:three :four]    [:notes-entry]]
-; [[:five :six :-.]  [:notes-entry]]
-; [[:long-editor]    [:long-editor]] <--- :long-editor takes two columns
-; [:bottom-labels    [[:bleft :<] [:bright :>]]]]
-;                   /|\
-;                    | Need to know width of first column to align x coord for second.
-;                      Same is with rows
-
 (def layout-cfg
   [[:name-label       [:name-editor :-]]
    [:password-label   [:password-textfield :-]                      :show-chars-btn]
    [:position-label   [:x :y :-]                                    :edit-pos-btn]
    [:dimensions-label [[:w-label] [:w :---] [:h-label] [:h :--] :-] :edit-dim-btn]
    [[:one :two :']    [:notes-entry :-|]]
-   ;[[:upper-ed :-']   [:notes-entry]]
-   ;[[:three :four]    [:notes-entry]]
-   ;[[:five :six :-.]  [:notes-entry]]
-   ;[[:long-editor]    [:long-editor]]
-   ;[:bottom-labels    [[:bleft :<] [:bright :>]]]
-   ])
+   [[:upper-ed :-']   [:notes-entry]]
+   [[:three :four]    [:notes-entry]]
+   [[:five :six :-.]  [:notes-entry]]
+   [[:long-editor :-] [:long-editor :-]]
+   [:bottom-labels    [[:bleft :<] [:bright :>]]]])

 (def demo-window
   (fg/defcomponent
@@ -67,7 +52,7 @@
     (fg/defcomponent textfield/textfield :y {})
     (fg/defcomponent button/button :edit-pos-btn {:text "..."})

-    (fg/defcomponent label/label :dimensions-label {:text "Dimensions:"})
+    (fg/defcomponent checkbox/checkbox :dimensions-label {:text "Dimensions:"})
     (fg/defcomponent label/label :w-label {:text "W:"})
     (fg/defcomponent textfield/textfield :w {})
     (fg/defcomponent label/label :h-label {:text "H:"})
@@ -77,20 +62,21 @@
     (fg/defcomponent checkbox/checkbox :one {:text "One"})
     (fg/defcomponent checkbox/checkbox :two {:text "Two"})

-    ;(fg/defcomponent textfield/textfield :upper-ed {})
-    ;
-    ;(fg/defcomponent checkbox/checkbox :three {:text "Three"})
-    ;(fg/defcomponent checkbox/checkbox :four {:text "Four"})
-    ;
-    ;(fg/defcomponent textfield/textfield :five {})
-    ;(fg/defcomponent textfield/textfield :six {})
-    ;
-    ;(fg/defcomponent label/label :bottom-labels {:text "Bottom labels:"})
-    ;(fg/defcomponent label/label :bleft {:text "Left"})
-    ;(fg/defcomponent label/label :bright {:text "Right"})
-    ;
-    (fg/defcomponent textfield/textfield :notes-entry {:multiline true})
-    ))
+    (fg/defcomponent textfield/textfield :upper-ed {})
+
+    (fg/defcomponent checkbox/checkbox :three {:text "Three"})
+    (fg/defcomponent checkbox/checkbox :four {:text "Four"})
+
+    (fg/defcomponent textfield/textfield :five {})
+    (fg/defcomponent textfield/textfield :six {})
+
+    (fg/defcomponent textfield/textfield :long-editor {})
+
+    (fg/defcomponent label/label :bottom-labels {:text "Bottom labels:"})
+    (fg/defcomponent label/label :bleft {:text "Left"})
+    (fg/defcomponent label/label :bright {:text "Right"})
+
+    (fg/defcomponent textfield/textfield :notes-entry {:multiline true})))

 (def layout-window
   (fg/defcomponent


give the post an image

give the post an image

--- src/pc/views/blog/diagramming_with_precursor.clj
+++ src/pc/views/blog/diagramming_with_precursor.clj
@@ -6,6 +6,7 @@
   {:title "Diagramming with Precursor"
    :blurb "Learn how to build flow diagrams as we sketch out Precursor's infrastructure."
    :author "Daniel"
+   :image (external-cdn-path "/blog/diagramming-with-precursor/full-infrastructure.png")
    :body
    (list
     [:article


[refactor] send-transaction-message fx/defn

- turn :send-transaction-message event into an fx producing function
- allow transaction with defined on-result event to also send transaction
message

Signed-off-by: yenda <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@status.im>

--- src/status_im/ui/screens/wallet/send/events.cljs
+++ src/status_im/ui/screens/wallet/send/events.cljs
@@ -75,32 +75,78 @@
                             all-tokens
                             symbol
                             chain
-                            #(re-frame/dispatch [::transaction-completed (types/json->clj %)])
+                            #(re-frame/dispatch [:wallet.callback/transaction-completed (types/json->clj %)])
                             password]}))))

+;; SIGN MESSAGE
+(handlers/register-handler-fx
+ :wallet/sign-message
+ (fn [_ [_ typed? screen-params password-error-cb]]
+   (let [{:keys [data from password]} screen-params]
+     (if typed?
+       {::sign-typed-data {:data     data
+                           :password password
+                           :account  from
+                           :on-completed #(re-frame/dispatch [::sign-message-completed
+                                                              screen-params
+                                                              (types/json->clj %)
+                                                              password-error-cb])}}
+       {::sign-message {:params       {:data     data
+                                       :password (security/safe-unmask-data password)
+                                       :account  from}
+                        :on-completed #(re-frame/dispatch [::sign-message-completed
+                                                           screen-params
+                                                           (types/json->clj %)
+                                                           password-error-cb])}}))))
+
+(fx/defn send-transaction-message
+  "NOTE(goranjovic): we want to send the payment message only when we have a
+   whisper id for the recipient, we always redirect to `:wallet-transaction-sent`
+   even when we don't"
+  [{:keys [db] :as cofx} chat-id params]
+  (let [send-command? (and chat-id
+                           (get-in db [:id->command ["send" #{:personal-chats}]]))]
+    (when send-command?
+      (commands-sending/send cofx chat-id send-command? params))))
+
 ;; SEND TRANSACTION CALLBACK
 (handlers/register-handler-fx
- ::transaction-completed
+ :wallet.callback/transaction-completed
+ [(re-frame/inject-cofx :random-id-generator)]
  (fn [{:keys [db now] :as cofx} [_ {:keys [result error]}]]
-   (let [{:keys [id method public-key to symbol amount-text on-result]} (get-in db [:wallet :send-transaction])
+   (let [{:keys [id method public-key to symbol amount-text on-result
+                 send-transaction-message?]}
+         (get-in db [:wallet :send-transaction])
          db' (assoc-in db [:wallet :send-transaction :in-progress?] false)]
      (if error
-        ;; ERROR
+       ;; ERROR
        (models.wallet/handle-transaction-error (assoc cofx :db db') error)
-        ;; RESULT
-       (merge
-        {:db (cond-> (assoc-in db' [:wallet :send-transaction] {})
-
-               (not (constants/web3-sign-message? method))
-               (assoc-in [:wallet :transactions result]
-                         (models.wallet/prepare-unconfirmed-transaction db now result)))}
-
-        (if on-result
-          {:dispatch (conj on-result id result method)}
-          {:dispatch [:send-transaction-message public-key {:address to
-                                                            :asset   (name symbol)
-                                                            :amount  amount-text
-                                                            :tx-hash result}]}))))))
+       ;; RESULT
+       (fx/merge cofx
+                 (merge
+                  {:db (cond-> (assoc-in db' [:wallet :send-transaction] {})
+
+                         (not (constants/web3-sign-message? method))
+                         (assoc-in [:wallet :transactions result]
+                                   (models.wallet/prepare-unconfirmed-transaction db now result)))}
+                  (when  on-result
+                    {:dispatch (conj on-result id result method)}))
+                 #(when (or (not on-result)
+                            send-transaction-message?)
+                    (send-transaction-message
+                     %
+                     public-key
+                     {:address to
+                      :asset   (name symbol)
+                      :amount  amount-text
+                      :tx-hash result}))
+                 #(when-not on-result
+                    (navigation/navigate-to-clean
+                     %
+                     (if (contains? #{:wallet-send-transaction :enter-pin :hardwallet-connect} (:view-id db))
+                       :wallet-transaction-sent
+                       :wallet-transaction-sent-modal)
+                     {})))))))

 (re-frame/reg-fx
  :show-sign-message-error
@@ -192,23 +238,6 @@
                                   :keycard?       keycard?}]
                (navigation/navigate-to-cofx {:db db'} :wallet-sign-message-modal screen-params))
              {:db db'})))))))
-
-(handlers/register-handler-fx
- :send-transaction-message
- (concat [(re-frame/inject-cofx :random-id-generator)]
-         navigation/navigation-interceptors)
- (fn [{:keys [db] :as cofx} [_ chat-id params]]
-   ;;NOTE(goranjovic): we want to send the payment message only when we have a whisper id
-   ;; for the recipient, we always redirect to `:wallet-transaction-sent` even when we don't
-   (let [send-command? (and chat-id (get-in db [:id->command ["send" #{:personal-chats}]]))]
-     (fx/merge cofx
-               #(when send-command?
-                  (commands-sending/send % chat-id send-command? params))
-               (navigation/navigate-to-clean
-                (if (contains? #{:wallet-send-transaction :enter-pin :hardwallet-connect} (:view-id db))
-                  :wallet-transaction-sent
-                  :wallet-transaction-sent-modal)
-                {})))))

 (defn set-and-validate-amount-db [db amount symbol decimals]
   (let [{:keys [value error]} (wallet.db/parse-amount amount decimals)]


Perhaps finally a working ES DSL to SQL conversion

--- taxi-rides-clj/src/taxi_rides_clj/benchmark.clj
+++ taxi-rides-clj/src/taxi_rides_clj/benchmark.clj
@@ -104,7 +104,7 @@

 (let [make-fn (fn [aggs] (fn [query] (if-not aggs query (assoc query :aggs aggs))))]
   (def aggregations
-    {:es-count
+    {:count
      (make-fn nil)

      :paid-total-stats-by-time-of-day
@@ -205,7 +205,9 @@
   (defn parse-aggs [agg]
     (loop [agg agg result ()]
       (if-not agg
-        (apply merge-with concat result)
+        (if-not (empty? result)
+          (apply merge-with concat result)
+          {:group-by [{:agg "COUNT(1)" :col "n_rows"}]})
         (let [_         (assert (= 1 (count agg)) "Currently only supports one aggregation / hierarchy level")
               [key agg] (-> agg first)
               agg-type  (-> agg keys set (disj :aggs) first)
@@ -215,9 +217,7 @@
                                                (clojure.string/replace #"doc\['([^']+)'\]\.value" "$1")
                                                (clojure.string/replace #"([a-z])-([a-z])"         "$1_$2")))))

-              gen-col-name
-              (fn [field name interval]
-                (-> (format "%s_%s_%.1f" field name interval) (clojure.string/replace #"\." "")))
+              gen-col-name (fn [field name interval] (format "%s_%s_%s" field name interval))

               this-agg
               (if (group-by? agg-type)
@@ -228,15 +228,15 @@

                    :histogram
                    (let [interval (-> agg-data :interval float)]
-                     [{:agg (format "ROUND(%s / %.1f)" field interval)
-                       :col (gen-col-name field "hist" interval)}])
+                     [{:agg (format "FLOOR(%s / %.1f)" field interval)
+                       :col (gen-col-name field "hist" (:interval agg-data))}])

                    :date_histogram
                    (let [_            (assert (= \d (-> agg-data :interval last)) "Only days are supported for now")
                          interval     (-> agg-data :interval butlast (#(Float. (apply str %))))
-                         interval-div (if (= 1.0 interval) "" (" / %.1f" interval))]
+                         interval-div (if (= 1.0 interval) "" (format " / %.1f" interval))]
                      [{:agg (format "FLOOR(CAST(CAST(%s AS datetime) AS float)%s)" field interval-div)
-                       :col (gen-col-name field "datehist" interval)}]))}
+                       :col (gen-col-name field "datehist" (:interval agg-data))}]))}

                 {:metrics
                  (cond
@@ -259,14 +259,25 @@
 ; (->> ((:time-pickupday-paidtip filters)) ((:paid-total-per-km-stats-by-company-and-day aggregations)) clojure.pprint/pprint)
 ; (->> ((:time-pickupday-paidtip filters)) ((:speed-kmph-percentiles-by-day aggregations)) :aggs parse-aggs clojure.pprint/pprint)
 ; (->> ((:time-pickupday-paidtip filters)) ((:paid-total-per-km-stats-by-company-and-day aggregations)) :aggs parse-aggs clojure.pprint/pprint)
+; (->> ((:count aggregations) {}) :aggs parse-aggs clojure.pprint/pprint)

 (defn es-to-sql [query]
-  (let [wheres (for [[f-type field f-args] (->> query :query :bool :filter (map parse-filter))]
+  (let [join        #(clojure.string/join % %2)
+        wheres (for [[f-type field f-args] (->> query :query :bool :filter (map parse-filter))]
                   (let [convert (if (clojure.string/ends-with? field "_dt") epoch-to-str identity)]
                     (case f-type
-                      :range {:str (str field " BETWEEN ? AND ?") :args (mapv (comp convert f-args) [:gte :lte])}
-                      :term  {:str (str field " = ?")             :args [f-args]})))
-        where-str    (->> (map :str wheres) (clojure.string/join " AND ") (str " WHERE "))
+                      :range {:str [(str field " BETWEEN ? AND ?")] :args (mapv (comp convert f-args) [:gte :lte])}
+                      :term  {:str [(str field " = ?")]             :args [f-args]}
+
+                      :geo_bounding_box
+                      {:str (let [field (subs field 0 (- (count field) 4))]
+                              [(str field "_lat BETWEEN ? AND ?")
+                               (str field "_lon BETWEEN ? AND ?")])
+
+                       ; This is truly terrible, but in essense we are picking just min and max of the bounding box's latitude and longitude
+                       ; and I didn't feel like writing lookup keywords to the four corners in the correct order.
+                       :args (mapcat #(apply (juxt min max) (map (comp % f-args) [:top_left :bottom_right])) [:lat :lon])})))
+        where-str    (->> (mapcat :str wheres) (join " AND\n      ") (str " WHERE\n      "))
         where-args   (mapcat :args wheres)

         agg-params   (-> query :aggs parse-aggs)
@@ -279,22 +290,51 @@
         mtr-tmps     (get-params :metrics  :tmp)
         mtr-cols     (get-params :metrics  :col)

-        comma-join  #(clojure.string/join ", " %)
-        sql-str      (-> (str "\nSELECT " (comma-join (concat grb-cols mtr-cols ["COUNT(1) as n_rows"]))
+        inner-sql    (str "\n    SELECT\n      "
+                            (join ",\n      " (concat
+                                                (map col-a-as-b grb-aggs grb-cols)
+                                                (-> mtr-funs set sort)))
+                           "\n    FROM taxi_trips"
+                           "\n   " where-str)
+
+        outer-sql  (if (= (first grb-cols) "n_rows")
+                     ; A special case when only row count is calculated
+                     (-> inner-sql (clojure.string/replace "    " "") (str "\n\n"))
+
+                     ; The generic case with a few levels of aggregations
+                     (-> (str "\nSELECT\n  " (join ",\n  " (concat grb-cols mtr-cols ["SUM(1) AS n_rows"]))
                               "\nFROM ("
-                              "\n  SELECT " (comma-join (concat grb-cols (-> mtr-tmps set sort)))
+                              "\n  SELECT\n    " (join ",\n    " (concat grb-cols (-> mtr-tmps set sort)))
                               "\n  FROM ("
-                              "\n    SELECT " (comma-join
-                                                (concat
-                                                  (map col-a-as-b grb-aggs grb-cols)
-                                                  (-> mtr-funs set sort)))
-                              "\n    " where-str
+                              inner-sql
                               "\n  ) t"
-                              "\n) t GROUP BY {GROUP_BY}\n")
-                         (clojure.string/replace "{GROUP_BY}" (comma-join grb-cols)))]
-    (into [] (concat [sql-str] where-args))))
+                              "\n) t GROUP BY {GROUP_BY}\n\n")
+                         (clojure.string/replace "{GROUP_BY}" (join ", " grb-cols))))]
+    (into [outer-sql] where-args)))

 ; (->> ((:time-pickupday-paidtip filters)) ((:speed-kmph-percentiles-by-day aggregations)) clojure.pprint/pprint)
 ; (->> ((:time-pickupday-paidtip filters)) ((:paid-total-per-km-stats-by-company-and-day aggregations)) es-to-sql print)
 ; (->> ((:time-pickupday-paidtip filters)) ((:speed-kmph-percentiles-by-day aggregations)) es-to-sql print)
 ; (->> ((:time-pickupday-paidtip filters)) ((:paid-total-stats-by-time-of-day  aggregations)) es-to-sql print)
+; (->> ((:from-to-time filters)) ((:paid-total-per-km-stats-by-company-and-day aggregations)) es-to-sql print)
+
+
+(comment
+  (->> (for [[filter-name filter-generator] filters
+             [aggregation-name aggregation] aggregations]
+         (->> (filter-generator) aggregation es-to-sql
+              ((fn [[sql & args]] (apply format (clojure.string/replace sql #"\?" "%s")
+                                                (map #(if (string? %) (str \' % \') (str %)) args))))))
+       (apply str)
+       (spit "out.sql")))
+
+
+(comment
+  (->> (for [[filter-name filter-generator] filters
+             [aggregation-name aggregation] aggregations]
+         (aggregation (filter-generator)))
+       (map json/write-str)
+       (#(concat % ["" ""]))
+       (clojure.string/join "\n")
+       (spit "out.json")))
+


(PE-3047) Call shutdown-agents at end of shutdown processing

This commit adds a call to clojure.core/shutdown-agents to the end of
Trapperkeeper core's main function.  This allows agent thread pools to
start shutdown processing sooner than the default delay which would
occur in the shutdown of these pools.  This is especially useful for
allowing the JVM process running Trapperkeeper to terminate quickly when
an error has occurred during startup.

--- src/puppetlabs/trapperkeeper/core.clj
+++ src/puppetlabs/trapperkeeper/core.clj
@@ -164,4 +164,6 @@
       (println (:message m))
       (case (without-ns (:type m))
         :cli-error (System/exit 1)
-        :cli-help  (System/exit 0)))))
+        :cli-help  (System/exit 0)))
+    (finally
+      (shutdown-agents))))


Increase wait timeout

Increase wait timeout

--- test/onyx/peer/dashboard_colors_flow_test.clj
+++ test/onyx/peer/dashboard_colors_flow_test.clj
@@ -288,12 +288,12 @@
     (is (= (into #{} blue) blue-expectatations))))

 (defn load-last-deployment []
-  (webdriver/wait-until #(not (empty? (webdriver/text "div.container"))))
+  (webdriver/wait-until #(not (empty? (webdriver/text "div.container"))) 15000)
   (webdriver/click "button#ddl-deployment")
   (webdriver/click "ul.dropdown-menu > li:last-child"))

 (defn load-job []
-  (webdriver/wait-until #(= 2 (count (webdriver/find-elements {:css "tr.job-entry"}))))
+  (webdriver/wait-until #(= 2 (count (webdriver/find-elements {:css "tr.job-entry"}))) 15000)
   (webdriver/click (second (webdriver/find-elements {:css "tr.job-entry"}))))

 (defn check-job-text []


tests for discovery endpoints

tests for discovery endpoints

--- test/io/sarnowski/swagger1st/discoverer_test.clj
+++ test/io/sarnowski/swagger1st/discoverer_test.clj
@@ -13,4 +13,16 @@
     (is (= discovery)
         {:schema_url  "/swagger.json"
          :schema_type "swagger-2.0"
-         :ui_url      "/ui/"})))
+         :ui_url      "/ui/"}))
+
+  (let [result (app (mock/request :get "/swagger.json"))
+        definition (json/read-str (:body result))]
+    (is (= "2.0" (get definition "swagger"))))
+
+  (let [result (app (mock/request :get "/ui/"))
+        html (:body result)]
+    (is (.contains html "html")))
+
+  (let [result (app (mock/request :get "/ui/swagger-ui.min.js"))
+        js (slurp (:body result))]
+    (is (.contains js "prototype"))))


Fix on-close handler.

Fix on-close handler.

--- src/tranjlator/user.clj
+++ src/tranjlator/user.clj
@@ -12,8 +12,9 @@
         user-write (chan 10)]
     (log/info "new websocket")
     (ws/on-receive websocket #(a/put! user-read %))
-    (ws/on-close websocket #(do (a/close! user-read)
-                                (a/close! user-write)))
+    (ws/on-close websocket (fn [& _]
+                             (a/close! user-read)
+                             (a/close! user-write)))

     (go-loop []
       (let [msg (edn/read-string (<! user-read))]


Extracted roles into two namespaces.

Extracted roles into two namespaces.

--- spec/freefrog/governance_anchor_circle_spec.clj
+++ spec/freefrog/governance_anchor_circle_spec.clj
@@ -41,3 +41,5 @@
       (g/anchor-circle "Not Enough Information" "Joe Schmoe" nil))
     (should-throw IllegalArgumentException "No parameters may be empty"
       (g/anchor-circle "Not Enough Information" "Joe Schmoe" ""))))
+
+(run-specs)


require command keys to avoid missing keys breaking commandbar

--- src/lt/objs/command.cljs
+++ src/lt/objs/command.cljs
@@ -3,7 +3,11 @@

 (declare manager)

+(def required-keys #{:command :desc :exec})
+
 (defn command [cmd]
+  (assert (every? cmd required-keys)
+          (str "Command doesn't have required keys: " required-keys))
   (object/update! manager [:commands] assoc (:command cmd) cmd)
   (when (:options cmd)
     (object/add-tags (:options cmd) [:command.options]))


Echo notifos messages to console, since notifos truncates them and cant be copy/pasted

--- src/lt/objs/notifos.cljs
+++ src/lt/objs/notifos.cljs
@@ -24,6 +24,7 @@
   (object/merge! statusbar/statusbar-loader (merge {:message m :class ""} opts)))

 (defn set-msg! [msg opts]
+  (println "Notifos:" msg)
   (msg* msg opts)
   (js/clearTimeout cur-timeout)
   (set! cur-timeout (wait standard-timeout #(msg* ""))))


Ditto

Ditto

--- test/clojurewerkz/cassaforte/multi/cql_test.clj
+++ test/clojurewerkz/cassaforte/multi/cql_test.clj
@@ -1,9 +1,9 @@
 (ns clojurewerkz.cassaforte.multi.cql-test
   (:require [clojurewerkz.cassaforte.test-helper :as th]
-            [clojurewerkz.cassaforte.client :as client])
-  (:use clojurewerkz.cassaforte.multi.cql
-        clojure.test
-        clojurewerkz.cassaforte.query))
+            [clojurewerkz.cassaforte.client :as client]
+            [clojurewerkz.cassaforte.multi.cql :refer :all]
+            [clojure.test :refer :all]
+            [clojurewerkz.cassaforte.query :refer :all]))

 (use-fixtures :each th/initialize!)


Issue 10485: Added funs for exploring objects at runtime

git-svn-id: b7e9aa1d6cd963481915708f70423d437278b157@19417 bd66a97b-2aff-0310-9095-89ca5cabf5a6

--- src/main/clojure/com/imcode/imcms/runtime.clj
+++ src/main/clojure/com/imcode/imcms/runtime.clj
@@ -4,8 +4,9 @@
   (:import
     [imcode.server Imcms]
     [imcode.server.document DocumentDomainObject]
-    [com.imcode.imcms.misc-utils :only (dump)]
-    [imcode.server.user UserDomainObject]))
+    [imcode.server.user UserDomainObject])
+  (:use
+    [com.imcode.imcms.misc-utils :only [dump]]))

 (defmacro invoke
   "Invokes Imcms class static method."
@@ -39,6 +40,9 @@
 (defn doc-mapper []
   (.getDocumentMapper (services)))

+(defn auth-mapper []
+  (.getImcmsAuthenticatorAndUserAndRoleMapper (services)))
+
 (defn langs []
   (.getLanguages (i18n-support)))

@@ -47,7 +51,7 @@

 (defn find-lang-by-code [#^String code]
-  (if-let [lang (.getByCode (get-i18n-support) code)]
+  (if-let [lang (.getByCode (i18n-support) code)]
     lang
     (throw (Exception. (format "Language with code [%s] can not be found." code)))))

@@ -91,20 +95,20 @@
   "Loads all documents from database to the cache. Use with care.
    Returns nil."
   []
-  (doseq [get-doc-fn [get-working-doc get-default-doc], id (get-doc-ids), lang (get-langs)]
-    (get-doc-fn id lang)))
+  (doseq [doc-fn [working-doc default-doc], id (doc-ids), lang (langs)]
+    (doc-fn id lang)))

 (defn unload-docs
   "Unloads doc(s) with the given id(s) from the cache.
    Returns nil."
   [id & ids]
-  (let [cache (get-doc-cache)]
+  (let [cache (doc-cache)]
     (doseq [doc-id (cons id ids)] (.removeDocumentFromCache cache doc-id))))

 (defn clear-cache []
-  (.clearCache (get-doc-cache)))
+  (.clearCache (doc-cache)))

 (defn loaded-docs-info
@@ -130,7 +134,7 @@
   [login password]
   (let [login (if (keyword? login) (name login) login)
         password (if (keyword? login) (name login) login)]
-    (.verifyUser (get-services) login password)))
+    (.verifyUser (services) login password)))

 (defn conf
@@ -140,4 +144,14 @@

 (defn print-conf []
-  (dump (conf)))+  (dump (conf)))
+
+
+(defn roles []
+  (.getAllRoles (auth-mapper)))
+
+(defn users []
+  (.getUsers (auth-mapper) true true))
+
+(defn users-info []
+  (for [u (users)] {:id (.getId u), :name (.getLoginName u), :password (.getPassword u)}))


Correct major/minor key

Correct major/minor key

--- src/musicbox/scales.cljs
+++ src/musicbox/scales.cljs
@@ -1,8 +1,8 @@
 (ns musicbox.scales)

-(def note-freqs {:c4 261.6})
-(def key' {:major [true false true true false true false true true false true false]
-           :minor [true false true false true true false true false true false true]})
+(def note-freqs {:c3 130.81 :c4 261.6})
+(def key' {:major [true false true false true true false true false true false true]
+          :minor [true false true true false true false true true false true false]})

 (defn chromatic
@@ -22,8 +22,8 @@

 (defn c-minor
   []
-  (let [all-notes (chromatic (:c4 note-freqs) 25)
-        key-notes (:major key')]
+  (let [all-notes (chromatic (:c3 note-freqs) 37)
+        key-notes (:minor key')]
     (filter identity
             (for [x (range (count all-notes))]
               (if (nth key-notes (mod x 12)) (nth all-notes x))))))


Makes eastwood happy.

Makes eastwood happy.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -7,7 +7,6 @@
             [oc.lib.text :as text]
             [hiccup.core :as h]
             [hickory.core :as hickory]
-            [taoensso.timbre :as timbre]
             [oc.lib.jwt :as jwt]
             [oc.email.config :as config]
             [jsoup.soup :as soup]))
@@ -117,21 +116,6 @@
     [:tr
       [:th {:class "small-12 large-12 columns"}
         (spacer-table pixels inner-css-class)]]]))
-
-(defn- horizontal-line
-  ([] (horizontal-line nil))
-  ([css-class]
-    [:table {:class (str (when css-class (str css-class " "))
-                         "row horizontal-line")}
-     [:tr
-      [:td {:class "small-12 large-12"}
-       (spacer 8)]]]))
-
-(def horizontal-line
-  [:table {:class "row horizontal-line"}
-    [:tr
-      [:td {:class "small-12 large-12"}
-        (spacer 8)]]])

 (defn- paragraph
   ([content] (paragraph content ""))


Stop measuring refl! versions

Stop measuring refl! versions

--- benchmarks/caesium/crypto/secretbox_benchmark.clj
+++ benchmarks/caesium/crypto/secretbox_benchmark.clj
@@ -85,16 +85,14 @@
    "secretbox to-buf! with direct bufs, pre-allocation"
    [secretbox-easy-to-direct-byte-bufs-with-macros!
     secretbox-easy-to-direct-byte-bufs!
-    secretbox-easy-to-byte-bufs-nocast!
-    secretbox-easy-refl!]
+    secretbox-easy-to-byte-bufs-nocast!]
    bb/->direct-byte-buf)

   (bench-secretnonce
    "secretbox to-buf! with indirect bufs, pre-allocation"
    [secretbox-easy-to-indirect-byte-bufs-with-macros!
     secretbox-easy-to-indirect-byte-bufs!
-    secretbox-easy-to-byte-bufs-nocast!
-    secretbox-easy-refl!]
+    secretbox-easy-to-byte-bufs-nocast!]
    bb/->indirect-byte-buf)

   (bench-secretnonce


Add new helper fns: node-destroyed-event-key, node-created-event-key, node-paused-event-key, node-started-event-key to discover the event keys for the node manipulation keys. Also add helper handler fns on-node-created, on-node-paused, on-node-started to make it easier to add fns to handle these events.

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -290,6 +290,78 @@
         (reset! (:status snode) :live)
         (event [:overtone :node-started (:id snode)] {:node snode}))
       (log/warn (format "ERROR: The fn node-started can't find synth node: %d" id)))))
+
+(defn node-destroyed-event-key
+  "Returns the key used for node destroyed events"
+  [node]
+  [:overtone :node-destroyed (to-sc-id node)])
+
+(defn node-created-event-key
+  "Returns the key used for node created events"
+  [node]
+  [:overtone :node-created (to-sc-id node)])
+
+(defn node-paused-event-key
+  "Returns the key used for node paused events"
+  [node]
+  [:overtone :node-paused (to-sc-id node)])
+
+(defn node-started-event-key
+  "Returns the key used for node started events"
+  [node]
+  [:overtone :node-started (to-sc-id node)])
+
+(defn on-node-destroyed
+  "Creates a oneshot event handler which will be triggered when node is
+   destroyed. Returns event handler key."
+  [node f]
+  (let [k  (uuid)
+        id (to-sc-id node)]
+    (oneshot-event (node-destroyed-event-key id)
+                   f
+                   id)
+    k))
+
+(defn on-node-created
+  "Creates a oneshot event handler which will be triggered when node is
+   created. Returns event handler key."
+  [node f]
+  (let [k  (uuid)
+        id (to-sc-id node)]
+    (oneshot-event (node-created-event-key id)
+                   f
+                   id)
+    k))
+
+(defn on-node-paused
+  "Creates a recurring event handler which will be triggered when node
+   is paused. This on-pause handler is automatically removed when node
+   is destroyed. Returns on-pause handler key."
+  [node f]
+  (let [k  (uuid)
+        id (to-sc-id node)]
+    (on-event (node-paused-event-key id)
+                   f
+                   id)
+    (oneshot-event (node-destroyed-event-key id)
+                   #(remove-handler k)
+                   (uuid))
+    k))
+
+(defn on-node-started
+  "Creates a recurring event handler which will be triggered when node
+   is paused. This on-started handler is automatically removed when node
+   is destroyed. Returns on-started handler key."
+  [node f]
+  (let [k  (uuid)
+        id (to-sc-id node)]
+    (on-event (node-started-event-key id)
+                   f
+                   id)
+    (oneshot-event (node-destroyed-event-key id)
+                   #(remove-handler k)
+                   (uuid))
+    k))

 ;; Setup the feedback handlers with the audio server.
 (on-event "/n_end" (fn [info] (node-destroyed (first (:args info)))) ::node-destroyer)


Increment version of modular.bidi

Increment version of modular.bidi

--- modules/bidi/project.clj
+++ modules/bidi/project.clj
@@ -1,6 +1,6 @@
 ;; Copyright © 2014 JUXT LTD.

-(defproject juxt.modular/bidi "0.5.2"
+(defproject juxt.modular/bidi "0.5.3"
   :description "A modular extension that provides support for bidi routing"
   :url "https://github.com/juxt/modular/tree/master/modules/bidi"
   :license {:name "The MIT License"


Added dependency fro cljs to shadow-build

--- modules/cljs/project.clj
+++ modules/cljs/project.clj
@@ -1,10 +1,11 @@
 ;; Copyright © 2014 JUXT LTD.

-(defproject juxt.modular/cljs "0.1.0"
+(defproject juxt.modular/cljs "0.1.1"
   :description "A modular extension that provides support for ClojureScript building and Javascript serving"
   :url "https://github.com/juxt/modular/tree/master/modules/cljs"
   :license {:name "The MIT License"
             :url "http://opensource.org/licenses/MIT"}
   :dependencies [[prismatic/schema "0.2.1"]
                  [juxt/modular "0.3.0"]
-                 [juxt.modular/bidi "0.3.0"]])
+                 [juxt.modular/bidi "0.3.0"]
+                 [thheller/shadow-build "0.5.0" :exclusions [org.clojure/clojurescript]]])


Fix error

Fix error

--- src/pict_source/core.clj
+++ src/pict_source/core.clj
@@ -43,15 +43,6 @@
               "Ошибка"
               (html (pict-source.error/page))))

-(defn public-assets []
-  (assets/load-bundle "assets/css"
-                      "style.css"
-                      ["/normalize.css" "/skeleton.css" "/main.css"]))
-
-(def public-pages (merge
-                    {"/" index "/error/" error}
-                    (lang-routes)))
-
 ;;; Site builder

 (defn lang-routes []
@@ -59,6 +50,15 @@
     (fn [acc param-lang] (into acc {(str "/" param-lang "/") (partial lang param-lang)}))
     {}
     (dictionary/langs-available)))
+
+(def site-pages (merge
+                    {"/" index "/error/" error}
+                    (lang-routes)))
+
+(defn public-assets []
+  (assets/load-bundle "assets/css"
+                      "style.css"
+                      ["/normalize.css" "/skeleton.css" "/main.css"]))

 (defn build-assets [assets]
   (as-> assets a
@@ -73,7 +73,7 @@
   (let [optimized-assets (assets-optimizations/all (public-assets) {})]
     (stasis/empty-directory! export-dir)
     (build-assets optimized-assets)
-    (stasis/export-pages public-pages export-dir {:optimus-assets optimized-assets})
+    (stasis/export-pages site-pages export-dir {:optimus-assets optimized-assets})
     (add-config-to-build)))

 ;;; Development server
@@ -92,7 +92,7 @@
           (update-in response [:headers "Content-Type"] #(str % "; charset=utf-8"))
           response)))))

-(def server (-> (stasis/serve-pages public-pages)
+(def server (-> (stasis/serve-pages site-pages)
                 (optimus/wrap
                   public-assets assets-optimizations/all assets-strategies/serve-live-assets)
                 ring.middleware.content-type/wrap-content-type


Allow starting with empty map when given a filename for a file that does not exist; calls to save-fs! will save to the given filename, useful to quickly start working with a new mapfs

--- src/mapfs/core.clj
+++ src/mapfs/core.clj
@@ -19,12 +19,12 @@
 (defn load-fs!
   "Load EDN from filename as current filesystem."
   [filename]
+  (reset! FS_FILENAME filename)
   (if (.exists (java.io.File. filename))
     (with-open [r (java.io.PushbackReader.
                     (clojure.java.io/reader filename))]
-      (reset! FS_ROOT (edn/read r))
-      (reset! FS_FILENAME filename))
-    (throw (Exception. "File not found :("))))
+      (reset! FS_ROOT (edn/read r)))
+    (reset! FS_ROOT {})))

 (defn save-fs!
   "Save current filesystem to file used with load-fs!"


shuffle before working on conversations.

--- src/polismath/poller.clj
+++ src/polismath/poller.clj
@@ -76,8 +76,10 @@
     (endlessly poll-interval
       (println "poll >" @last-timestamp)
       (let [new-votes (poll pg-spec @last-timestamp)
-            split-votes (group-by :zid new-votes)]
-        (doseq [[zid votes] split-votes]
+            zid-to-votes (group-by :zid new-votes)
+            zid-votes (shuffle (into [] zid-to-votes))
+            ]
+        (doseq [[zid votes] zid-votes]
           (let [lastVoteTimestamp (:created (last votes))]
             (swap! conversations
               (fn [convs]


Cruft

Cruft

--- src-dev/cljs/kindness/dev.cljs
+++ src-dev/cljs/kindness/dev.cljs
@@ -10,13 +10,7 @@
 (defn teardown []
   (when game/control-chan
     (println "Sending close signal")
-    (put! game/control-chan :close)
-    )
-  ;; While game-state is still in flux...
-  ;; (reset! game/game-state {})
-  ;; (when game/@rafID
-  ;;   (js/window cancelAnimationFrame game/@rafID))
-  )
+    (put! game/control-chan :close)))

 (fw/start {
            ;; configure a websocket url if you are using your own server


good so far

good so far

--- test/bluebell/utils/core_test.clj
+++ test/bluebell/utils/core_test.clj
@@ -33,3 +33,9 @@
 (deftest group-transducer-test
   (is (reduce ((bundle 2) conj) [] [1 2 3 4 5 6])
       [[1 2] [3 4] [5 6]]))
+
+(defn count-and-inc [state x]
+  [(inc state) (inc x)])
+
+(deftest reduce-coll-items-test
+  (is [3 #{1 2 3} (reduce-coll-items count-and-inc 0 #{0 1 2})]))


cleaning

cleaning

--- test/celestial/test/workflows.clj
+++ test/celestial/test/workflows.clj
@@ -15,7 +15,6 @@
       success (merge machine {:foo 1} {:event :success :workflow :reload})
       fail   (merge machine {:foo 1} {:event :error :workflow :reload})]
   (with-redefs [config identity-hook]
-    (println config)
     (fact "post hook invoke"
       (run-hooks machine :reload :success) => nil
       (provided
@@ -29,4 +28,3 @@
 (fact "missing fn resolution error"
   (resolve- "non.existing/fn") => (throws ExceptionInfo))

-(run-hooks {} :reload :post-success)


fixup build api tests

fixup build api tests

--- test/clj/cljs/build_api_tests.clj
+++ test/clj/cljs/build_api_tests.clj
@@ -6,9 +6,9 @@
    [cljs.analyzer]))

 (deftest test-target-file-for-cljs-ns
-  (is (= (.getPath (target-file-for-cljs-ns nil 'example.core-lib))
+  (is (= (.getPath (target-file-for-cljs-ns 'example.core-lib nil))
          "out/example/core_lib.js"))
-  (is (= (.getPath (target-file-for-cljs-ns "output" 'example.core-lib))
+  (is (= (.getPath (target-file-for-cljs-ns 'example.core-lib "output"))
          "output/example/core_lib.js")))

 (deftest test-cljs-dependents-for-macro-namespaces


Added comments to all functions from db-interface module

--- src/zg/db_interface.clj
+++ src/zg/db_interface.clj
@@ -7,7 +7,7 @@
 ;  http://www.eclipse.org/legal/epl-v10.html
 ;
 ;  Contributors:
-;      Pavel Tisnovsky
+;      Pavel Tisnovsky
 ;

 (ns zg.db-interface
@@ -19,12 +19,14 @@
 (require '[zg.format-date :as format-date])

 (defn status->int
+    "Convert word status (:deleted, :undeleted) into an integer."
     [status]
     (if (= status :deleted)
         1
         0))

 (defn dictionary-type->char
+    "Convert dictionary type (:whitelist, :blacklist) into an integer."
     [dictionary-type]
     (condp = dictionary-type
         :whitelist "w"
@@ -32,7 +34,7 @@

 (defn insert-word-into-dictionary
     "Try to insert new word into the dictionary. If insert fails, exception
-     is thrown and needs to be caught outside this function."
+     is thrown and it needs to be caught outside this function."
     [word description user-name dictionary-type datetime]
     (jdbc/insert! db-spec/zg-db
         :dictionary {:word       word
@@ -43,6 +45,8 @@
                      :description description}))

 (defn add-new-word-into-dictionary
+    "Add new word into the dictionary. If the word already exist, it is
+     simply updated (make sense only for blacklist)."
     ([word user-name dictionary-type]
     (let [datetime (format-date/format-current-date)]
         (println "storing" datetime word)
@@ -63,10 +67,12 @@
                         (println e))))))))

 (defn set-word-status
+    "Set or change status of given word in the dictionary (:deleted, :undeleted)."
     [word dictionary-type status]
     (try
         (jdbc/update! db-spec/zg-db
-                      :dictionary {:deleted (status->int status)} ["word = ? and dictionary = ?" word (dictionary-type->char dictionary-type)])
+                      :dictionary {:deleted (status->int status)}
+                                   ["word = ? and dictionary = ?" word (dictionary-type->char dictionary-type)])
         (catch Exception e
             (println e)
             [])))


Add a game chooser

Add a game chooser

--- src/randometer/core.cljs
+++ src/randometer/core.cljs
@@ -67,7 +67,7 @@
      [:button {:on-click #(on-reset) :style {:margin-top "0.5em"}}
       "play again"])])

-(defn choose-one [x xs]
+(defn choose-corr [x xs]
   (let [game-state (atom {})
         init-game! (fn []
                      (let [boards (map #(puzzle muted-generator %) (cons x xs))
@@ -88,9 +88,22 @@
          boards keymap guess]))))

 (defn main-page []
-  [:div
-   [:h1 "Randometer"]
-   [choose-one 0.5 [0.25 0.33 0.67 0.75]]])
+  (let [app-state (atom {:game nil})]
+    (fn []
+      [:div
+       [:h1 "Randometer"]
+       [:label {:style {:display "block" :margin-bottom "1em"}}
+        "Select a game: "
+        [:select {:value (:game @app-state)
+                  :on-change #(swap! app-state assoc :game (-> % .-target .-value))}
+         [:option]
+         [:option {:value "choose-corr"} "Identify the uncorrelated sequence"]
+         [:option {:value "choose-bias"} "Identify the unbiased sequence"]
+         [:option {:value "decide-corr"} "Correlated or uncorrelated"]
+         [:option {:value "decide-bias"} "Biased or unbiased"]]]
+       (case (:game @app-state)
+         "choose-corr" [choose-corr 0.5 [0.25 0.33 0.67 0.75]]
+         nil)])))

 (reagent/render-component [main-page]
                           (. js/document (getElementById "app")))


:fire: Remove unused change event impl (:mov-obj).

--- common/uxbox/common/pages.cljc
+++ common/uxbox/common/pages.cljc
@@ -149,10 +149,6 @@
   (s/keys :req-un [::id]
           :opt-un [::session-id]))

-(defmethod change-spec-impl :mov-obj [_]
-  (s/keys :req-un [::id ::frame-id]
-          :opt-un [::session-id]))
-
 (defmethod change-spec-impl :mov-objects [_]
   (s/keys :req-un [::parent-id ::shapes]
           :opt-un [::index]))
@@ -228,16 +224,6 @@
               (assoc objects id (reduce process-operation obj operations))
               objects))))

-(defmethod process-change :mov-obj
-  [data {:keys [id frame-id] :as change}]
-  (assert (contains? (:objects data) frame-id))
-  (let [frame-id' (get-in data [:objects id :frame-id])]
-    (when (not= frame-id frame-id')
-      (-> data
-          (update-in [:objects frame-id' :shapes] (fn [s] (filterv #(not= % id) s)))
-          (update-in [:objects id] assoc :frame-id frame-id)
-          (update-in [:objects frame-id :shapes] conj id)))))
-
 (defmethod process-change :del-obj
   [data {:keys [id] :as change}]
   (when-let [{:keys [frame-id shapes] :as obj} (get-in data [:objects id])]


Clean up mode config imports.

Clean up mode config imports.

--- src/org/playasophy/wonderdome/mode/config.clj
+++ src/org/playasophy/wonderdome/mode/config.clj
@@ -5,12 +5,10 @@
       lantern
       rainbow
       strobe)
-    (org.playasophy.wonderdome.util
-      [color :as color])
-    [potemkin :refer [import-vars]]))
+    potemkin))

-(import-vars
+(potemkin/import-vars
   (org.playasophy.wonderdome.mode.lantern lantern)
   (org.playasophy.wonderdome.mode.rainbow rainbow)
   (org.playasophy.wonderdome.mode.strobe strobe))


core: resolve

core: resolve

--- core/data/core.clj
+++ core/data/core.clj
@@ -2077,6 +2077,12 @@
     (when-not (contains? env sym)
       (ns-resolve* (the-ns ns) sym))))

+(defn resolve
+  "Same as (ns-resolve *ns* sym) or (ns-resolve *ns* env sym)"
+  {:added "1.0"}
+  ([sym] (ns-resolve *ns* sym))
+  ([env sym] (ns-resolve *ns* env sym)))
+
 (defn slurp
   "Opens a file f and reads all its contents, returning a string."
   {:added "1.0"}


[#1303] Refactor SentryErrorTracker

[#1303] Refactor SentryErrorTracker

--- backend/src/akvo/lumen/boundary/error_tracker.clj
+++ backend/src/akvo/lumen/boundary/error_tracker.clj
@@ -7,15 +7,18 @@
 (defprotocol IErrorTracker
   (track [this error]))

+(defn event-map [error]
+  (let [text (str (ex-data error))]
+    {:extra {:ex-data (subs text 0 (min (count text) 4096))}
+     :message (.getMessage error)}))
+
 (extend-protocol IErrorTracker

   SentryErrorTracker
   (track [{:keys [dsn]} error]
     (let [app-namespaces ["org.akvo" "akvo"]
-          event-info (raven-interface/stacktrace
-                      {:message (.getMessage error)
-                       :extra {:ex-data (truncate-extra-str (str (ex-data error)))}}
-                      error app-namespaces)]
+          event-map (event-map error)
+          event-info (raven-interface/stacktrace event-map error app-namespaces)]
       (future (raven/capture dsn event-info))))

   LocalErrorTracker


CMR-2118 Removes redundant defmulti.

CMR-2118 Removes redundant defmulti.

--- ingest-app/src/cmr/ingest/services/ingest_service.clj
+++ ingest-app/src/cmr/ingest/services/ingest_service.clj
@@ -27,13 +27,9 @@
   "A configuration feature switch that turns on CMR ingest validation."
   (cfg/config-value-fn :ingest-validation-enabled "true" #(= % "true")))

-(defmulti add-extra-fields-for-collection
+(defn add-extra-fields-for-collection
   "Returns collection concept with fields necessary for ingest into metadata db
   under :extra-fields."
-  (fn [context concept collection]
-    (type collection)))
-
-(defn add-extra-fields-for-collection
   [context concept collection]
   (let [{{:keys [short-name version-id]} :product
          {:keys [delete-time]} :data-provider-timestamps


Tweaks to prevent errors when operating with systap bigdata backed sesame implementations, which aren't as liberal as plain sesame.

--- src/rdf-repository/grafter/rdf/repository.clj
+++ src/rdf-repository/grafter/rdf/repository.clj
@@ -331,10 +331,12 @@
   ([repo sparql-string] (prepare-query repo sparql-string nil))
   ([repo sparql-string dataset]
      (let [conn (->connection repo)]
-       (doto (.prepareQuery conn
-                            QueryLanguage/SPARQL
-                            sparql-string)
-         (.setDataset dataset)))))
+       (let [pq (.prepareQuery conn
+                               QueryLanguage/SPARQL
+                               sparql-string)]
+
+         (when dataset (.setDataset pq dataset))
+         pq))))

 (defn prepare-update
   "Prepare (parse but don't process) a SPARQL update request.
@@ -343,11 +345,13 @@
   ([repo sparql-update-str] (prepare-update repo sparql-update-str nil))
   ([repo sparql-update-str dataset]
      (let [conn (->connection repo)]
-       (doto
-           (.prepareUpdate conn
-                           QueryLanguage/SPARQL
-                           sparql-update-str)
-         (.setDataset dataset)))))
+       (let [pu (.prepareUpdate conn
+                                QueryLanguage/SPARQL
+                                sparql-update-str)]
+         (when dataset
+           (.setDataset pu dataset))
+
+         pu))))

 (extend-type RepositoryConnection
   pr/ISPARQLable


Update deps

Update deps

--- cortex/project.clj
+++ cortex/project.clj
@@ -4,17 +4,17 @@
                  [com.taoensso/timbre "4.3.1"]
                  [org.clojure/test.check "0.9.0"]
                  [thinktopic/matrix.fressian "0.3.1"]
-                 [net.mikera/vectorz-clj "0.44.0"]
-                 [net.mikera/core.matrix "0.51.0"]
+                 [net.mikera/vectorz-clj "0.45.0"]
+                 [net.mikera/core.matrix "0.54.0"]
                  [thinktopic/caffe-protobuf "0.1.0"]
-                 [net.mikera/clojure-utils "0.6.2"]
+                 [net.mikera/clojure-utils "0.7.0"]
                  [core.blas "1.0.2"]
                  [com.github.fommil.netlib/all "1.1.2" :extension "pom"]
                  [rhizome "0.2.5"]]

   :java-source-paths ["java"]

-  :profiles {:dev {:dependencies [[net.mikera/cljunit "0.4.0"]  ;; allows JUnit testing
+  :profiles {:dev {:dependencies [[net.mikera/cljunit "0.4.1"]  ;; allows JUnit testing
                                   [criterium/criterium "0.4.4"] ;; benchmarking tool
                                   ] ;; alternate core.matrix implementation
                    :source-paths ["src" "test/cljc" "test/clj"]


Make some code more robust

Make some code more robust

--- src/spectrace/trace.cljc
+++ src/spectrace/trace.cljc
@@ -76,10 +76,11 @@
 (defn- step-for-every [{:keys [val in] :as state} succ fail]
   (with-cont succ fail
     (let [[key & in] in]
-      (-> state
-          (update :spec get-in [:args :spec])
-          (assoc :val (nth val key))
-          (assoc :in in)))))
+      (when (and (vector? val) (> (count val) key))
+        (-> state
+            (update :spec get-in [:args :spec])
+            (assoc :val (nth val key))
+            (assoc :in in))))))

 (defmethod step* `s/every [state succ fail]
   (step-for-every state succ fail))
@@ -87,15 +88,19 @@
 (defmethod step* `s/coll-of [state succ fail]
   (step-for-every state succ fail))

-(defn- step-for-every-kv [{:keys [path val in] :as state} succ fail]
+(defn- step-for-every-kv [{:keys [spec path val in] :as state} succ fail]
   (with-cont succ fail
     (let [[segment & path] path
-          [key1 key2 & in] in]
-      (-> state
-          (update :spec get-in [:args (case segment 0 :kpred 1 :vpred)])
-          (assoc :path path
-                 :val (-> val (find key1) (nth key2))
-                 :in in)))))
+          [key1 key2 & in] in
+          pred-key (case segment 0 :kpred 1 :vpred nil)]
+      (when (and pred-key
+                 (contains? (:args spec) pred-key)
+                 (map? val)
+                 (contains? val key1))
+        {:spec (get-in spec [:args pred-key])
+         :path path
+         :val (-> val (find key1) (nth key2))
+         :in in}))))

 (defmethod step* `s/map-of [state succ fail]
   (step-for-every-kv state succ fail))


Upgraded to latest stable cider release (+ deps).

--- lein/.lein/profiles.d/cider.clj
+++ lein/.lein/profiles.d/cider.clj
@@ -1,6 +1,6 @@
-{:plugins [[cider/cider-nrepl "0.14.0"]
-           [refactor-nrepl "2.2.0"]]
- :dependencies [[cider/cider-nrepl "0.14.0"]]
+{:plugins [[cider/cider-nrepl "0.15.0"]
+           [refactor-nrepl "2.3.1"]]
+ :dependencies [[cider/cider-nrepl "0.15.0"]]
  :env {:squiggly
               ;; Quote options to avoid warnings
               ;; introduced with `lein-environ 1.1.0` plugin


Report correct test name in debug output.

--- web/test-integration/immutant/web/integ_test.clj
+++ web/test-integration/immutant/web/integ_test.clj
@@ -724,10 +724,10 @@
                (async/as-channel request
                  :timeout 100
                  :on-error (fn [_ e]
-                             (println "ERROR stream-should-timeout")
+                             (println "ERROR stream-timeouts")
                              (.printStackTrace e))
                  :on-close (fn [_ reason]
-                             (println "CLOSE stream-should-timeout")
+                             (println "CLOSE stream-timeouts")
                              (deliver @client-state :closed)))))]
       (flog
         (replace-handler handler)


Better error message if resource doesn't exist

--- src/territory_bro/db.clj
+++ src/territory_bro/db.clj
@@ -191,6 +191,8 @@
     (apply query-fn conn params)))

 (defn compile-queries [path]
-  (let [queries (atom {:resource (io/resource path)})]
+  (let [resource (io/resource path)
+        _ (assert resource (str "Resource not found: " path))
+        queries (atom {:resource resource})]
     (fn [conn name & params]
       (query! conn queries name params))))


Use syntax-quote instead of (apply list ...)

--- src/useful/datatypes.clj
+++ src/useful/datatypes.clj
@@ -76,10 +76,10 @@
         vals   (reduce (fn [vals [f field & args]]
                          (if-let [i (index (normalize-field-name field))]
                            (assoc vals
-                             i (apply list f (get vals i) args))
+                             i `(~f ~(get vals i) ~@args))
                            (let [i (index '__extmap)]
                              (assoc vals
-                               i (apply list `update (get vals i) (keyword field) args)))))
+                               i `(update ~(get vals i) ~(keyword field) ~@args)))))
                        (vec (map #(list '. r %) fields))
                        forms)]
     `(let [~r ~record]


Fix (cljs) tests

Fix (cljs) tests

--- test/cljc/reitit/middleware_test.cljc
+++ test/cljc/reitit/middleware_test.cljc
@@ -113,7 +113,7 @@

         (testing "too deeply compiled Middleware fails"
           (binding [middleware/*max-compile-depth* 2]
-            (is (thrown? Exception (->app [[(middleware/create mw3) :value]] identity)))))
+            (is (thrown? ExceptionInfo (->app [[(middleware/create mw3) :value]] identity)))))

         (testing "nil unmounts the middleware"
           (let [app (->app [{:compile (constantly nil)}


improve fullscreen behavior

improve fullscreen behavior

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

--- plugins/SlideExplorer2/src/slide_explorer/display.clj
+++ plugins/SlideExplorer2/src/slide_explorer/display.clj
@@ -1,7 +1,8 @@
 (ns slide-explorer.display
   (:import (javax.swing AbstractAction JComponent JFrame JLabel KeyStroke)
            (java.awt Canvas Color Graphics Graphics2D RenderingHints Window)
-           (java.awt.event ComponentAdapter KeyAdapter KeyEvent MouseAdapter WindowAdapter)
+           (java.awt.event ComponentAdapter KeyAdapter KeyEvent MouseAdapter
+                           WindowAdapter)
            (java.awt.image BufferedImage WritableRaster)
            (java.awt.geom AffineTransform Point2D$Double)
            (java.io ByteArrayInputStream)
@@ -87,6 +88,7 @@

 (defn get-tile [[nx ny nz nc nt]]
   (awt-image (grab-tagged-image)))
+  ;(slide-explorer.imagej/try-3-colors false))

 (defn add-tile [tile-map tile-zoom indices]
   (assoc-in tile-map [tile-zoom indices] (get-tile indices)))
@@ -142,17 +144,16 @@
 to normal size."
   ([^java.awt.GraphicsDevice device window]
     (if window
-      (do
+      (when (not= (.getFullScreenWindow device) window)
         (.dispose window)
         (.setUndecorated window true)
         (.setFullScreenWindow device window)
         (.show window))
-      (let [window (.getFullScreenWindow device)]
+      (when-let [window (.getFullScreenWindow device)]
+        (.dispose window)
         (.setFullScreenWindow device nil)
-        (when window
-          (.dispose window)
-          (.setUndecorated window false)
-          (.show window))))
+        (.setUndecorated window false)
+        (.show window)))
     window)
   ([window]
     (full-screen! (default-screen-device) window)))
@@ -300,12 +301,14 @@
   (add-to-available-tiles at 0 [nx ny 0 0 0]))

 (defn test-tiles [nx ny]
-  (doseq [i (range (- nx) (inc nx)) j (range (- ny) (inc ny))]
-    (Thread/sleep 1000)
-    (test-tile i j)))
+  (.start (Thread.
+            #(doseq [i (range (- nx) (inc nx)) j (range (- ny) (inc ny))]
+               (Thread/sleep 1000)
+               (test-tile i j)))))

 (defn test-rotate []
-  (.start (Thread. #(do (dorun (repeatedly 2000 (fn [] (Thread/sleep 10) (swap! angle + 0.02))))
+  (.start (Thread. #(do (dorun (repeatedly 2000 (fn [] (Thread/sleep 10)
+                                                  (swap! angle + 0.02))))
                         (reset! angle 0)))))


Write tests for util functions

Write tests for util functions

--- test/hydrofoil/expectations/utils.clj
+++ test/hydrofoil/expectations/utils.clj
@@ -1,9 +1,28 @@
 (ns hydrofoil.expectations.utils
   (:require [expectations :refer :all]
-            [hydrofoil.core :refer :all]
-            [hydrofoil.evolution :refer :all]))
+            [hydrofoil.utils :refer :all]))

 ;;; --------- Utils Tests ------------

-(expect 2
-        (+ 1 1))
+;; round-double tests
+; Four Digits or less
+(expect 0.1000
+        (round-double 0.1000))
+(expect 0.9999
+        (round-double 0.9999))
+
+; Over four digits
+(expect 0.1
+        (round-double 0.100001))
+(expect 1.0
+        (round-double 0.99999))
+
+;; rand-double tests
+(expect true
+        (<= 0.0 (rand-double 0 1) 1))
+(expect true
+        (<= 0.5 (rand-double 0.5 12) 12))
+(expect true
+        (<= -1.0 (rand-double -1.0 1.0) 1.0))
+(expect 0.0
+        (rand-double 0 0))


Zap reduce-scalar-config-settings.

Zap reduce-scalar-config-settings.

--- src/active/clojure/config.cljc
+++ src/active/clojure/config.cljc
@@ -857,14 +857,6 @@
                     (really-make-configuration cf
                                                (section-schema (last sections))))))

-(defn reduce-scalar-config-settings
-  "Reduce over all scalary config values in config, where `f` is
-  called as `(f range key init val)`, where `val` matches the scalary
-  `range`."
-  [schema f init config-object]
-  (let [r (schema-range schema)]
-    ((range-reduce r) r [] f init config-object)))
-
 (defn or-dot-range
   "Given range `r` is required in the first line,
 the remainder of the lines the field holds \".\"."


Remove old gloss tests

Remove old gloss tests

--- test/onyx/messaging/protocol_test.clj
+++ test/onyx/messaging/protocol_test.clj
@@ -2,7 +2,7 @@
   (:require [onyx.messaging.protocol :as protocol]
             [midje.sweet :refer :all]))

-(fact (let [message {:type protocol/completion-type-id
+(comment (fact (let [message {:type protocol/completion-type-id
                      :id #uuid "11837bd7-2de5-4b62-888d-171c4c47845c"}]
         (= message (protocol/read-buf (protocol/build-msg-buf message))))
       => true)
@@ -41,79 +41,4 @@
 (fact (let [messages {:type protocol/messages-type-id
                       :messages '()}]
         (= messages (protocol/read-buf (protocol/build-msg-buf messages))))
-      => true)
-
-;;;;
-;;; GLOSS TESTS
-
-(comment
-  ; (io/decode
-  ;   onyx-protocol
-  ;   (io/encode onyx-protocol
-  ;              (send-messages->frame '({:id #uuid  "ac39bc62-8f06-46a0-945e-3a17642a619f"
-  ;                                       :acker-id #uuid  "11837bd7-2de5-4b62-888d-171c4c47845c"
-  ;                                       :completion-id #uuid  "b57f7be1-f2f9-4d0f-aa02-939b3d48dc23"
-  ;                                       :message {:n 1}
-  ;                                       :ack-val 7292143382010058362}))))
-
-  (alength (compress '({:id #uuid  "ac39bc62-8f06-46a0-945e-3a17642a619f"
-                        :acker-id #uuid  "11837bd7-2de5-4b62-888d-171c4c47845c"
-                        :completion-id #uuid  "b57f7be1-f2f9-4d0f-aa02-939b3d48dc23"
-                        :message {:n 1}
-                        :ack-val 7292143382010058362}
-                       {:id #uuid  "ac39bc62-8f06-46a0-945e-3a17642a619f"
-                        :acker-id #uuid  "11837bd7-2de5-4b62-888d-171c4c47845c"
-                        :completion-id #uuid  "b57f7be1-f2f9-4d0f-aa02-939b3d48dc23"
-                        :message {:n 1}
-                        :ack-val 7292143382010058362})))
-
-  (reduce + (map (fn [a] (alength (.array a)))
-                 (io/encode onyx-protocol
-                            (send-messages->frame '({:id #uuid  "ac39bc62-8f06-46a0-945e-3a17642a619f"
-                                                     :acker-id #uuid  "11837bd7-2de5-4b62-888d-171c4c47845c"
-                                                     :completion-id #uuid  "b57f7be1-f2f9-4d0f-aa02-939b3d48dc23"
-                                                     :message {:n 1}
-                                                     :ack-val 7292143382010058362}
-
-                                                    {:id #uuid  "ac39bc62-8f06-46a0-945e-3a17642a619f"
-                                                     :acker-id #uuid  "11837bd7-2de5-4b62-888d-171c4c47845c"
-                                                     :completion-id #uuid  "b57f7be1-f2f9-4d0f-aa02-939b3d48dc23"
-                                                     :message {:n 1}
-                                                     :ack-val 7292143382010058362})))))
-
-
-
-  (frame->msg
-    (io/decode
-      onyx-protocol
-      (io/encode onyx-protocol
-                 (send-messages->frame '({:id #uuid  "ac39bc62-8f06-46a0-945e-3a17642a619f"
-                                          :acker-id #uuid  "11837bd7-2de5-4b62-888d-171c4c47845c"
-                                          :completion-id #uuid  "b57f7be1-f2f9-4d0f-aa02-939b3d48dc23"
-                                          :message {:n 1}
-                                          :ack-val 7292143382010058362})))))
-
-  (frame->send-messages
-    (io/decode
-      onyx-protocol
-      (io/encode onyx-protocol
-                 (send-messages->frame '({:id #uuid  "ac39bc62-8f06-46a0-945e-3a17642a619f"
-                                          :acker-id #uuid  "11837bd7-2de5-4b62-888d-171c4c47845c"
-                                          :completion-id #uuid  "b57f7be1-f2f9-4d0f-aa02-939b3d48dc23"
-                                          :message {:n 1}
-                                          :ack-val 7292143382010058362})))))
-
-  (io/encode onyx-protocol
-             (send-messages->frame '({:id #uuid  "ac39bc62-8f06-46a0-945e-3a17642a619f"
-                                      :acker-id #uuid  "11837bd7-2de5-4b62-888d-171c4c47845c"
-                                      :completion-id #uuid  "b57f7be1-f2f9-4d0f-aa02-939b3d48dc23"
-                                      :message {:n 1}
-                                      :ack-val 7292143382010058362})))
-
-  (io/encode onyx-protocol
-             (completion-msg->frame {:id #uuid "7bdac75d-9fc8-47fb-92b2-73eb885beeea"}))
-
-  (io/encode onyx-protocol
-             (ack-msg->frame {:id #uuid  "e2ba38dd-b523-4e63-ba74-645fb91c231a"
-                              :completion-id #uuid  "b57f7be1-f2f9-4d0f-aa02-939b3d48dc23"
-                              :ack-val 3323130347050513529})))
+      => true))


placeholder: code readability in Clojure

--- clojure/lazy_seq_again.clj
+++ clojure/lazy_seq_again.clj
@@ -17,14 +17,19 @@
 (defn adj-ww [x, y] (->Square (dec x)      y))
 (defn adj-nw [x, y] (->Square (dec x) (inc y)))

-(defn adjacency [{{x :x y :y} :square {dx :dx dy :dy} :delta}]
+(defn adjacency
+  [{{x :x y :y} :square
+    {dx :dx dy :dy} :delta}]
   (case [dx dy]
     [0  1] [(adj-nw x y) (adj-ww x y) (adj-sw x y) (adj-ss x y)]
     [-1 0] [(adj-sw x y) (adj-ss x y) (adj-se x y) (adj-ee x y)]
     [0 -1] [(adj-se x y) (adj-ee x y) (adj-ne x y) (adj-nn x y)]
     [1  0] [(adj-ne x y) (adj-nn x y) (adj-nw x y) (adj-ww x y)]))

-(defn write [{memory :memory square :square :as spiral-memory}]
+(defn write
+  [{memory :memory
+    square :square
+    :as spiral-memory}]
   (->>
    (adjacency spiral-memory)
    (map #(get memory % 0))


additional sonar tweaks

additional sonar tweaks

--- cljs/src/main/plastic/reagent/sonar.cljs
+++ cljs/src/main/plastic/reagent/sonar.cljs
@@ -5,7 +5,9 @@

 (defonce ^:mutable sonars {})

-(declare destroy-sonar)
+(declare destroy-sonar!)
+
+(defprotocol ISonar)

 (defprotocol ISonarGet
   (-get [this path]))
@@ -38,6 +40,8 @@
   IHash
   (-hash [this] (goog/getUid this))

+  ISonar
+
   ISonarGet
   (-get [_this path]
     (binding [ratom/*ratom-context* nil]
@@ -45,7 +49,7 @@

   ISonarDispose
   (-dispose [_this]
-    (destroy-sonar source))
+    (destroy-sonar! source))

   ISonarFilter
   (-handle-change [_this _sender oldval newval]
@@ -138,7 +142,7 @@
     (-register sonar path reaction)
     reaction))

-(defn create-sonar [source]
+(defn create-sonar! [source]
   {:pre [(nil? (get sonars source))]}
   (let [sonar (make-sonar source)]
     (set! sonars (assoc sonars source sonar))
@@ -146,9 +150,10 @@
     sonar))

 (defn get-or-create-sonar! [source]
-  (or (get sonars source) (create-sonar source)))
+  {:post [(satisfies? ISonar %)]}
+  (or (get sonars source) (create-sonar! source)))

-(defn destroy-sonar [source]
+(defn destroy-sonar! [source]
   {:pre [(get sonars source)]}
   (log "destroyed " (get sonars source))
   (set! sonars (dissoc sonars source)))


move external-server-log* from a ref to an atom

--- src/overtone/sc/machinery/server/connection.clj
+++ src/overtone/sc/machinery/server/connection.clj
@@ -15,9 +15,11 @@

 (defonce server-thread*       (ref nil))
 (defonce sc-world*            (ref nil))
-(defonce external-server-log* (ref []))
 (defonce connection-info*     (ref {}))
 (defonce connection-status*   (ref :disconnected))
+
+(defonce external-server-log* (atom []))
+

 (defn transient-server?
   "Return true if the server was booted by us, whether internally or
@@ -196,7 +198,7 @@
     (let [n (min (count read-buf) (.available stream))
           _ (.read stream read-buf 0 n)
           msg (String. read-buf 0 n)]
-      (dosync (alter external-server-log* conj msg))
+      (swap! external-server-log* conj msg)
       (log/info (String. read-buf 0 n)))))

 (defn- external-booter


Document exit status codes in Clojure version

--- clojure/src/biotool/core.clj
+++ clojure/src/biotool/core.clj
@@ -29,8 +29,8 @@
 (timbre/refer-timbre)

 ;; Program exit status codes
-(def exit-success 0)
-(def exit-failure 1)
+(def exit-success 0)     ; Program terminated successfully
+(def exit-failure 1)     ; General runtime failure
 (def exit-failure-cli 2) ; Command line argument error

 (defn exit-with-error


+"put": (pred=put)

+"put": (pred=put)

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1696,6 +1696,9 @@
                            :present {:3sing "put"}
                            :note "past tense"}}]
      [{:unify [common]
+       :synsem {:sem {:pred :put}}}
+
+      {:unify [common]
        :phrasal-verb true
        :synsem {:cat :verb
                 :sem {:pred :insult}


Agregando cache de lib noir

Agregando cache de lib noir

--- zambuko-back/src/zambuko_back/routes/default.clj
+++ zambuko-back/src/zambuko_back/routes/default.clj
@@ -5,6 +5,7 @@
             [ring.middleware.head :as h]
             [ring.util.response :as r]
             [org.jclouds.blobstore2 :as bs]
+            [noir.util.cache :as cache]
             [zambuko-back.data.sites :as sites]))

 (defn resources [db bstore]
@@ -14,14 +15,14 @@
           site (sites/site @db host)
           site-id (:_id site "default")
           full-path (str site-id uri)
-          stream (and (bs/blob-exists? @bstore "sites" full-path)
-                      (bs/get-blob-stream @bstore "sites" full-path))]
-      (if stream
-        (let [stream-fn (-> stream
-                            (r/response)
-                            (constantly)
-                            (c/wrap-content-type)
-                            (f/wrap-file-info)
-                            (h/wrap-head))]
-          (stream-fn request))))))
+          stream-fn #(bs/get-blob-stream @bstore "sites" full-path)
+          stream (cache/cache! (str "sites/" full-path) stream-fn)]
+      (if (bs/blob-exists? @bstore "sites" full-path)
+        (let [request-fn (-> (stream)
+                             (r/response)
+                             (constantly)
+                             (c/wrap-content-type)
+                             (f/wrap-file-info)
+                             (h/wrap-head))]
+          (request-fn request))))))


whitespace

whitespace

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -318,9 +318,9 @@
 (deftest gestiscono
   (let [result
         (take 10 (repeatedly #(generate {:modified false
-                                        :synsem {:sem {:subj {:pred :loro}
-                                                       :pred :manage
-                                                       :tense :present}}})))]
+                                         :synsem {:sem {:subj {:pred :loro}
+                                                        :pred :manage
+                                                        :tense :present}}})))]
     (count (map (fn [each]
                   (is (= "loro gestiscono" (fo each))))
                 (map :surface


specify both :root and tense for purpose of test

--- test/babel/test/la.cljc
+++ test/babel/test/la.cljc
@@ -90,7 +90,10 @@
     (is (or (= target "respondebat")))))

 (deftest reader2
-  (let [result (read-one {:root "ardēre"}) ;; use a specific :root so that we can test
+  (let [;; use a specific :root and verb conjugation so that we can test
+        result (read-one {:root "ardēre"
+                          :synsem {:sem {:tense :past
+                                         :aspect :progressive}}})
         ;; for specific literal strings in the result.
         subj (get-in result [:semantics :subj :pred])
         possible-answer (first (get result :targets))]


Let job without tasks pass

Let job without tasks pass

--- src/cider_ci/builder/tasks.clj
+++ src/cider_ci/builder/tasks.clj
@@ -155,7 +155,13 @@
         {:job_id (:id job)
          :type "warning"
          :title "No Tasks Have Been Created"
-         :description "This job has **no tasks** and has been set to defective state."}))))
+         :description (str "This job has **no tasks**. It has been set to "
+                           "success state which is the consistent behavior. "
+                           "This warning is issued in case this is not intended.")})
+      (when (->> [(str "SELECT true AS is_pending "
+                       " FROM jobs WHERE id = ? AND state = 'pending'") job-id]
+                 (jdbc/query tx) first :is_pending)
+        (jdbc/update! tx :jobs {:state "passed"} ["id = ?" job-id])))))

 (defn create-tasks-and-trials [job job-spec tx]
   (wrap-exception-create-job-issue


refactor test

refactor test

--- test/babel/test/la.cljc
+++ test/babel/test/la.cljc
@@ -65,20 +65,17 @@
 (def target-format-fn (-> models target-language :morph))

 (deftest reader1
-  (let [source (->
-                {:synsem {:sem {:subj {:pred :lui}
-                                :obj :unspec
-                                :tense :past
-                                :aspect :progressive
-                                :pred :answer}}}
+  (let [spec {:synsem {:sem {:subj {:pred :lui}
+                             :obj :unspec
+                             :tense :past
+                             :aspect :progressive
+                             :pred :answer}}}
+        source (->
+                spec
                 source-generate-fn
                 source-format-fn)
         target (->
-                {:synsem {:sem {:subj {:pred :lui}
-                                :obj :unspec
-                                :tense :past
-                                :aspect :progressive
-                                :pred :answer}}}
+                spec
                 target-generate-fn
                 target-format-fn)]
     (is (or (= source "he used to answer")


onto 0.1.15-SNAPSHOT

onto 0.1.15-SNAPSHOT

--- build.boot
+++ build.boot
@@ -1,4 +1,4 @@
-(def +version+ "0.1.14")
+(def +version+ "0.1.15-SNAPSHOT")

 (set-env!
   :source-paths #{"src"}


Update clj-http

Update clj-http

--- build.boot
+++ build.boot
@@ -5,7 +5,7 @@
  :dependencies
  '[[org.clojure/clojure "1.8.0"]
    [clj-jgit "0.8.8"]
-   [clj-http "2.1.0"]
+   [clj-http "3.0.0"]
    [cheshire "5.5.0"]
    [throttler "1.0.0"]
    [org.slf4j/slf4j-nop "1.7.18"]


Update boot-cljs

Update boot-cljs

--- build.boot
+++ build.boot
@@ -6,7 +6,7 @@
   :dependencies '[[org.clojure/clojure    "1.9.0-alpha15"]
                   [org.clojure/clojurescript "1.9.495" :scope "test"]

-                  [adzerk/boot-cljs       "2.1.0-SNAPSHOT" :scope "test"]
+                  [adzerk/boot-cljs       "2.0.0" :scope "test"]
                   [crisptrutski/boot-cljs-test "0.3.0" :scope "test"]
                   [doo "0.1.7" :scope "test"]
                   [adzerk/boot-cljs-repl "0.3.3" :scope "test"]


Fix command line port handling

Fix command line port handling

--- src/clj/jugsclojure/server.clj
+++ src/clj/jugsclojure/server.clj
@@ -31,5 +31,5 @@
                   (run-jetty #'http-handler {:port (or port 10555) :join? false}))))

 (defn -main [& [port]]
-  (let [port (Integer. (or port (env :port)))]
-    (restart-server port)))+  (let [port (some-> (or port (env :port)) (Integer.))]
+    (restart-server port)))


fix arena 1 in boot sim

fix arena 1 in boot sim

--- build.boot
+++ build.boot
@@ -49,12 +49,14 @@
         (println "Failed to retrive " username "/" repo "/bot.clj"))))

 (defn arena-1
-  [player]
-  [[o o b o b o]
-   [f f p o f p]
-   [a b p (gu/sanitize-player player) o b]
-   [f f o o b o]
-   [f b f o b o]])
+  [player hp]
+  (let [w (assoc (gu/sanitize-player player) :hp hp)
+        a (assoc a :uuid "a1")]
+    [[o o b o b o]
+     [f f p o f p]
+     [a b p w o b]
+     [f f o o b o]
+     [f b f o b o]]))

 (defn arena-2
   [player hp]


Added matrix multiplication and base-points function

--- src/clj/stitch/util/opencv.clj
+++ src/clj/stitch/util/opencv.clj
@@ -36,6 +36,11 @@
   ([img x1 y1 x2 y2 col fill?]
      (Core/rectangle img (Point. x1 y1) (Point. x2 y2) col (if fill? Core/FILLED 1))))

+(defn matrix-multiplication [m1 m2]
+  (let [res-mat (Mat.)]
+    (Core/gemm h p2 1  (Mat.) 0 res-mat 0))
+    res-mat
+  )
 ;; ----------------------------------------------------------------
 ;; Feature detection
 ;; ----------------------------------------------------------------
@@ -78,6 +83,7 @@
         a (into-array matches)]
     (.fromArray m a)
     m))
+

 ;; ----------------------------------------------------------------
@@ -203,7 +209,7 @@
         dists   (map #(.distance %) matches)
         d-min (apply min dists)
         d-max (apply max dists)
-        good (filter (fn [x] (<= (.distance x) (max (* 4.5 d-min) 0.0045))) matches)]
+        good (filter (fn [x] (<= (.distance x) (max (* 5 d-min) 0.005))) matches)]
     (dmatch-mat good)))

 (defn calculate-homography [img-a img-b]
@@ -315,8 +321,31 @@

   (def iv1 [i1 i2 i3 i4 i5])
-  (def iv2 [i5 i6])
-  (def s123456789 (reduce stitch iv1))
-  (write-image "test_stitches/1/s56789.jpg" s56789)
+  (def iv [i2 i1])
+  (def rsiv (map #(resize-to-scale % 0.25) iv))
+  (def keyImage (first rsiv))
+  (def col (.cols keyImage))
+  (def row (.rows keyImage))
+
+  (def keyImage (first rsiv))
+  (def h (calculate-homography (first rsiv) (second rsiv)))
+  (def r1 (Mat.))
+  (def r2 (Mat.))
+  (def r3 (Mat.))
+  (def r4 (Mat.))
+  (def p1 (Mat. 3 1 CvType/CV_64FC1 (Scalar. 0 0)))
+  (.put p1 0 0 (double-array [0.0 0.0 1.0] ))
+  (Core/gemm h p1 1  (Mat.) 0 r1 0)
+  (def p2 (Mat. 3 1 CvType/CV_64FC1 (Scalar. 0 0)))
+  (.put p2 0 0 (double-array [col 0.0 1.0] ))
+  (Core/gemm h p2 1  (Mat.) 0 r2 0)
+  (def p3 (Mat. 3 1 CvType/CV_64FC1 (Scalar. 0 0)))
+  (.put p3 0 0 (double-array [0 row 1.0] ))
+  (Core/gemm h p3 1  (Mat.) 0 r3 0)
+  (def p4 (Mat. 3 1 CvType/CV_64FC1 (Scalar. 0 0)))
+  (.put p4 0 0 (double-array [col row 1.0] ))
+  (Core/gemm h p4 1  (Mat.) 0 r4 0)
+  ;;(def s123456789 (reduce stitch iv1))
+  ;;(write-image "test_stitches/1/s56789.jpg" s56789)

 )


Start 2.5.3-SNAPSHOT

Start 2.5.3-SNAPSHOT

--- build.boot
+++ build.boot
@@ -29,7 +29,7 @@
 (task-options!
   sift {:include #{#"\.jar$"}}
   pom {:project 'nightcode
-       :version "2.5.2"
+       :version "2.5.3-SNAPSHOT"
        :description "An IDE for Clojure"
        :url "https://github.com/oakes/Nightcode"
        :license {"Public Domain" "http://unlicense.org/UNLICENSE"}}


Add docstrings for new producer API.

Add docstrings for new producer API.

--- src/clj_kafka/new/producer.clj
+++ src/clj_kafka/new/producer.clj
@@ -1,4 +1,7 @@
-(ns clj-kafka.new.producer
+(ns ^{:doc "Clojure interface to the \"new\" Kafka Producer API. For
+  complete JavaDocs, see:
+  http://kafka.apache.org/082/javadoc/org/apache/kafka/clients/producer/package-summary.html"}
+  clj-kafka.new.producer
   (:refer-clojure :exclude [send])
   (:import [org.apache.kafka.clients.producer Callback KafkaProducer ProducerRecord]
            [org.apache.kafka.common.serialization Serializer ByteArraySerializer StringSerializer]))
@@ -7,12 +10,21 @@
 (defn byte-array-serializer [] (ByteArraySerializer.))

 (defn producer
+  "Return a `KafkaProducer` for publishing records to Kafka.
+  `KafkaProducer` instances are thread-safe and should generally be
+  shared for best performance.
+
+  Implements `Closeable`, so suitable for use with `with-open`.
+
+  For available config options, see:
+  http://kafka.apache.org/documentation.html#newproducerconfigs "
   ([^java.util.Map config]
    (KafkaProducer. config))
   ([^java.util.Map config ^Serializer key-serializer ^Serializer value-serializer]
    (KafkaProducer. config key-serializer value-serializer)))

 (defn record
+  "Return a record that can be published to Kafka using `send`."
   ([topic value]
    (ProducerRecord. topic value))
   ([topic key value]
@@ -21,6 +33,13 @@
    (ProducerRecord. topic partition key value)))

 (defn send
+  "Asynchronously send a record to Kafka. Returns a `Future` with
+  `RecordMetadata`. Optionally provide a callback fn that will be
+  called when operation completes. Callback should be a fn of two
+  arguments, a `RecordMetadata` instance, and an exception. Exception
+  will be nil if operation succeeded.
+
+  For details on behaviour, see: http://kafka.apache.org/082/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html#send(org.apache.kafka.clients.producer.ProducerRecord, org.apache.kafka.clients.producer.Callback)"
   ([^KafkaProducer producer record]
    (.send producer record))
   ([^KafkaProducer producer record callback]