WIP LazySeq traversable instance

WIP LazySeq traversable instance

--- test/cats/builtin_spec.cljc
+++ test/cats/builtin_spec.cljc
@@ -136,6 +136,104 @@
     (t/is (= [1 2 3] (m/foldr (fn [v acc] (into [v] acc)) [] [1 2 3])))
     (t/is (= 6 (m/foldr + 0 [1 2 3])))))

+(t/deftest lazyseq-foldable
+  (t/testing "Foldl"
+    (t/is (= [3 2 1] (m/foldl (fn [acc v] (into [v] acc)) [] (map identity [1 2 3]))))
+    (t/is (= 6 (m/foldl + 0 (map identity [1 2 3])))))
+
+  (t/testing "Foldr"
+    (t/is (= [1 2 3] (m/foldr (fn [v acc] (into [v] acc)) [] (map identity [1 2 3]))))
+    (t/is (= 6 (m/foldr + 0 (map identity [1 2 3]))))))
+
+(t/deftest range-foldable
+  (t/testing "Foldl"
+    (t/is (= [3 2 1] (m/foldl (fn [acc v] (into [v] acc)) [] (range 1 4))))
+    (t/is (= 6 (m/foldl + 0 (range 1 4)))))
+
+  (t/testing "Foldr"
+    (t/is (= [1 2 3] (m/foldr (fn [v acc] (into [v] acc)) [] (range 1 4))))
+    (t/is (= 6 (m/foldr + 0 (range 1 4))))))
+
+(t/deftest any-monoid
+  (t/testing "mempty"
+    (ctx/with-context b/any-monoid
+      (t/is (= false (m/mempty)))))
+
+  (t/testing "mappend"
+    (ctx/with-context b/any-monoid
+      (t/is (true? (m/mappend (m/mempty) true)))
+      (t/is (false? (m/mappend false false)))
+      (t/is (true? (m/mappend true false)))
+      (t/is (true? (m/mappend false true)))
+      (t/is (true? (m/mappend true true))))))
+
+(t/deftest all-monoid
+  (t/testing "mempty"
+    (ctx/with-context b/all-monoid
+      (t/is (= true (m/mempty)))))
+
+  (t/testing "mappend"
+    (ctx/with-context b/all-monoid
+      (t/is (false? (m/mappend (m/mempty) false)))
+      (t/is (false? (m/mappend false false)))
+      (t/is (false? (m/mappend true false)))
+      (t/is (false? (m/mappend false true)))
+      (t/is (true? (m/mappend true true))))))
+
+(t/deftest sum-monoid
+  (t/testing "mempty"
+    (ctx/with-context b/sum-monoid
+      (t/is (= 0 (m/mempty)))))
+
+  (t/testing "mappend"
+    (ctx/with-context b/sum-monoid
+      (t/is (= 3 (m/mappend (m/mempty) 3)))
+      (t/is (= 3 (m/mappend 1 2))))))
+
+(t/deftest prod-monoid
+  (t/testing "mempty"
+    (ctx/with-context b/prod-monoid
+      (t/is (= 1 (m/mempty)))))
+
+  (t/testing "mappend"
+    (ctx/with-context b/prod-monoid
+      (t/is (= 6 (m/mappend (m/mempty) 6)))
+      (t/is (= 6 (m/mappend 1 2 3)))
+      (t/is (= (reduce * (range 1 6)) (apply m/mappend (range 1 6)))))))
+
+(t/deftest string-monoid
+  (t/testing "mempty"
+    (ctx/with-context b/string-monoid
+      (t/is (= "" (m/mempty)))))
+
+  (t/testing "mappend"
+    (ctx/with-context b/string-monoid
+      (t/is (= "Hello" (m/mappend (m/mempty) "Hello"))))
+    (t/is (= "Hello World" (m/mappend "Hello " "World")))
+    (t/is (= "abcdefghi" (m/mappend "abc" "def" "ghi")))))
+
+(t/deftest pair-monoid
+  (t/testing "mempty"
+    (ctx/with-context (b/pair-monoid b/string-monoid)
+      (t/is (= (d/pair "" "") (m/mempty))))
+
+    (ctx/with-context (b/pair-monoid b/sum-monoid)
+      (t/is (= (d/pair 0 0) (m/mempty)))))
+
+  (t/testing "mappend"
+    (t/is (= (d/pair "Hello buddy" "Hello mate")
+             (m/mappend
+              (d/pair "Hello " "Hello ")
+              (d/pair "buddy" "mate")))))
+
+  (t/testing "mappend with other-context"
+    (ctx/with-context (b/pair-monoid b/sum-monoid)
+      (t/is (= (d/pair 10 20)
+               (m/mappend
+                (d/pair 3 5)
+                (d/pair 3 5)
+                (d/pair 4 10)))))))
+
 (defn inc-if-even
   [n]
   (if (even? n)
@@ -151,101 +249,11 @@
     (t/is (= (maybe/nothing)
              (m/traverse inc-if-even [1 2])))))

-(t/deftest lazyseq-foldable
-  (t/testing "Foldl"
-    (t/is (= [3 2 1] (m/foldl (fn [acc v] (into [v] acc)) [] (map identity [1 2 3]))))
-    (t/is (= 6 (m/foldl + 0 (map identity [1 2 3])))))
-
-  (t/testing "Foldr"
-    (t/is (= [1 2 3] (m/foldr (fn [v acc] (into [v] acc)) [] (map identity [1 2 3]))))
-    (t/is (= 6 (m/foldr + 0 (map identity [1 2 3]))))))
-
-(t/deftest range-foldable
-  (t/testing "Foldl"
-    (t/is (= [3 2 1] (m/foldl (fn [acc v] (into [v] acc)) [] (range 1 4))))
-    (t/is (= 6 (m/foldl + 0 (range 1 4)))))
-
-  (t/testing "Foldr"
-    (t/is (= [1 2 3] (m/foldr (fn [v acc] (into [v] acc)) [] (range 1 4))))
-    (t/is (= 6 (m/foldr + 0 (range 1 4))))))
-
-(t/deftest any-monoid
-  (t/testing "mempty"
-    (ctx/with-context b/any-monoid
-      (t/is (= false (m/mempty)))))
-
-  (t/testing "mappend"
-    (ctx/with-context b/any-monoid
-      (t/is (true? (m/mappend (m/mempty) true)))
-      (t/is (false? (m/mappend false false)))
-      (t/is (true? (m/mappend true false)))
-      (t/is (true? (m/mappend false true)))
-      (t/is (true? (m/mappend true true))))))
-
-(t/deftest all-monoid
-  (t/testing "mempty"
-    (ctx/with-context b/all-monoid
-      (t/is (= true (m/mempty)))))
-
-  (t/testing "mappend"
-    (ctx/with-context b/all-monoid
-      (t/is (false? (m/mappend (m/mempty) false)))
-      (t/is (false? (m/mappend false false)))
-      (t/is (false? (m/mappend true false)))
-      (t/is (false? (m/mappend false true)))
-      (t/is (true? (m/mappend true true))))))
-
-(t/deftest sum-monoid
-  (t/testing "mempty"
-    (ctx/with-context b/sum-monoid
-      (t/is (= 0 (m/mempty)))))
-
-  (t/testing "mappend"
-    (ctx/with-context b/sum-monoid
-      (t/is (= 3 (m/mappend (m/mempty) 3)))
-      (t/is (= 3 (m/mappend 1 2))))))
-
-(t/deftest prod-monoid
-  (t/testing "mempty"
-    (ctx/with-context b/prod-monoid
-      (t/is (= 1 (m/mempty)))))
-
-  (t/testing "mappend"
-    (ctx/with-context b/prod-monoid
-      (t/is (= 6 (m/mappend (m/mempty) 6)))
-      (t/is (= 6 (m/mappend 1 2 3)))
-      (t/is (= (reduce * (range 1 6)) (apply m/mappend (range 1 6)))))))
-
-(t/deftest string-monoid
-  (t/testing "mempty"
-    (ctx/with-context b/string-monoid
-      (t/is (= "" (m/mempty)))))
-
-  (t/testing "mappend"
-    (ctx/with-context b/string-monoid
-      (t/is (= "Hello" (m/mappend (m/mempty) "Hello"))))
-    (t/is (= "Hello World" (m/mappend "Hello " "World")))
-    (t/is (= "abcdefghi" (m/mappend "abc" "def" "ghi")))))
-
-(t/deftest pair-monoid
-  (t/testing "mempty"
-    (ctx/with-context (b/pair-monoid b/string-monoid)
-      (t/is (= (d/pair "" "") (m/mempty))))
-
-    (ctx/with-context (b/pair-monoid b/sum-monoid)
-      (t/is (= (d/pair 0 0) (m/mempty)))))
-
-  (t/testing "mappend"
-    (t/is (= (d/pair "Hello buddy" "Hello mate")
-             (m/mappend
-              (d/pair "Hello " "Hello ")
-              (d/pair "buddy" "mate")))))
-
-  (t/testing "mappend with other-context"
-    (ctx/with-context (b/pair-monoid b/sum-monoid)
-      (t/is (= (d/pair 10 20)
-               (m/mappend
-                (d/pair 3 5)
-                (d/pair 3 5)
-                (d/pair 4 10))))))
-  )
+(t/deftest lazyseq-traversable
+  (t/testing "Traverse"
+    (t/is (= (maybe/just [])
+             (m/traverse inc-if-even (lazy-seq []))))
+    (t/is (= (maybe/just [3 5])
+             (m/traverse inc-if-even (lazy-seq [2 4]))))
+    (t/is (= (maybe/nothing)
+             (m/traverse inc-if-even (lazy-seq [1 2]))))))


fixing tests

fixing tests

--- test/celestial/test/api.clj
+++ test/celestial/test/api.clj
@@ -29,16 +29,16 @@
     (s/get-system "1") => {:type "redis"}
     (t/get-type "redis") => {:classes {:redis {:append true}}}))

-(let [machine {:type "redis" :machine {:host "foo"}} type {:classes {:redis {}}}]
+(let [machine {:type "redis" :machine {:host "foo"}} type {:run-opts nil :classes {:redis {}}}]
   (fact "provisioning job"
-    (non-sec-app (request :post "/jobs/provision/1")) => (contains {:status 200})
+    (non-sec-app (request :post "/jobs/provision/1" {})) => (contains {:status 200})
     (provided
       (u/op-allowed? "provision" nil) => true
       (s/system-exists? "1") => true
       (s/get-system "1")  => machine
       (s/get-system "1" :env)  => :dev
       (t/get-type "redis") => type
-      (jobs/enqueue "provision" { :identity "1" :args [type (assoc machine :system-id 1)] :tid nil :env :dev :user nil}) => nil)))
+      (jobs/enqueue "provision" {:identity "1" :args [type (assoc machine :system-id 1)] :tid nil :env :dev :user nil}) => nil)))

 (fact "staging job"
   (non-sec-app (request :post "/jobs/stage/1")) => (contains {:status 200})


adds style-src with unsafe-inline as we require inline styles for monitor page

--- src/nevergreen/wrap_content_security_policy.clj
+++ src/nevergreen/wrap_content_security_policy.clj
@@ -4,13 +4,14 @@

 (def ^:private default-src "default-src 'self'")
 (def ^:private script-src "script-src 'self' 'unsafe-eval'")
+(def ^:private style-src "style-src 'self' 'unsafe-inline'")
 (def ^:private img-src "img-src * data:")
 (def ^:private font-src "font-src 'self' data:")
 (def ^:private media-src "media-src *")
 (def ^:private connect-src "connect-src 'self' https://api.github.com https://gist.githubusercontent.com")
 (def ^:private object-src "object-src 'none'")
 (def ^:private child-src "child-src 'none'")
-(def ^:private sources [default-src script-src img-src font-src media-src connect-src object-src child-src])
+(def ^:private sources [default-src script-src style-src img-src font-src media-src connect-src object-src child-src])

 (defn wrap-content-security-policy [app]
   (fn [req]


Remove debugging.

Remove debugging.

--- integration-tests/src/test/clojure/immutant/integs/bundled_clojure_version.clj
+++ integration-tests/src/test/clojure/immutant/integs/bundled_clojure_version.clj
@@ -32,7 +32,6 @@
         expected-version (if (= immutant.integs/*current-clojure-version* "default")
                            "1.3.0"
                            immutant.integs/*current-clojure-version*)]
-    (println result)
     (is (.contains (result :body) (str "version:" expected-version)))))


Small cli help correction

Small cli help correction

--- src/polismath/export.clj
+++ src/polismath/export.clj
@@ -533,7 +533,7 @@
 (def cli-options
   [["-z" "--zid ZID"           "ZID on which to do a rerun" :parse-fn #(Integer/parseInt %)]
    ["-Z" "--zinvite ZINVITE"   "ZINVITE code on which to perform a rerun"]
-   ["-u" "--user-id USER_ID"   "Export all conversations associated with ZID, and place in zip file" :parse-fn #(Integer/parseInt %)]
+   ["-u" "--user-id USER_ID"   "Export all conversations associated with USER_ID, and place in zip file" :parse-fn #(Integer/parseInt %)]
    ["-a" "--at-date AT_DATE"   "A string of YYYY MM DD HH MM SS (in UTC)" :parse-fn parse-date]
    ["-f" "--format FORMAT"     "Either csv, excel or (soon) json" :parse-fn keyword :validate [#{:csv :excel} "Must be either csv or excel"]]
    ;; -U ;utc offset?


acq engine: if first trigger is missing, then image number will be off by one. Handle that correctly.

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -394,6 +394,7 @@
                    (Long/parseLong cam-chan-str)
                    0)
         image-number (Long/parseLong (get-in image [:tags "ImageNumber"]))
+        image-number (if (first-trigger-missing?) (dec image-number) image-number)
         burst-event (nth burst-events image-number)
         camera-channel-name (nth camera-channel-names cam-chan)
         event (-> burst-event


add missing "uses"

add missing "uses"

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -16,7 +16,7 @@

 (ns org.micromanager.acq-engine
   (:use [org.micromanager.mm :only [map-config get-config get-positions
-                                    get-default-devices mmc gui]]
+                                    get-default-devices core log mmc gui]]
         [org.micromanager.sequence-generator :only [generate-acq-sequence]])
   (:import [org.micromanager AcqControlDlg]
            [org.micromanager.api AcquisitionEngine]


Fix keyword generator to conform to reader specs.

Specs as defined here: http://clojure.org/reader

Signed-off-by: Reid Draper <1f4d9895740d1b07c3b2f21f4b03e23d1086f158@gmail.com>

--- src/main/clojure/clojure/test/check/generators.clj
+++ src/main/clojure/clojure/test/check/generators.clj
@@ -435,6 +435,26 @@
                  (choose 65 90)
                  (choose 97 122)])))

+(def char-alpha
+  "Generate alpha characters."
+  (fmap core/char
+        (one-of [(choose 65 90)
+                 (choose 97 122)])))
+
+(def char-symbol-special
+  "Generate non-alphanumeric characters that can be in a symbol."
+  (elements [\* \+ \! \- \_ \?]))
+
+(def char-keyword-rest
+  "Generate characters that can be the char following first of a keyword."
+  (frequency [[2 char-alpha-numeric]
+              [1 char-symbol-special]]))
+
+(def char-keyword-first
+  "Generate characters that can be the first char of a keyword."
+  (frequency [[2 char-alpha]
+              [1 char-symbol-special]]))
+
 (def string
   "Generate strings. May generate unprintable characters."
   (fmap clojure.string/join (vector char)))
@@ -449,9 +469,8 @@

 (def keyword
   "Generate keywords."
-  (->> string-alpha-numeric
-    (such-that #(not= "" %))
-    (fmap core/keyword)))
+  (->> (tuple char-keyword-first (vector char-keyword-rest))
+       (fmap (fn [[c cs]] (core/keyword (clojure.string/join (cons c cs)))))))

 (def ratio
   "Generates a `clojure.lang.Ratio`. Shrinks toward 0. Not all values generated


RS & CC | #60 | Use jsoup as enlive parser

--- src/objective8/templates/objective.clj
+++ src/objective8/templates/objective.clj
@@ -1,5 +1,6 @@
 (ns objective8.templates.objective
   (:require [net.cgrand.enlive-html :as html]
+            [net.cgrand.jsoup :as jsoup]
             [objective8.templates.page-furniture :as f]))

 (defn text->p-nodes
@@ -11,7 +12,7 @@
     (map (fn [p] (html/html [:p p])) (clojure.string/split text
                                                            newline-followed-by-optional-whitespace)))))

-(def objective-template (html/html-resource "templates/jade/objective.html"))
+(def objective-template (html/html-resource "templates/jade/objective.html" {:parser jsoup/parser}))

 (defn objective-page [context]
   (apply str


Add tests for DLO metrics

Add tests for DLO metrics

--- test/com/puppetlabs/puppetdb/test/command/dlo.clj
+++ test/com/puppetlabs/puppetdb/test/command/dlo.clj
@@ -106,11 +106,16 @@

     (testing "with subdirectories"
       (let [subdir (fs/temp-dir dlo)
-            other-subdir (fs/temp-dir dlo)]
+            other-subdir (fs/temp-dir dlo)
+            compression (get-in @metrics [:global :compression])
+            failures (get-in @metrics [:global :compression-failures])]
         (testing "should not archive empty subdirectories"
           (compress! dlo threshold)
           (is (empty? (archives subdir)))
-          (is (empty? (archives other-subdir))))
+          (is (empty? (archives other-subdir)))
+
+          (is (= 0 (.count compression)))
+          (is (= 0 (.count failures))))

         (testing "should not archive new messages"
           (fs/touch (fs/file subdir "foo"))
@@ -119,7 +124,10 @@
           (is (= 1 (count (messages subdir))))
           (is (= 1 (count (messages other-subdir))))
           (is (empty? (archives subdir)))
-          (is (empty? (archives other-subdir))))
+          (is (empty? (archives other-subdir)))
+
+          (is (= 0 (.count compression)))
+          (is (= 0 (.count failures))))

         (testing "should archive old messages in subdirectories which haven't been archived"
           (fs/touch (fs/file subdir "foo") stale-timestamp)
@@ -128,7 +136,10 @@
           (is (empty? (messages subdir)))
           (is (empty? (messages other-subdir)))
           (is (= 1 (count (archives subdir))))
-          (is (= 1 (count (archives other-subdir)))))
+          (is (= 1 (count (archives other-subdir))))
+
+          (is (= 1 (.count compression)))
+          (is (= 0 (.count failures))))

         (testing "should not archive subdirectories which have already been, even if there are old messages"
           (fs/touch (fs/file subdir "foo2") stale-timestamp)
@@ -137,11 +148,17 @@
           (is (= 1 (count (messages subdir))))
           (is (= 1 (count (messages other-subdir))))
           (is (= 1 (count (archives subdir))))
-          (is (= 1 (count (archives other-subdir)))))
+          (is (= 1 (count (archives other-subdir))))
+
+          (is (= 1 (.count compression)))
+          (is (= 0 (.count failures))))

         (testing "should archive subdirectories again after the threshold has passed"
           (compress! dlo short-threshold)
           (is (empty? (messages subdir)))
           (is (empty? (messages other-subdir)))
           (is (= 2 (count (archives other-subdir))))
-          (is (= 2 (count (archives other-subdir)))))))))
+          (is (= 2 (count (archives other-subdir))))
+
+          (is (= 2 (.count compression)))
+          (is (= 0 (.count failures))))))))


Added denotes relation and fixed bug from previous commit

--- kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/bio_to_ice/ontology_ice_gen_rules.clj
+++ kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/bio_to_ice/ontology_ice_gen_rules.clj
@@ -2,16 +2,47 @@
 ;; --------- Root Concept Assignment ---------
 ;; -------------------------------------------
 ;; create ICE URI's for each term in the ontology
-`{:name "root-concept-ice-gen"
-  :head ((?/id rdfs/subClassOf ccp/IAO_EXT_0000190)) ; ontology root concept identifer
+`{:name "ontology-concept-record-gen"
+  :head ((?/id rdf/type ccp/IAO_EXT_0000190) ; ontology root concept identifer
+         (?/id obo/IAO_0000219 ?/root)) ; denotes
   :sparql-string "select ?root {
-								  ?root rdf:type owl:Class .
+								  ?root rdfs:subClassOf owl:Class .
 								  minus{?root rdf:type ?class}
 								  minus{?root owl:deprecated true}
 								         }"
   :reify ([?/id {:ln (:localname ?/root)
                  :ns "ccp" :prefix "" :suffix ""}])}

+
+;; ------------------------------------------------------------------------
+;; --------- Ontology Concept Identifier Denotes Ontology Concept ---------
+;; ------------------------------------------------------------------------
+;; create instance of ontology record for each ontology concept
+;`{:name "ontology-concept-record-gen"
+;  :head ((?/id rdfs/subClassOf ccp/IAO_EXT_0000190) ; ontology root concept identifer
+;         (?/id obo/IAO_0000219 ?/root)) ; denotes
+;  :sparql-string "select ?root {
+;								  ?root rdf:type owl:Class .
+;								  minus{?root rdf:type ?class}
+;								  minus{?root owl:deprecated true}
+;								         }"
+;  :reify ([?/id {:ln (:localname ?/root)
+;                 :ns "ccp" :prefix "" :suffix ""}])}
+
+
+;; ----------------------------------------------------
+;; --------- Ontology Concept Record Creation ---------
+;; ----------------------------------------------------
+;; create instance of ontology record for each ontology concept
+;`{:name "ontology-concept-record-gen"
+;  :head ((?/id rdfs/subClassOf ccp/IAO_EXT_0000190)) ; ontology root concept identifer
+;  :sparql-string "select ?root {
+;								  ?root rdf:type owl:Class .
+;								  minus{?root rdf:type ?class}
+;								  minus{?root owl:deprecated true}
+;								         }"
+;  :reify ([?/id {:ln (:localname ?/root)
+;                 :ns "ccp" :prefix "" :suffix ""}])}

 ;
 ;; -------------------------------------------


bump dep

bump dep

--- labs/architecture-examples/om/project.clj
+++ labs/architecture-examples/om/project.clj
@@ -5,7 +5,7 @@
   :jvm-opts ^:replace ["-Xmx1g" "-server"]

   :dependencies [[org.clojure/clojure "1.5.1"]
-                 [org.clojure/clojurescript "0.0-2134"]
+                 [org.clojure/clojurescript "0.0-2138"]
                  [org.clojure/core.async "0.1.267.0-0d7780-alpha"]
                  [secretary "0.4.0"]
                  [om "0.1.0-SNAPSHOT"]]


Fixed issue #10

Fixed issue #10

--- src/alfresco_technical_validation/source_validation.clj
+++ src/alfresco_technical_validation/source_validation.clj
@@ -261,9 +261,9 @@
                        content-index
                        :sec05
                        "SEC05"
-                       "Uses of eval in Javascript"
+                       "Uses of eval() in Javascript"
                        false
-                       "The technology does not use eval in Javascript."))
+                       "The technology does not use eval() in Javascript."))

 (defn- up01-explorer-ui-extension
   [source file-index]


don't show notifications from self

don't show notifications from self

Signed-off-by: Michele Balistreri <47483730395cccb6448ad7313d5cedb48de25e40@bitgamma.com>

--- src/status_im/notifications/local.cljs
+++ src/status_im/notifications/local.cljs
@@ -94,11 +94,14 @@
      :message   description}))

 (defn show-message-pn?
-  [{{:keys [app-state]} :db :as cofx}
+  [{{:keys [app-state multiaccount]} :db :as cofx}
    notification]
-  (let [chat-id (get-in notification [:body :chat :id])]
-    (or (= app-state "background")
-        (not (chat.models/foreground-chat? cofx chat-id)))))
+  (let [chat-id             (get-in notification [:body :chat :id])
+        notification-author (get-in notification [:notificationAuthor :id])]
+    (and
+     (not= notification-author (:public-key multiaccount))
+     (or (= app-state "background")
+         (not (chat.models/foreground-chat? cofx chat-id))))))

 (defn create-notification
   ([notification]


clean up :require

clean up :require

--- test/metabase/api/meta/table_test.clj
+++ test/metabase/api/meta/table_test.clj
@@ -10,7 +10,7 @@
                              [table :refer [Table]])
             [metabase.test.data :refer :all]
             (metabase.test.data [data :as data]
-                                [datasets :as datasets, :refer [*dataset* with-dataset-when-testing]]
+                                [datasets :as datasets]
                                 [users :refer :all])
             [metabase.test.util :refer [match-$ expect-eval-actual-first]]))

@@ -26,7 +26,7 @@
 ;; ## GET /api/meta/table?org
 ;; These should come back in alphabetical order and include relevant metadata
 (expect (set (reduce concat (for [dataset-name @datasets/test-dataset-names]
-                              (with-dataset-when-testing dataset-name
+                              (datasets/with-dataset-when-testing dataset-name
                                 [{:name                (format-name "categories")
                                   :human_readable_name "Categories"
                                   :db_id               (db-id)


Explicit require

Explicit require

--- test/caesium/crypto/secretbox_test.clj
+++ test/caesium/crypto/secretbox_test.clj
@@ -1,28 +1,28 @@
 (ns caesium.crypto.secretbox-test
-  (:require [caesium.crypto.secretbox :refer :all]
-            [caesium.util :as u]
-            [clojure.test :refer :all]))
+  (:require
+   [caesium.crypto.secretbox :as s]
+   [caesium.util :as u]
+   [caesium.vectors :as v]
+   [clojure.test :refer :all]))

 (def message (byte-array [80 117 114 101 32 105 110 116 101 110 116 105 111 110 32 106 117 120 116 97 112 111 115 101 100]))
 (def secret-key (byte-array (range 32)))

 (deftest secretbox-kat-test
-  (testing "Implementation handles several KATs; decrypt & encrypt roundtrip"
-    (are [secret-key nonce plaintext ciphertext] (and (u/array-eq (encrypt secret-key nonce plaintext)
-                                                                  ciphertext)
-                                                      (u/array-eq (decrypt secret-key nonce ciphertext)
-                                                                  plaintext))
-      secret-key (int->nonce 0) message (u/unhexify "cb97a2f8b60ea0cafd933dd497c0eddc1a7b8224b8c3d147393a06664a289eb8914c009137895b290f")
-      secret-key (int->nonce 1) message (u/unhexify "74f47d0db1fc9d22265d85218cd546e1924ef845d27696ba971614282f0a6647a23b481a91dd20399a")))
-  (testing "Decrypting bogus ciphertexts causes exceptions"
-    (are [secret-key nonce ciphertext]
-        (thrown-with-msg? RuntimeException #"Decryption failed. Ciphertext failed verification"
-                          (decrypt secret-key nonce ciphertext))
-      secret-key (int->nonce 1) (u/unhexify "74f47d0db1fc9d22265d85218cd546e1924ef845d27696ba971614282f0a6647a23b481a91dd203990"))))
+  (are [nonce ciphertext] (and (u/array-eq (s/encrypt secret-key nonce message)
+                                           ciphertext)
+                               (u/array-eq (s/decrypt secret-key nonce ciphertext)
+                                           message))
+    (s/int->nonce 0) (u/unhexify "cb97a2f8b60ea0cafd933dd497c0eddc1a7b8224b8c3d147393a06664a289eb8914c009137895b290f")
+    (s/int->nonce 1) (u/unhexify "74f47d0db1fc9d22265d85218cd546e1924ef845d27696ba971614282f0a6647a23b481a91dd20399a"))
+  (are [nonce ciphertext]
+      (thrown-with-msg? RuntimeException #"Decryption failed. Ciphertext failed verification"
+                        (s/decrypt secret-key nonce ciphertext))
+    (s/int->nonce 1) (u/unhexify "74f47d0db1fc9d22265d85218cd546e1924ef845d27696ba971614282f0a6647a23b481a91dd203990")))

 (deftest int->nonce-test
   (testing "Turning numbers into nonces works"
-    (are [n nonce] (u/array-eq (int->nonce n) nonce)
+    (are [n nonce] (u/array-eq (s/int->nonce n) nonce)
       0 (byte-array 24)
       0M (byte-array 24)
       1000000000000 (byte-array [0, -24, -44, -91, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))))


database: allow compound indices

database: allow compound indices

--- src/subrosa/database.clj
+++ src/subrosa/database.clj
@@ -35,12 +35,18 @@
   ([table column value]
      (get* @db table column value)))

+(defn select-from-indices [db table m]
+  (into {} (for [index (get-indices* db table)]
+             [index (if (coll? index)
+                      (map m index)
+                      (m index))])))
+
 (defn delete* [db table m]
   (update-in db [table] assoc
              :data (reduce (fn [a [k v]]
                              (update-in a [k] dissoc v))
                            (get-in db [table :data])
-                           (select-keys m (get-indices* db table)))))
+                           (select-from-indices db table m))))

 (defn delete [table id]
   (dosync
@@ -52,7 +58,7 @@
              :data (reduce (fn [a [k v]]
                              (update-in a [k] assoc v m))
                            (get-in db [table :data])
-                           (select-keys m (get-indices* db table)))))
+                           (select-from-indices db table m))))

 (defn put [table m]
   (dosync


update verb-aux-sem: tense should be present for passé-composé

--- src/babel/francais/lexicon.cljc
+++ src/babel/francais/lexicon.cljc
@@ -14,7 +14,7 @@
 (def cat1 (atom :top))
 (def gender (atom :top))
 (def verb-aux-sem (atom {:aspect :perfect
-                         :tense :past}))
+                         :tense :present}))
 (def verb-aux-subject (atom :top))
 (declare compile-lexicon)


+TODOs about :boot-stem2

+TODOs about :boot-stem2

--- src/babel/francais/lexicon.cljc
+++ src/babel/francais/lexicon.cljc
@@ -101,6 +101,7 @@

    "boire" {:français {:past-participle "bu"
                        :boot-stem1 "boiv"
+                       ;; TODO: boot-stem2 is currently unsupported by babel.francais.morphology:
                        :boot-stem2 "buv"
                        :present {:1sing "bois"
                                  :2sing "boit"
@@ -566,6 +567,7 @@
                          :sem {:pred :participate}}}

    "peindre" {:français {:boot-stem1 "pein"
+                         ;; TODO: boot-stem2 is currently unsupported by babel.francais.morphology:
                          :boot-stem2 "peign"
                          :passé "peint"
                          :future-stem "paindr"


add comments and improve :name value

add comments and improve :name value

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -733,10 +733,12 @@
         debug (log/info "  finalizing..")]

     (->
-
+     ;; Create the model in stages; we need stages because some closures need a model
+     ;; as a parameter, so they use as the model what precedes it in the list of
+     ;; stages.
      {:index-fn (fn [spec] (lookup-spec spec indices index-lexicon-on-paths))
       :default-fn default-fn
-      :name "model"
+      :name "Italiano language model created with ❤ by babel.italiano.grammar/model-plus-lexicon."
       :generate {:lexicon lexicon-for-generation}
       :grammar grammar
       :language "it"


fix extraction of size from message body

st_size has been renamed to size inside the stat field.

--- src/brainbot/nozzle/extract.clj
+++ src/brainbot/nozzle/extract.clj
@@ -49,7 +49,7 @@
         routing-key (:routing-key metadata)
         exchange (:exchange metadata)
         directory (:directory body)
-        size (get-in body [:entry :stat :st_size])
+        size (get-in body [:entry :stat :size])
         relpath (:relpath (:entry body))
         delivery-tag (:delivery-tag metadata)
         fp (string/join File/separator [directory relpath])


Fixing bug in sql shell

Fixing bug in sql shell

--- src/clj/apoya/data/sessions.clj
+++ src/clj/apoya/data/sessions.clj
@@ -28,7 +28,10 @@
      :conn conn}))

 (defn create-session []
-  (let [{:keys [subprotocol subname classname] :as db-spec} (:db (cfg/apoya-config))
+  (let [db-config (:db (cfg/apoya-config))
+        db-config (or (cfg/db-env-config db-config)
+                      db-config)
+        {:keys [subprotocol subname classname] :as db-spec} db-config
         url  (format "jdbc:%s:%s" subprotocol subname)
         etc  (dissoc db-spec :classname :subprotocol :subname)]
     (clojure.lang.RT/loadClassForName classname)


1. query string 에 readability 적용

1. query string 에 readability 적용

--- src/clj/cauca/dao/mysql_dao.clj
+++ src/clj/cauca/dao/mysql_dao.clj
@@ -5,6 +5,7 @@
   (:require [cauca.db :as db-pool]
             [clojure.java.jdbc :as jdbc]
             [clojure.java.jdbc.sql :as sql]
+            [clojure.string :as string]
             )
  )

@@ -13,10 +14,19 @@
         getVal (fn [data min max] (if (< data min) min (if (> data max) max data)))
         page (getVal (getNum (params "page") 1) 1 100)
         pageSize (getVal (getNum (params "pageSize") 10) 0 100)]
-    (str "select * from courtauction where 1 = 1 "
-         (apply str (map #(str "and " (key %) " = '" (val %) "' ")
-                         (filter #(= (contains? #{"page" "pageSize"} (key %)) false) params)))
-         "limit " (* (- page 1) pageSize) ", " pageSize)))
+    (string/join \newline
+                 ["SELECT * FROM courtauction"
+                  "WHERE 1 = 1"
+                  (string/join
+                    \newline
+                    (map #(str "AND " (key %) " = '" (val %) "'")
+                         (filter #(contains? #{"itemType" "addr0" "addr1"} (key %)) params)))
+                  (if-not (nil? (params "minValue")) (str "AND valueMin >= " (params "minValue")))
+                  (if-not (nil? (params "maxValue")) (str "AND valueMin <= " (params "maxValue")))
+                  (if-not (nil? (params "auctionStartDate")) (str "AND auctionDate >= '" (params "auctionStartDate") "'"))
+                  (if-not (nil? (params "auctionEndDate")) (str "AND auctionDate <= '" (params "auctionEndDate") "'"))
+                  "ORDER BY id DESC"
+                  (str "LIMIT " (* (- page 1) pageSize) ", " pageSize)])))

 (defn mysql-courtauction-dao []
   (reify


fix: deleting app is broken

fix: deleting app is broken

--- src/clj/dokkaa_builder/apps.clj
+++ src/clj/dokkaa_builder/apps.clj
@@ -7,7 +7,6 @@
             [dokkaa-builder.clusters :as clusters]
             [dokkaa-builder.redis :refer [wcar*]]
             [clojurewerkz.urly.core :as urly]
-
             [taoensso.carmine :as redis]
             ))

@@ -33,8 +32,8 @@
 (defn- pick-backends
   "Randomly choose docker backend"
   [n]
-  (mapv (fn [ip] {:client (docker/make-client (str ip ":2375"))
-                  :port   (router/generate-host-port ip)})
+  (mapv (fn [host] {:client (docker/make-client host)
+                    :port   (router/generate-host-port (urly/host-of host))})
         (->> (clusters/docker-hosts)
              shuffle
              (take n))))
@@ -57,7 +56,7 @@
                :cmd command
                :port-bindings {host-port port})
           upstream (upstream-url cli host-port)]
-      {:id id, :host upstream})))
+      {:id id, :docker-host (.host cli), :host upstream})))

 (defn create [app-name user image & {:keys [tag command port ps]}]
   (let [ps (or ps 1)
@@ -98,8 +97,8 @@

 (defn delete-instances [instances]
   (doseq [i instances]
-    (let [{host :host, id :id} i
-          cli (docker/make-client (str (urly/host-of (urly/url-like host)) ":4243"))]
+    (let [{:keys [docker-host id]} i
+          cli (docker/make-client docker-host)]
       (container/stop cli id)
       (container/remove cli id))))


implement Port Anson Grid

implement Port Anson Grid

--- src/clj/game/cards-upgrades.clj
+++ src/clj/game/cards-upgrades.clj
@@ -233,6 +233,16 @@
    {:init {:root "HQ"} :abilities [{:cost [:credit 1] :label "Draw 1 card" :effect (effect (draw))
                                     :req (req (and run (= (first (:server run)) :hq)))}]}

+   "Port Anson Grid"
+   {:msg "prevent the Runner from jacking out unless they trash an installed program"
+    :effect (req (when this-server
+                   (prevent-jack-out state side)))
+    :events {:run {:req (req this-server)
+                   :msg "prevent the Runner from jacking out unless they trash an installed program"
+                   :effect (effect (prevent-jack-out))}
+             :runner-trash {:req (req (and this-server (is-type? target "Program")))
+                            :effect (req (swap! state update-in [:run] dissoc :cannot-jack-out))}}}
+
    "Product Placement"
    {:access {:req (req (not= (first (:zone card)) :discard))
              :msg "gain 2 [Credits]" :effect (effect (gain :corp :credit 2))}}


refactor oauth routes, navigate to dashboard on login

--- src/clj/salava/oauth/routes.clj
+++ src/clj/salava/oauth/routes.clj
@@ -32,7 +32,7 @@
                     (if (= status "success")
                       (if current-user
                         (redirect (str (get-base-path ctx) "/user/oauth/facebook"))
-                        (assoc-in (redirect (str (get-base-path ctx) "/social/stream"))[:session :identity] {:id user-id :role role :private private} ))
+                        (assoc-in (redirect (str (get-base-path ctx) "/social"))[:session :identity] {:id user-id :role role :private private} ))
                       (if current-user
                         (assoc (redirect (str (get-base-path ctx) "/user/oauth/facebook")) :flash message)
                         (assoc (redirect (str (get-base-path ctx) "/user/login")) :flash message)))))
@@ -56,7 +56,7 @@
                         (if current-user
                           (redirect (str (get-base-path ctx) "/user/oauth/facebook"))
                           ;(u/set-session ctx (redirect (str (get-base-path ctx) "/social/stream")) user-id)
-                          (u/finalize-login ctx (redirect (str (get-base-path ctx) "/social/stream")) user-id (get-in req [:session :pending :user-badge-id]) false)))
+                          (u/finalize-login ctx (redirect (str (get-base-path ctx) "/social")) user-id (get-in req [:session :pending :user-badge-id]) false)))

                       (if current-user
                         (assoc (redirect (str (get-base-path ctx) "/user/oauth/facebook")) :flash message)
@@ -80,7 +80,6 @@
                         {:keys [status user-id message]} r
                         _ (if (= true (get-in req [:session :seen-terms])) (d/insert-user-terms ctx user-id "accepted"))
                         accepted-terms? (u/get-accepted-terms-by-id ctx user-id)]
-                    (prn status)

                     (if (= status "success")


resource bars

resource bars

--- src/cljs/oxylab/components.cljs
+++ src/cljs/oxylab/components.cljs
@@ -22,22 +22,24 @@
      (for [[k spec] (get-in @s/state [:world :species])]
        [:li [:a {:on-click #(act/populate! k)} (name k)]])]]])

-(defn bar [k p]
+(defn bar [cap v max]
   [:div.row
-   [:div.col-xs-4 (name k)]
+   [:div.col-xs-4 cap]
    [:div.col-xs-8
     [:div.progress {:style {:height "15px"}}
      [:div.progress-bar.progress-bar-success
       {:style
        {:width
-        (str (* 100 (/ (:size p)
-                       (get-in @s/state [:world :species k :max-size])))
-             "%")}}]]]])
+        (str (* 100 (/ v max)) "%")}}]]]])

 (defn bars []
   [:div
-  (for [[k p] (get-in @s/state [:world :cells [0 0] :populations])]
-    [bar k p])])
+   [:h5 "Species bars"]
+   (for [[k p] (get-in @s/state [:world :cells [0 0] :populations])]
+     [bar (str k) (:size p) (get-in @s/state [:world :species k :max-size])])
+   [:h5 "Resource bars"]
+   (for [[k v] (get-in @s/state [:world :cells [0 0] :resources])]
+     [bar (str k) v 100])])

 (defn root []
   [:div.container


[n.u.mapping] Include progress-bar in reverse mapping

--- src/clojure/neko/ui/mapping.clj
+++ src/clojure/neko/ui/mapping.clj
@@ -51,8 +51,6 @@
     :progress-bar {:classname android.widget.ProgressBar
                    :inherits  :view
                    :value-namespaces {:visibility android.view.View}}
-    :progress-bar-large {:inherits  :progress-bar
-                         :constructor-args [nil android.R$attr/progressBarStyleLarge]}
     :text-view {:classname android.widget.TextView
                 :inherits :view
                 :value-namespaces
@@ -110,6 +108,7 @@
     android.widget.ScrollView :scroll-view
     android.widget.Gallery :gallery
     android.widget.GridView :grid-view
+    android.widget.ProgressBar :progress-bar
     android.app.ProgressDialog :progress-dialog}))

 (defn set-classname!


Fix strip ui

Fix strip ui

--- src/com/wsscode/pathom/gen.cljc
+++ src/com/wsscode/pathom/gen.cljc
@@ -103,9 +103,7 @@
                                                       acc
                                                       (conj acc (drop-ui-children n))))
                                                   [] (:children ast-node))]
-                             (if (seq children)
-                               (assoc ast-node :children children)
-                               (dissoc ast-node :children))))]
+                             (assoc ast-node :children children)))]
     (p/ast->query (drop-ui-children ast))))

 (defn query->props


fix ugen docstring

fix ugen docstring

--- src/overtone/sc/machinery/ugen/metadata/buf_io.clj
+++ src/overtone/sc/machinery/ugen/metadata/buf_io.clj
@@ -201,7 +201,7 @@
                      from <= 0 to > 0." }

               {:name "action", :default 0
-               :doc "an integer representing an action to be aexecuted
+               :doc "an integer representing an action to be executed
                      when the buffer is finished playing. This can be
                      used to free the enclosing synth. Action is only
                      evaluated if loop is 0"}]
@@ -210,7 +210,7 @@
              data. If they are both 1.0 then the new data is added to
              the existing data. (Any other settings are also valid.)
              Note that the number of channels must be fixed for the
-             SynthDef, it cannot vary depending on which buffer you
+             defsynth, it cannot vary depending on which buffer you
              use." }

       {:name "ScopeOut",


autogenerated

autogenerated

--- src/tic_tac_toe/game.clj
+++ src/tic_tac_toe/game.clj
@@ -1,96 +0,0 @@
-(ns tic-tac-toe.game)
-
-(def blank-board
-  [:e :e :e
-   :e :e :e
-   :e :e :e])
-
-;(def winning-board
-;  [:x :x :o
-;   :e :x :e
-;   :o :o :e])
-
-(def poses (range 9))
-
-(defn available-squares [board]
-  (filter #(= :e (board %)) poses))
-
-(defn zip [rest]
-  (apply map vector rest))
-
-(defn place-piece [board piece pos]
-  (assoc board pos piece))
-
-(defn winning-partitions [board]
- ;(println board)
-  (let [rows (partition 3 board)
-        cols (zip rows)
-        diagonals [(apply concat (partition 1 4 board))
-                   (->> board
-                        (drop 2)
-                        (partition 1 2)
-                        (take 3)
-                        (apply concat))]]
-    (concat rows cols diagonals)))
-
-(defn player-has-won [player partitions]
-  (some (fn [partition] (every? #(= player %) partition)) partitions))
-
-(defn get-game-state
-  "Return one of :x, :o, :ongoing, :draw"
-  ([board]
-     (let [partitions (winning-partitions board)]
-       (cond
-        (player-has-won :x partitions) :x
-        (player-has-won :o partitions) :o
-        (empty? (available-squares board)) :draw
-        :else :ongoing))))
-
-;; who is the opposite player?
-(defn other-player [who]
-  (if (= who :x) :o :x))
-
-(declare choose-move)
-
-(defn score-board [board who]
-  (condp = (get-game-state board)
-    who 100
-    (other-player who) -100
-    :draw 0
-    :ongoing (let [other-players-move (choose-move board (other-player who))
-                   score (second other-players-move)]
-                  (* -1 score))))
-
-(defn score-move [board who place]
-  (let [new-board (place-piece board who place)
-        score (score-board new-board who)]
-  [place score]))
-
-
-(defn choose-move [board who]
-  (let [open-spaces (available-squares board)
-        weighted-moves          (map #(score-move board who %)  open-spaces)
-        best-move (first (sort-by second > weighted-moves))  ]
-  ; (println weighted-moves)
-   best-move))
-
-(def choose-move (memoize choose-move))
-
-
-;(choose-move winning-board :x)
-
-(defn choose-really-good-move [board who]
-  (let [best-score (choose-move board who)]
-         (if-let [score (= 100 (second best-score))]
-            (first best-score)
-            (first (choose-move board (other-player who))))))
-
-(def upgraded-rgm (memoize choose-really-good-move))
-
-
-(comment
-  (clojure.core.typed/check-ns )
-
-  )
-
-;;;;;;;;;;;; This file autogenerated from src-cljx/tic_tac_toe/game.cljx


Update docs in vault.blob.store ns.

Update docs in vault.blob.store ns.

--- src/vault/blob/store.clj
+++ src/vault/blob/store.clj
@@ -5,11 +5,18 @@
     byte-streams
     [vault.blob.content :as content]))

+;; When blob records are returned from a blob store, they may include 'stat'
+;; metadata about the blobs:
+;;
+;; - `:stat/size`        content size in bytes
+;; - `:stat/stored-at`   time blob was added to the store
+;; - `:stat/origin`      resource location for the blob

-;;;;; STORAGE INTERFACE ;;;;;
+
+;; ## Storage Interface

 (defprotocol BlobStore
-  "Protocol for content storage providers, keyed by hash ids."
+  "Protocol for content storage keyed by hash identifiers."

   (enumerate
     [store opts]
@@ -18,21 +25,17 @@

   (stat
     [store id]
-    "Returns a blob record with metadata but no content. Properties are
-    generally implementation-specific, but may include:
-    * :stat/size        blob size in bytes
-    * :stat/stored-at   date blob was added to store
-    * :stat/origin      a resource location for the blob")
+    "Returns a blob record with metadata but no content.")

   (get*
     [store id]
-    "Loads content for a hash-id and returns a Blob record. Returns nil if no
-    blob is stored. The blob may include `stat` metadata.")
+    "Loads content for a hash-id and returns a blob record. Returns nil if no
+    blob is stored. The blob should include stat metadata.")

   (put!
     [store blob]
-    "Saves a blob into the store. Returns the blob record, potentially updated
-    with `stat` metadata.")
+    "Saves a blob into the store. Returns the blob record, updated with stat
+    metadata.")

   (delete!
     [store id]
@@ -44,7 +47,7 @@

 (defn list
-  "Enumerates the stored blobs, returning a sequence of HashIDs.
+  "Enumerates the stored blobs, returning a sequence of `HashID`s.
   See `select-ids` for the available query options."
   ([store]
    (enumerate store nil))
@@ -55,10 +58,11 @@

 (defn get
-  "Loads content for a hash-id and returns a Blob record. Returns nil if no
-  blob is stored. The blob may contain `stat` metadata.
+  "Loads content for a hash-id and returns a blob record. Returns nil if no
+  blob is stored. The blob should include stat metadata.

-  This digest of the loaded content is checked against the requested hash-id."
+  The digest of the loaded content is checked against the requested hash-id.
+  Throws an exception if the digest does not match."
   [store id]
   (when-let [blob (get* store id)]
     (let [digest (content/hash (:algorithm id) (:content blob))]
@@ -72,27 +76,22 @@
 (defn store!
   "Stores content from a byte source in a blob store and returns the blob
   record. This method accepts any source which can be handled as a byte
-  stream by `vault.blob.content/read`."
+  stream by the byte-streams library."
   [store source]
   (when-let [blob (content/read source)]
     (put! store blob)))

-(defn scan-size
-  "Scans the blobs in a store to determine the total stored content size."
-  [store]
-  (reduce + 0 (map (comp :stat/size (partial stat store)) (list store))))

-
-
-;;;;; UTILITY FUNCTIONS ;;;;;
+;; ## Utility Functions

 (defn select-ids
   "Selects hash identifiers from a sequence based on input criteria.
   Available options:
-  * :after    start enumerating ids lexically following this string
-  * :prefix   only return ids matching the given string
-  * :limit    limit the number of results returned"
+
+  - `:after`   start enumerating ids lexically following this string
+  - `:prefix`  only return ids starting with the given string
+  - `:limit`   limit the number of results returned"
   [opts ids]
   (let [{:keys [after prefix limit]} opts
         after (or after prefix)]
@@ -100,3 +99,9 @@
       after  (drop-while #(pos? (compare after (str %))))
       prefix (take-while #(.startsWith (str %) prefix))
       limit  (take limit))))
+
+
+(defn scan-size
+  "Scans the blobs in a store to determine the total stored content size."
+  [store]
+  (reduce + 0 (map (comp :stat/size (partial stat store)) (list store))))


Reload server when custard.parser or custard.core change

--- build.boot
+++ build.boot
@@ -52,12 +52,12 @@

 (deftask run-development
   [p path PATH str "Path to a CUSTARD Git repository"]
-  (comp (environ :env {:custard-path path})
-        (watch)
+  (comp (watch)
+        (environ :env {:custard-path path})
         (system :sys #'development-system
                 :auto-start true
                 :hot-reload true
-                :files ["handler.clj"])
+                :files ["core.clj" "handler.clj" "parser.clj"])
         (reload :on-jsload 'web.app/run)
         (cljs-repl)
         (less)


Bump version.

Bump version.

--- build.boot
+++ build.boot
@@ -4,7 +4,7 @@
   :src-paths    #{"src"}
   :rsc-paths    #{"resources"})

-(def +version+ "0.1.0")
+(def +version+ "0.2.0-SNAPSHOT")

 (task-options!
   pom  [:project 'clj.rb


Fix color-harness performance by using set-pixel instead of point.

--- test/org/playasophy/wonderdome/util/color_test.clj
+++ test/org/playasophy/wonderdome/util/color_test.clj
@@ -74,8 +74,10 @@
         (quil/rect -1 9 (inc width) (inc height))
         (doseq [x (range 0 width)
                 y (range 0 height)]
-          (quil/stroke (color/hsv (/ x width) 1 (- 1 (/ y height))))
-          (quil/point x (+ y 10)))))
+          (quil/set-pixel
+            (+ x 20)
+            (+ y 110)
+            (color/hsv (/ x width) 1 (- 1 (/ y height)))))))

     ; HSL spectrum
     (quil/with-translation [20 240]
@@ -87,8 +89,10 @@
         (quil/rect -1 9 (inc width) (inc height))
         (doseq [x (range 0 width)
                 y (range 0 height)]
-          (quil/stroke (color/hsl (/ x width) 1 (- 1 (/ y height))))
-          (quil/point x (+ y 10)))))
+          (quil/set-pixel
+            (+ x 20)
+            (+ y 250)
+            (color/hsl (/ x width) 1 (- 1 (/ y height)))))))

     ; Cubehelix rainbow
     (quil/with-translation [20 380]


ns: namespace

ns: namespace

--- src/hackerrank/clojure_libs.clj
+++ src/hackerrank/clojure_libs.clj
@@ -88,3 +88,8 @@
 ;; (import 'stuff.BigWidget)
 ;; (BigWidget.)
 ;; require needed, then import
+
+;; Bringing it all together: ns
+;; ns is actually used often then require, use & import
+(ns my-great-project.core)
+;; gives namespace


use :as

use :as

--- src/hackerrank/clojure_libs.clj
+++ src/hackerrank/clojure_libs.clj
@@ -43,6 +43,8 @@
 ;; (require '[clojure.string :as string] :verbose)
 ;; (require '[clojure.test :as test] :verbose)

+;; Using other namespaces’ code as though it’s yours: use
+
 ;; use
 ;; (use 'clojure.string)
 ;; (split "a,b,c" #",")
@@ -60,6 +62,11 @@
 ;; best: use only with :only

 ;; use rename
-(use '[clojure.string :rename {replace str-replace, reverse str-reverse}])
-(str-reverse "foobar")
-(reverse "foobar")
+;; (use '[clojure.string :rename {replace str-replace, reverse str-reverse}])
+;; (str-reverse "foobar")
+;; (reverse "foobar")
+
+;; use :as
+(use '[clojure.string :as str :only [join split]])
+(str/replace "foobar" "f" "p")
+;; same as require, so dont use it better


remove reflection warning

remove reflection warning

--- ssclj/jar/src/main/clojure/com/sixsq/slipstream/ssclj/resources/common/cimi_filter.clj
+++ ssclj/jar/src/main/clojure/com/sixsq/slipstream/ssclj/resources/common/cimi_filter.clj
@@ -71,7 +71,7 @@
   [attribute-full-name op [type value]]
   (mk-pred attribute-full-name
            value
-           (fn [value actual] (when actual (.startsWith actual value)))))
+           (fn [^String value ^String actual] (when actual (.startsWith actual value)))))

 (defmethod mk-pred-attribute-value [">" :DateValue]
   [attribute-full-name op [type value]]


working and somewhat tested; but printing suxx

--- 6clojure/day3.clj
+++ 6clojure/day3.clj
@@ -8,9 +8,22 @@
 (def counter (atom 0))
 (def customer-cut (atom 0))
 (def HAIRCUT-TIME 2500)
-(def SPAWN-TIME 1000)
+(def SPAWN-TIME '(1000 2000))
+
+(def HAIRCUT-TIME 20)
+(def SPAWN-TIME '(10 30))
 (def PRINT-TIME 600)
-(def printer (agent []))
+(def printer (agent 0))
+(def LEVEL 20)
+
+(defn myprint [level & more]
+  (if (>= level LEVEL)
+    (do
+      ;(println @printer level)
+      ;(send-off printer inc)
+      (apply println more)
+      ;(send-off printer (fn [msgcount] (apply println more) (inc msgcount)))
+      )))

 (defn err-handler-fn [ag ex]
   (println "error occured: " ex " and we still have value " @ag)
@@ -19,34 +32,35 @@

 (set-error-handler! barber err-handler-fn)
 (set-error-handler! shop err-handler-fn)
+(set-error-handler! printer err-handler-fn)

 (declare do-haircut)

 (defn next-client [who]
   (reset! barber-chair [])
-  (println "barber is handling next client")
+  (myprint 10 "barber is handling next client")
   (if (> (count @queue-chairs) 0)
     (let [next-customer (peek @queue-chairs)]
       (swap! queue-chairs pop)
-      (println "Barber will cut " next-customer " and those are waiting" @queue-chairs)
+      (myprint 10 "Barber will cut " next-customer " and those are waiting" @queue-chairs)
       (do-haircut next-customer))
-    (println "barber is going to sleep")))
+    (myprint 10 "barber is going to sleep")))

 (defn wake-up [barber customer]
   (do-haircut customer))

 (defn do-haircut [customer]
-  (println customer "is getting haircut")
+  (myprint 11 customer "is getting haircut")
   (swap! barber-chair conj customer)
   (Thread/sleep HAIRCUT-TIME)
-  (println customer "got haircut")
+  (myprint 11 customer "got haircut")
   (swap! customer-cut inc)
   (send-off barber next-client))

 (defn wait-for-haircut [customer]
   (if (< (count @queue-chairs) 3)
     (swap! queue-chairs conj customer)
-    (println "Barber is busy and no place for" customer))
+    (myprint 12 "Barber is busy and no place for" customer))
   customer)

 (defn customer-action [customer]
@@ -62,24 +76,28 @@
     []))

 (defn print-world []
-  (println "\n**********")
-  (println "Barber: " @barber-chair)
-  (println "Queue: " (seq @queue-chairs))
-  (printf "Customer visited: %d, cut: %d\n" @counter @customer-cut)
-  (println "=============\n"))
+  (myprint 20 "\n**********")
+  (myprint 20 "Barber: " @barber-chair)
+  (myprint 20 "Queue: " (seq @queue-chairs))
+  (myprint 20 "Customer visited: " @counter "cut: " @customer-cut)
+  (myprint 20 "=============\n"))
+
+(def print-loop-agent (agent []))

 (defn print-loop [who]
   (while true
     (print-world)
     (Thread/sleep PRINT-TIME)))

-(send printer print-loop)
+(send-off print-loop-agent print-loop)

-(defn spawn [time]
-  (println "Spawning")
-  (Thread/sleep time)
-  (send shop add-customer)
-  time)
+(defn spawn [times]
+  (let [next-sleep (+ (first times) (rand-int (- (second times) (first times))))]
+    ;(println "Spawn" times "current" next-sleep)
+    (myprint 5 "Spawning" times next-sleep)
+    (Thread/sleep next-sleep)
+    (send shop add-customer)
+    times))

 (while true
   (spawn SPAWN-TIME))


Commented out definition field value

Commented out definition field value

--- kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/bio_to_ice/step_c/ontology_concept_record_gen.clj
+++ kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/bio_to_ice/step_c/ontology_concept_record_gen.clj
@@ -8,9 +8,9 @@
          (?/id_field_value rdf/type ccp/IAO_EXT_0000194) ; id field value
          (?/id_field_value rdf/type ?/id) ; ontology concept identifier
          (?/id_field_value rdfs/label ?/id_string)
-         (?/record obo/BFO_0000051 ?/definition_field_value) ; has part
-         (?/definition_field_value rdf/type ccp/IAO_EXT_0000195) ; ontology concept record definition field value
-         (?/definition_field_value rdfs/label ?/definition)
+         ;(?/record obo/BFO_0000051 ?/definition_field_value) ; has part
+         ;(?/definition_field_value rdf/type ccp/IAO_EXT_0000195) ; ontology concept record definition field value
+         ;(?/definition_field_value rdfs/label ?/definition)
          (?/record obo/BFO_0000051 ?/label_field_value)
          (?/label_field_value rdf/type ccp/IAO_EXT_0000196) ; ontology concept record label field value
          (?/label_field_value rdfs/label ?/label))
@@ -18,8 +18,8 @@
                     :ns "ccp" :prefix "R_" :suffix ""}]
            [?/id_field_value {:ln (:sha-1 ?/id)
                :ns "ccp" :prefix "F_" :suffix ""}]
-           [?/definition_field_value {:ln (:sha-1 ?/definition)
-               :ns "ccp" :prefix "F_" :suffix ""}]
+           ;[?/definition_field_value {:ln (:sha-1 ?/definition)
+               ;:ns "ccp" :prefix "F_" :suffix ""}]
            [?/label_field_value {:ln (:sha-1 ?/label)
                :ns "ccp" :prefix "F_" :suffix ""}])
   :sparql-string "prefix ccp: <http://ccp.ucdenver.edu/obo/ext/>


adds support for tracking grpc-response headers (#1655)

--- waiter/src/waiter/process_request.clj
+++ waiter/src/waiter/process_request.clj
@@ -694,11 +694,13 @@
   "Adds logging for tracking response trailers for requests.
    When only headers are provided jetty terminates the request with an empty data frame,
    we work around that limitation by sending trailers that carry the same grpc error message."
-  [{:keys [headers trailers] :as response}]
+  [{:keys [headers trailers] :as response} service-id]
   (if trailers
     (let [correlation-id (cid/get-correlation-id)
           trailers-copy-ch (async/chan 1)
           {:strs [grpc-status] :as grpc-headers} (select-keys headers ["grpc-message" "grpc-status"])]
+      (when grpc-status
+        (counters/inc! (metrics/service-counter service-id "grpc-response-status" (str grpc-status))))
       (if (hu/grpc-status-success? grpc-status)
         (do
           (async/go
@@ -788,7 +790,7 @@
         (utils/attach-waiter-source :backend)
         (introspect-trailers)
         (handle-grpc-error-response request backend-proto reservation-status-promise)
-        (forward-successful-grpc-status-headers-in-trailers)
+        (forward-successful-grpc-status-headers-in-trailers service-id)
         (assoc :body resp-body)
         (update-in [:headers] (fn update-response-headers [headers]
                                 (utils/filterm #(not= "connection" (str/lower-case (str (key %)))) headers)))))))


#26 - Tweaked toc and nav link formatting. #32 Added rel attributes.

--- src/biblecli/commands/staticpages.cljs
+++ src/biblecli/commands/staticpages.cljs
@@ -42,7 +42,6 @@
   color: #77f;
 }
 .content {
-  font-size: 125%;
   background-color: white;
 }
 .ref {
@@ -71,9 +70,6 @@
   line-height: 1.2em;
   text-indent: 0;
 }
-.votd {
-  min-height: 4em;
-}
 .ps119h {
   margin-top: 0.6em;
   margin-bottom: 0.3em;
@@ -84,12 +80,14 @@
 .book, .main {
   display: none;
 }
-.book a.back {
-  font-size: 0.67em;
-  font-weight: normal;
-  margin-left: 1em;
-}
-.books a, .chapters a {
+.book div.back h2 {
+  display: inline-block;
+  margin-right: 0.5em;
+}
+.book div.back a {
+  display: inline-block;
+}
+.books a, .chapters a, .menu a {
   display: inline-block;
   display: inline-flex;
   justify-content: center;
@@ -106,6 +104,13 @@
 .chapters a {
   min-width: 3.7ex;
 }
+.menu a {
+  padding: 2px 1.3ex;
+  margin: 0.75ex;
+}
+.menu span {
+  display: none;
+}
 .toc .active {
   display: block;
 }
@@ -119,7 +124,7 @@
   margin: 0.5em 0 -0.25em 0;
 }

-@media (min-width: 1100px) {
+@media (min-width: 1300px) {
   .menu {
     position: fixed;
   }
@@ -144,7 +149,11 @@
     background-color: #DDD;
     overflow-y: scroll;
   }
+  .votd {
+    min-height: 4em;
+  }
   .content {
+    font-size: 125%;
     width: 600px;
     margin: 25px auto 15px auto;
     border: 1px solid #BBB;
@@ -155,7 +164,7 @@
   }
 }

-@media (min-width: 680px) and (max-width: 1100px) {
+@media (min-width: 680px) and (max-width: 1300px) {
   .menu {
     position: fixed;
     top: 0;
@@ -167,10 +176,10 @@
     background-color: #FFFFFF;
     border: 1px solid #BBB;
     text-align: right;
-    padding: 6px 25px;
+    padding: 0;
     position: absolute;
     left: -26px;
-    width: 600px;
+    width: 650px;
   }
 }

@@ -195,7 +204,7 @@
     background-color: #FFFFFF;
     border-bottom: 1px solid #BBB;
     text-align: right;
-    padding: 6px 25px;
+    padding: 0;
     position: absolute;
     right: 0;
     width: 100%;
@@ -430,8 +439,9 @@
         id (:id b)
         bookid (book-elem-id id)]
     [:div.book {:id (str "_" bookid)}
-      [:h2.chapter (book-name-nbsp id) " "
-       [:a.back {:href "#"} "Table of Contents"]]
+      [:div.back
+        [:h2 (book-name-nbsp id)]
+        [:a {:href "#"} "Table of Contents"]]
       [:div.chapters
         (->> chapters
              (map (fn [ch]
@@ -566,10 +576,10 @@
       (number-markup i ch)
       (tokens-to-markup tokens)]))

-(defn chapter-url [ch inner]
+(defn chapter-url [ch inner rel]
   (if ch
-    [:a {:href (rel-url ch)} inner]
-    inner))
+    [:a {:href (rel-url ch) :rel rel} inner]
+    [:a inner]))

 (defn chapter
   [{book-id :book-id
@@ -594,10 +604,10 @@
             [:div.menu
               [:div.menu2
                 [:a {:href (str ".#" (book-elem-id book-id))} (chapter-name ch)]
-                "  "
-                (chapter-url prev-ch "<<")
-                "  "
-                (chapter-url next-ch ">>")]]
+                [:span " "]
+                (chapter-url prev-ch "<<" "prev")
+                [:span " "]
+                (chapter-url next-ch ">>" "next")]]
             [:h1.chap
               (chapter-name ch)]
             (map-indexed #(verse %1 ch %2) verses)


Update maps.clj

Update maps.clj

--- backend/src/akvo/lumen/lib/visualisation/maps.clj
+++ backend/src/akvo/lumen/lib/visualisation/maps.clj
@@ -15,7 +15,7 @@
   (:import [com.zaxxer.hikari HikariDataSource]
            [java.net URI]))

-(def http-client-req-defaults (http.client/req-opts 5000))
+(def http-client-req-defaults (http.client/req-opts 10000))

 (defn- headers [tenant-conn]
   (let [db-uri (-> ^HikariDataSource (:datasource tenant-conn)


small refactor

small refactor

--- src/chat/client/views/new_message.cljs
+++ src/chat/client/views/new_message.cljs
@@ -14,6 +14,7 @@

 (defn fuzzy-matches?
   [s m]
+  ; TODO: make this fuzzier? something like interleave with .* & re-match?
   (letfn [(normalize [s]
             (-> (.toLowerCase s) (string/replace #"\s" "")))]
     (not= -1 (.indexOf (normalize s) (normalize m)))))
@@ -134,10 +135,7 @@
                           (> x z) z
                           (< x a) a
                           :else x))
-            results (let [engine-results (map (fn [e] (e text (config :thread-id))) engines)]
-                      (if (every? nil? engine-results)
-                         nil
-                        (apply concat engine-results)))
+            results (seq (mapcat (fn [e] (e text (config :thread-id))) engines))
             highlight-next!
             (fn []
               (om/update-state! owner :highlighted-result-index


Additional functions for testing

Additional functions for testing


fix hard reset

fix hard reset

--- src/cljs/salava/badge/ui/exporter.cljs
+++ src/cljs/salava/badge/ui/exporter.cljs
@@ -27,19 +27,9 @@
    {:value "internal"  :title (t :badge/Shared)}
    {:value "private" :title (t :badge/Private)}])

-(defn reset-visibility [state]
-    (swap! state assoc :visibility "all"))
-
 (defn hard-reset [state]
-  (swap! state assoc :badges-all false
-         :badges-selected []
-         :tags-selected []
-         ;:visibility "all"
-         :tags-all true
-         :search ""
-         :order "mtime"
-         )
-  (reset-visibility state))
+  (swap! state assoc :badges-all false :badges-selected [] :tags-selected [] :tags-all true :search "" :order "mtime" :visibility "all")
+  (-> js/document (.getElementById "select-visibility") (.-selectedIndex) (set! 0)))

 (defn soft-reset [state]
   (swap! state assoc :badges-all false :badges-selected []))
@@ -190,9 +180,7 @@
   (fn []
      [:button {:class    "btn btn-primary"
                :on-click #(select-all state)}
-      (if (:badges-all @state) (t :badge/Clearall) (t :badge/Selectall))]
-    )
-  )
+      (if (:badges-all @state) (t :badge/Clearall) (t :badge/Selectall))]))

 (defn content [state]
   [:div {:id "export-badges"}


Fix compile time IllegalArgumentException.

--- src/cljx/active/clojure/condition.cljx
+++ src/cljx/active/clojure/condition.cljx
@@ -286,17 +286,14 @@
   `(throw (condition ~?base ~?message ~@?irritants)))

 #+cljs
-(defrecord IllegalArgumentException [str])
-
-#+cljs
 (def Throwable js/Object)

 (defmacro guard
   [?handling & ?body]
   (when-not (vector? ?handling)
-    (throw (IllegalArgumentException. (str "guard requires vector in " ~'*ns* ":" (:line (meta ~'&form))))))
+    (throw (IllegalArgumentException. (str "guard requires vector in " *ns* " " (meta &form)))))
   (when-not (odd? (count ?handling))
-    (throw (IllegalArgumentException. (str "guard requires vector in " ~'*ns* ":" (:line (meta ~'&form))))))
+    (throw (IllegalArgumentException. (str "guard requires vector in " *ns* " " (meta &form)))))
   (let [?id (first ?handling)]
     `(try
        ~@?body


Removed overlogging.

Removed overlogging.

--- src/kixi/hecuba/api/devices.clj
+++ src/kixi/hecuba/api/devices.clj
@@ -125,7 +125,6 @@
                                         :version "4"})})))

 (defn resource-exists? [store ctx]
-  (log/infof "resource-exists? CTX: %s" ctx)
   (db/with-session [session (:hecuba-session store)]
     (let [entity_id (-> ctx :request :route-params :entity_id)
           device_id (-> ctx :request :route-params :device_id)


remove redundant when-not

remove redundant when-not

--- src/main/clojure/cljs/core.cljc
+++ src/main/clojure/cljs/core.cljc
@@ -387,12 +387,6 @@
      "Evaluates test. If logical true, evaluates body in an implicit do."
      [test & body]
      (core/list 'if test (cons 'do body))))
-
-#?(:cljs
-   (defmacro when-not
-     "Evaluates test. If logical false, evaluates body in an implicit do."
-     [test & body]
-     (core/list 'if test nil (cons 'do body))))

 #?(:cljs
    (core/defmacro when-first


Use string-reader to simplify clj/cljs

Use string-reader to simplify clj/cljs

This also made it clear that some tests which were clj-only didn't need
to be and were perfectly fine in Cljs when using the push-back-reader.

--- test/aero/core_test.cljc
+++ test/aero/core_test.cljc
@@ -19,6 +19,11 @@
   #?(:clj (System/getenv (str s)))
   #?(:cljs (gobj/get js/process.env s)))

+(defn- string-reader
+  [str]
+  (#?(:cljs source-logging-push-back-reader
+      :clj java.io.StringReader.) str))
+
 (def network-call-count (atom 0))

 (defmethod reader 'expensive-network-call
@@ -153,7 +158,7 @@
        (is (read-config source {:profile :relative-abs}))
        (is (read-config source {:profile :resource :resolver resource-resolver}))
        (is (read-config source {:profile :file :resolver root-resolver}))
-       (is (read-config (-> source slurp java.io.StringReader.)
+       (is (read-config (-> source slurp string-reader)
                         {:profile :relative-abs}))
        (is (read-config source {:profile  :map
                                 :resolver {:sub-includes (io/resource "aero/sub/includes.edn")
@@ -164,20 +169,18 @@
   (let [source "test/aero/includes.edn"]
     (is (:aero/missing-include (read-config source {:profile :file-does-not-exist})))))

-#?(:clj
-   (deftest dangling-ref-test
-     (is
-      (=
-       {:user {:favorite-color :blue}
-        :gardner {:favorite-color :blue}
-        :karl {:favorite-color :blue}
-        :color :blue}
-       (read-config (java.io.StringReader.
-                     (binding [*print-meta* true]
-                       (pr-str {:user ^:ref [:karl]
-                                :gardner {:favorite-color ^:ref [:color]}
-                                :karl ^:ref [:gardner]
-                                :color :blue}))))))))
+(deftest dangling-ref-test
+  (is (= {:user {:favorite-color :blue}
+          :gardner {:favorite-color :blue}
+          :karl {:favorite-color :blue}
+          :color :blue}
+         (read-config
+           (string-reader
+             (binding [*print-meta* true]
+               (pr-str {:user ^:ref [:karl]
+                        :gardner {:favorite-color ^:ref [:color]}
+                        :karl ^:ref [:gardner]
+                        :color :blue})))))))

 (deftest deferred-test
   (is
@@ -204,11 +207,12 @@
   (let [config (read-config "test/aero/config.edn")]
     (is (= nil (config :falsey-user-return)))))

-#?(:clj
-   (deftest ref-in-set-test
-     (is (= #{10} (:bar
-                    (read-config (java.io.StringReader.
-                                   "{:foo 10 :bar #{#ref [:foo]}}")))))))
+(deftest ref-in-set-test
+  (is (= #{10}
+         (:bar
+           (read-config
+             (string-reader
+               "{:foo 10 :bar #{#ref [:foo]}}"))))))

 (deftest or-incomplete-child
   (let [config-str "{:x \"foo\"
@@ -222,14 +226,12 @@
                    :junk6 \"6\"
                    :junk7 \"7\"
                    :junk8 \"8\"}"
-        config (#?(:cljs source-logging-push-back-reader
-                   :clj java.io.StringReader.) config-str)]
+        config (string-reader config-str)]
     (is (= "foo" (:x (read-config config))))))

 (deftest or-dangling-ref
   (let [config-str "{:y #or [#ref [:x] \"bar\"]}"
-        config (#?(:cljs source-logging-push-back-reader
-                   :clj java.io.StringReader.) config-str)]
+        config (string-reader config-str)]
     (is (= "bar" (:y (read-config config))))))

 (deftest meta-preservation-test
@@ -237,10 +239,9 @@
                (::foo
                  (meta
                    (read-config
-                     (#?(:cljs source-logging-push-back-reader
-                         :clj java.io.StringReader.)
-                               (binding [*print-meta* true]
-                                 (pr-str (with-meta ds {::foo ds}))))))))
+                     (string-reader
+                       (binding [*print-meta* true]
+                         (pr-str (with-meta ds {::foo ds}))))))))
     []
     {}
     #{}


Update builtins.clj

Update builtins.clj

--- src/iyye/subcon/knowledge/builtins.clj
+++ src/iyye/subcon/knowledge/builtins.clj
@@ -1,5 +1,5 @@
 ; Iyye - AI agent
-; Copyright (C) 2016-2017  Sasha Yumzya
+; Copyright (C) 2016-2018  Sasha Yumzya

 ; This program is free software: you can redistribute it and/or modify
 ; it under the terms of the GNU Affero General Public License as
@@ -51,7 +51,8 @@
                                      (conj (:Relations p2-type) p2-subtype))]
       (do
         (words/set-iyye-type! new-p1-type)
-        (words/set-iyye-type! new-p2-type)))))
+        (words/set-iyye-type! new-p2-type)
+        true))))

 (defn iyye_is_type_function [params]
   (let [[p1-type p2-type] params]
@@ -60,7 +61,7 @@

 (defn iyye_is_type_create_function [params]
   (let [[p1-name p2-type] params
-        p1-type (words/create-iyye-type p1-name)]
+        p1-type (words/create-iyye-type (:UNKNOWN p1-name))]
     (iyye_is_type_function [p1-type p2-type])))

 (defn iyye_consists_function [params]
@@ -89,7 +90,8 @@
 (defn- create-entry [entry] {(:Uname (:atom entry)) entry})

 (defn- init-builtin-words []
-  (let [actor (words/create-iyye-type "actor" true)
+  (let [type (words/create-iyye-type "type" true)
+        actor (words/create-iyye-type "actor" true)
         ai (words/create-iyye-type "ai" true)
         iyye (words/create-iyye-type "iyye" true)
         human (words/create-iyye-type "human" true)
@@ -100,7 +102,7 @@
     (dosync (ref-set iyye_iyye (uname iyye)))
     (dosync (ref-set iyye_human (uname human)))
     (dosync (ref-set iyye_yumzya (uname yumzya)))
-    (dosync (alter words/noun-words conj (create-entry actor)
+    (dosync (alter words/noun-words conj (create-entry type) (create-entry actor)
                    (create-entry ai) (create-entry iyye) (create-entry human)
                    (create-entry yumzya)))))


Adding CLJ test example and documentation

--- src/leiningen/new/chestnut/project.clj
+++ src/leiningen/new/chestnut/project.clj
@@ -49,6 +49,7 @@
                    :rules :cljs}]}{{/cljx?}}

   :profiles {:dev {:source-paths ["env/dev/clj"]
+                   :test-paths ["test/clj"]

                    :dependencies [[figwheel "0.1.6-SNAPSHOT"]
                                   [com.cemerick/piggieback "0.1.3"]


always serve the established set of files, add .png, issue reported by Kovas Boguta

--- src/main/clojure/cljs/repl/browser.clj
+++ src/main/clojure/cljs/repl/browser.clj
@@ -23,6 +23,19 @@
 (def ^:dynamic browser-state nil)
 (def ^:dynamic ordering nil)
 (def ^:dynamic es nil)
+
+(def ext->mime-type
+  {".html" "text/html"
+   ".css" "text/css"
+
+   ".jpg" "image/jpeg"
+   ".png" "image/png"
+   ".gif" "image/gif"
+
+   ".js" "text/javascript"
+   ".cljs" "text/x-clojure"
+   ".cljc" "text/x-clojure"
+   ".map" "application/json"})

 (defn- set-return-value-fn
   "Save the return value function which will be called when the next
@@ -84,16 +97,8 @@
             local-path)]
       (if local-path
         (server/send-and-close conn 200 (slurp local-path)
-          (condp #(.endsWith %2 %1) path
-            ".html" "text/html"
-            ".css" "text/css"
-            ".html" "text/html"
-            ".jpg" "image/jpeg"
-            ".js" "text/javascript"
-            ".cljs" "text/x-clojure"
-            ".cljc" "text/x-clojure"
-            ".map" "application/json"
-            ".png" "image/png"
+          (if (some #(.endsWith path %) (keys ext->mime-type))
+            (get ext->mime-type path)
             "text/plain"))
         (server/send-404 conn path)))
     (server/send-404 conn path)))
@@ -105,14 +110,7 @@

 (server/dispatch-on :get
   (fn [{:keys [path]} _ _]
-    (or
-      (= path "/")
-      (.endsWith path ".js")
-      (.endsWith path ".cljc")
-      (.endsWith path ".cljs")
-      (.endsWith path ".map")
-      (.endsWith path ".html")
-      (.endsWith path ".css")))
+    (or (= path "/") (some #(.endsWith path %) (keys ext->mime-type))))
   send-static)

 (defmulti handle-post (fn [m _ _ ] (:type m)))


clean: removes processed and errored from stats

For long running instances this really gets big, and it doesn't add much extra useful info

--- src/main/clojure/pdok/featured/api.clj
+++ src/main/clojure/pdok/featured/api.clj
@@ -126,7 +126,6 @@
                 _ (dorun (consume processor features))
                 processor (shutdown processor)
                 run-stats (assoc (:statistics processor) :request request)]
-            (swap! stats update-in [:processed] #(conj % run-stats))
             (swap! stats assoc-in [:processing worker-id] nil)
             (stats-on-callback callback-chan request run-stats)))
         (catch Exception e
@@ -134,7 +133,6 @@
                 processor (shutdown processor)
                 error-stats (assoc request :error (str e))]
             (log/warn e error-stats)
-            (swap! stats update-in [:errored] #(conj % error-stats))
             (swap! stats assoc-in [:processing worker-id] nil)
             (stats-on-callback callback-chan request error-stats)))
         (finally (io/delete-file file))))))
@@ -217,10 +215,8 @@
         ec (chan 100)
         cc (chan 10)
         stats (atom {:processing {}
-                     :processed  []
                      :queued     (PersistentQueue/EMPTY)
-                     :extract-queue (PersistentQueue/EMPTY)
-                     :errored    []})]
+                     :extract-queue (PersistentQueue/EMPTY)})]
     (create-workers stats cc pc)
     (go (while true (extract* stats cc (<! ec))))
     (go (while true (apply callbacker (<! cc))))


fix handling of constrained map in mapping generation (#1750)

--- cimi/src/com/sixsq/slipstream/ssclj/util/spec.cljc
+++ cimi/src/com/sixsq/slipstream/ssclj/util/spec.cljc
@@ -78,7 +78,6 @@
 ;;

 (defmethod st-parse/parse-form 'com.sixsq.slipstream.ssclj.util.spec/only-keys [dispatch form]
-  #_(log/error "DEBUX X" form)
   (st-parse/parse-form 'clojure.spec.alpha/keys form))

@@ -94,8 +93,13 @@
   (st-parse/parse-form 'clojure.spec.alpha/keys (transform-form form)))

+(defn transform-as-every
+  [[spec-name key-spec value-spec & _]]
+  [[spec-name key-spec value-spec]])
+
+
 (defmethod st-parse/parse-form 'com.sixsq.slipstream.ssclj.util.spec/constrained-map [dispatch form]
-  (st-parse/parse-form 'clojure.spec.alpha/keys (transform-form form)))
+  (st-parse/parse-form 'clojure.spec.alpha/every (transform-as-every form)))

 ;;
@@ -113,19 +117,17 @@

 (defmethod visitor/visit-spec 'com.sixsq.slipstream.ssclj.util.spec/constrained-map [spec accept options]
-  (let [keys (impl/extract-keys (transform-form (impl/extract-form spec)))]
-    (accept 'com.sixsq.slipstream.ssclj.util.spec/constrained-map spec (mapv #(visitor/visit % accept options) keys) options)))
+  (let [[_ inner-spec] (transform-as-every (impl/extract-form spec))]
+    (accept 'com.sixsq.slipstream.ssclj.util.spec/constrained-map spec [(visitor/visit inner-spec accept options)] options)))

 ;; accept-spec monkey patches

 (defmethod jsc/accept-spec 'com.sixsq.slipstream.ssclj.util.spec/only-keys [dispatch spec children arg]
-  #_(log/error "monkey only-keys")
   (jsc/accept-spec 'clojure.spec.alpha/keys spec children arg))

 (defmethod jsc/accept-spec 'com.sixsq.slipstream.ssclj.util.spec/only-keys-maps [_ spec children _]
-  #_(log/error "monkey only-keys-maps")
   (let [{:keys [req req-un opt opt-un]} (impl/parse-keys (transform-form (impl/extract-form spec)))
         names-un (map name (concat req-un opt-un))
         names (map impl/qualified-name (concat req opt))
@@ -142,20 +144,7 @@

 (defmethod jsc/accept-spec 'com.sixsq.slipstream.ssclj.util.spec/constrained-map [_ spec children _]
-  #_(log/error "monkey constrainted-map")
-  (let [{:keys [req req-un opt opt-un]} (impl/parse-keys (transform-form (impl/extract-form spec)))
-        names-un (map name (concat req-un opt-un))
-        names (map impl/qualified-name (concat req opt))
-        required (map impl/qualified-name req)
-        required-un (map name req-un)
-        all-required (not-empty (concat required required-un))]
-    (#'jsc/maybe-with-title
-      (merge
-        {:type       "object"
-         :properties (zipmap (concat names names-un) children)}
-        (when all-required
-          {:required (vec all-required)}))
-      spec)))
+  (#'jsc/maybe-with-title {:type "object", :additionalProperties (impl/unwrap children)} spec))

 ;;


allow repeat for shift version of nudges

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -72,13 +72,17 @@
                   (= "true" (.. event -target -contentEditable)))
       (when (contains? suppressed-key-combos key-set)
         (.preventDefault event))
-      (when-not (and (and (not (contains? #{#{"left"}
+      (when-not (and (and (.-repeat event)
+                          ;; allow repeat for arrows
+                          (not (contains? #{#{"left"}
                                             #{"right"}
                                             #{"up"}
-                                            #{"down"}}
-                                          key-set))
-                          ;; allow repeat for arrows
-                          (.-repeat event))
+                                            #{"down"}
+                                            #{"shift" "left"}
+                                            #{"shift" "right"}
+                                            #{"shift" "up"}
+                                            #{"shift" "down"}}
+                                          key-set)))
                      (= "keydown" (.-type event)))
         (cast! :key-state-changed [{:key-set key-set
                                     :code (.-which event)


Update Jetty dependency to 9.4.12.v20180830

Jetty 9.2 has reached End of Life. See the announcement:
https://www.eclipse.org/lists/jetty-announce/msg00116.html

Fixes #347.

--- ring-jetty-adapter/project.clj
+++ ring-jetty-adapter/project.clj
@@ -7,7 +7,7 @@
   :dependencies [[org.clojure/clojure "1.7.0"]
                  [ring/ring-core "1.7.0"]
                  [ring/ring-servlet "1.7.0"]
-                 [org.eclipse.jetty/jetty-server "9.2.24.v20180105"]]
+                 [org.eclipse.jetty/jetty-server "9.4.12.v20180830"]]
   :aliases {"test-all" ["with-profile" "default:+1.8:+1.9" "test"]}
   :profiles
   {:dev {:dependencies [[clj-http "2.2.0"]]


Refactor - use launch-action everywhere

Refactor - use launch-action everywhere

--- src/aerobio/actions.clj
+++ src/aerobio/actions.clj
@@ -91,9 +91,8 @@
   [_ eid params get-toolinfo template]
   (let [status (atom {:done []})
         {:keys [user cmd phase modifier compfile]} params
-        rep (if modifier :rep nil)
+        rep (if (= modifier "replicates") :rep nil)
         outdir (cmn/get-exp-info eid :out)
-
         exp (cmn/get-exp-info eid :exp)
         user (get-mail-recipient user)]
     {:status status
@@ -113,7 +112,13 @@
         {:keys [user cmd phase modifier compfile]} params
         recipient (pams/get-params [:email (keyword user)])]
     {:status status
-     :fut (cmn/run-comparison
+     :fut (cmn/launch-action
+           eid user
+           get-toolinfo template
+           :action (name cmd)
+           :compfile compfile
+           :status status)
+     #_(cmn/run-comparison
            exp eid recipient compfile get-toolinfo template status)}))

 (defmethod action :xcompare
@@ -123,8 +128,14 @@
         {:keys [user cmd phase modifier compfile]} params
         user (get-mail-recipient user)]
     {:status status
-     :fut (cmn/run-comparison
-           exp eid user compfile get-toolinfo template status)}))
+     :fut (cmn/launch-action
+           eid user
+           get-toolinfo template
+           :action (name cmd)
+           :compfile compfile
+           :status status)
+     #_(cmn/run-comparison
+      exp eid user compfile get-toolinfo template status)}))

 (defmethod action :aggregate
@@ -134,8 +145,14 @@
         {:keys [user cmd phase modifier compfile]} params
         recipient (pams/get-params [:email (keyword user)])]
     {:status status
-     :fut (htts/run-aggregation
-           eid recipient compfile get-toolinfo template status)}))
+     :fut (cmn/launch-action
+           eid user
+           get-toolinfo template
+           :action (name cmd)
+           :compfile compfile
+           :status status)
+     #_(htts/run-aggregation
+        eid recipient compfile get-toolinfo template status)}))

 (comment


Bumps version to 1.17.3-SNAPSHOT

Bumps version to 1.17.3-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.17.2"
+(defproject cook "1.17.3-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"]


Adapt engine/next-column-index function to keywordized column

Adapt engine/next-column-index to  keywordized column

--- backend/src/akvo/lumen/transformation/engine.clj
+++ backend/src/akvo/lumen/transformation/engine.clj
@@ -97,7 +97,7 @@

 (defn next-column-index [columns]
   (let [nums (->> columns
-                  (map #(get % "columnName"))
+                  (map #(or (get % "columnName") (:columnName %)))
                   (filter #(re-find #"^d\d+$" %))
                   (map #(subs % 1))
                   (map #(Long/parseLong %)))]


Speeding up the tempo.

Speeding up the tempo.

--- examples/piano_phase.clj
+++ examples/piano_phase.clj
@@ -5,14 +5,15 @@
 (def piece [:E4 :F#4 :B4 :C#5 :D5 :F#4 :E4 :C#5 :B4 :F#4 :D5 :C#5])

 (defn player
-  [metro beat notes]
+  [t speed notes]
   (let [n     (first notes)
         notes (next notes)
-        b     (inc beat)]
+        t-next (+ t speed)]
     (when n
-      (at (metro beat)
+      (at t
           (sampled-piano (note n)))
-      (apply-at (metro b) #'player [metro b (next notes)]))))
+      (apply-at t-next #'player [t-next speed notes]))))

-(def m (metronome 140))
-(player m (m) piece)
+(do
+  (player (now) 338 (take 100 (cycle piece)))
+  (player (now) 328 (take 100 (cycle piece))))


+TODOs and +FIXMEs

+TODOs and +FIXMEs

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -31,6 +31,8 @@
 (declare path-to-map)
 (declare spec-info)

+;; FIXME: truncate-children=false (the non-default option) is not propagated through all calls,
+;; causing trees to be unexpectedly truncated.
 (defn generate [spec language-model
                 & {:keys [max-total-depth truncate-children lexicon]
                    :or {max-total-depth max-total-depth
@@ -199,11 +201,17 @@

                           (and (empty? filtered-lexical-complements)
                                (empty? phrasal-complements))
-                          (log/warn (str "add-complement-to-bolt: could generate neither phrasal "
+
+                          (let [message (str "add-complement-to-bolt: could generate neither phrasal "
                                          "nor lexical complements for "
                                          "bolt:" (show-bolt bolt language-model) "; immediate parent: "
                                           (get-in bolt (concat (butlast path) [:rule]) :norule) " "
-                                          "while trying to create a complement: " (spec-info spec)))
+                                          "while trying to create a complement: " (spec-info spec))]
+                            (log/warn message)
+                            ;; TODO: add optional exception-throwing if
+                            ;; "could generate neither phrasal nor lexical complements for bolt.." is
+                            ;; reached.
+                            (if false (exception message)))

                           lexemes-before-phrases
                           (take max-generated-complements


(defn add-all-comps-with-paths) should take only a single bolt

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -90,14 +90,12 @@
   (lazy-mapcat
    (fn [bolt]
      (log/debug (str "add-all-comps: adding comps to bolt: " (show-bolt bolt language-model)))
-     (add-all-comps-with-paths [bolt] language-model total-depth
+     (add-all-comps-with-paths bolt language-model total-depth
                                (find-comp-paths-in (bolt-depth bolt))
                                truncate-children max-total-depth))
    bolts))

-(defn add-all-comps-with-paths [bolts language-model total-depth comp-paths truncate-children max-total-depth]
-  (log/trace (str "add-all-comps-with-paths with (empty? bolts): "
-                  (empty? bolts)))
+(defn add-all-comps-with-paths [bolt language-model total-depth comp-paths truncate-children max-total-depth]
   (if (not (empty? comp-paths))
     (let [path (first comp-paths)]
       (add-all-comps-with-paths
@@ -109,13 +107,13 @@
                                   language-model (+ total-depth (count path))
                                   :max-total-depth max-total-depth
                                   :truncate-children truncate-children))
-        bolts)
+        [bolt])
        language-model
        total-depth
        (rest comp-paths)
        truncate-children
        max-total-depth))
-    bolts))
+    bolt))

 (defn bolt-depth [bolt]
   (if-let [head (get-in bolt [:head] nil)]
@@ -251,7 +249,7 @@
                            (let [candidate-lexemes (get-lex parent :head index)
                                  filter-on-spec {:synsem {:cat (get-in spec [:cat] :top)
                                                           :sem (get-in spec [:synsem :sem] :top)}}
-                                 subset (filter #(not (fail? (unifyc filter-on-spec %)))
+                                 subset (filter #(or true (not (fail? (unifyc filter-on-spec %))))
                                                 candidate-lexemes)]
                              (filter #(not (nil? %))
                                      (do (log/debug (str "trying over parent:" (:rule parent)))


expose babel.italiano/lexicon

expose babel.italiano/lexicon

--- src/babel/italiano.cljc
+++ src/babel/italiano.cljc
@@ -2,11 +2,11 @@
   (:require
    [babel.engine :as engine]
    [babel.italiano.grammar :refer [medium]]
-   [babel.italiano.lexicon :refer [lexicon]]
    [babel.italiano.morphology :as morph :refer [fo]]
    [babel.generate :as generate :refer [try-hard-to]]
    [babel.parse :as parse]
    [clojure.string :as string]))
+(def lexicon (:lexicon medium))

 (defn analyze
   ([surface-form]


Add created-at to migration-row and post route's response.

--- src/cadence/views/admin.clj
+++ src/cadence/views/admin.clj
@@ -10,7 +10,7 @@

 (defhtml migration-row
   "Convert a modified migration map to a table row."
-  [{:keys [id doc applied? source]}]
+  [{:keys [id doc applied? source created-at]}]
   (let [[badge-class badge-icon badge-text button-class button-text]
         (if applied?
           ["label-success" "icon-ok-sign" "Applied" "btn-inverse" "Rollback"]
@@ -23,8 +23,10 @@
      [:div.left-side.span4
       [:h3.migration-title hdoc]
       (common/meta-table {:date (h (common/human-readable-objectid-datetime id))
-                          "Object id" [:code (h id)]
+                          "object id" [:code (h id)]
                           :doc [:p hdoc]
+                          "applied at" (h (if created-at (str created-at)
+                                            "N/A"))
                           :applied [:span {:class (str "label " badge-class)}
                                     [:i {:class (str "icon-white " badge-icon)}]
                                     (str " " badge-text)]})
@@ -54,6 +56,8 @@
   [{{id "object_id" action "action"} :form-params}]
   (let [write-result ((case action
                         "Rollback" migration/rollback-by-id
-                        "Apply" migration/migrate-by-id) id)]
-    (resp/json {:count (.getField write-result "n")})))
-
+                        "Apply" migration/migrate-by-id) id)
+        created-at (:created_at (migration/find-migration-by-id
+                                  (ObjectId. id)))]
+    (resp/json {:count (.getField write-result "n")
+                :createdAt (if created-at (str created-at) "N/A")})))


setting base

setting base

--- src/celestial/hosts_api.clj
+++ src/celestial/hosts_api.clj
@@ -18,7 +18,7 @@
      [slingshot.slingshot :only  [throw+ try+]]
      [swag.model :only (defmodel wrap-swag defv defc)]
      [celestial.common :only (import-logging resp bad-req conflict success wrap-errors)]
-     [swag.core :only (swagger-routes GET- POST- PUT- DELETE- defroutes- errors)]))
+     [swag.core :only (swagger-routes set-base GET- POST- PUT- DELETE- defroutes- errors)]))

 (import-logging)

@@ -60,6 +60,8 @@
 (defc [:machine :os] (keyword v))

 (defc [:env] (keyword v))
+
+(set-base "https://localhost:8443/")

 (defroutes- hosts {:path "/host" :description "Operations on hosts"}


Fix spec

Fix spec

--- src/clj/nightcode/utils.clj
+++ src/clj/nightcode/utils.clj
@@ -13,7 +13,8 @@
   (onload [])
   (onautosave [])
   (onchange [])
-  (onenter [text]))
+  (onenter [text])
+  (oneval [code]))

 (defn get-relative-path
   "Returns the selected path as a relative URI to the project path."
@@ -202,7 +203,7 @@
   :args (s/cat :project-set set? :path string?))

 (fdef delete-children-recursively!
-  :args (s/cat :path file?))
+  :args (s/cat :path spec/file?))

 (fdef get-project-root-path
   :args (s/cat :pref-state map?)


Badge content saving fixes

Badge content saving fixes

--- src/clj/salava/badge/db.clj
+++ src/clj/salava/badge/db.clj
@@ -21,7 +21,7 @@
                      (map :attrs link-tags))]
     (try (u/http-get md-url) (catch Exception _ ""))))

-(defn- content-type [_ input]
+(defn- content-type [_ input & _]
   (cond
     (map? input)          :default
     (string/blank? input) :blank
@@ -34,20 +34,21 @@

 (defmulti save-criteria-content! content-type)

-(defmethod save-criteria-content! :blank [_ _]
+(defmethod save-criteria-content! :blank [_ _ & _]
   (throw (Exception. "badge/MissingCriteriaContent")))

-(defmethod save-criteria-content! :url [ctx input]
-  (save-criteria-content! ctx (with-meta (u/http-get input) {:url input})))
+(defmethod save-criteria-content! :url [ctx input & _]
+  (save-criteria-content! ctx (u/http-get input) {:url input}))

-(defmethod save-criteria-content! :html [ctx input]
-  (save-criteria-content!
-    ctx (with-meta {:id ""
-                    :html_content input
-                    :markdown_content (alt-markdown input)}
-                   (meta input))))
+(defmethod save-criteria-content! :html [ctx input & more]
+  (let [input-meta (or (meta input) (first more) {})]
+    (save-criteria-content!
+      ctx (with-meta {:id ""
+                      :html_content input
+                      :markdown_content (alt-markdown input)}
+                     input-meta))))

-(defmethod save-criteria-content! :default [ctx input]
+(defmethod save-criteria-content! :default [ctx input & _]
   (s/validate schemas/CriteriaContent input)
   (let [id (content-id input)]
     (insert-criteria-content! (assoc input :id id) (u/get-db ctx))
@@ -57,14 +58,15 @@

 (defmulti save-issuer-content! content-type)

-(defmethod save-issuer-content! :blank [_ _]
+(defmethod save-issuer-content! :blank [_ _ & _]
   (throw (Exception. "badge/MissingIssuerContent")))

-(defmethod save-issuer-content! :url [ctx input]
-  (save-issuer-content! ctx (with-meta (u/http-get input) {:url input})))
+(defmethod save-issuer-content! :url [ctx input & _]
+  (save-issuer-content! ctx (u/http-get input) {:url input}))

-(defmethod save-issuer-content! :json [ctx input]
-  (let [data (json/read-str input :key-fn keyword)]
+(defmethod save-issuer-content! :json [ctx input & more]
+  (let [input-meta (or (meta input) (first more) {})
+        data (json/read-str input :key-fn keyword)]
     (save-issuer-content!
       ctx (with-meta {:id ""
                       :name        (:name data)
@@ -73,9 +75,9 @@
                       :url   (:url data)
                       :email (:email data)
                       :revocation_list_url (:revocationList data)}
-                     (meta input)))))
+                     input-meta))))

-(defmethod save-issuer-content! :default [ctx input]
+(defmethod save-issuer-content! :default [ctx input & _]
   (s/validate schemas/IssuerContent input)
   (let [id (content-id input)]
     (insert-issuer-content! (assoc input :id id) (u/get-db ctx))
@@ -85,14 +87,15 @@

 (defmulti save-creator-content! content-type)

-(defmethod save-creator-content! :blank [_ _]
+(defmethod save-creator-content! :blank [_ _ & _]
   (throw (Exception. "badge/MissingCreatorContent")))

-(defmethod save-creator-content! :url [ctx input]
-  (save-creator-content! ctx (with-meta (u/http-get input) {:json-url input})))
+(defmethod save-creator-content! :url [ctx input & _]
+  (save-creator-content! ctx (u/http-get input) {:json-url input}))

-(defmethod save-creator-content! :json [ctx input]
-  (let [data (json/read-str input :key-fn keyword)]
+(defmethod save-creator-content! :json [ctx input & more]
+  (let [input-meta (or (meta input) (first more) {})
+        data (json/read-str input :key-fn keyword)]
     (save-creator-content!
       ctx (with-meta {:id ""
                       :name        (:name data)
@@ -101,9 +104,9 @@
                       :url   (:url data)
                       :email (:email data)
                       :json_url ((meta input) :json-url "")}
-                     (meta input)))))
+                     input-meta))))

-(defmethod save-creator-content! :default [ctx input]
+(defmethod save-creator-content! :default [ctx input & _]
   (s/validate schemas/CreatorContent input)
   (let [id (content-id input)]
     (insert-creator-content! (assoc input :id id) (u/get-db ctx))
@@ -113,14 +116,15 @@

 (defmulti save-badge-content! content-type)

-(defmethod save-badge-content! :blank [_ _]
+(defmethod save-badge-content! :blank [_ _ & _]
   (throw (Exception. "badge/MissingBadgeContent")))

-(defmethod save-badge-content! :url [ctx input]
-  (save-badge-content! ctx (with-meta (u/http-get input) {:url input})))
+(defmethod save-badge-content! :url [ctx input & _]
+  (save-badge-content! ctx (u/http-get input) {:url input}))

-(defmethod save-badge-content! :json [ctx input]
-  (let [data (json/read-str input :key-fn keyword)]
+(defmethod save-badge-content! :json [ctx input & more]
+  (let [input-meta (or (meta input) (first more) {})
+        data (json/read-str input :key-fn keyword)]
     (merge
       (save-badge-content! ctx (with-meta {:id ""
                                            :name        (:name data)
@@ -128,15 +132,18 @@
                                            :description (:description data)
                                            :alignment   []
                                            :tags        (:tags data)}
-                                          (meta input)))
-      (when (:issuer data)
-        (save-issuer-content! ctx (:issuer data)))
-      (when (:criteria data)
-        (save-criteria-content! ctx (:criteria data)))
-      (when (:extensions:OriginalCreator data)
-        (save-creator-content! ctx (get-in data [:extensions:OriginalCreator :url]))))))
+                                          input-meta))
+      (if (:issuer data)
+        (save-issuer-content! ctx (:issuer data))
+        {:issuer_content_id nil})
+      (if (:criteria data)
+        (save-criteria-content! ctx (:criteria data))
+        {:criteria_content_id nil})
+      (if (:extensions:OriginalCreator data)
+        (save-creator-content! ctx (get-in data [:extensions:OriginalCreator :url]))
+        {:creator_content_id nil}))))

-(defmethod save-badge-content! :default [ctx input]
+(defmethod save-badge-content! :default [ctx input & _]
   (s/validate schemas/BadgeContent input)
   (let [id (content-id input)]
     (jdbc/with-db-transaction  [t-con (:connection (u/get-db ctx))]
@@ -150,7 +157,7 @@
 ;;

 (defn save-badge! [ctx data]
-  (let [content (save-badge-content! (:badge_url data))]
+  (let [content (save-badge-content! ctx (:badge_url data))]
     (assoc content :id (insert-badge<! (merge data content) (u/get-db ctx)))))

 ;;


Removed unused function

Removed unused function

--- src/clj/salava/badge/db.clj
+++ src/clj/salava/badge/db.clj
@@ -21,22 +21,6 @@
                         )))
         reduced-events (vals (reduce helper {} (reverse events)))]
     (filter #(false? (:hidden %)) reduced-events)))
-
-
-
-
-
-(defn admin-events-reduce [events]
-  (let [helper (fn [current item]
-                  (let [key [(:verb item)]]
-                    (-> current
-                        (assoc  key item)
-                        (assoc-in  [key :count] (inc (get-in current [key :count ] 0)))
-                        )))
-        reduced-events (vals (reduce helper {} (reverse events)))]
-    (filter #(false? (:hidden %)) reduced-events)))
-
-


App app-context to error pages

App app-context to error pages

--- src/clj/sparqlab/layout.clj
+++ src/clj/sparqlab/layout.clj
@@ -47,7 +47,8 @@
    :headers {"Content-Type" "text/html; charset=utf-8"}
    :body    (parser/render-file "error.html" (merge (i18n/base-locale request)
                                                     error-details
-                                                    {:label (tr [:error/title])}))})
+                                                    {:label (tr [:error/title])
+                                                     :servlet-context *app-context*}))})

 (defn not-found
   "Page not found"


changed default working directory to temp

--- src/clj/swarmpit/config.clj
+++ src/clj/swarmpit/config.clj
@@ -5,7 +5,7 @@
   (atom {:docker-sock      "/var/run/docker.sock"
          :docker-api       "1.30"
          :db-url           "http://localhost:5984"
-         :work-dir         "/usr/src/app"
+         :work-dir         "/tmp"
          :password-hashing {:alg        :pbkdf2+sha512
                             :iterations 200000}}))