:wrench: Clean unused LDAP var

:wrench: Clean unused LDAP var

Signed-off-by: mathieu.brunot <cbb78c9d6ecc8139b4697c3352cc1f1edbdf61d7@monogramm.io>

--- backend/src/uxbox/config.clj
+++ backend/src/uxbox/config.clj
@@ -48,7 +48,6 @@
    ;; LDAP auth disabled by default. Set ldap-auth-host to enable
    ;:ldap-auth-host "ldap.mysupercompany.com"
    ;:ldap-auth-port 389
-   :ldap-auth-version "3"
    ;:ldap-bind-dn "cn=admin,dc=ldap,dc=mysupercompany,dc=com"
    ;:ldap-bind-password "verysecure"
    ;:ldap-auth-ssl false
@@ -104,7 +103,6 @@
 (s/def ::ldap-auth-email-attribute ::us/string)
 (s/def ::ldap-auth-fullname-attribute ::us/string)
 (s/def ::ldap-auth-avatar-attribute ::us/string)
-(s/def ::ldap-auth-isactivedirectory ::us/boolean)

 (s/def ::config
   (s/keys :opt-un [::http-server-cors
@@ -137,7 +135,6 @@
                    ::image-process-max-threads
                    ::ldap-auth-host
                    ::ldap-auth-port
-                   ::ldap-auth-version
                    ::ldap-bind-dn
                    ::ldap-bind-password
                    ::ldap-auth-ssl
@@ -147,8 +144,7 @@
                    ::ldap-auth-username-attribute
                    ::ldap-auth-email-attribute
                    ::ldap-auth-fullname-attribute
-                   ::ldap-auth-avatar-attribute
-                   ::ldap-auth-isactivedirectory]))
+                   ::ldap-auth-avatar-attribute]))

 (defn env->config
   [env]


fix indentation

fix indentation

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -355,7 +355,7 @@
     (apply-to-map-vals offset-if-extra-trigger (:properties trigger-sequence)))
   (let [absolute-slices (load-slice-sequence
                           (compensate-for-extra-trigger (:slices trigger-sequence))
-                           relative-z)]
+                          relative-z)]
     (start-property-sequences (:properties trigger-sequence))
     (when absolute-slices
       (start-slice-sequence (:slices trigger-sequence)))


move another private method out of prometheus wrapper

--- src/vignette/perfmonitoring/core.clj
+++ src/vignette/perfmonitoring/core.clj
@@ -58,6 +58,12 @@
             (catch Exception e#
               (log/warn "prometheus timer failed" {:exception (str e#) :counter ~metric})))))))

+(defn record-request-metric [metrics-store app-name request-method response-status request-time response-path]
+  (let [status-class (str (int (/ response-status 100)) "XX")
+        method-label (string/upper-case (name request-method))
+        labels [method-label (str response-status) status-class response-path]]
+    (prometheus/track-observation metrics-store app-name "http_request_latency_seconds" request-time labels)
+    (prometheus/increase-counter metrics-store app-name "http_requests_total" labels)))

 (defn instrument-handler
   "Ring middleware to record request metrics"
@@ -84,10 +90,3 @@
             request-time (/ (double (- finish-time start-time)) 1000.0)]
         (record-request-metric metrics-store app-name request-method response-status request-time response-path)
         response))))
-
-(defn record-request-metric [metrics-store app-name request-method response-status request-time response-path]
-  (let [status-class (str (int (/ response-status 100)) "XX")
-        method-label (string/upper-case (name request-method))
-        labels [method-label (str response-status) status-class response-path]]
-    (prometheus/track-observation metrics-store app-name "http_request_latency_seconds" request-time labels)
-    (prometheus/increase-counter metrics-store app-name "http_requests_total" labels)))


Fixes #135 - ArrayIndexOutOfBoundsException on file save

--- ccw.core/src/ccw/debug/serverrepl.clj
+++ ccw.core/src/ccw/debug/serverrepl.clj
@@ -27,9 +27,13 @@
             line-number (.getLineNumber first-stack)
             message (.getMessage e)]
         (recur (.getCause e)
-          (conj v {"file-name" file-name
-                   "line-number" line-number
-                   "message" message}))))))
+          (conj v (if (> (.length stack-traces) 0)
+                    {"file-name" file-name
+                     "line-number" line-number
+                     "message" message}
+                    {"file-name" "<none>"
+                     "line-number" 0
+                     "message" "<none>"})))))))

 (defmacro with-exception-serialization
   [& body]


Bug fix reported by @iwillig on Slack

Bug fix reported by @iwillig on Slack

--- src/yada/resources/file_resource.clj
+++ src/yada/resources/file_resource.clj
@@ -202,7 +202,7 @@
             suffix (when f (filename-ext (.getName f)))
             custom-suffix-args (when suffix (get custom-suffices suffix))]
         (cond
-          (nil? f) (resource nil)
+          (nil? f) (as-resource nil)

           (.isFile f)
           (resource


Removed unused clojure.test namespace.

Removed unused clojure.test namespace.

--- nav_source.clj
+++ nav_source.clj
@@ -1,6 +1,5 @@
 (ns nav-source
-  (:use [clojure.test])
-  (:require [clojure.string]))
+  (:require [clojure.string :as string]))

 (def type-id-map {"Table" 1 "Form" 2 "Report" 3 "Dataport" 4 "Codeunit" 5 "XMLport" 6 "MenuSuite" 7 "Page" 8})
 (def first-line-regex #"^OBJECT (.+) (\d+) (.+)")
@@ -17,7 +16,7 @@
 (defn get-big-source-lines
   "doc"
   [file-name]
-  (let [lines (clojure.string/split-lines (slurp file-name :encoding "ibm850"))]
+  (let [lines (string/split-lines (slurp file-name :encoding "ibm850"))]
     lines))

 (defn first-line-of-object-source?
@@ -44,7 +43,7 @@
         (println current)
         (if (first-line-of-object-source? current)
           (def current-object-source current)
-          (def current-object-source (clojure.string/join "\n" [current-object-source current])))
+          (def current-object-source (string/join "\n" [current-object-source current])))
         (recur (first buffer) (rest buffer)))
       nil)))

@@ -61,7 +60,7 @@
 (defn make-single-file-name
   "Returns a file name built from object meta data."
   [object-metadata]
-  (let [file-name (clojure.string/join "-" (map object-metadata [:type-id :type :id]))]
+  (let [file-name (string/join "-" (map object-metadata [:type-id :type :id]))]
     (str file-name source-file-extension)))

 (defn save-single-source-file


+{:pred :bread}

+{:pred :bread}

--- src/babel/encyclopedia.cljc
+++ src/babel/encyclopedia.cljc
@@ -117,10 +117,14 @@
    {:pred :bicycle} {:artifact true
                      :consumable false}

+   {:pred :bread} {:artifact true
+                   :edible true}
+
    {:pred :key} {:animate false
                  :consumable false
                  :event false
                  :place false}
+
    ;; </preds>

    {:time true} {:activity false


Make more sense

Make more sense

--- cljs-lambda/src/cljs_lambda/util.cljs
+++ cljs-lambda/src/cljs_lambda/util.cljs
@@ -31,7 +31,11 @@
   (wrap-lambda-fn
    (fn [event context]
      (go
-       (try
-         (succeed! context (<! (f event context)))
-         (catch js/Error e
-           (fail! context e)))))))
+       (let [result
+             (try
+               (<! (f event context))
+               (catch js/Error e
+                 e))]
+         (if (instance? js/Error result)
+           (fail!    context result)
+           (succeed! context result)))))))


Placeholder storage-cmd-handlers.

Placeholder storage-cmd-handlers.

--- src/cbfg/world-storage.cljs
+++ src/cbfg/world-storage.cljs
@@ -6,58 +6,73 @@
                               get-el-innerHTML set-el-innerHTML]]
             [cbfg.fence :refer [make-fenced-pump]]))

-(defn example-add [actx opaque-id x y delay]
-  (ago example-add actx
-       (let [timeout-ch (atimeout example-add delay)]
-         (atake example-add timeout-ch)
-         {:opaque-id opaque-id :result (+ x y)})))
+(defn storage-get [actx opaque-id key]
+  (ago storage-get actx
+       {:opaque-id opaque-id :status :ok :key key :val "yay"}))

-(defn example-sub [actx opaque-id x y delay]
-  (ago example-sub actx
-       (let [timeout-ch (atimeout example-sub delay)]
-         (atake example-sub timeout-ch)
-         {:opaque-id opaque-id :result (- x y)})))
+(defn storage-set [actx opaque-id key val]
+  (ago storage-set actx
+       {:opaque-id opaque-id :status :ok}))

-(def example-cmd-handlers
-  {"get"  (fn [c] {:opaque-id (:opaque-id c) :fence (:fence c)
-                   :rq #(example-add % (:opaque-id c) (:x c) (:y c) (:delay c))})
-   "set"  (fn [c] {:opaque-id (:opaque-id c) :fence (:fence c)
-                   :rq #(example-sub % (:opaque-id c) (:x c) (:y c) (:delay c))})
-   "del"  (fn [c] {:opaque-id (:opaque-id c) :fence (:fence c)
-                   :rq #(example-sub % (:opaque-id c) (:x c) (:y c) (:delay c))})
-   "scan" (fn [c] {:opaque-id (:opaque-id c) :fence (:fence c)
-                   :rq #(example-sub % (:opaque-id c) (:x c) (:y c) (:delay c))})
-   "noop" (fn [c] {:opaque-id (:opaque-id c) :fence (:fence c)
-                   :rq #(example-sub % (:opaque-id c) (:x c) (:y c) (:delay c))})
-   "test" (fn [c] {:opaque-id (:opaque-id c) :fence (:fence c)
-                   :rq #(cbfg.fence/test %)})})
+(defn storage-del [actx opaque-id key]
+  (ago storage-del actx
+       {:opaque-id opaque-id :status :ok}))

-(def example-max-inflight (atom 10))
+(defn storage-scan [actx opaque-id from to]
+  (ago storage-del actx
+       {:opaque-id opaque-id :status :ok}))
+
+(defn storage-noop [actx opaque-id]
+  (ago storage-del actx
+       {:opaque-id opaque-id :status :ok}))
+
+(def storage-cmd-handlers
+  {"get"  [["key"]
+           (fn [c] {:rq #(storage-get % (:opaque-id c) (:key c))})]
+   "set"  [["key" "val"]
+           (fn [c] {:rq #(storage-set % (:opaque-id c) (:key c) (:val c))})]
+   "del"  [["key"]
+           (fn [c] {:rq #(storage-del % (:opaque-id c) (:key c))})]
+   "scan" [["from" "to"]
+           (fn [c] {:rq #(storage-scan % (:opaque-id c) (:from c) (:to c))})]
+   "noop" [[]
+           (fn [c] {:rq #(storage-noop % (:opaque-id c))})]
+   "test" [[]
+           (fn [c] {:rq #(cbfg.fence/test %)})]})
+
+(def storage-max-inflight (atom 10))

 (defn world-vis-init [el-prefix]
-  (let [cmd-ch (map< (fn [ev] {:op (.-id (.-target ev))
-                               :x (js/parseInt (get-el-value "x"))
-                               :y (js/parseInt (get-el-value "y"))
-                               :delay (js/parseInt (get-el-value "delay"))
-                               :fence (= (get-el-value "fence") "1")})
+  (let [cmd-ch (map< (fn [ev] {:op (.-id (.-target ev))})
                      (merge (map #(listen-el (gdom/getElement %) "click")
-                                 (keys example-cmd-handlers))))]
+                                 (keys storage-cmd-handlers))))]
     (vis-init (fn [world]
-                (let [in-ch (achan-buf world 100)
+                (let [input-log (str el-prefix "-input-log")
+                      output-log (str el-prefix "-output-log")
+                      in-ch (achan-buf world 100)
                       out-ch (achan-buf world 0)]
                   (ago-loop a-input world [num-ins 0]
-                            (let [cmd (assoc-in (<! cmd-ch) [:opaque-id] num-ins)
-                                  cmd-handler ((get example-cmd-handlers (:op cmd)) cmd)]
-                              (set-el-innerHTML (str el-prefix "-input-log")
-                                                (str num-ins ": " cmd "\n"
-                                                     (get-el-innerHTML (str el-prefix "-input-log"))))
-                              (aput a-input in-ch cmd-handler)
+                            (let [cmd (<! cmd-ch)
+                                  op (:op cmd)
+                                  op-fence (= (get-el-value (str op "-fence")) "1")
+                                  [params handler] (get storage-cmd-handlers op)
+                                  cmd2 (-> cmd
+                                           (assoc-in [:opaque-id] num-ins)
+                                           (assoc-in [:fence] op-fence))
+                                  cmd3 (reduce #(assoc %1
+                                                  (symbol (str ":" %2))
+                                                  (get-el-value (str op "-" %2)))
+                                               cmd2 params)]
+                              (set-el-innerHTML input-log
+                                                (str num-ins ": " cmd3 "\n"
+                                                     (get-el-innerHTML input-log)))
+                              (aput a-input in-ch (handler cmd3))
                               (recur (inc num-ins))))
                   (ago-loop z-output world [num-outs 0]
                             (let [result (atake z-output out-ch)]
-                              (set-el-innerHTML (str el-prefix "-output-log")
+                              (set-el-innerHTML output-log
                                                 (str num-outs ": " result "\n"
-                                                     (get-el-innerHTML (str el-prefix "-output-log"))))
+                                                     (get-el-innerHTML output-log)))
                               (recur (inc num-outs))))
-                  (make-fenced-pump world in-ch out-ch @example-max-inflight)))
+                  (make-fenced-pump world in-ch out-ch @storage-max-inflight)))
               el-prefix)))


remove unused import

remove unused import

--- src/main/clojure/cljs/core.cljc
+++ src/main/clojure/cljs/core.cljc
@@ -39,8 +39,7 @@
             clojure.set
             cljs.compiler
             [cljs.util :as util]
-            [cljs.env :as env])
-  (:import [java.io File]))
+            [cljs.env :as env]))

 (alias 'core 'clojure.core)
 (alias 'ana 'cljs.analyzer)


remove `cljs.core/load-lib*` helper macro too


Add flags column to database

Add flags column to database

--- src/demogorgon/nh.clj
+++ src/demogorgon/nh.clj
@@ -456,7 +456,8 @@
       [:starttime "TIMESTAMP"]
       [:endtime "TIMESTAMP"]
       [:gender0 "TEXT"]
-      [:align0 "TEXT"])
+      [:align0 "TEXT"]
+      [:flags "TEXT"])
      (let [lines (read-lines (str (:un-dir config) "xlogfile"))]
        (doseq [line lines]
          (insert-xlogfile-line-db line)))))


Use intro page from docs repo

Use intro page from docs repo

--- src/app/core.cljs
+++ src/app/core.cljs
@@ -92,7 +92,7 @@
                        [:.serif.tc.mw-page.center.mv3
                         [:.f0.pt4 "Re-View"]
                         [:.f4 "Simple React apps in ClojureScript."]]
-                       (code/repo-file-page "re-view" "INTRO.md")])
+                       (code/repo-file-page "docs" "intro.md")])
            ["components"] (layout (examples/library {}))
            ["components" id] (layout (examples/library {:detail-view id}))
            ["docs"] (layout (docs/doc-page "/"))


depending on middleware the value for checkbox can already be split up into a vector

--- src/ez_form/field.clj
+++ src/ez_form/field.clj
@@ -81,6 +81,10 @@
                                          (or checked?
                                              (if (string? (:value opts))
                                                (some #(= value %) (str/split (:value opts) #",")))
+                                             (if (string? (:value-added field))
+                                               (some #(= value %) (str/split (:value-added field) #",")))
+                                             (if (vector? (:value-added field))
+                                               (some #(= value %) (:value-added field)))
                                              (= value (:value opts))
                                              (= "on" (:value opts))
                                              (= "on" value)))


RR: set overview as default tab on load

RR: set overview as default tab on load

--- src/hatti/shared.cljs
+++ src/hatti/shared.cljs
@@ -34,7 +34,7 @@
   []
   (atom
    {:views {:all [:overview :map :table :chart :settings]
-            :selected :map}
+            :selected :overview}
     :map-page {:data []
                :submission-clicked {:data nil}
                :geofield {}}


Fix for cljs.core.Keyword

Fix for cljs.core.Keyword

--- src/inkspot/color.clj
+++ src/inkspot/color.clj
@@ -115,7 +115,7 @@
   (alpha  [s] nil)
   (coerce [s] nil))

-(extend-type clojure.lang.Keyword
+(extend-type ^{:cljs cljs.core.Keyword} clojure.lang.Keyword
   IColor
   (red    [s] (red (keyword->color s)))
   (green  [s] (green (keyword->color s)))
@@ -162,4 +162,4 @@
           sum (->>
                 (map scale colors proportions)
                 (reduce (partial map +)))]
-      (coerce (mapv #(int (/ % cnt)) sum)))))+      (coerce (mapv #(int (/ % cnt)) sum)))))


Remove println of updated-tiles information

--- src/main/clojure/pdok/featured/processor.clj
+++ src/main/clojure/pdok/featured/processor.clj
@@ -353,8 +353,7 @@

 (defn- add-updated-tiles [statistics feature]
   (if-let [tiles (tiles/nl (:geometry feature))]
-    (do (println tiles)
-        (swap! statistics update :updatedTiles #(clojure.set/union % tiles)))
+    (swap! statistics update :updatedTiles #(clojure.set/union % tiles))
     )
   )

@@ -366,7 +365,6 @@
     (when (:invalid? feature)
       (swap! statistics update :n-errored inc)
       (swap! statistics update :errored #(conj % (:id feature))))
-    (println statistics)
     )
   )


User ns not required in test any more.

User ns not required in test any more.

--- resources/leiningen/new/onyx_app/sample_job_test.clj
+++ resources/leiningen/new/onyx_app/sample_job_test.clj
@@ -12,8 +12,7 @@
             [{{app-name}}.plugins.http-reader]
             [{{app-name}}.functions.sample-functions]
             [{{app-name}}.dev-inputs.sample-input :as dev-inputs]
-            [onyx.api]
-            [user]))
+            [onyx.api]))

 (deftest test-sample-dev-job
   ;; Start the development environment with 4 peers.


New test cases added into test-render-package-descriptions

--- test/clouseau/test_text_renderer.clj
+++ test/clouseau/test_text_renderer.clj
@@ -93,6 +93,23 @@
     "Check the function clouseau.text-renderer/render-package-descriptions"
     (testing "the function clouseau.text-renderer/render-package-descriptions"
         (is (= (render-package-descriptions {"x" "y"}) '("[x]\ny\n\n")))
-        (is (= (render-package-descriptions {"x" nil}) '("[x]\n\n\n")))
-        (is (= (render-package-descriptions {}) '()))
-        ))
+        (is (= (render-package-descriptions {"package1" "description1"}) '("[package1]\ndescription1\n\n")))
+        (is (= (render-package-descriptions {"package1" "description1"
+                                             "package2" "description2"})
+                                             '("[package1]\ndescription1\n\n"
+                                               "[package2]\ndescription2\n\n")))
+        (is (= (render-package-descriptions {"package1" "description1"
+                                             "package2" "description2"
+                                             "package3" "description3"})
+                                             '("[package1]\ndescription1\n\n"
+                                               "[package2]\ndescription2\n\n"
+                                               "[package3]\ndescription3\n\n")))
+        (is (= (render-package-descriptions {"package1" "description1"
+                                             "package2" "description2"
+                                             "package3" "description3"
+                                             "package4" "description4"})
+                                             '("[package1]\ndescription1\n\n"
+                                               "[package2]\ndescription2\n\n"
+                                               "[package3]\ndescription3\n\n"
+                                               "[package4]\ndescription4\n\n")))))
+


Final set of tests for slugify.

Final set of tests for slugify.

--- test/fcms/unit/resources/slugify.clj
+++ test/fcms/unit/resources/slugify.clj
@@ -60,9 +60,14 @@
 (fact "slug collisions are detected and resolved by a function"
   (slugify "already-used-slug" unique-it) => "i-am-a-pretty-snowflake")

-(fact "slugs longer than 256 characters are truncated")
+(fact "slugs longer than 256 characters are truncated"
+  (let [long-slug (apply str (range 0 200))]
+    (slugify long-slug) => (apply str (take 256 long-slug))
+    ; shouldn't end on a - if that's where it gets cut off for length
+    (slugify (str (apply str (take 255 long-slug)) "-")) => (apply str (take 255 long-slug))
+    (slugify (str (apply str (take 254 long-slug)) "--")) => (apply str (take 254 long-slug))))

-(fact "all these slug rules work together")
+(fact "all these slug rules work together"
   ; upper lower
   ; internal white space
   ; prefixed and trailing space
@@ -71,7 +76,11 @@
   ; punctuation
   ; accented latin
   ; unicode
-  ; longer than 256
+  ; truncate to <= 256 characters
+  (let [all-in-one " -tHiS #$is%?-----ελληνικήalso-მივჰხვდემასჩემსაãالزجاجوهذالايؤلمني-slüg♜-♛-☃-✄-✈  - "
+        long-slug (apply str (range 0 200))]
+    (slugify all-in-one) => "this-is-also-a-slug"
+    (slugify (str all-in-one long-slug)) => (str "this-is-also-a-slug-" (apply str (take 236 long-slug)))))

 (fact "perfectly good slugs are unaffected"
   (slugify "slug") => "slug"


When the REPL is closed, the code completion (hippie) now woks

--- ccw.core/src/clj/ccw/editors/clojure/clojure_proposal_processor.clj
+++ ccw.core/src/clj/ccw/editors/clojure/clojure_proposal_processor.clj
@@ -182,10 +182,14 @@
 (defn send-message
   "Send the command over the nrepl connection."
   [connection command]
-  (-> (.client connection)
-    (repl/message {"op"   "eval"
-                   "code" command})
-    repl/response-values))
+  (try
+    (-> (.client connection)
+      (repl/message {"op"   "eval"
+                     "code" command})
+      repl/response-values)
+    (catch Exception e
+      (ccw.CCWPlugin/logError (str "exception while sending command " command " to connection " connection) e)
+      nil)))

 (defn find-var-metadata
   [current-namespace editor var]


Print tag header over public-key data info.

--- tool/vault/tool/data.clj
+++ tool/vault/tool/data.clj
@@ -39,7 +39,9 @@
 (defn- print-key-blob
   "Prints a public-key blob info."
   [blob]
-  (-> blob :data/values first pgp/key-info puget/cprint))
+  (puget/with-color
+    (println (puget/color-text :tag "#vault.tool/public-key"))
+    (-> blob :data/values first pgp/key-info puget/pprint)))

 (defn- print-edn-blob


Same job in volunteer? and reallocate-from-task?

--- src/onyx/log/commands/volunteer_for_task.clj
+++ src/onyx/log/commands/volunteer_for_task.clj
@@ -162,7 +162,7 @@
   [{:keys [args]} old new diff peer-args]
   (let [scheduler (get-in new [:task-schedulers (:job diff)])]
     (when (and (common/volunteer? old new peer-args (:job peer-args))
-               (common/reallocate-from-task? scheduler old new (:job diff) peer-args))
+               (common/reallocate-from-task? scheduler old new (:job peer-args) peer-args))
       [{:fn :volunteer-for-task :args {:id (:id peer-args)}}])))

 (defmethod extensions/fire-side-effects! :volunteer-for-task


Reduce nesting with if-let

Reduce nesting with if-let

--- src/onyx/scheduling/common_job_scheduler.clj
+++ src/onyx/scheduling/common_job_scheduler.clj
@@ -451,10 +451,9 @@
             planned-capacities (job->planned-task-capacity current-replica jobs max-utilization)]
         (if (= planned-capacities (actual-usage current-replica jobs))
           current-replica
-          (let [updated-replica (btr-place-scheduling current-replica jobs max-utilization planned-capacities)]
-            (if updated-replica
-              (let [acker-replica (choose-ackers updated-replica jobs)]
-                (if (full-allocation? acker-replica max-utilization planned-capacities)
-                  (deallocate-starved-jobs acker-replica)
-                  (recur (butlast jobs) (remove-job current-replica (butlast jobs)))))
-              (recur (butlast jobs) (remove-job current-replica (butlast jobs))))))))))
+          (if-let [updated-replica (btr-place-scheduling current-replica jobs max-utilization planned-capacities)]
+            (let [acker-replica (choose-ackers updated-replica jobs)]
+              (if (full-allocation? acker-replica max-utilization planned-capacities)
+                (deallocate-starved-jobs acker-replica)
+                (recur (butlast jobs) (remove-job current-replica (butlast jobs)))))
+            (recur (butlast jobs) (remove-job current-replica (butlast jobs)))))))))


String to InputStream helper

String to InputStream helper

--- test/rdf_path_examples/core_test.clj
+++ test/rdf_path_examples/core_test.clj
@@ -8,11 +8,18 @@
             [ring.mock.request :as mock])
   (:import [java.io ByteArrayInputStream]))

+(set! *warn-on-reflection* true)
+
 (def jsonld "application/ld+json")

 (def status-code (comp :status app))

 (def valid-path (resource->string "valid_path.jsonld"))
+
+(defn- string->input-stream
+  "Convert string `s` to InputStream."
+  [^String s]
+  (ByteArrayInputStream. (.getBytes s)))

 (deftest ^:integration routes
   (testing "Invalid URLs are not found."
@@ -36,7 +43,7 @@
         is-400? (comp (partial = 400) status-code)
         has-constraint-violation? (comp #(ask-query % has-constraint-violation-query)
                                         json-ld->rdf-model
-                                        #(ByteArrayInputStream. (.getBytes %))
+                                        string->input-stream
                                         :body)
         response-for-path (comp app (partial generate-examples :body) resource->string)]
     (testing "Requests are sent using HTTP POST"


No need for github index

No need for github index

--- workspaces/src/com/wsscode/pathom/workspaces/graphql/github_demo.cljs
+++ workspaces/src/com/wsscode/pathom/workspaces/graphql/github_demo.cljs
@@ -22,8 +22,6 @@

 (defmulti mutation-fn pc/mutation-dispatch)
 (def defmutation (pc/mutation-factory mutation-fn indexes))
-
-(defonce github-index (atom {}))

 (def base-env
   {::p/reader             [p/map-reader pc/all-async-readers]


fixing unit tests after transfer! changes

--- test/vignette/storage/local_test.clj
+++ test/vignette/storage/local_test.clj
@@ -1,6 +1,6 @@
 (ns vignette.storage.local-test
   (:require [vignette.storage.protocols :refer :all]
-            [vignette.storage.local :refer :all]
+            [vignette.storage.local :as local-storage]
             [clojure.java.shell :refer (sh)]
             [vignette.util.filesystem :refer :all]
             [clojure.java.io :as io]
@@ -16,23 +16,33 @@
                     (sh "rm" "-rf" local-path)
                     (sh "mkdir" "-p" local-path)))]
   (facts :transfer
-     (transfer! "project.clj" (format "%s/tbar" local-path)) => truthy)
+     (transfer! (local-storage/create-stored-object (io/file "project.clj"))
+                (format "%s/tbar" local-path)) => truthy)

   (facts :put-object
-    (let [local (create-local-object-storage "/tmp/vignette-local-storage")]
+    (let [local (local-storage/create-local-object-storage "/tmp/vignette-local-storage")]
       local => truthy
-      (put-object local "project.clj" "bucket" "bar") => truthy))
+      (put-object local
+                  (local-storage/create-stored-object (io/file "project.clj"))
+                  "bucket"
+                  "bar") => truthy))

   (facts :get-object
-    (let [local (create-local-object-storage "/tmp/vignette-local-storage")]
+    (let [local (local-storage/create-local-object-storage "/tmp/vignette-local-storage")]
       local => truthy
       (get-object local "bucket" "bar") => falsey
-      (put-object local "project.clj" "bucket" "bar") => truthy
+      (put-object local
+                  (local-storage/create-stored-object (io/file "project.clj"))
+                  "bucket"
+                  "bar") => truthy
       (get-object local "bucket" "bar") => truthy))

   (facts :delete-object
-    (let [local (create-local-object-storage "/tmp/vignette-local-storage")]
+    (let [local (local-storage/create-local-object-storage "/tmp/vignette-local-storage")]
       local => truthy
       (delete-object local "bucket" "bar") => falsey
-      (put-object local "project.clj" "bucket" "bar") => truthy
+      (put-object local
+                  (local-storage/create-stored-object (io/file "project.clj"))
+                  "bucket"
+                  "bar") => truthy
       (delete-object local "bucket" "bar") => truthy)))


Switching over to with-out-str-not-threadsafe

--- jvm-runner/test/codewars/runner/clojure_test.clj
+++ jvm-runner/test/codewars/runner/clojure_test.clj
@@ -1,6 +1,7 @@
 (ns codewars.runner.clojure-test
   (:require [clojure.test :refer :all]
             [codewars.core :refer [-main]]
+            [codewars.test.utils :refer [with-out-str-not-threadsafe]]
             [cheshire.core :as json]
             [codewars.clojure.test]))

@@ -52,7 +53,7 @@
        {:language "clojure"
         :solution "(print \"Oh no, here it comes again\")"})
       (is (= "Oh no, here it comes again"
-             (with-out-str (-main)))))))
+             (with-out-str-not-threadsafe (-main)))))))

 (deftest clojure-solution-and-setup
   (testing "-main will just run solution code and read correctly from setup code"
@@ -62,7 +63,7 @@
         :setup "(ns heaven.and.hell) (defn first-track [] (print \"So it's on and on and on, oh it's on and on and on\"))"
         :solution "(require 'heaven.and.hell) (heaven.and.hell/first-track)"})
       (is (= "So it's on and on and on, oh it's on and on and on"
-             (with-out-str (-main)))))))
+             (with-out-str-not-threadsafe (-main)))))))

 (deftest clojure-solution-fixture-and-setup
   (testing "-main can handle a solution, fixture, and setup code in clojure"


Update Jetty to 9.2.21.v201701209

Update Jetty to 9.2.21.v201701209

--- ring-jetty-adapter/project.clj
+++ ring-jetty-adapter/project.clj
@@ -7,7 +7,7 @@
   :dependencies [[org.clojure/clojure "1.5.1"]
                  [ring/ring-core "1.6.0"]
                  [ring/ring-servlet "1.6.0"]
-                 [org.eclipse.jetty/jetty-server "9.2.17.v20160517"]]
+                 [org.eclipse.jetty/jetty-server "9.2.21.v20170120"]]
   :profiles
   {:dev {:dependencies [[clj-http "2.2.0"]]}
    :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}


Updated tools.reader version (fixes #93)

--- ring-core/project.clj
+++ ring-core/project.clj
@@ -4,7 +4,7 @@
   :license {:name "The MIT License"
             :url "http://opensource.org/licenses/MIT"}
   :dependencies [[org.clojure/clojure "1.3.0"]
-                 [org.clojure/tools.reader "0.7.3"]
+                 [org.clojure/tools.reader "0.8.1"]
                  [ring/ring-codec "1.0.0"]
                  [commons-io "2.4"]
                  [commons-fileupload "1.3"]


forgot to bind

forgot to bind

--- src/bzzz/core.clj
+++ src/bzzz/core.clj
@@ -297,7 +297,7 @@
     (every 10000 #(log/trace "up:" @timer* @index-directory/identifier* @discover-hosts* @peers*) (mk-pool) :desc "dump")
     (repeatedly
      (try
-       (run-server handler {:port @port* :threads @http-threads*})
+       (run-server handler {:port @port* :threads @http-threads* :ip (:bind options)})
        (catch Throwable e
          (do
            (log/warn (ex-str e))


add swank.autostart back

add swank.autostart back

--- src/cake/main.clj
+++ src/cake/main.clj
@@ -6,7 +6,8 @@
         [clojure.contrib.condition :only [handler-case *condition*]]
         [cake.utils :only [*readline-marker*]]
         [bake.io :only [init-multi-out]]
-        [bake.reload :only [reload reload-project-files]])
+        [bake.reload :only [reload reload-project-files]]
+        [cake.tasks.swank :only [start-swank]])
   (:require [cake.tasks default global]
             [cake.project :as project]
             [cake.server :as server])
@@ -28,4 +29,6 @@
   (reload-project-files)
   (in-project
    (init-multi-out ".cake/cake.log")
+   (when-let [autostart (get *config* "swank.autostart")]
+     (start-swank autostart))
    (server/create port process-command)))


Add missing :onyx.log/config to information model

--- src/onyx/information_model.cljc
+++ src/onyx/information_model.cljc
@@ -919,6 +919,12 @@
              :type :boolean
              :default true
              :added "0.8.4"}
+
+            :onyx.log/config
+            {:doc "Timbre logging configuration for the peers. See [Logging](http://www.onyxplatform.org/docs/user-guide/latest/logging.html)."
+             :optional? true
+             :type :map
+             :added "0.6.0"}

             :onyx.messaging/inbound-buffer-size
             {:doc "Number of messages to buffer in the core.async channel for received segments."
@@ -1385,6 +1391,7 @@
    [:onyx/tenancy-id
     :onyx.peer/job-scheduler
     :zookeeper/address
+    :onyx.log/config
     :onyx.peer/inbox-capacity :onyx.peer/outbox-capacity
     :onyx.peer/retry-start-interval :onyx.peer/join-failure-back-off
     :onyx.peer/drained-back-off :onyx.peer/peer-not-ready-back-off


always return vectors from malformed-json?

--- src/open_company/api/common.clj
+++ src/open_company/api/common.clj
@@ -75,10 +75,10 @@
       ; handle case of a string which is valid JSON, but still malformed for us
       (do (when-not (map? data) (throw (Exception.)))
         [good-json {:data data}])
-      malformed)
+      [malformed])
     (catch Exception e
       (debug "Request body not processable as JSON: " e)
-      malformed)))
+      [malformed])))

 (defn known-content-type?
   [ctx content-type]


Basic cli implemented. Working towards fully implementing #2.

--- src/civs/core.clj
+++ src/civs/core.clj
@@ -39,12 +39,19 @@
     (System/exit 0))

 (defn simulate [game n-turns]
-  (println "Simulating..."))
+  (def current-game game)
+  (dotimes [t n-turns]
+    (do
+      (println "=== Turn" (inc t) "===")
+      (def current-game (turn current-game))
+      (println "  population " (game-total-pop current-game))
+      (println ""))))

 (defn run [world-filename n-bands n-turns]
   (println "World         :" world-filename)
   (println "Initial bands :" n-bands)
   (println "No. turns     :" n-turns)
+  (println "")
   (try
     (let [w (load-world "examples-worlds/seed_77.world")
           g (generate-game w n-bands)]


Make metrics.ring.expose-metrics-as-json accept an optional registry argument

Fixes #25.

--- metrics-clojure-ring/src/metrics/ring/expose.clj
+++ metrics-clojure-ring/src/metrics/ring/expose.clj
@@ -95,9 +95,11 @@
   ([handler]
      (expose-metrics-as-json handler "/metrics"))
   ([handler uri]
-   (fn [request]
-     (let [request-uri (:uri request)]
-       (if (or (.startsWith request-uri (sanitize-uri uri))
-               (= request-uri uri))
-         (serve-metrics request)
-         (handler request))))))
+    (expose-metrics-as-json handler uri default-registry))
+  ([handler uri registry]
+    (fn [request]
+      (let [request-uri (:uri request)]
+        (if (or (.startsWith request-uri (sanitize-uri uri))
+                (= request-uri uri))
+          (serve-metrics request registry)
+          (handler request))))))


Add :context-path to request map in ring system

--- systems/ring/src/containium/systems/ring.clj
+++ systems/ring/src/containium/systems/ring.clj
@@ -63,7 +63,9 @@
 (defn- wrap-trim-context
   [handler context-path]
   (fn [request]
-    (handler (update-in request [:uri] #(subs % (count context-path))))))
+    (handler (-> request
+                 (update-in [:uri] #(subs % (count context-path)))
+                 (assoc :context-path context-path)))))

 (defn- wrap-call-in-box


Add support for copying docs files from upstream projects

--- src/puppetlabs/ezbake/stage.clj
+++ src/puppetlabs/ezbake/stage.clj
@@ -11,6 +11,7 @@
 (def template-dir-prefix "./template")
 (def staging-dir "./target/staging")
 (def shared-config-prefix "ext/config/shared/")
+(def docs-prefix "ext/docs/")

 ;; NOTE: this is unfortunate, but I couldn't come up with a better solution.
 ;; we need to walk over all of the dependencies in the lein project file
@@ -20,15 +21,6 @@
 ;; are not at all relevant to our task at hand.
 (def exclude-dependencies #{'org.clojure/tools.nrepl
                             'clojure-complete/clojure-complete})
-
-(defn find-shared-config-files
-  [jar-file]
-  {:pre [(instance? JarFile jar-file)]
-   :post [(every? #(instance? JarEntry %) %)]}
-  (filter
-    #(and (.startsWith (.getName %) shared-config-prefix)
-          (not= shared-config-prefix (.getName %)))
-    (enumeration-seq (.entries jar-file))))

 (defn find-maven-jar-file
   [coords lein-project]
@@ -66,7 +58,7 @@

 (defn cp-template-files
   [template-dir]
-  (println "copying template files from" template-dir "to" staging-dir)
+  (println "copying template files from" (.toString template-dir) "to" staging-dir)
   (fs/copy-dir template-dir staging-dir))

 (defn cp-project-file
@@ -175,6 +167,16 @@
   (let [artifact-id (first dep)]
     (not (contains? exclude-dependencies artifact-id))))

+
+(defn find-shared-config-files
+  [jar-file]
+  {:pre [(instance? JarFile jar-file)]
+   :post [(every? #(instance? JarEntry %) %)]}
+  (filter
+    #(and (.startsWith (.getName %) shared-config-prefix)
+          (not= shared-config-prefix (.getName %)))
+    (enumeration-seq (.entries jar-file))))
+
 (defn cp-shared-config-file
   [jar-file conf-file]
   (println "Copying shared config file:" (.getName conf-file))
@@ -196,6 +198,54 @@
   [lein-project]
   (let [deps (filter include-dep? (:dependencies lein-project))]
     (vec (mapcat (partial cp-shared-config-files-for-dep lein-project) deps))))
+
+;; TODO: these cp-doc-files and cp-shared-config-files functions have a lot of
+;; overlap, should probably refactor.
+(defn find-doc-files
+  [jar-file]
+  {:pre [(instance? JarFile jar-file)]
+   :post [(every? #(instance? JarEntry %) %)]}
+  (filter
+    #(and (.startsWith (.getName %) docs-prefix)
+          (not= docs-prefix (.getName %)))
+    (enumeration-seq (.entries jar-file))))
+
+(defn cp-doc-file
+  [proj-name jar-file doc-file]
+  (println "Copying doc file:" (.getName doc-file))
+  (let [orig-file (File. (.getName doc-file))
+        ;; This is a bit complex; we want to put the doc files into the staging
+        ;; dir under `ext/docs/<project-name>/<original-dir-structure-in-project`.
+        ;; To build this path we need to find <original-dir-structure-in-project>
+        ;; and then remove the first two elements (which will be "ext/docs").
+        rel-dir  (->> orig-file
+                     .getParentFile
+                     .toPath
+                     .iterator
+                     iterator-seq
+                     (drop 2)
+                     (mapv #(.toString %))
+                     (str/join "/")
+                     (File.))
+        out-dir  (fs/file staging-dir "ext" "docs" proj-name rel-dir)
+        out-file (fs/file out-dir (.getName orig-file))]
+    (fs/mkdirs out-dir)
+    (spit out-file
+          (slurp (.getInputStream jar-file doc-file)))
+    out-file))
+
+(defn cp-doc-files-for-dep
+  [lein-project dep]
+  (println "Checking for doc files in dependency:" dep)
+  (let [jar-file (find-maven-jar-file dep lein-project)
+        doc-files (find-doc-files jar-file)
+        proj-name (name (first dep))]
+    {(keyword proj-name) (mapv (partial cp-doc-file proj-name jar-file) doc-files)}))
+
+(defn cp-doc-files
+  [lein-project]
+  (let [deps (filter include-dep? (:dependencies lein-project))]
+    (apply merge (mapv (partial cp-doc-files-for-dep lein-project) deps))))

 (defn -main
   [& args]
@@ -207,7 +257,8 @@
       (clean)
       (cp-template-files template-dir)
       (let [lein-project (project/read project-file)
-            config-files (cp-shared-config-files lein-project)]
+            config-files (cp-shared-config-files lein-project)
+            doc-files    (cp-doc-files lein-project)]
         (cp-project-file project-file)
         (rename-redhat-spec-file lein-project)
         (generate-ezbake-config-file lein-project config-files)


React property _reactInternalInstance was removed in React 0.13

--- src/reagent/impl/component.cljs
+++ src/reagent/impl/component.cljs
@@ -268,8 +268,7 @@
        create-react-class))

 (defn component-path [c]
-  (let [elem (some-> (or (some-> c ($ :_reactInternalInstance))
-                          c)
+  (let [elem (some-> c
                      ($ :_currentElement))
         name (some-> elem
                      ($ :type)


adds passes

adds passes

- almost the same stack as in tools.analyzer.jvm; may be tweaked later
- removes create-env
- some indentation and sort requires

--- src/refactor_nrepl/analyzer.clj
+++ src/refactor_nrepl/analyzer.clj
@@ -1,14 +1,35 @@
 (ns refactor-nrepl.analyzer
   (:refer-clojure :exclude [macroexpand-1 read read-string])
   (:require [clojure.tools.analyzer :as ana]
-            [clojure.tools.analyzer.passes.source-info :as ana.si]
+            [clojure.tools.analyzer.ast :refer :all]
+            [clojure.tools.analyzer.env :refer [with-env]]
             [clojure.tools.analyzer.jvm :as ana.jvm]
-            [clojure.tools.analyzer.ast :refer :all]
-            [clojure.tools.analyzer.env :refer [with-env deref-env]]
-            [clojure.tools.analyzer.utils :refer [source-info]]
+            [clojure.tools.analyzer.passes.jvm
+             [box :refer [box]]
+             [constant-lifter :refer [constant-lift]]
+             [annotate-branch :refer [annotate-branch]]
+             [annotate-loops :refer [annotate-loops]]
+             [annotate-methods :refer [annotate-methods]]
+             [annotate-class-id :refer [annotate-class-id]]
+             [annotate-internal-name :refer [annotate-internal-name]]
+             [fix-case-test :refer [fix-case-test]]
+             [clear-locals :refer [clear-locals]]
+             [classify-invoke :refer [classify-invoke]]
+             [infer-tag :refer [infer-tag ensure-tag]]
+             [annotate-tag :refer [annotate-tag]]
+             [validate-loop-locals :refer [validate-loop-locals]]
+             [analyze-host-expr :refer [analyze-host-expr]]]
+            [clojure.tools.analyzer.passes
+             [source-info :refer [source-info]]
+             [cleanup :refer [cleanup]]
+             [elide-meta :refer [elide-meta]]
+             [warn-earmuff :refer [warn-earmuff]]
+             [collect :refer [collect collect-closed-overs]]
+             [add-binding-atom :refer [add-binding-atom]]
+             [uniquify :refer [uniquify-locals]]]
+            [clojure.tools.namespace.parse :refer [read-ns-decl]]
             [clojure.tools.reader :as r]
-            [clojure.tools.reader.reader-types :as rts]
-            [clojure.tools.namespace.parse :refer [read-ns-decl deps-from-ns-decl]])
+            [clojure.tools.reader.reader-types :as rts])
   (:import java.io.PushbackReader))

 (def e (ana.jvm/empty-env))
@@ -34,12 +55,6 @@
                                (map first %))))]
     [(second ns-decl) aliases]))

-(defn create-env [ns-info]
-  (let [ns (first ns-info)]
-    (atom {:namespaces {ns {:mappings {}
-                          :aliases (last ns-info)
-                          :ns ns}}})))
-
 (defn read-all-forms [reader]
   (let [eof (reify)]
     (loop [forms []]
@@ -48,20 +63,94 @@
           forms
           (recur (conj forms form)))))))

+(defn ^:dynamic run-passes
+  "Passes were copied from tools.analyzer.jvm and tweaked for the needs of
+   refactor-nrepl
+
+   Applies the following passes in the correct order to the AST:
+   * uniquify
+   * add-binding-atom
+   * cleanup
+   * source-info
+   * elide-meta
+   * warn-earmuff
+   * collect
+   * jvm.box
+   * jvm.constant-lifter
+   * jvm.annotate-branch
+   * jvm.annotate-loops
+   * jvm.annotate-class-id
+   * jvm.annotate-internal-name
+   * jvm.annotate-methods
+   * jvm.fix-case-test
+   * jvm.clear-locals
+   * jvm.classify-invoke
+   * jvm.infer-tag
+   * jvm.annotate-tag
+   * jvm.validate-loop-locals
+   * jvm.analyze-host-expr"
+  [ast]
+  (-> ast
+
+      uniquify-locals
+      add-binding-atom
+
+      (prewalk (fn [ast]
+                 (-> ast
+                     warn-earmuff
+                     source-info
+                     elide-meta
+                     annotate-methods
+                     fix-case-test
+                     annotate-class-id
+                     annotate-internal-name)))
+
+      ((fn analyze [ast]
+         (postwalk ast
+                   (fn [ast]
+                     (-> ast
+                         annotate-tag
+                         analyze-host-expr
+                         infer-tag
+                         classify-invoke
+                         constant-lift
+                         (validate-loop-locals analyze))))))
+
+      (prewalk (fn [ast]
+                 (-> ast
+                     box
+                     annotate-loops ;; needed for clear-locals to safely clear locals in a loop
+                     annotate-branch ;; needed for clear-locals
+                     ensure-tag)))
+
+      ((collect {:what       #{:constants
+                               :callsites}
+                 :where      #{:deftype :reify :fn}
+                 :top-level? false}))
+
+      ;; needs to be run in a separate pass to avoid collecting
+      ;; constants/callsites in :loop
+      (collect-closed-overs {:what  #{:closed-overs}
+                             :where #{:deftype :reify :fn :loop :try}
+                             :top-level? false})
+
+      ;; needs to be run after collect-closed-overs
+      clear-locals))
+
 (defn string-ast [string]
-     (binding [ana/macroexpand-1 ana.jvm/macroexpand-1
-               ana/create-var    ana.jvm/create-var
-               ana/parse         ana.jvm/parse
-               ana/var?          var?]
-       (try
-         (let [[_ aliases] (parse-ns string)]
-           (with-env (ana.jvm/global-env)
-             (-> string
-                 rts/indexing-push-back-reader
-                 read-all-forms
-                 (ana/analyze e)
-                 (prewalk ana.si/source-info)
-                 (assoc :alias-info aliases))))
-         (catch Exception e
-           (.printStackTrace e)
-           {}))))
+  (binding [ana/macroexpand-1 ana.jvm/macroexpand-1
+            ana/create-var    ana.jvm/create-var
+            ana/parse         ana.jvm/parse
+            ana/var?          var?]
+    (try
+      (let [[_ aliases] (parse-ns string)]
+        (with-env (ana.jvm/global-env)
+          (-> string
+              rts/indexing-push-back-reader
+              read-all-forms
+              (ana/analyze e)
+              run-passes
+              (assoc :alias-info aliases))))
+      (catch Exception e
+        (.printStackTrace e)
+        {}))))


Check handler before call it

Check handler before call it

--- src/pot/core/act.cljs
+++ src/pot/core/act.cljs
@@ -10,7 +10,8 @@
 (defn- process-msg
   [{action-key :msg :as msg} state history]
   (let [{action-handler action-key} msg-handler-map]
-    (action-handler msg state history)))
+    (when action-handler
+      (action-handler msg state history))))

 (defn listen-channels
   [state history {:keys [actions]}]


tweak failed test output a bit

tweak failed test output a bit

--- test/metabase/test_setup.clj
+++ test/metabase/test_setup.clj
@@ -35,9 +35,9 @@
                                   u/pprint-to-str
                                   (u/format-color 'red "\nin actual, not expected:\n%s"))
        :raw              [str-e str-a]
-       :result           ["expected:\n"
+       :result           ["\nexpected:\n"
                           (u/pprint-to-str 'green e)
-                          "\n                was:\n"
+                          "\nwas:\n"
                           (u/pprint-to-str 'red a)]})))


add tests for exception->event

add tests for exception->event

--- test/riemann/common_test.clj
+++ test/riemann/common_test.clj
@@ -117,3 +117,10 @@
   (is (= (truncate-bytes "あいう" 4) "あ"))
   (is (= (truncate-bytes "あいう" 9) "あいう"))
   (is (= (truncate-bytes "あいう" 10) "あいう")))
+
+(deftest exception->event-test
+  (is (= ["exception" "clojure.lang.ExceptionInfo"]
+         (:tags (exception->event (ex-info "fake test error" {})))))
+
+  (is (= "original-event"
+         (:service (:original-event (exception->event (ex-info "fake test error" {}) {:service "original-event"}))))))


it's alive ... cors requests that get back edn

--- src/semtag_web/client/main.cljs
+++ src/semtag_web/client/main.cljs
@@ -35,21 +35,11 @@
       (jayq.core/inner (str "Search results for '" query "'")))
    (jayq.core/ajax
       "http://localhost:3000/url_search"
-      {:contentType  "application/json; charset=UTF-8"
-       :type "GET"
-       ;:crossdomain true
-       :error (fn [_ _ err] (js/alert (pr-str err)))
-       :success  (fn [data] (js/alert (str "data: " data)))})
-
-    #_(jayq.core/ajax
-      "http://localhost:3000/url_search"
       {:dataType "edn"
        :error (fn [_ _ err] (js/alert (pr-str err)))
-       :beforeSend (fn [xhr]
-                     (prn "setting headerzzzz")
-                     (.setRequestHeader xhr "Access-Control-Allow-Origin" "http://localhost:3000"))
-       :success (fn [data]
-                  (.replaceWith (jayq.core/find parent "table tbody")
-                    (generate-rows data)))})))
+       :success  (fn [data]
+                   (.replaceWith (jayq.core/find parent "table tbody")
+                     (generate-rows data)))
+       })))

 (bind $button "click" button-handler)


Timestamps should be ... Timestamps

Timestamps should be ... Timestamps

--- src/route_ccrs/route_ccr.clj
+++ src/route_ccrs/route_ccr.clj
@@ -70,7 +70,7 @@
 (defn ccr-entry-updates [id current-ccr new-ccr]
   (let [[old-values new-values no-change] (diff current-ccr new-ccr)
         updated-ccr (merge id no-change new-values)
-        ts (java.sql.Date. (.getTime (java.util.Date.)))]
+        ts (java.sql.Timestamp. (.getTime (java.util.Date.)))]
     (if (seq new-values)
       [(assoc updated-ccr :calculated_at ts)
        (if (:work_center_no new-values)


tighten up

tighten up

--- src/tailrecursion/boot/core.clj
+++ src/tailrecursion/boot/core.clj
@@ -36,7 +36,9 @@
 ;; PUBLIC ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn dummy-task [boot]
-  (println "Nothing to do."))
+  (printf "Usage: boot [task1 [task1 ...]]\n")
+  (printf "Available tasks: %s.\n"
+          (apply str (interpose ", " (map name (keys (:tasks @boot)))))))

 (defn init! [base-env]
   (doto (atom base-env) (add-watch (gensym) (fn [_ _ o n] (configure! o n)))))


update clojure tests to work with current zproto.

--- main/clojure/test/org/zproto/hydra_server_test.clj
+++ main/clojure/test/org/zproto/hydra_server_test.clj
@@ -8,16 +8,19 @@

 (def dummy-backend
   (reify server/HydraServerBackend
-    (get-latest-post [this]
-      "dummy-post-id")
-    (get-single-post [this post-id]
-      (when (= "dummy-post-id" post-id)
-        ["dummy-post-id" "none" "none" "tag_2" 123123123 "dummy" "dummy-post"]))
-    (get-all-tags [this]
-      "tag_1 tag_2 tag_3 tag_4")
-    (get-single-tag [this tag-id]
-      (when (= tag-id "tag_1")
-        [tag-id "dummy-post-id-2"]))))
+    (get-latest-post [this m]
+      (msg/post-id! m "dummy-post-id"))
+    (get-single-post [this m post-id]
+      (msg/reply-to! m "none")
+      (msg/previous! m "none")
+      (msg/tags! m "tag_2")
+      (msg/timestamp! m 123123123)
+      (msg/type! m "dummy")
+      (msg/content! m "dummy-post"))
+    (get-all-tags [this m]
+      (msg/tags! m "tag_1 tag_2 tag_3 tag_4"))
+    (get-single-tag [this m tag-id]
+      (msg/post-id! m "dummy-post-id-2"))))

 (defn setup [& [connect?]]
   (let [srv-sock (msg/server-socket test-endpoint)
@@ -33,6 +36,9 @@
   (.close (:socket srv-sock))
   (.close (:socket cl-sock)))

+(defn blank-msg []
+  (HydraMsg. 0))
+
 (defn server-client-comm [cl-sock srv srv-sock cl-msg & args]
   (apply cl-msg cl-sock args)
   (server/match-msg srv (msg/recv srv-sock))
@@ -41,10 +47,12 @@
 (deftest test-hello-ok
   (let [[cl-sock srv-sock srv] (setup)]
     (try
-      (let [response (server-client-comm cl-sock srv srv-sock msg/hello)]
+      (let [response (server-client-comm cl-sock srv srv-sock msg/hello)
+            expected (blank-msg)]
+        (server/get-latest-post dummy-backend expected)
         (is (= HydraMsg/HELLO_OK
                (.id response)))
-        (is (= (server/get-latest-post dummy-backend)
+        (is (= (.post_id expected)
                (.post_id response)))
         (is (= :connected
                (-> @(:state srv) vals first))))
@@ -54,10 +62,12 @@
 (deftest test-get-tags-ok
   (let [[cl-sock srv-sock srv] (setup :connected)]
     (try
-      (let [response (server-client-comm cl-sock srv srv-sock msg/get-tags)]
+      (let [response (server-client-comm cl-sock srv srv-sock msg/get-tags)
+            expected (blank-msg)]
+        (server/get-all-tags dummy-backend expected)
         (is (= HydraMsg/GET_TAGS_OK
                (.id response)))
-        (is (= (server/get-all-tags dummy-backend)
+        (is (= (.tags expected)
                (.tags response)))
         (is (= :connected
                (-> @(:state srv) vals first))))
@@ -67,11 +77,16 @@
 (deftest test-get-tag-ok
   (let [[cl-sock srv-sock srv] (setup :connected)]
     (try
-      (let [response (server-client-comm cl-sock srv srv-sock msg/get-tag "tag_1")]
+      (let [tag "tag_1"
+            response (server-client-comm cl-sock srv srv-sock msg/get-tag tag)
+            expected (blank-msg)]
+        (server/get-single-tag dummy-backend expected tag)
         (is (= HydraMsg/GET_TAG_OK
                (.id response)))
-        (is (= (server/get-single-tag dummy-backend "tag_1")
-               [(.tag response) (.post_id response)]))
+        (is (= tag
+               (.tag response)))
+        (is (= (.post_id expected)
+               (.post_id response)))
         (is (= :connected
                (-> @(:state srv) vals first))))
       (finally
@@ -80,17 +95,26 @@
 (deftest test-get-post-ok
   (let [[cl-sock srv-sock srv] (setup :connected)]
     (try
-      (let [response (server-client-comm cl-sock srv srv-sock msg/get-post "dummy-post-id")]
+      (let [post-id "dummy-post-id"
+            response (server-client-comm cl-sock srv srv-sock msg/get-post post-id)
+            expected (blank-msg)]
+        (server/get-single-post dummy-backend expected post-id)
         (is (= HydraMsg/GET_POST_OK
                (.id response)))
-        (is (= (server/get-single-post dummy-backend "dummy-post-id")
-               [(.post_id response)
-                (.reply_to response)
-                (.previous response)
-                (.tags response)
-                (.timestamp response)
-                (.type response)
-                (.content response)]))
+        (is (= post-id
+               (.post_id response)))
+        (is (= (.reply_to expected)
+               (.reply_to response)))
+        (is (= (.previous expected)
+               (.previous response)))
+        (is (= (.tags expected)
+               (.tags response)))
+        (is (= (.timestamp expected)
+               (.timestamp response)))
+        (is (= (.type expected)
+               (.type response)))
+        (is (= (.content expected)
+               (.content response)))
         (is (= :connected
                (-> @(:state srv) vals first))))
       (finally


Bump to 1.42.5-SNAPSHOT

Bump to 1.42.5-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.42.4"
+(defproject cook "1.42.5-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Improving docs for todomvc

Improving docs for todomvc

--- examples/todomvc/src/todomvc/events.cljs
+++ examples/todomvc/src/todomvc/events.cljs
@@ -34,19 +34,20 @@
 ;; Later, we use this interceptor in the interceptor chain of all event handlers.
 ;; When included in the interceptor chain of an event handler, this interceptor
 ;; runs `check-and-throw` `after` the event handler has finished, checking
-;; the value in `app-db` against a spec.
-;; If the event handler corrupted tha value in `app-db` an exception will be
+;; the value for `app-db` against a spec.
+;; If the event handler corrupted tha value for `app-db` an exception will be
 ;; thrown. This helps us detect event handler bugs early.
 ;; Because all state is held in `app-db`, we are effectively validating the
 ;; ENTIRE state of the application after each event handler runs.  All of it.
 (def check-spec-interceptor (after (partial check-and-throw :todomvc.db/db)))

-;; Part of the TodoMVC challenge is to store todos in Local Storage.
+;; Part of the TodoMVC challenge is to store todos in local storage.
 ;; Next, we define an interceptor to help with this challenge.
 ;; This interceptor runs `after` an event handler, and it stores the
 ;; current todos into local storage.
 ;; Later, we include this interceptor into the interceptor chain
-;; of all event handlers which modify todos.
+;; of all event handlers which modify todos.  In this way, we ensure that
+;; any change to todos is written to local storage.
 (def ->local-store (after todos->local-store))

 ;; Each event handler can have its own chain of interceptors.
@@ -75,24 +76,24 @@

 ;; usage:  (dispatch [:initialise-db])
 ;;
-;; You'll see this event dispatched in the app's `main` (core.cljs)
-;; It's job is to establish initial application state in `app-db`.
+;; This event is dispatched in the app's `main` (core.cljs).
+;; It establishes initial application state in `app-db`.
 ;; That means merging:
 ;;   1. Any todos stored in LocalStore (from the last session of this app)
-;;   2. The default initial value
+;;   2. Default initial values
 ;;
 ;; Advanced topic:  we inject the todos currently stored in LocalStore
 ;; into the first, coeffect parameter via use of the interceptor
 ;;    `(inject-cofx :local-store-todos)`
 ;;
-;; To fully understand how this works, you'll have to review the tutorials
+;; To fully understand this advanced topic, you'll have to read the tutorials
 ;; and look at the bottom of `db.cljs` for the `:local-store-todos` cofx
 ;; registration.
 (reg-event-fx                 ;; part of the re-frame API
   :initialise-db              ;; event id being handled

   ;; the interceptor chain (a vector of interceptors)
-  [(inject-cofx :local-store-todos)  ;; get todos from localstore, and put into coeffects arg
+  [(inject-cofx :local-store-todos)  ;; gets todos from localstore, and puts into coeffects arg
    check-spec-interceptor]           ;; after the event handler runs, check app-db matches Spec

   ;; the event handler (function) being registered
@@ -109,7 +110,7 @@
   (fn [db [_ new-filter-kw]]     ;; new-filter-kw is one of :all, :active or :done
     (assoc db :showing new-filter-kw)))

-;; NOTE: here is a rewrite of the event handler above using `path` or `trimv`
+;; NOTE: here is a rewrite of the event handler above using `path` and `trimv`
 ;; These interceptors are useful, but they are an advanced topic.
 ;; It will be illuminating if you compare this rewrite with the original above.
 #_(reg-event-db


More, more, more documentation.

More, more, more documentation.

--- src/midje/doc.clj
+++ src/midje/doc.clj
@@ -2,11 +2,15 @@
   midje.doc
   (:use clojure.pprint)
   (:require [midje.util.colorize :as color]
+            [clojure.java.browse :as browse]
             [midje.util.ecosystem :as ecosystem]))

 (def appropriate? ecosystem/running-in-repl?)
-(def for-sweet '[midje-help midje-configuration-help])
-(def for-repl  '[midje-repl-help print-level-help])
+(def for-sweet '[midje-help
+                 midje-configuration-help
+                 print-level-help
+                 guide])
+(def for-repl  '[midje-repl-help])

 (defn repl-notice []
   (println (color/note "Run `(midje-repl-help)` for descriptions of Midje repl functions.")))
@@ -14,6 +18,23 @@
 (defn midje-notice []
   (println (color/note "For Midje usage, run `(midje-help)`."))
   (println (color/note "For Midje configuration options, run `(midje-configuration-help)`.")))
+
+
+(def guide-topics {
+ 'future-facts  "https://github.com/marick/Midje/wiki/Future-facts"
+ 'partial-prerequisites "https://github.com/marick/Midje/wiki/Partial-prerequisites"
+})
+
+(defmacro guide
+  "Open a web page that addresses a particular topic"
+  [topic]
+  `(if-let [url# (guide-topics '~topic)]
+     (browse/browse-url url#)
+     (do
+       (println "There is no such topic. Did you mean one of these?")
+       (doseq [topic# (keys guide-topics)]
+         (println "   " topic#)))))
+

 (defn midje-repl-help
   "Midje repl help"
@@ -226,4 +247,35 @@
 (defn midje-configuration-help
   "What can go in the .midje.clj files."
   []
-  "Not implemented yet.")
+  (println "On startup, Midje loads ${HOME}/.midje.clj and ./.midje.clj")
+  (println "(in that order). To affect the default configuration, use")
+  (println "code like this:")
+  (println "    (override-with :visible-deprecation false")
+  (println "                   :visible-future false")
+  (println "                   :print-level :print-namespaces)")
+  (println)
+  (println "You can temporarily override the configuration like this:")
+  (println "    (midje.config/with-augmented-config {:print-level :print-no-summary}")
+  (println "       <forms>...)")
+  (println)
+  (println "------ Configuration keywords")
+  (println ":print-level                  ; Verbosity of printing.")
+  (println "                              ; See `(print-level-help)`")
+  (println)
+  (println ":check-after-creation         ; Should facts be checked as they're loaded?")
+  (println "                              ; Default true.")
+  (println)
+  (println ":visible-deprecation          ; Whether information about deprecated")
+  (println "                              ; features or functions is printed.")
+  (println "                              ; Default true.")
+  (println)
+  (println ":visible-future               ; Whether future facts produce output.")
+  (println "                              ; Default true.")
+  (println "                              ; More: `(guide future-facts)`")
+  (println)
+  (println ":partial-prerequisites        ; Whether the real function can be used.")
+  (println "                              ; Default false.")
+  (println "                              ; More: `(guide partial-prerequisites)`")
+  (println)
+  )
+


adding support for edge indexes

adding support for edge indexes

--- src/ophion/db.clj
+++ src/ophion/db.clj
@@ -5,7 +5,9 @@
   (:import
    [org.apache.commons.configuration BaseConfiguration]
    [org.janusgraph.core JanusGraphFactory JanusGraph]
-   [org.apache.tinkerpop.gremlin.structure Vertex Edge]
+   [org.janusgraph.core.schema SchemaAction]
+   [org.apache.tinkerpop.gremlin.structure Vertex Edge Direction]
+   [org.apache.tinkerpop.gremlin.process.traversal P Order Traversal]
    [org.apache.tinkerpop.gremlin.tinkergraph.structure TinkerGraph]))

 (defn connect-tinkergraph
@@ -22,24 +24,62 @@
     (.setProperty base "storage.cassandra.frame-size-mb" "60")
     (JanusGraphFactory/open base)))

+(defn janus-get-property-key
+  [manage [key type]]
+  (or
+   (.getPropertyKey manage)
+   (.make
+    (.dataType
+     (.makePropertyKey manage (name key)) type))))
+
 (defn janus-apply-index
   [manage db-index index]
   (let [db (reduce
             (fn [db-index [k v]]
-              (let [property (if-let [property (.getPropertyKey manage (name k))]
-                               property
-                               (.make (.dataType (.makePropertyKey manage (name k)) v)))]
+              (let [property (janus-get-property-key manage k v)]
                 (.addKey db-index property)))
             db-index index)]
     (.buildCompositeIndex db)))

-(defn janus-make-index
+(defn property-index-name
+  [index]
+  (string/join "-" (concat (keys index) ["index"])))
+
+(defn janus-property-index
   [graph index]
   (try
-    (let [index-name (string/join "-" (concat (keys index) ["index"]))
+    (let [index-name (property-index-name index)
           manage (.openManagement graph)]
       (janus-apply-index manage (.buildIndex manage (str index-name "-vertex") Vertex) index)
       (janus-apply-index manage (.buildIndex manage (str index-name "-edge") Edge) index)
+      (.commit manage))
+    (catch Exception e
+      (.printStackTrace e))))
+
+(defn edge-index-name
+  [edge-label index]
+  (string/join "-" (concat [edge-label] (keys index) ["vertex-centric-index"])))
+
+(defn janus-edge-index
+  [graph edge-label index]
+  (try
+    (let [index-name (edge-index-name edge-label index)
+          manage (.openManagement graph)
+          property-keys (into-array (mapv (partial janus-get-property-key index)))
+          edge (.getEdgeLabel manage edge-label)
+          index (.buildEdgeIndex manage edge index-name Direction/BOTH Order/incr property-keys)]
+      (.commit manage))
+    (catch Exception e
+      (.printStackTrace e))))
+
+(defn janus-edge-reindex
+  [graph edge-label index]
+  (try
+    (let [index-name (edge-index-name edge-label index)
+          manage (.openManagement graph)
+          edge (.getEdgeLabel manage edge-label)
+          index (.getRelationIndex manage edge index-name)]
+      (.updateIndex index SchemaAction/REINDEX)
       (.commit manage))
     (catch Exception e
       (.printStackTrace e))))
@@ -65,10 +105,10 @@
 (defn -main
   [& args]
   (let [graph (connect-graph "config/ophion.clj")]
-    (janus-make-index graph {:id String})
-    (janus-make-index graph {:gid String})
-    (janus-make-index graph {:type String})
-    (janus-make-index graph {:label String})
-    (janus-make-index graph {:symbol String})
-    (janus-make-index graph {:featureId String})
-    (janus-make-index graph {:chromosome String :start String :end String})))
+    (janus-property-index graph {:id String})
+    (janus-property-index graph {:gid String})
+    (janus-property-index graph {:type String})
+    (janus-property-index graph {:label String})
+    (janus-property-index graph {:symbol String})
+    (janus-property-index graph {:featureId String})
+    (janus-property-index graph {:chromosome String :start String :end String})))


Deprecated usage of string refs.

Deprecated usage of string refs.

Closes #124

--- src/rum/core.cljs
+++ src/rum/core.cljs
@@ -267,19 +267,22 @@

 (defn dom-node
-  "Given state, returns top-level DOM node of component. Call it during lifecycle callbacks. Can’t be called during render."
+  "Usage of this function is discouraged. Use :ref callback instead.
+  Given state, returns top-level DOM node of component. Call it during lifecycle callbacks. Can’t be called during render."
   [state]
   (js/ReactDOM.findDOMNode (:rum/react-component state)))

 (defn ref
-  "Given state and ref handle, returns React component."
+  "DEPRECATED: Use :ref (fn [dom-or-nil]) callback instead. See rum issue #124
+  Given state and ref handle, returns React component."
   [state key]
   (-> state :rum/react-component (aget "refs") (aget (name key))))

 (defn ref-node
-  "Given state and ref handle, returns DOM node associated with ref."
+  "DEPRECATED: Use :ref (fn [dom-or-nil]) callback instead. See rum issue #124
+  Given state and ref handle, returns DOM node associated with ref."
   [state key]
   (js/ReactDOM.findDOMNode (ref state (name key))))


catch some in test

catch some in test

--- src/runtime/q.clj
+++ src/runtime/q.clj
@@ -546,7 +546,8 @@
   (isthrown? rte (thro rte))
   (isthrown? rte (thro rte "msg"))
   (isthrown? rte (thro rte2))
-  ;FIXME: won't work: (isthrown? rte2 (thro rte2));due to compiletime/runtime macro crap; let's just say I wanna transcend this level of programming and get up there into a graph-like based system in 3D, asap ffs!
+  ;FIXed: won't work:
+  (isthrown? exceptionThrownWhenNotAClass (eval '(isthrown? rte2 (thro rte2))))
   (isthrown? java.lang.RuntimeException (thro java.lang.RuntimeException))
   (isthrown? rte (thro java.lang.RuntimeException))


Unpend locking tests [ISPN-2891]

Unpend locking tests [ISPN-2891]

--- integration-tests/apps/caching/counter/test/counter/test/locking.clj
+++ integration-tests/apps/caching/counter/test/counter/test/locking.clj
@@ -28,23 +28,19 @@
                         (msg/unlisten listener))))

 (deftest correct-counting-with-pessimistic-locking
-  (println "PENDING: fix prior to release")
-  ;; (csh/put (:pessimistic caches) :count 0)
-  ;; (is (= 0 (:count (:pessimistic caches))))
-  ;; (dotimes [_ 10] (msg/publish "/queue/work" {:name :pessimistic :key :count}))
-  ;; (log/info "JC: published 10 messages")
-  ;; (is (every? (partial = :pessimistic) (take 10 (msg/message-seq "/queue/done" :timeout 60000))))
-  ;; (log/info "JC: pessimistic done" (:count (:pessimistic caches)))
-  ;; (is (= 10 (:count (:pessimistic caches))))
-  )
+  (csh/put (:pessimistic caches) :count 0)
+  (is (= 0 (:count (:pessimistic caches))))
+  (dotimes [_ 10] (msg/publish "/queue/work" {:name :pessimistic :key :count}))
+  (log/info "JC: published 10 messages")
+  (is (every? (partial = :pessimistic) (take 10 (msg/message-seq "/queue/done" :timeout 60000))))
+  (log/info "JC: pessimistic done" (:count (:pessimistic caches)))
+  (is (= 10 (:count (:pessimistic caches)))))

 (deftest correct-counting-with-optimistic-locking
-  (println "PENDING: fix prior to release")
-  ;; (csh/put (:optimistic caches) :count 0)
-  ;; (is (= 0 (:count (:optimistic caches))))
-  ;; (dotimes [_ 3] (msg/publish "/queue/work" {:name :optimistic :key :count}))
-  ;; (log/info "JC: published 3 messages")
-  ;; (is (every? (partial = :optimistic) (take 3 (msg/message-seq "/queue/done" :timeout 60000))))
-  ;; (log/info "JC: optimistic done" (:count (:optimistic caches)))
-  ;; (is (= 3 (:count (:optimistic caches))))
-  )
+  (csh/put (:optimistic caches) :count 0)
+  (is (= 0 (:count (:optimistic caches))))
+  (dotimes [_ 3] (msg/publish "/queue/work" {:name :optimistic :key :count}))
+  (log/info "JC: published 3 messages")
+  (is (every? (partial = :optimistic) (take 3 (msg/message-seq "/queue/done" :timeout 60000))))
+  (log/info "JC: optimistic done" (:count (:optimistic caches)))
+  (is (= 3 (:count (:optimistic caches)))))


fix ping recursion.

fix ping recursion.

--- src/tranjlator/chat_room.clj
+++ src/tranjlator/chat_room.clj
@@ -183,10 +183,11 @@
                          (log/warn "ChatRoom shutting down due to \"clojure\" channel closing")))
             ping ([{:keys [text target language user-name] :as msg}]
                     (if-not (nil? msg)
-                      (when-let [target-chan (get users target)]
-                        (>! pub-chan (msg/->chat user-name language text "ping"))
-                        (>! target-chan msg)
-                        (recur users history translators try-clj-cookie)))))))))
+                      (do (when-let [target-chan (get users target)]
+                            (>! pub-chan (msg/->chat user-name language text "ping"))
+                            (>! target-chan msg))
+                          (recur users history translators try-clj-cookie))
+                      (log/warn "ChatRoom shutting down due to \"ping\" channel closing"))))))))

   (stop [this]
     (a/close! pub-chan)


Use a go-block per dynamic translation

Use a go-block per dynamic translation

--- src/tranjlator/chat_room.clj
+++ src/tranjlator/chat_room.clj
@@ -74,16 +74,16 @@
   [chan history translator]
   (go (let [token (<! (p/token translator))]
         (doseq [h history]
-          (let [[translation orig-sha trans-sha] (<! (p/translate translator
-                                                                  (:content h)
-                                                                  (:language h)
-                                                                  token))]
-            (log/infof "XLATE HISTORY: %s" translation)
-            (>! chan (msg/->translation (:language translator)
-                                        translation
-                                        (xlate/sha-hex orig-sha)
-                                        (xlate/sha-hex trans-sha)
-                                        (:user-name h))))))))
+          (go (let [[translation orig-sha trans-sha] (<! (p/translate translator
+                                                                      (:content h)
+                                                                      (:language h)
+                                                                      token))]
+                (>! chan (msg/->translation (:language translator)
+                                            translation
+                                            (xlate/sha-hex orig-sha)
+                                            (xlate/sha-hex trans-sha)
+                                            (:user-name h)))
+                (log/infof "XLATE HISTORY: %s" translation)))))))

 (defrecord ChatRoom
     [initial-users initial-history pub-chan process-chan mock-translator? db]


Remove static mixin from lightbox component.

This facilitates code reloading and rerendering
on development mode.

--- src/uxbox/main/ui/lightbox.cljs
+++ src/uxbox/main/ui/lightbox.cljs
@@ -66,4 +66,4 @@
     :render lightbox-render
     :will-mount lightbox-will-mount
     :will-unmount lightbox-will-umount
-    :mixins [mx/reactive mx/static]}))
+    :mixins [mx/reactive]}))


Added sliding tab navigator Added  number needed texts Added bars and number needed to tab navigator

--- src/unspun/screens/tabs.cljs
+++ src/unspun/screens/tabs.cljs
@@ -5,7 +5,8 @@
             [cljs-exponent.components :refer [element text view image touchable-highlight status-bar] :as rn]
             [shared.ui :refer [sliding-tab-navigation sliding-tab-navigation-item ionicon]]
             [unspun.screens.rum-bars :as bars]
-            [unspun.screens.number-needed :as nn]))
+            [unspun.screens.number-needed :as nn]
+            [clojure.string :refer [upper-case]]))

 (defn get-color [is-selected]
@@ -15,17 +16,9 @@
   (text {:style {:color (get-color is-selected)}}
         title))

-(defn render-icon [name is-selected]
-  (ionicon {:name  name
-            :size  30
-            :color (if is-selected "blue" "orange")}))
-
-(defn get-style [is-selected]
-  {:backgroundColor (if is-selected "#0084FF" "#888")})
-
-(rum/defcs page [state]
-  (let [navigator (aget (:rum/react-component state) "props" "navigator")]
-    (prn navigator)
+(rum/defcs page < rum/reactive [state]
+  (let [navigator (aget (:rum/react-component state) "props" "navigator")
+        palette (get-palette (rum/react palette-index))]
     (view {:style {
                    :flex            1
                    :backgroundColor "#CCF"
@@ -33,22 +26,19 @@
           (sliding-tab-navigation
             {:id                 "tab-navigation"
              :navigatorUID       "tab-navigation"
-             :barBackgroundColor "black"
-             :indicatorStyle     {:backgroundColor "red"}
-             :initialTab         "bars"}
+             :barBackgroundColor (:dark-primary palette)
+             :indicatorStyle     {:backgroundColor (:accent palette)}
+             :initialTab         "bars"
+             }
             (sliding-tab-navigation-item
-              {:id            "icons"
-               :title         "Number Needed"
-               :renderTitle   render-title
-               :render-icon   (partial render-icon "md-keypad")
-               :selectedStyle (:backgroundColor "#0084FF")}
+              {:id          "icons"
+               :title       "Number Needed"
+               :renderTitle render-title}
               (nn/page)
               )
             (sliding-tab-navigation-item
-              {:id            "bars"
-               :title         "Compare With and without"
-               :renderTitle   render-title
-               :render-icon   (partial render-icon "ios-stats")
-               :selectedStyle (:backgroundColor "#0084FF")
+              {:id          "bars"
+               :title       "Comparing\nWith and without"
+               :renderTitle render-title
                }
               (bars/page))))))


Add comment to original-path

Add comment to original-path

--- src/vignette/media_types.clj
+++ src/vignette/media_types.clj
@@ -53,6 +53,14 @@
   (:original data))

 (defn original-path
+  "From a request map, generate a URI for an original image. These typically
+  take the form of one of the following:
+
+  /bucket/images/a/ab/original.ext
+  /bucket/avatars/a/ab/original.ext
+  /bucket/lang/images/a/ab/original.ext
+  /bucket/lang/images/timeline/original.ext
+  "
   [data]
   (let [prefix (image-type->path-prefix data)
         image-path (clojure.string/join "/" (filter not-empty ((juxt top-dir middle-dir) data)))


Allows getting /usage for all users (#1781)

* Allows getting /usage for all users

* Improves schema

* Adds UserUsageInPool to snake case conversion

* Fixes schema

* Adds UsageResponse to snake case conversion

* Uses cached-queries

--- scheduler/src/cook/rest/api.clj
+++ scheduler/src/cook/rest/api.clj
@@ -27,6 +27,7 @@
             [compojure.api.middleware :as c-mw]
             [compojure.api.sweet :as c-api]
             [compojure.core :refer [ANY GET POST routes]]
+            [cook.cached-queries :as cached-queries]
             [cook.compute-cluster :as cc]
             [cook.config :as config]
             [cook.datomic :as datomic]
@@ -2741,8 +2742,8 @@

 (def UserUsageParams
   "User usage endpoint query string parameters"
-  (assoc UserParam
-    (s/optional-key :group_breakdown) s/Bool))
+  {(s/optional-key :user) s/Str
+   (s/optional-key :group_breakdown) s/Bool})

 (def UsageInfo
   "Schema for a dictionary of job resource usage info."
@@ -2758,7 +2759,7 @@

 (def UserUsageInPool
   "Schema for a user's usage within a particular pool."
-  {:total_usage UsageInfo
+  {(s/optional-key :total_usage) UsageInfo
    (s/optional-key :grouped) [{:group UsageGroupInfo, :usage UsageInfo}]
    (s/optional-key :ungrouped) JobsUsageResponse})

@@ -2766,6 +2767,11 @@
   "Schema for a usage response."
   (assoc UserUsageInPool
     (s/optional-key :pools) {s/Str UserUsageInPool}))
+
+(def UsageResponse
+  "Schema for a usage response."
+  (assoc UserUsageResponse
+    (s/optional-key :users) {s/Str UserUsageResponse}))

 (def zero-usage
   "Resource usage map 'zero' value"
@@ -2802,32 +2808,51 @@
                                        :ungrouped {:running-jobs []
                                                    :usage zero-usage})))

+(defn usage
+  "Given a collection of jobs, returns the usage information for those jobs."
+  [db pool with-group-breakdown? jobs]
+  (if pool
+    (user-usage with-group-breakdown? jobs)
+    (let [pools (pool/all-pools db)]
+      (if (pos? (count pools))
+        (let [default-pool-name (config/default-pool)
+              pool-name->jobs (group-by
+                                #(if-let [pool (:job/pool %)]
+                                   (:pool/name pool)
+                                   default-pool-name)
+                                jobs)
+              no-usage (no-usage-map with-group-breakdown?)
+              pool-name->usage (pc/map-vals (partial user-usage with-group-breakdown?) pool-name->jobs)
+              pool-name->no-usage (into {} (map (fn [{:keys [pool/name]}] [name no-usage]) pools))
+              total-usage (user-usage with-group-breakdown? jobs)]
+          (assoc total-usage
+            :pools (merge pool-name->no-usage pool-name->usage)))
+        (user-usage with-group-breakdown? jobs)))))
+
 (defn get-user-usage
   "Query a user's current resource usage based on running jobs."
   [db ctx]
   (let [user (get-in ctx [:request :query-params :user])
         with-group-breakdown? (get-in ctx [:request :query-params :group_breakdown])
         pool (or (get-in ctx [:request :query-params :pool])
-                 (get-in ctx [:request :headers "x-cook-pool"]))]
-    (if pool
-      (let [jobs (util/get-user-running-job-ents-in-pool db user pool)]
-        (user-usage with-group-breakdown? jobs))
-      (let [jobs (util/get-user-running-job-ents db user)
-            pools (pool/all-pools db)]
-        (if (pos? (count pools))
-          (let [default-pool-name (config/default-pool)
-                pool-name->jobs (group-by
-                                  #(if-let [pool (:job/pool %)]
-                                     (:pool/name pool)
-                                     default-pool-name)
-                                  jobs)
-                no-usage (no-usage-map with-group-breakdown?)
-                pool-name->usage (pc/map-vals (partial user-usage with-group-breakdown?) pool-name->jobs)
-                pool-name->no-usage (into {} (map (fn [{:keys [pool/name]}] [name no-usage]) pools))
-                total-usage (user-usage with-group-breakdown? jobs)]
-            (assoc total-usage
-              :pools (merge pool-name->no-usage pool-name->usage)))
-          (user-usage with-group-breakdown? jobs))))))
+                 (get-in ctx [:request :headers "x-cook-pool"]))
+        running-jobs
+        (if user
+          (if pool
+            (util/get-user-running-job-ents-in-pool db user pool)
+            (util/get-user-running-job-ents db user))
+          (cond->>
+            (util/get-running-job-ents db)
+            pool (filter
+                   #(= pool
+                       (cached-queries/job->pool-name %)))))]
+    (if user
+      (usage db pool with-group-breakdown? running-jobs)
+      {:users
+       (->> running-jobs
+            (group-by cached-queries/job-ent->user)
+            (pc/map-vals
+              #(usage db pool with-group-breakdown? %)))})))

 (defn read-usage-handler
   "Handle GET requests for a user's current usage."
@@ -3428,6 +3453,7 @@
                         {JobResponseDeprecated (partial pc/map-keys ->snake_case)
                          JobResponse (partial pc/map-keys ->snake_case)
                          GroupResponse (partial pc/map-keys ->snake_case)
+                         UsageResponse (partial pc/map-keys ->snake_case)
                          UserUsageResponse (partial pc/map-keys ->snake_case)
                          UserUsageInPool (partial pc/map-keys ->snake_case)
                          UsageGroupInfo (partial pc/map-keys ->snake_case)
@@ -3613,7 +3639,7 @@
           "/usage" []
           (c-api/resource
             {:produces ["application/json"],
-             :responses {200 {:schema UserUsageResponse
+             :responses {200 {:schema UsageResponse
                               :description "User's usage calculated."}
                          400 {:description "Invalid request format."}
                          401 {:description "Not authorized to read usage."}}


I only want one result

I only want one result

--- src/wishlistd/models/sql.clj
+++ src/wishlistd/models/sql.clj
@@ -42,9 +42,10 @@
       (values neu))))

 (defn read-wishlist [code]
-  (select wishlist (wishlist-fields)
-    (with wish (wish-fields))
-    (where {:code code})))
+  (first
+    (select wishlist (wishlist-fields)
+      (with wish (wish-fields))
+      (where {:code code}))))

 (defn update-wishlist [{:keys [code] :as wl}]
   (update wishlist


Cleanup

Cleanup

--- worker/src/clinicico/worker/task.clj
+++ worker/src/clinicico/worker/task.clj
@@ -2,6 +2,7 @@
   (:import [org.zeromq ZMQ])
   (:require [taoensso.nippy :as nippy]
             [zeromq.zmq :as zmq]
+            [clinicico.common.zeromq :as q]
             [crypto.random :as crypto]
             [clojure.string :as s :only [blank?]]
             [clojure.tools.logging :as log]))
@@ -43,19 +44,12 @@
                      (let [socket (zmq/socket context :req)]
                        (zmq/set-identity socket (.getBytes ident))
                        (zmq/connect socket "tcp://localhost:7740")
-                       (zmq/send socket (.getBytes method) ZMQ/SNDMORE)
-                       (zmq/send socket (byte-array 0) ZMQ/SNDMORE)
-                       (zmq/send socket (.getBytes "READY"))
+                       (q/send-frame socket method "READY")
                        (while true
-                         (let [address (zmq/receive socket)
-                               _ (zmq/receive socket)
-                               response (handler (nippy/thaw (zmq/receive socket)))]
-                           (log/debug "Sending response for" (String. address))
-                           (zmq/send socket (.getBytes method) ZMQ/SNDMORE)
-                           (zmq/send socket (byte-array 0) ZMQ/SNDMORE)
-                           (zmq/send socket address ZMQ/SNDMORE)
-                           (zmq/send socket (byte-array 0) ZMQ/SNDMORE)
-                           (zmq/send socket (nippy/freeze response)))))))))
+                         (let [[address request] (q/take socket [String zmq/bytes-type])
+                                response (handler (nippy/thaw request))]
+                           (log/debug "Sending response for" address)
+                           (q/send-frame socket method address (nippy/freeze response)))))))))

 (defn initialize
   [method n task-fn]


key off of blocking-text for blocker

key off of blocking-text for blocker

--- src/cljs/org/broadinstitute/firecloud_ui/page/method_config_importer.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/method_config_importer.cljs
@@ -16,9 +16,8 @@
   (let [{:keys [workspace-id on-back]} props
         workspaces-list (:workspaces-list @state)]
     [:div {}
-     (when (:blocking? @state)
-       [comps/Blocker {:banner (if (:blocking-text @state)
-                                 (:blocking-text @state) "Please wait...")}])
+     (when (:blocking-text @state)
+       [comps/Blocker {:banner (:blocking-text @state)}])
      [:div {:style {:paddingBottom "0.5em"}}
       (style/create-link #(on-back)
         (icons/font-icon {:style {:fontSize "70%" :marginRight "0.5em"}} :angle-left)
@@ -42,12 +41,12 @@
             (let [name (entity "name")
                   namespace (entity "namespace")
                   snapshotId (entity "snapshotId")]
-              (swap! state assoc :blocking-text "Redacting..." :blocking? true)
+              (swap! state assoc :blocking-text "Redacting...")
               (endpoints/call-ajax-orch
                 {:endpoint (endpoints/delete-agora-entity
                              config? namespace name snapshotId)
                  :on-done (fn [{:keys [success? status-text]}]
-                            (swap! state dissoc :blocking? :blocking-text)
+                            (swap! state dissoc :blocking-text)
                             (if success?
                               ((:on-delete props))
                               (js/alert (str "Error ! Message : " status-text))))})))}]])
@@ -110,7 +109,7 @@
            (common/scroll-to-center (.getDOMNode (@refs "error")) 100)
            (swap! state assoc :bad-input true))
          (do
-           (swap! state assoc :blocking? true :blocking-text "Importing...")
+           (swap! state assoc :blocking-text "Importing...")
            (endpoints/call-ajax-orch
              {:endpoint (endpoints/copy-method-config-to-workspace workspace-id)
               :payload {"configurationNamespace" (config "namespace")
@@ -120,7 +119,7 @@
                         "destinationName" name}
               :headers {"Content-Type" "application/json"}
               :on-done (fn [{:keys [success? xhr]}]
-                         (swap! state dissoc :blocking?)
+                         (swap! state dissoc :blocking-text)
                          (if success?
                            (do
                              (on-back)
@@ -176,7 +175,7 @@
            (common/scroll-to-center (.getDOMNode (@refs "error")) 100)
            (swap! state assoc :bad-input true))
          (do
-           (swap! state assoc :blocking? true :blocking-text "Importing...")
+           (swap! state assoc :blocking-text "Importing...")
            (endpoints/call-ajax-orch
              {:endpoint (endpoints/post-workspace-method-config workspace-id)
               :payload (assoc (:template @state)
@@ -185,7 +184,7 @@
                          "rootEntityType" rootEntityType)
               :headers {"Content-Type" "application/json"}
               :on-done (fn [{:keys [success? xhr]}]
-                         (swap! state dissoc :blocking?)
+                         (swap! state dissoc :blocking-text)
                          (if success?
                            (do
                              (on-back)
@@ -297,7 +296,7 @@
        :else [comps/Spinner {:text "Loading..."}]))
    :reload-entities
    (fn [{:keys [state this]}]
-     (swap! state dissoc :blocking? :selected-method :selected-config :methods-list :configs-list)
+     (swap! state dissoc :blocking-text :selected-method :selected-config :methods-list :configs-list)
      (endpoints/call-ajax-orch
        {:endpoint endpoints/list-configurations
         :on-done (fn [{:keys [success? get-parsed-response status-text]}]


fix register-sub and register-handler

fix register-sub and register-handler

--- src/cljs/phonecat_re_frame/core.cljs
+++ src/cljs/phonecat_re_frame/core.cljs
@@ -12,12 +12,12 @@
 ;; -------------------------
 ;; Re-frame data

-(re-frame/register-subs        ;; a new subscription handler
+(re-frame/register-sub        ;; a new subscription handler
    :phones             ;; usage (subscribe [:phones])
    (fn [db]
      (reaction (:phones @db))))  ;; pulls out :phones

-(re-frame/register-pure-handler
+(re-frame/register-handler
    :initialise-db             ;; usage: (dispatch [:initialise-db])
    (fn
      [_ _]                   ;; Ignore both params (db and v).


verify badge

verify badge

--- src/cljs/salava/badge/ui/verify.cljs
+++ src/cljs/salava/badge/ui/verify.cljs
@@ -6,32 +6,30 @@
             [salava.core.helper :refer [dump]]
             [salava.badge.ui.helper :as bh]
             [salava.badge.ui.assertion :as a]
+            [clojure.string :refer [blank?]]
             [salava.core.time :refer [date-from-unix-time unix-time unix-time]]
             ))

-(defn init-badge-info [assertion state]
+(defn init-badge-info [badgeid state]
   (ajax/GET
-    (path-for (str "/obpv1/badge/verify"))
-    { :params {:assertion_url (:id assertion)}
-      :handler (fn [data]
-                 (reset! state (assoc data
-                                 ;:verifying false
-                                 :display "none"
-                                 :style "success")))}))
+    (path-for (str "/obpv1/badge/verify/" badgeid))
+    {:handler (fn [data]
+                (reset! state (assoc data
+                                :verifying false
+                                :display "none"
+                                :style "success")))}))
 (defn code-helper [v]
   (case v
     200 "ok"
-    800 "empty"
+    800 "not provided"
     v
     ))

-(defn verify-badge [assertion]
+(defn verify-badge [badgeid]
   (let [state (atom {:verifying true})]
-    (init-badge-info assertion state)
+    (init-badge-info badgeid state)
     (fn []
-      (let [{:keys [assertion-status badge-image-status revoked? expired? assertion badge-issuer-status badge-criteria-status]} @state
-            ]
-        (js/setTimeout (fn [] (swap! state assoc :verifying false)) 2000)
+      (let [{:keys [assertion-status badge-image-status revoked? expired? assertion badge-issuer-status badge-criteria-status asr revocation_reason]} @state]
         (if (= true (:verifying @state))
           [:div.ajax-message {:style {:padding-top "20px"}}
            [:i {:class "fa fa-cog fa-spin fa-2x "}]
@@ -41,31 +39,32 @@
              410  [:div {:class "revoked"}
                    (str (t :badge/Badge) (t :badge/Revoked))
                    ]
-             500 [:div {:class "expired"}
-                  (:badge-status @state)
-                  ]
+             500 [:div
+                  [:div {:class "expired"}
+                   (:badge-status @state)]
+                  [:br]
+                  [:p [:i asr]]
+                  [:a {:target "_blank" :rel "nofollow noopener" :href (str "https://badgecheck.io/?url="asr) :style {:float "right"}} "use external validator"]]
              [:div
               #_(if (and verified_by_obf issued_by_obf) [:p (t :badge/Issuedandverifiedbyobf)])
-              [:p [:b "Assertion url"]" - " (code-helper assertion-status)]
-              [:p [:b "Badge Image url"]" - " (code-helper badge-image-status)]
-              [:p [:b "Badge Criteria url"]" - " (code-helper badge-criteria-status)]
-              [:p [:b "Badge Issuer url"]" - " (code-helper badge-issuer-status)]
-              [:p [:b (str (t :badge/Revoked))] " - " (if revoked? (t :core/Yes) (t :core/No)) ]
-              [:p [:b (str (t :badge/Expired))]" - " (if expired? (t :core/Yes) (t :core/No))]
+              (cond
+                revoked? [:div [:p {:class "revoked"} (str (t :badge/Badge) " " (t :badge/Revoked))] [:p revocation_reason]]
+                expired? [:div {:class "expired"} [:p (t :badge/Badgeisexpired)]]
+                :else [:div
+                       [:p [:b "Assertion url"]" - " (code-helper assertion-status)]
+                       [:p [:b "Badge Image url"]" - " (code-helper badge-image-status)]
+                       [:p [:b "Badge Criteria url"]" - " (code-helper badge-criteria-status)]
+                       [:p [:b "Badge Issuer url"]" - " (code-helper badge-issuer-status)]
+                       [:p [:b (str (t :badge/Revoked))] " - " (if revoked? (t :core/Yes) (t :core/No)) ]
+                       [:p {:class "success"} (t :badge/Validbadge)]])

-
-
-              [:div {:class (:style @state)}
-               (cond
-                 revoked? (do (swap! state assoc :style "revoked") (str (t :badge/Badge) (t :badge/Revoked)))
-                 expired? (do (swap! state assoc :style "expired") (t :badge/Badgeisexpired))
-                 :else (do (swap! state assoc :style "success")  (t :badge/Validbadge)))]
-              [:br]
               [:p [:i "last checked on " (date-from-unix-time (* 1000 (unix-time)))]]
-              [:a.link {:href     "#"
-                        :on-click #(do (.preventDefault %)
-                                     (if (= (:display @state) "none") (swap! state assoc :display "block") (swap! state assoc :display "none"))
-                                     )} (if (= (:display @state) "none") (str (t :badge/Openassertion) "...") (str (t :badge/Hideassertion) "..."))]
+              [:div
+               [:a.link {:href     "#"
+                         :on-click #(do (.preventDefault %)
+                                      (if (= (:display @state) "none") (swap! state assoc :display "block") (swap! state assoc :display "none"))
+                                      )} (if (= (:display @state) "none") (str (t :badge/Openassertion) "...") (str (t :badge/Hideassertion) "..."))]
+               [:a {:style {:float "right"} :href (str "https://badgecheck.io/?url="asr) :target "_blank" :rel "nofollow noopener"} "use external validator"]]
               [:div {:style {:display (:display @state) :padding-top "30px"}}
                [a/assertion-content (dissoc assertion :evidence)]
                ]])])))))


translation

translation

--- src/cljs/salava/metabadge/ui/my.cljs
+++ src/cljs/salava/metabadge/ui/my.cljs
@@ -51,7 +51,7 @@

 (defn order-radio-values []
   [{:value "name" :id "radio-name" :label (t :core/byname)}
-   {:value "status" :id "radio-status" :label "by status"#_(t :core/byname)}])
+   {:value "status" :id "radio-status" :label (t :metabadge/bystatus)}])

 (defn grid-form [state]
   [:div#grid-filter {:class "form-horizontal" :style {:margin "10px 0px 10px 0px"}}