Experiment more with meta-errors

Experiment more with meta-errors

--- src/clojush/evaluate.clj
+++ src/clojush/evaluate.clj
@@ -173,6 +173,45 @@
                                                (iterate (partial * (- 1 improvement-discount)) 1))
                                  sum (reduce + (mapv * improvements weights))]
                              (- sum)))))))
+              ;
+              (= cat :case-gens-since-improvement)
+              (if (not (:print-history argmap))
+                (throw
+                  (Exception.
+                    ":print-history must be true for :case-gens-since-improvement"))
+                (let [huge 1000000]
+                  (if (empty? (rest (:history ind)))
+                    (vec (repeat (count (:errors ind)) huge))
+                    (vec (for [case-history (apply map list (:history ind))]
+                           (if (zero? (first case-history))
+                             (- huge)  ;; solved, improvement doesn't matter
+                             (let [improved? (mapv (fn [[newer-error older-error]]
+                                                     (< newer-error older-error))
+                                                   (partition 2 1 case-history))
+                                   gens (take-while not improved?)]
+                               (if (= (count gens)
+                                      (count improved?))
+                                 huge
+                                 (count gens)))))))))
+              (= cat :case-gens-since-change)
+              (if (not (:print-history argmap))
+                (throw
+                  (Exception.
+                    ":print-history must be true for :case-gens-since-change"))
+                (let [huge 1000000]
+                  (if (empty? (rest (:history ind)))
+                    (vec (repeat (count (:errors ind)) huge))
+                    (vec (for [case-history (apply map list (:history ind))]
+                           (if (zero? (first case-history))
+                             (- huge)  ;; solved, improvement doesn't matter
+                             (let [changed? (mapv (fn [[newer-error older-error]]
+                                                    (not= newer-error older-error))
+                                                  (partition 2 1 case-history))
+                                   gens (take-while not changed?)]
+                               (if (= (count gens)
+                                      (count changed?))
+                                 huge
+                                 (count gens)))))))))
               ;
               (= cat :case-sibling-uniformity)
               (if (empty? (:parent-uuids ind))


Experiment more with meta-errors

Experiment more with meta-errors

--- src/clojush/evaluate.clj
+++ src/clojush/evaluate.clj
@@ -551,7 +551,7 @@
                            (= e (max p1e p2e)) 4
                            :else 5))))
                 (vec (repeat (count (:errors ind)) 6)))
-              (if (and (:parent1-errors ind)
+              #_(if (and (:parent1-errors ind)
                        (:parent2-errors ind))
                 (if (or (= (:errors ind) (:parent1-errors ind))
                         (= (:errors ind) (:parent2-errors ind)))
@@ -568,6 +568,21 @@
                            (= e (max p1e p2e)) 4
                            :else 5))))
                 (vec (repeat (count (:errors ind)) 6)))
+              (if (and (:parent1-errors ind)
+                       (:parent2-errors ind))
+                (if (or (= (:errors ind) (:parent1-errors ind))
+                        (= (:errors ind) (:parent2-errors ind)))
+                  (vec (repeat (count (:errors ind)) 5))
+                  (vec (for [[e p1e p2e] (mapv #(vector %1 %2 %3)
+                                               (:errors ind)
+                                               (:parent1-errors ind)
+                                               (:parent2-errors ind))]
+                         (cond
+                           (or (zero? e) (< e (min p1e p2e))) 0
+                           (some #{e} #{p1e p2e}) 3
+                           (< e (max p1e p2e)) 1
+                           :else 2))))
+                (vec (repeat (count (:errors ind)) 4)))
               ;
               (= cat :error-neglect)
               #_(if (and (:parent1-errors ind) (:parent2-errors ind))


Include spec macros in CLJS.

Include spec macros in CLJS.

--- test/active/clojure/record_spec_test.cljc
+++ test/active/clojure/record_spec_test.cljc
@@ -9,8 +9,8 @@
     :cljs
     [(:require
       [active.clojure.record-spec :refer-macros [define-record-type]]
-      [cljs.spec.alpha :as s]
-      [cljs.spec.test.alpha :as stest]
+      [cljs.spec.alpha :as s :include-macros true]
+      [cljs.spec.test.alpha :as stest :include-macros true]
       [cljs.test :as t :include-macros true])]))

 (s/def ::k int?)


Reduce sample rate to once a second and move output to a ring buffer

--- src/clojure/com/flashlightdb/ceilingbounce/runtime.clj
+++ src/clojure/com/flashlightdb/ceilingbounce/runtime.clj
@@ -20,6 +20,7 @@
                        update-ui
                        read-field
                        update-main]]
+              [amalloy.ring-buffer :refer [ring-buffer]]
               )
     (:import android.widget.EditText
              [android.app
@@ -39,10 +40,12 @@
               XYMultipleSeriesRenderer
               XYSeriesRenderer]
              [org.achartengine ChartFactory]
-             [android.graphics Bitmap$CompressFormat]))
+             [android.graphics Bitmap$CompressFormat])
+    (:use overtone.at-at))

 (def peak-lux (atom 0))
 (def test-time (atom 0))
+(def runtime-pool (mk-pool))

 (defn handle-lux [lux]
   (update-main ::lux-now
@@ -59,7 +62,7 @@

 (declare runtime-test)

-(def output (atom []))
+(def output (atom (ring-buffer 1000)))

 (defn nanos-since [start-time]
   (-> (. System nanoTime)
@@ -68,9 +71,12 @@
 (defn minutes-since [start-time]
   (float (/ (nanos-since start-time) 60000000000)))

-(defn handle-lux-rt [lux start-time]
+#_(defn handle-lux-rt [lux start-time]
   (let [offset (minutes-since start-time)]
     (swap! output conj [lux offset])))
+
+(defn sample-lux []
+  (swap! output conj [@common/lux (minutes-since @test-time)]))

 (def lux-30s (atom 0))

@@ -118,12 +124,13 @@
                         (.setXTitle "Minutes")
                         (.setYTitle "Relative Output")
                         (.setShowLegend false)
-                        (.setZoomEnabled false)
+                        (.setZoomEnabled true)
                         (.setYAxisMin 0)
                         (.setYAxisMax 120)
                         (.setApplyBackgroundColor true)
                         (.setBackgroundColor Color/BLACK)
                         (.setYLabels 10)
+                        (.setXLabels 10)
                         (.setPanLimits (double-array [0 20000 0 200]))
                         (.setZoomLimits (double-array [0 20000 0 200]))
                         ))
@@ -156,6 +163,8 @@
              (percent lux)))

 (defn save-chart [chart-path]
+  ; While the chart view should have a .toBitmap method, it returns nil
+  ; probably because the larger chart is not drawn
   (let [bitmap (Bitmap/createBitmap 1400 1050 Bitmap$Config/ARGB_8888)
         canvas (Canvas. bitmap)]
     (on-ui (doto outfile-chart-view
@@ -190,6 +199,7 @@
   (future (save-chart (path @test-time "png")))
   ; TODO do things with output before it's cleared
   (swap! output identity* [])
+  (stop-and-reset-pool! runtime-pool)
   (update-main ::runtime-test
              :text "Start runtime test"
              :on-click #'runtime-test))
@@ -203,9 +213,13 @@
     (swap! lux-30s identity* @common/lux) ; start the graph with this, update later
     (clear-chart)
     (.setChartTitle multi-renderer (read-field @main-activity ::filename))
-    (add-watch common/lux :runtime-watch
+    #_(add-watch common/lux :runtime-watch
                (fn [_key _ref _old new]
                  (handle-lux-rt new start-time)))
+    (every 1000
+           sample-lux
+           runtime-pool
+           :desc "Sample the light meter reading")
     (add-watch output :runtime-watch
                (fn [_key _ref _old new]
                  (handle-output new dir-path csv-path)))


fix docstrings

fix docstrings

--- src/main/clojure/clojure/tools/reader/reader_types.clj
+++ src/main/clojure/clojure/tools/reader/reader_types.clj
@@ -282,7 +282,7 @@
      (PushbackReader. (input-stream-reader is) (object-array buf-len) buf-len buf-len)))

 (defn indexing-push-back-reader
-  "Creates an IndexingPushbackReader from a given string or Reader"
+  "Creates an IndexingPushbackReader from a given string or PushbackReader"
   ([s-or-rdr]
      (indexing-push-back-reader s-or-rdr 1))
   ([s-or-rdr buf-len]
@@ -292,7 +292,7 @@
       (if (string? s-or-rdr) (string-push-back-reader s-or-rdr buf-len) s-or-rdr) 0 1 true nil 0 file-name)))

 (defn source-logging-push-back-reader
-  "Creates a SourceLoggingPushbackReader from a given string or Reader"
+  "Creates a SourceLoggingPushbackReader from a given string or PushbackReader"
   ([s-or-rdr]
      (source-logging-push-back-reader s-or-rdr 1))
   ([s-or-rdr buf-len]
@@ -341,7 +341,7 @@
   (instance? SourceLoggingPushbackReader rdr))

 (defmacro log-source
-  "If reader implements SourceLoggingReader, execute body in a source
+  "If reader is a SourceLoggingPushbackReader, execute body in a source
   logging context. Otherwise, execute body, returning the result."
   [reader & body]
   `(if (and (source-logging-reader? ~reader)
@@ -350,7 +350,7 @@
      (do ~@body)))

 (defmacro log-source-unread
-  "If reader implements SourceLoggingReader, execute body in a source
+  "If reader is a SourceLoggingPushbackReader, execute body in a source
   logging context. Otherwise, execute body, returning the result."
   [reader & body]
   `(if (and (source-logging-reader? ~reader)


better snippet for cljs design post

better snippet for cljs design post

--- src/pc/views/blog/clojure_is_a_product_design_tool.clj
+++ src/pc/views/blog/clojure_is_a_product_design_tool.clj
@@ -44,7 +44,7 @@

 (defn clojure-is-a-product-design-tool []
   {:title "Clojure is a product design tool."
-   :blurb "There's something you can learn right now that will make you build better products and extend your reach as a designer..."
+   :blurb "Clojure makes me more efficient and extends my reach as a designer. And it protects me from complex design tools..."
    :author "Danny"
    :body
    (list


remove test that could never pass

remove test that could never pass

--- test/fm/land/arachne/sass_test.clj
+++ test/fm/land/arachne/sass_test.clj
@@ -33,7 +33,8 @@
         result     (slurp (io/file output-dir "css/application.css"))]
     (is (re-find #"background-color: #0000FF;" result))))

-(deftest error-build
+;; This can never be true since pipeline errors are logged but not thrown from the top level
+#_(deftest error-build
   (let [output-dir (fs/tmpdir!)
         cfg        (arachne/build-config [:fm.land/arachne-sass]
                                          `(fm.land.arachne.sass-test/build-cfg "error.scss" ~(.getCanonicalPath output-dir) false))]


enable old mutation test

enable old mutation test

--- test/graphql_clj/executor_test.clj
+++ test/graphql_clj/executor_test.clj
@@ -453,24 +453,27 @@
                                           "friends" [{"id" "1000"} {"id" "1002"} {"id" "1003"}]}]}}}
              (executor/execute context valid-starwars-schema starwars-resolver-fn validated-statement variables))))))

-;; (def mutation-schema (sv/validate-schema (parser/parse-schema "type Query {
-;;   people: String
-;; }
-
-;; type Mutation {
-;;   createPeople(emails: [String]): String
-;; }
-
-;; schema {
-;;   query: Query
-;;   mutation: Mutation
-;; }")))
-
-;; (deftest list-type-variables
-;;   (testing "validation for list type variable"
-;;     (let [query-str "mutation($emails: [String]) {
-;;   createPeople(emails: $emails)
-;; }"
-;;           validated (prepare-statement query-str)
-;;           result (executor/execute nil mutation-schema (constantly nil) validated {:emails ["this@that.com"]})]
-;;       (is (not (:errors result))))))
+(def mutation-schema (sv/validate-schema (parser/parse-schema "type Query {
+  people: String
+}
+
+type Mutation {
+  createPeople(emails: [String]): String
+}
+
+schema {
+  query: Query
+  mutation: Mutation
+}")))
+
+(deftest list-type-variables
+  (testing "validation for list type variable"
+    (let [query-str "mutation($emails: [String]) {
+  createPeople(emails: $emails)
+}"
+          validated (->> query-str
+                         parser/parse-query-document
+                         (qv/validate-query (peek mutation-schema)))
+          result (executor/execute nil mutation-schema (constantly nil) validated {"emails" ["this@that.com"]})]
+      (println "result:" result)
+      (is (not (:errors result))))))


Simplify match-seq-spec

Simplify match-seq-spec

--- test/icecap/handlers/core_test.clj
+++ test/icecap/handlers/core_test.clj
@@ -11,15 +11,13 @@
   takes as many elements as that coll has off of the thing to match
   into a coll of the same type, and compares it to that coll.
   "
-  [spec to-match]
-  (loop [spec spec
-         to-match to-match]
-    (let [spec-part (first spec)
-          [candidate to-match] (split-at (count spec-part) to-match)
-          candidate (into (empty spec-part) candidate)]
-      (cond (not= candidate spec-part) false
-            (seq spec) (recur (rest spec) to-match)
-            :else (not (seq to-match))))))
+  [[part & parts] to-match]
+  (let [[candidate to-match] (split-at (count part) to-match)
+        candidate (into (empty part) candidate)]
+    (cond (not= candidate part) false
+          (seq parts) (recur parts to-match)
+          :else (not (seq to-match)))))
+

 (deftest match-seq-spec-tests
   (testing "match single matching items"


Remove unused [http.async.client :as client] require

--- src/yetibot/core/util.clj
+++ src/yetibot/core/util.clj
@@ -2,7 +2,6 @@
   (:require
     [datomico.db :as db :refer [with-latest-database]]
     [datomic.api :as api]
-    [http.async.client :as client]
     [clojure.string :as s]
     [robert.hooke :as rh]
     [clojure.stacktrace :as st]


Implement kibit suggestions

Implement kibit suggestions

--- src/zaffre/glterminal.clj
+++ src/zaffre/glterminal.clj
@@ -108,9 +108,8 @@
                    Keyboard/KEY_NUMPAD8 :numpad8
                    Keyboard/KEY_NUMPAD9 :numpad9
                    ;; event-key didn't match, default to event-char if it is printable, else nil
-                   (if (<= (int (first " ")) (int event-char) (int \~))
-                     event-char
-                     nil))]
+                   (when (<= (int (first " ")) (int event-char) (int \~))
+                     event-char))]
     (log/info "key" key)
     (on-key-fn key)))

@@ -246,15 +245,15 @@
     texture-buffer))

 (defn- get-fields [#^Class static-class]
-  (. static-class getFields))
+  (.getFields static-class))

 (defn- gl-enum-name
   "Takes the numeric value of a gl constant (i.e. GL_LINEAR), and gives the name"
   [enum-value]
-  (if (= 0 enum-value)
+  (if (zero? enum-value)
     "NONE"
     (.getName #^Field (some
-                       #(if (= enum-value (.get #^Field % nil)) % nil)
+                       #(when (= enum-value (.get #^Field % nil)) %)
                        (mapcat get-fields [GL11 GL12 GL13 GL15 GL20 GL30])))))

 (defn- except-gl-errors
@@ -836,7 +835,7 @@
           ;;; Set fx uniforms
           ;(log/info "fx-uniforms" (vec fx-uniforms))
           (doseq [[uniform-name [value-atom location]] fx-uniforms]
-            (when (not (neg? location))
+            (when-not (neg? location)
               (GL20/glUniform1f location (-> value-atom deref float))))
           ;; Draw fx shaded terminal
           (GL11/glDrawArrays GL11/GL_TRIANGLE_STRIP 0 vertices-count)


fix platform-specific path separators (missed in a previous merge)

--- storm-core/test/clj/backtype/storm/supervisor_test.clj
+++ storm-core/test/clj/backtype/storm/supervisor_test.clj
@@ -247,7 +247,7 @@
     (let [mock-port "42"
           mock-storm-id "fake-storm-id"
           mock-worker-id "fake-worker-id"
-          mock-cp "/base:/stormjar.jar"
+          mock-cp (str file-path-separator "base" class-path-separator file-path-separator "stormjar.jar")
           exp-args-fn (fn [opts topo-opts classpath]
                        (concat [(supervisor/java-cmd) "-server"]
                                opts
@@ -255,10 +255,8 @@
                                ["-Djava.library.path="
                                 (str "-Dlogfile.name=worker-" mock-port ".log")
                                 "-Dstorm.home="
-                                "-Dstorm.conf.file="
-                                "-Dstorm.options="
-                                "-Dstorm.log.dir=/logs"
-                                "-Dlogback.configurationFile=/logback/cluster.xml"
+                                (str "-Dstorm.log.dir=" file-path-separator "logs")
+                                (str "-Dlogback.configurationFile=" file-path-separator "logback" file-path-separator "cluster.xml")
                                 (str "-Dstorm.id=" mock-storm-id)
                                 (str "-Dworker.id=" mock-worker-id)
                                 (str "-Dworker.port=" mock-port)
@@ -308,14 +306,14 @@
                                                 [0]
                                                 exp-args))))
       (testing "testing topology.classpath is added to classpath"
-        (let [topo-cp "/any/path"
+        (let [topo-cp (str file-path-separator "any" file-path-separator "path")
               exp-args (exp-args-fn [] [] (add-to-classpath mock-cp [topo-cp]))
               mock-supervisor {:conf {STORM-CLUSTER-MODE :distributed}}]
           (stubbing [read-supervisor-storm-conf {TOPOLOGY-CLASSPATH topo-cp}
                      supervisor-stormdist-root nil
                      supervisor/jlp nil
                      launch-process nil
-                     current-classpath "/base"]
+                     current-classpath (str file-path-separator "base")]
                     (supervisor/launch-worker mock-supervisor
                                               mock-storm-id
                                               mock-port
@@ -331,7 +329,7 @@
                      supervisor-stormdist-root nil
                      supervisor/jlp nil
                      launch-process nil
-                     current-classpath "/base"]
+                     current-classpath (str file-path-separator "base")]
                     (supervisor/launch-worker mock-supervisor
                                               mock-storm-id
                                               mock-port
@@ -471,4 +469,4 @@
      (validate-launched-once (:launched changed)
                              {"sup1" [3 4]}
                              (get-storm-id (:storm-cluster-state cluster) "topology2"))
-     )))
+     )))


finished cleaning up src

finished cleaning up src


routing can simpler

routing can simpler

--- labs/architecture-examples/om/src/todomvc/app.cljs
+++ labs/architecture-examples/om/src/todomvc/app.cljs
@@ -21,14 +21,8 @@
 ;; =============================================================================
 ;; Routing

-(defroute "/" []
-  (swap! app-state assoc :showing :all))
-
-(defroute "/active" []
-  (swap! app-state assoc :showing :active))
-
-(defroute "/completed" []
-  (swap! app-state assoc :showing :completed))
+(defroute "/:filter" []
+  (swap! app-state assoc :showing (keyword filter)))

 (def history (History.))


Update event handling to reflect new clj-minecraft change

--- src/memorystone/core.clj
+++ src/memorystone/core.clj
@@ -56,8 +56,8 @@

 (defn events
   []
-  [(ev/event block.sign-change #'sign-change)
-   (ev/event block.block-break #'sign-break)])
+  [(ev/event "block.sign-change" #'sign-change)
+   (ev/event "block.block-break" #'sign-break)])

 ;; Command Handling
 (defmethod cmd/convert-type :memorystone [sender type arg]


Add midje-test-only arrow form.

Add midje-test-only arrow form.

--- src/midje/semi_sweet.clj
+++ src/midje/semi_sweet.clj
@@ -14,7 +14,10 @@
 (def => "=>")
 (def =not=> "=not=>")
 (def =deny=> "=deny=>")
-(def =streams=> "=streams=>")
+(def =streams=> "=streams=>")
+
+(def ^{:doc "Use this when testing Midje code that processes arrow-forms"}
+     =test=> "=test=>")

 (def expect-arrows [=> =not=> =deny=>])
 (def fake-arrows [=> =streams=>])


Moving toward multiple kinds of expect

Moving toward multiple kinds of expect

--- src/midje/semi_sweet.clj
+++ src/midje/semi_sweet.clj
@@ -88,6 +88,10 @@
      :file-position (user-file-position)}
     (hash-map-duplicates-ok ~@overrides)))

+(defn- expect-expansion [call-form arrow expected-result other-stuff]
+  (let [ [fakes overrides] (fakes-and-overrides other-stuff)]
+      `(let [call# (call-being-tested ~call-form ~expected-result ~overrides)]
+         (expect* call# (vector ~@fakes)))))

 (defmacro expect
   "Run the call form, check that all the mocks defined in the fakes
@@ -97,11 +101,9 @@

    To strip tests from production code, set either clojure.test/*load-tests*
    or midje.semi-sweet/*check* to false."
-  [call-form => expected-result & other-stuff]
+  [call-form arrow expected-result & other-stuff]
   (when (user-desires-checking?)
-    (let [ [fakes overrides] (fakes-and-overrides other-stuff)]
-      `(let [call# (call-being-tested ~call-form ~expected-result ~overrides)]
-         (expect* call# (vector ~@fakes))))))
+    (expect-expansion call-form arrow expected-result other-stuff)))

 (defmulti make-result-supplier (fn [arrow & _]  arrow))


Fix all namespaces names.

Fix all namespaces names.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -368,7 +368,7 @@
 (defn- digest-post-block
   [user entry]
   (let [publisher (:publisher entry)
-        avatar-url (user-avatar/fix-avatar-url c/filestack-api-key (:avatar-url publisher))
+        avatar-url (user-avatar/fix-avatar-url config/filestack-api-key (:avatar-url publisher))
         vid (:video-id entry)
         cleaned-body (text/truncated-body (:body entry))
         has-body (seq cleaned-body)
@@ -829,7 +829,7 @@
         intro (notify-intro msg)
         notification-author (:author notification)
         notification-author-name (:name notification-author)
-        notification-author-url (user-avatar/fix-avatar-url c/filestack-api-key (:avatar-url notification-author))
+        notification-author-url (user-avatar/fix-avatar-url config/filestack-api-key (:avatar-url notification-author))
         uuid (:entry-id notification)
         secure-uuid (:secure-uuid notification)
         origin-url config/web-url


specify the standard SC port

specify the standard SC port

--- src/overtone/sc/core.clj
+++ src/overtone/sc/core.clj
@@ -193,9 +193,9 @@
   (connect)                        ;=> connect to the internal server
   (connect 57710)                  ;=> connect to an external server on the
                                        localhost listening to port 57710
-  (connect \"192.168.1.23\" 57711) ;=> connect to an external server with ip
+  (connect \"192.168.1.23\" 57110) ;=> connect to an external server with ip
                                        address 192.168.1.23 listening to port
-                                       57711"
+                                       57110"
   ([] (connect-internal))
   ([port] (connect "127.0.0.1" port))
   ([host port]


Fix cut and paste errors in exec task

Fix cut and paste errors in exec task

--- src/pallet/task/exec.clj
+++ src/pallet/task/exec.clj
@@ -1,5 +1,5 @@
 (ns pallet.task.exec
-  "Execute bash commands on nodes"
+  "Execute actions an plan functions on nodes"
   (:require
    [clojure.pprint :refer [pprint]]
    [clojure.stacktrace :refer [print-cause-trace]]
@@ -88,7 +88,7 @@
         s (if (namespace s) s (symbol "pallet.actions" action))
         groups (or ;; spec
                 (service-groups compute))]
-    (tracef "bash running on %s groups" (count groups))
+    (tracef "exec running on %s groups" (count groups))
     (if (seq args)
       (-> (lift-groups compute
                        groups


Respond to ting properly on server

Respond to ting properly on server

--- server/src/inlein/server/server.clj
+++ server/src/inlein/server/server.clj
@@ -36,6 +36,12 @@
 (defn- write-ack [^BencodeWriter out msg]
   (bencode-write out {:type "ack" :op (:op msg)}))

+(defn- write-response [^BencodeWriter out op resp]
+  (bencode-write out
+                 (merge {:type "response"
+                         :returns (:op op)}
+                        resp)))
+
 (defn- warn [^BencodeWriter out ^String msg]
   (bencode-write out {:type "log"
                       :level "warn"
@@ -45,13 +51,12 @@
 (defmulti handle-request (fn [operation in out] (:op operation)))

 (defmethod handle-request "ping" [op in out]
-  (bencode-write out {:type "response"
-                      :returns "ping"
-                      :msg "PONG"}))
+  (write-response out op {:msg "PONG"}))

-(defmethod handle-request :default [operation in out]
-  (println "unknown op!")
-  (bencode-write out {:ret "unknown operation"}))
+(defmethod handle-request :default [op in out]
+  (write-response out op
+                  {:error (str "Inlein server is not familiar with the operation "
+                               (:op op))}))

 (defn- do-request [client-sock]
   (with-open [client-sock client-sock


move de-elementize call so that to-template-fn generates proper code.

--- src/rapscallion/core.clj
+++ src/rapscallion/core.clj
@@ -428,6 +428,17 @@
       apply-directives
       ))

+(defn- de-elementize
+  "We work with Element instances as compile-time, but they do not
+   self-evaluate like normal maps do. Convert them into an eval-able form."
+  [x]
+  (walk/prewalk
+   (fn [e]
+     (if (instance? xml/element-type e)
+       (list 'rapscallion.xml.Element. (:tag e) (:attrs e) (:content e))
+       e))
+   x))
+
 (defn to-template-fn
   "Given a template, returns a data structure that can be eval-ed into a function."
   [xml-in]
@@ -436,7 +447,8 @@
         (xml/pop-attrs root :rap:args :rap:require :rap:use :rap:import)
         args (read-all args)
         root (with-meta root {::root true})
-        compiled (compile-xml root)]
+        compiled (-> root compile-xml de-elementize)
+        ]
     `(do
        ~@(for [lib (read-all requires)] `(require '~lib))
        ~@(for [lib (read-all uses)]     `(use '~lib))
@@ -469,24 +481,12 @@
       (reset! *template-ns* ns-name)))
   @*template-ns*)

-(defn- de-elementize
-  "We work with Element instances as compile-time, but they do not
-   self-evaluate like normal maps do. Convert them into an eval-able form."
-  [x]
-  (walk/prewalk
-   (fn [e]
-     (if (instance? xml/element-type e)
-       (list 'rapscallion.xml.Element. (:tag e) (:attrs e) (:content e))
-       e))
-   x))
-
 (defn compile-template
   "Compiles the template into a function that takes a context-map as input
   and produces a lazy sequence of xml-event objects."
   [xml-in]
   (-> xml-in
       to-template-fn
-      de-elementize
       eval-in-ns
       (with-meta {::template-fn true ::template-source xml-in})
       ))


Fix SSLSocketfactory not supported on JDK 9+ issue (#1008)

--- src/riemann/influxdb.clj
+++ src/riemann/influxdb.clj
@@ -47,20 +47,20 @@
         (assoc "value" (:metric event)))))

 (defn get-trust-manager
-  "Returns an array with an instance of `X509TrustManager`
+  "Returns an instance of `X509TrustManager`
   Used for trust all certs in the InfluxDB `insecure` mode."
   []
   (let [trust-manager (proxy [X509TrustManager] []
                         (checkServerTrusted [_ _])
                         (checkClientTrusted [_ _] )
                         (getAcceptedIssuers [] (make-array X509Certificate 0)))]
-    (into-array (list trust-manager))))
+    trust-manager))

 (defn get-ssl-factory
   "Get an instance of `javax.net.ssl.SSLSocketFactory`."
-  []
+  [trust-manager]
   (let [ssl-context (SSLContext/getInstance "TLS")]
-    (.init ssl-context nil (get-trust-manager) (new SecureRandom))
+    (.init ssl-context nil (into-array (list trust-manager)) (new SecureRandom))
     (.getSocketFactory ssl-context)))

 (defn get-hostname-verifier
@@ -73,9 +73,10 @@
 (defn get-builder
   "Returns a new okhttp3.OkHttpClient$Builder."
   [{:keys [timeout insecure]}]
-  (let [builder (new okhttp3.OkHttpClient$Builder)]
+  (let [builder (new okhttp3.OkHttpClient$Builder)
+        trust-manager (get-trust-manager)]
     (when insecure
-      (.sslSocketFactory builder (get-ssl-factory))
+      (.sslSocketFactory builder (get-ssl-factory trust-manager) trust-manager)
       (.hostnameVerifier builder (get-hostname-verifier)))
     (doto builder
       (.readTimeout timeout TimeUnit/MILLISECONDS)


Write `total-seconds->hms`

Write `total-seconds->hms`

--- src/test_utils/core.cljc
+++ src/test_utils/core.cljc
@@ -108,3 +108,9 @@
           :float (vec (repeatedly 4 rand))
           :bytes (vec (map floats->bytes (rand-argb :float)))
           :hex-string (cljstr/join (rand-argb :bytes))))))
+
+(defn total-seconds->hms [total-seconds]
+  (let [hours (quot total-seconds 3600)
+        minutes (quot (rem total-seconds 3600) 60)
+        seconds (rem (rem total-seconds 3600) 60)]
+    [hours minutes seconds]))


remove debug log

remove debug log

--- src/cljs/daveconservatoire/site/mutations.cljs
+++ src/cljs/daveconservatoire/site/mutations.cljs
@@ -18,7 +18,6 @@
            data-query (if (implements? r/IRouteMiddleware comp)
                         (r/remote-query comp route)
                         (om/get-query comp))]
-       (js/console.log (implements? uc/InitialAppState comp))
        (if data-query
          (df/load-data reconciler [{:route/data data-query}] :post-mutation 'fetch/export-idents))
        (om/set-query! root {:params {:route/data (uiu/normalize-route-data-query data-query)}})


trivial fix for get-hosts on 2.0.x

trivial fix for get-hosts on 2.0.x

--- src/clojure/clojurewerkz/cassaforte/client.clj
+++ src/clojure/clojurewerkz/cassaforte/client.clj
@@ -322,7 +322,7 @@
          {:datacenter (.getDatacenter host)
           :address    (.getHostAddress (.getAddress host))
           :rack       (.getRack host)
-          :is-up      (.isUp (.getMonitor host))})
+          :is-up      (.isUp host)})
        (-> session
            .getCluster
            .getMetadata


Treat later-today items specially

Treat later-today items specially

--- org-mode/src/com/gfredericks/org_agenda.clj
+++ org-mode/src/com/gfredericks/org_agenda.clj
@@ -447,6 +447,17 @@
        (finally
          (.delete tmp-file#)))))

+(defn later-today-time
+  "If the item is scheduled for today, but still in the future, then returns
+  the LocalTime that it's scheduled at. Else nil."
+  [item now]
+  (if-let [s (:scheduled item)]
+    (if (instance? LocalDateTime s)
+      (if (= (.toLocalDate s) (.toLocalDate now))
+        (let [lt (.toLocalTime s)]
+          (if (compare/< (.toLocalTime now) lt)
+            lt))))))
+
 (defn write-to-agenda-file
   [deets-by-file {:keys [preamble] :as cfg} today]
   (let [now (ZonedDateTime/now CHICAGO)
@@ -467,7 +478,7 @@
                                 (make-org-link item header))))
         print-todo-line (fn [{:keys [effort properties] :as item}
                              {:keys [omit-effort?]}]
-                          (println (format "-%s %s%s"
+                          (println (format "-%s %s%s%s"
                                            (if omit-effort?
                                              ""
                                              (str " "
@@ -478,6 +489,9 @@
                                                       "?:??"))))
                                            (if (= 1 (priority item))
                                              "  "
+                                             "")
+                                           (if-let [lt (later-today-time item now)]
+                                             (format "(not until %s) " lt)
                                              "")
                                            (format-todo item)))
                           (when (= "t" (get properties "DEBUG"))
@@ -555,7 +569,8 @@
           ;; TODO: we shouldn't be putting things in the calendar if they're
           ;; scheduled in the past...
           (->> todos
-               (sort-by (juxt (comp - priority)
+               (sort-by (juxt #(later-today-time % now) ;; put future things at the bottom
+                              (comp - priority)
                               ;; move rep entries to the bottom for the future blocks, so that
                               ;; nonrepeating items stick out
                               (if (= date today) (constantly nil) :repeat?)


fix config using wrong var

fix config using wrong var

--- src/main/shadow/build/targets/react_native.clj
+++ src/main/shadow/build/targets/react_native.clj
@@ -59,11 +59,11 @@
        append-key (str "\nmodule.exports = " (cljs-comp/munge x) ";\n")}

       (and (map? x)
-           (qualified-symbol? (:exports x)))
+           (qualified-symbol? (:export x)))
       (-> x
           (update :depends-on util/set-conj :index)
           (assoc :entries [(output/ns-only x)])
-          (update append-key str "\nmodule.exports = " (cljs-comp/munge x) ";\n"))
+          (update append-key str "\nmodule.exports = " (cljs-comp/munge (:export x)) ";\n"))

       :else
       (throw (ex-info "invalid :chunks config" {:x x})))))


clearer position indicator

clearer position indicator

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

--- plugins/SlideExplorer2/src/slide_explorer/view.clj
+++ plugins/SlideExplorer2/src/slide_explorer/view.clj
@@ -121,16 +121,20 @@
         (paint/draw-image g image x y)
         ))))

-(defn paint-position [^Graphics2D g
-                      {[w h] :tile-dimensions
-                       :keys [zoom] :as screen-state}
-                      x y color]
-    (when (and x y w h color)
-      (canvas/draw g
-                   [{:type :rect :l (inc (* zoom x)) :t (inc (* zoom y))
-                     :w (* zoom w) :h (* zoom h)
-                     :color color
-                     :stroke {:width 2}}])))
+(defn paint-position
+  "Paints a rectangle outlining the camera's field of view at a
+   given position (x,y). The rectangle contains a stroke of the
+   given color, edged by a black background for better visibility."
+  [^Graphics2D graphics
+   {[w h] :tile-dimensions
+    :keys [zoom] :as screen-state}
+   x y color]
+  (when (and x y w h color)
+    (let [rect {:type :rect :l (inc (* zoom x)) :t (inc (* zoom y))
+                :w (* zoom w) :h (* zoom h)}]
+      (canvas/draw graphics
+                   [(assoc rect :color :black :stroke {:width 4})
+                    (assoc rect :color color :stroke {:width 3})]))))

 (defn paint-stage-position [^Graphics2D g screen-state]
   (let [[x y] (:xy-stage-position screen-state)


AW + CY | 400 | twitter doesn't ask you to reauthorise the application on sign in

--- src/objective8/front_end/workflows/twitter.clj
+++ src/objective8/front_end/workflows/twitter.clj
@@ -12,7 +12,7 @@
                                     secret-token
                                     "https://api.twitter.com/oauth/request_token"
                                     "https://api.twitter.com/oauth/access_token"
-                                    "https://api.twitter.com/oauth/authorize"
+                                    "https://api.twitter.com/oauth/authenticate"
                                     :hmac-sha1)
      :callback-url (str utils/host-url "/twitter-callback")}
     :invalid-configuration))


Silent connect test

Silent connect test

--- test/com/wsscode/pathom/connect/test_test.cljc
+++ test/com/wsscode/pathom/connect/test_test.cljc
@@ -83,7 +83,8 @@
 (defn test-env [env]
   (test/prepare-environment
     (merge {::test/data-bank    (atom {})
-            ::p.connect/indexes indexes}
+            ::p.connect/indexes indexes
+            ::test/report-fn    test/silent-reporter}
            env)))

 (deftest test-resolve-attr
@@ -212,20 +213,20 @@
   (with-redefs [test/now (fn [] "NOW")]
     (is (= (-> (test-resolver {} `greet)
                ::test/data-bank)
-           {::test/call-history {`greet {{} {:greet "Hello"}}}
-            ::test/call-log     [["NOW" `greet {} {:greet "Hello"}]]
-            :com.wsscode.pathom.connect.test/multi-args   #{#{:greet :stranger}}
-            :greet              #{"Hello"}}))
+           {::test/call-history                         {`greet {{} {:greet "Hello"}}}
+            ::test/call-log                             [["NOW" `greet {} {:greet "Hello"}]]
+            :com.wsscode.pathom.connect.test/multi-args #{#{:greet :stranger}}
+            :greet                                      #{"Hello"}}))

     (is (= (-> (test-resolver {} `greet-stranger)
                ::test/data-bank)
-           {::test/call-history {`greet          {{} {:greet "Hello"}}
-                                 `greet-stranger {{:greet "Hello"} {:stranger "Hello Stranger!"}}}
-            ::test/call-log     [["NOW" `greet {} {:greet "Hello"}]
-                                 ["NOW" `greet-stranger {:greet "Hello"} {:stranger "Hello Stranger!"}]]
-            :com.wsscode.pathom.connect.test/multi-args   #{#{:greet :stranger}}
-            :greet              #{"Hello"}
-            :stranger           #{"Hello Stranger!"}}))
+           {::test/call-history                         {`greet          {{} {:greet "Hello"}}
+                                                         `greet-stranger {{:greet "Hello"} {:stranger "Hello Stranger!"}}}
+            ::test/call-log                             [["NOW" `greet {} {:greet "Hello"}]
+                                                         ["NOW" `greet-stranger {:greet "Hello"} {:stranger "Hello Stranger!"}]]
+            :com.wsscode.pathom.connect.test/multi-args #{#{:greet :stranger}}
+            :greet                                      #{"Hello"}
+            :stranger                                   #{"Hello Stranger!"}}))

     (is (= ::test/unreachable
            (-> (test-resolver
@@ -278,7 +279,8 @@
 (defn test-resolver-call-count
   ([resolvers resolver] (test-resolver-call-count {} resolvers resolver))
   ([env resolvers resolver-sym]
-   (let [env (merge {::p.connect/indexes (make-index resolvers)} env)
+   (let [env (merge {::p.connect/indexes (make-index resolvers)
+                     ::test/report-fn test/silent-reporter} env)
          res (test/test-resolver env (p.connect/resolver-data env resolver-sym))]
      (some->> res
               ::test/data-bank deref ::test/call-history
@@ -309,7 +311,8 @@
 (defn test-call-count
   ([resolvers] (test-call-count {} resolvers))
   ([env resolvers]
-   (let [res (test/test-index (merge {::p.connect/indexes (make-index resolvers)}
+   (let [res (test/test-index (merge {::p.connect/indexes (make-index resolvers)
+                                      ::test/report-fn test/silent-reporter}
                                      env))]
      (->> res
           ::test/data-bank deref ::test/call-history


(PDB-4832) Add schema-diff check for migration 76

Add a schema diff check for migration 76 when the index has not been
applied by migration 74 (which will be the case for anyone running a
version of pdb between 6.10.0 and 6.11.2.

--- test/puppetlabs/puppetdb/scf/migrate_partitioning_test.clj
+++ test/puppetlabs/puppetdb/scf/migrate_partitioning_test.clj
@@ -1277,3 +1277,40 @@
                                           :same nil}]))
                                     dates))}
            (diff-schema-maps before-migration (schema-info-map *db*))))))
+
+(deftest migration-76-schema-diff
+  (clear-db-for-testing!)
+  ;; don't add the idx_reports_id index when fast forwarding past migration 74
+  (binding [partitioning/add-report-id-idx? false]
+    (fast-forward-to-migration! 75))
+
+  (let [before-migration (schema-info-map *db*)
+        today (ZonedDateTime/now (ZoneId/of "UTC"))
+        days-range (range -4 4)
+        dates (map #(.plusDays today %) days-range)
+        part-names (map #(str/lower-case (partitioning/date-suffix %)) dates)]
+    (apply-migration-for-testing! 76)
+
+    (is (= {:index-diff (into
+                          []
+                          cat
+                          (map
+                            (fn [part-name]
+                              (let [table-name (str "reports_" part-name)]
+                                 [{:left-only nil
+                                  :right-only
+                                  {:schema "public"
+                                   :table table-name
+                                   :index (str "idx_reports_id_" part-name)
+                                   :index_keys ["id"]
+                                   :type "btree"
+                                   :unique? true
+                                   :functional? false
+                                   :is_partial false
+                                   :primary? false
+                                   :user "pdb_test"}
+                                  :same nil}]))
+                            part-names))
+            :table-diff nil
+            :constraint-diff nil}
+           (diff-schema-maps before-migration (schema-info-map *db*))))))


Fix two issues w/ nginx pallet config. 1) create /etc/nginx/certs/ directory, so they have a place to go, 2) delete the default site

--- src/circle/backend/nodes/circle.clj
+++ src/circle/backend/nodes/circle.clj
@@ -94,6 +94,8 @@
                               (gem install bundler)
                               (gem install rspec))

+                             (directory/directory "/etc/nginx/certs" :action :create)
+                             (file/file "/etc/nginx/sites-enabled/default" :action :delete)
                              (remote-file/remote-file "/etc/nginx/sites-enabled/circle" :local-file "nginx-circle.conf" :no-versioning true)
                              (remote-file/remote-file "/etc/nginx/certs/circleci.com.crt" :local-file "circleci.com.crt" :no-versioning true)
                              (remote-file/remote-file "/etc/nginx/certs/circleci.com.key" :local-file "circleci.com.key" :no-versioning true)


provide a copy of MAX_BATCH_SIZE_CONF

provide a copy of MAX_BATCH_SIZE_CONF

for convenience; so that configuring it doesn't require an additional class import

--- src/clj/marceline/storm/trident.clj
+++ src/clj/marceline/storm/trident.clj
@@ -4,6 +4,7 @@
            [storm.trident.tuple TridentTupleView]
            [storm.trident.fluent GroupedStream]
            [backtype.storm.tuple Values Fields]
+           [storm.trident.spout RichSpoutBatchExecutor]
            [backtype.storm.utils RotatingMap TimeCacheMap]
            [marceline.storm.trident.clojure
             ClojureFunction
@@ -18,6 +19,10 @@
   (:require [backtype.storm.clojure :refer (to-spec normalize-fns)])
   (:refer-clojure :exclude [group-by get nth vals first count partition-by shuffle filter])
   (:gen-class))
+
+
+;; This is to make configuration easier
+(def MAX_BATCH_SIZE_CONF RichSpoutBatchExecutor/MAX_BATCH_SIZE_CONF)

 ;; ## tridentfn
 (defn clojure-tridentfn* [fn-var args]


Let's just call it an "url"

Let's just call it an "url"

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -608,15 +608,15 @@
 (defn create-player
   "Creates the player with the state built from given options by starting event
   processing loop and mounting Reagent component in DOM."
-  [dom-node asciicast-url options]
+  [dom-node url options]
   (let [dom-node (if (string? dom-node) (.getElementById js/document dom-node) dom-node)
-        state (make-player-ratom asciicast-url options)]
+        state (make-player-ratom url options)]
     (mount-player-with-ratom state dom-node)))

 (defn ^:export CreatePlayer
   "JavaScript API for creating the player, delegating to create-player."
-  ([dom-node asciicast-url] (CreatePlayer dom-node asciicast-url {}))
-  ([dom-node asciicast-url options]
+  ([dom-node url] (CreatePlayer dom-node url {}))
+  ([dom-node url options]
    (let [options (-> options
                      (js->clj :keywordize-keys true)
                      (rename-keys {:autoPlay :auto-play
@@ -625,6 +625,6 @@
                                    :authorURL :author-url
                                    :startAt :start-at
                                    :authorImgURL :author-img-url}))]
-     (create-player dom-node asciicast-url options))))
+     (create-player dom-node url options))))

 (enable-console-print!)


Add keyboard event handling

Add keyboard event handling

--- src/cljs/asciinema_player/view.cljs
+++ src/cljs/asciinema_player/view.cljs
@@ -131,9 +131,19 @@

 (defn player-style [] {})

+(defn process-key-event [events e]
+  (if-let [event-name (case (.-which e)
+                        32 :toggle-play
+                        102 :toggle-fullscreen
+                        nil)]
+    (do
+      (.preventDefault e)
+      (go (>! events [event-name])))))
+
 (defn player [state events]
-  [:div.asciinema-player-wrapper {:tab-index -1}
-   [:div.asciinema-player {:class-name (player-class-name (:theme @state)) :style (player-style)}
-    [terminal (:font-size @state) (:lines @state)]
-    [control-bar (:playing @state) false 24 (:duration @state) events]
-    #_ [start-overlay]]])
+  (let [on-key-press (partial process-key-event events)]
+    [:div.asciinema-player-wrapper {:tab-index -1 :on-key-press on-key-press}
+    [:div.asciinema-player {:class-name (player-class-name (:theme @state)) :style (player-style)}
+      [terminal (:font-size @state) (:lines @state)]
+      [control-bar (:playing @state) false 24 (:duration @state) events]
+      #_ [start-overlay]]]))


dot list of influence used now has colors

--- src/cljs/netrunner/deckbuilder.cljs
+++ src/cljs/netrunner/deckbuilder.cljs
@@ -267,6 +267,24 @@
   "Returns a string with UTF-8 empty circles representing MWL restricted cards."
   [num]
   (apply str (conj (for [_ (range num)] "○") "")))
+
+(defn influence-html
+  "Returns hiccup-ready vector with dots colored appropriately to deck's influence."
+  [deck]
+  (let [infmap (influence deck)]
+    (for [factionkey (sort (keys infmap))] [:span.influence
+                                            {:class (name factionkey)
+                                             :dangerouslySetInnerHTML
+                                                    #js {:__html (influence-dots (factionkey infmap))}}])))
+
+(defn restricted-html
+  "Returns hiccup-ready vector with dots colored appropriately to deck's MWL restricted cards."
+  [deck]
+  (let [mwlmap (mostwanted deck)]
+    (for [factionkey (sort (keys mwlmap))] [:span.influence
+                                         {:class (name factionkey)
+                                          :dangerouslySetInnerHTML
+                                          #js {:__html (restricted-dots (factionkey mwlmap))}}])))

 (defn octgn-link [owner]
   (let [deck (om/get-state owner :deck)
@@ -431,10 +449,7 @@
                     [:span {:class (when (> inf limit) "invalid")} inf]
                     "/" (if (= INFINITY limit) "∞" limit)
                     (if (< 0 (+ inf mwl))
-                      (list " " [:span.influence
-                       {:class (name :neutral)
-                        :dangerouslySetInnerHTML
-                        #js {:__html (str (influence-dots inf) (restricted-dots mwl))}}]))])
+                      (list " " (influence-html deck) (restricted-html deck)))])
                  (when (= (:side identity) "Corp")
                    (let [min-point (min-agenda-points deck)
                          points (agenda-points deck)]


Make async test verbosity and flogging optional.

And off by default.

--- web/test-integration/immutant/web/integ_test.clj
+++ web/test-integration/immutant/web/integ_test.clj
@@ -52,11 +52,12 @@

 (let [serializer (java.util.concurrent.Executors/newSingleThreadExecutor)]
   (defn mark [& msg]
-    (let [ts (.format (java.text.SimpleDateFormat. "HH:mm:ss,SSS")
-               (java.util.Date.))
-          ^Runnable r #(apply println ts msg)]
-      (when (in-container?) (apply println ts msg))
-      (.submit serializer r))))
+    (when (System/getenv "VERBOSE")
+      (let [ts (.format (java.text.SimpleDateFormat. "HH:mm:ss,SSS")
+                 (java.util.Date.))
+            ^Runnable r #(apply println ts msg)]
+        (when (in-container?) (apply println ts msg))
+        (.submit serializer r)))))

 (defmacro marktest [t & body]
   `(deftest ~t
@@ -68,11 +69,13 @@
 (defmacro flog
   "runs the body 100 times"
   [& body]
-  `(dotimes [n# 100]
-     (mark (format "RUNNING %s (iteration %s)"
-             (-> *testing-vars* first meta :name)
-             n#))
-     ~@body))
+  `(if (System/getenv "FLOG")
+     (dotimes [n# 100]
+       (mark (format "RUNNING %s (iteration %s)"
+               (-> *testing-vars* first meta :name)
+               n#))
+       ~@body)
+     (do ~@body)))

 (marktest http-session-store
   (is (= "0" (get-body (url) :cookies nil)))


basic exercice rendering

basic exercice rendering

--- src/clj/leiningen/midje_doc/run/renderer.clj
+++ src/clj/leiningen/midje_doc/run/renderer.clj
@@ -37,6 +37,24 @@
           rst-new (.replaceAll rst-ori (str "\n" spaces) "\n")
           fst-str (.substring s 0 fst-idx)]
         (str fst-str rst-new)))))
+
+
+
+(defn render-exercice [title exs solution]
+
+   [:div
+
+    [:h4 "exercice : " title]
+    [:div "résoudre avec les contraintes suivantes"
+     (for [e exs]
+       [:pre (-> e str basic-html-escape)]
+       )]
+
+
+    [:pre "Your code goes here ! "]
+     ]
+  )
+

 (defn render-element [elem]
   (condp = (:type elem)
@@ -94,15 +112,15 @@
          output))]

     :exercice
-    [:div "exercice // TODO RENDERING"
-     [:pre (-> (:content elem)
-               str
-               (basic-html-escape))]
-     ]
+    (apply render-exercice (:content elem))
+

     (throw (Exception. (str "not matching clause on " elem)))

     ))
+
+
+

 (defn render-toc-element [elem]


avoid errors when insert does not return a sequence of maps

--- src/clj_money/models/storage/sql_storage.clj
+++ src/clj_money/models/storage/sql_storage.clj
@@ -45,7 +45,9 @@
   "Accepts a hash and replaces underscores in key names
   with hyphens"
   [model]
-  (update-keys model ->clojure-key))
+  (if (map? model)
+    (update-keys model ->clojure-key)
+    model))

 (defn- insert
   "Inserts a record into the specified table"


Switch workflow and catalog panel

Switch workflow and catalog panel

--- src/cljs/onyx_dashboard/components/jobs.cljs
+++ src/cljs/onyx_dashboard/components/jobs.cljs
@@ -108,13 +108,13 @@
             (om/build job-overview-panel job)
             (om/build task-panel job {})
             (p/panel
+              {:header (om/build section-header-collapsible {:text "Workflow"} {})
+               :collapsible? true
+               :bs-style "primary"}
+              (om/build clojure-block {:input pretty-workflow}))
+
+            (p/panel
               {:header (om/build section-header-collapsible {:text "Catalog"} {})
                :collapsible? true
                :bs-style "primary"}
-              (om/build clojure-block {:input pretty-catalog}))
-
-            (p/panel
-              {:header (om/build section-header-collapsible {:text "Workflow"} {})
-               :collapsible? true
-               :bs-style "primary"}
-              (om/build clojure-block {:input pretty-workflow})))))
+              (om/build clojure-block {:input pretty-catalog})))))


don't use default-value in forms, fixes #94

--- priv/ui/src/cljs/holiday_ping_ui/common/forms.cljs
+++ priv/ui/src/cljs/holiday_ping_ui/common/forms.cljs
@@ -24,8 +24,8 @@
 (defmethod input-view "select"
   [form field]
   [:div.select
-   [:select {:on-change     (field-handler form (:key field))
-             :default-value (get field :value "")}
+   [:select {:on-change (field-handler form (:key field))
+             :value     (get field :value "")}
     (for [option (:options field)
           :let   [value (get option :value option)
                   text  (get option :text option)]]
@@ -33,11 +33,11 @@

 (defmethod input-view :default
   [form {:keys [key type disabled] :as field}]
-  (let [attrs {:type          type
-               :name          (field-name field)
-               :placeholder   (field-name field)
-               :default-value (get @form key)
-               :on-change     (field-handler form key)}]
+  (let [attrs {:type        type
+               :name        (field-name field)
+               :placeholder (field-name field)
+               :value       (get @form key)
+               :on-change   (field-handler form key)}]
     [:input.input (if disabled
                     (assoc attrs :disabled true)
                     attrs)]))


upgrade to ubergraph 0.3.0

upgrade to ubergraph 0.3.0

--- iwaswhere-web/project.clj
+++ iwaswhere-web/project.clj
@@ -18,7 +18,7 @@
                  [cljsjs/moment "2.10.6-4"]
                  [cljsjs/leaflet "0.7.7-4"]
                  [com.drewnoakes/metadata-extractor "2.9.1"]
-                 [ubergraph "0.2.3"]
+                 [ubergraph "0.3.0"]
                  [camel-snake-kebab "0.4.0"]
                  [matthiasn/systems-toolbox "0.6.1-alpha6"]
                  [matthiasn/systems-toolbox-ui "0.6.1-alpha8"]


As a convenience, set :source-paths for any string args

--- modules/core/src/main/clojure/immutant/dev.clj
+++ modules/core/src/main/clojure/immutant/dev.clj
@@ -110,5 +110,6 @@
 Works only under Clojure 1.4 or newer. (beta)"
   [& coords]
   (reload-project!
-   (update-in (current-project) [:dependencies]
-              #(set (concat % coords)))))
+   (-> (current-project)
+       (update-in [:dependencies] #(set (concat % (remove string? coords))))
+       (update-in [:source-paths] #(concat % (filter string? coords))))))


Fix drop table to use plurals.

Fix drop table to use plurals.

--- clj_record/test/main.clj
+++ clj_record/test/main.clj
@@ -6,8 +6,8 @@

 (defn drop-tables []
   (try
-    (sql/drop-table :manufacturer)
-    (sql/drop-table :product)
+    (sql/drop-table :manufacturers)
+    (sql/drop-table :products)
     (catch Exception e)))

 (defn create-tables []


optimize lexical renames, now around ~1.5X of the JVM under JavaScriptCore, under 3X for V8

--- src/main/clojure/cljs/compiler.cljc
+++ src/main/clojure/cljs/compiler.cljc
@@ -87,7 +87,7 @@
          ;; Unshadowing
          (let [depth       (shadow-depth s)
                code        #?(:clj  (System/identityHashCode s)
-                              :cljs (hash s))
+                              :cljs (-hash ^not-native name))
                renamed     (get *lexical-renames* code)
                name        (cond
                              (true? field) (str "self__." name)
@@ -766,9 +766,12 @@
     (binding [*lexical-renames*
               (into *lexical-renames*
                 (when (= :statement context)
-                  (map #(vector #?(:clj (System/identityHashCode %)
-                                   :cljs (hash %))
-                         (gensym (str (:name %) "-")))
+                  (map
+                    (fn [binding]
+                      (let [name (:name binding)]
+                        (vector #?(:clj  (System/identityHashCode binding)
+                                   :cljs (-hash ^not-native name))
+                          (gensym (str name "-")))))
                     bindings)))]
       (doseq [{:keys [init] :as binding} bindings]
         (emits "var ")


format low priority differently

format low priority differently

--- org-mode/src/com/gfredericks/org_agenda.clj
+++ org-mode/src/com/gfredericks/org_agenda.clj
@@ -378,7 +378,9 @@
         {:keys [triage deadlines by-day past-log]} (synthesize-agenda deets-by-file)
         format-todo (fn [{:keys [done todo priority-cookie header] :as item}]
                       (format "%s%s %s"
-                              (or done todo)
+                              (cond-> (or done todo)
+                                (= "[#C]" priority-cookie)
+                                (->> .toLowerCase (format "(%s)")))
                               (if priority-cookie
                                 (str " " priority-cookie)
                                 "")
@@ -387,7 +389,7 @@
                                 (make-org-link item header))))
         print-todo-line (fn [{:keys [effort properties] :as item}
                              {:keys [omit-effort?]}]
-                          (println (format "-%s %s"
+                          (println (format "-%s %s%s"
                                            (if omit-effort?
                                              ""
                                              (str " "
@@ -396,6 +398,9 @@
                                                     (if (= "t" (get properties "EFFORT_EXEMPT"))
                                                       "    "
                                                       "?:??"))))
+                                           (if (= 1 (priority item))
+                                             "  "
+                                             "")
                                            (format-todo item))))
         print-calendar (fn [items]
                          (->> items


properly skip parsing cljsjs files since we don't need them

--- src/main/shadow/build/classpath.clj
+++ src/main/shadow/build/classpath.clj
@@ -57,94 +57,97 @@
         :module-type (or module-type "goog"))))

 (defn inspect-js [{:keys [compiler] :as state} {:keys [resource-name url] :as rc}]
-  (let [source
-        (slurp url)
-
-        ;; all requires are collected into
-        ;; :js-requires ["foo" "bar/thing" "./baz]
-        ;; all imports are collected into
-        ;; :js-imports ["react"]
-        {:keys [js-requires
-                js-imports
-                js-errors
-                js-warnings
-                js-invalid-requires
-                js-language
-                js-str-offsets
-                goog-module
-                goog-requires
-                goog-provides]
-         :as info}
-        (JsInspector/getFileInfo
-          compiler
-          ;; SourceFile/fromFile seems to leak file descriptors
-          (SourceFile/fromCode resource-name source))]
-
-    (cond
-      (seq js-errors)
-      (do (log/warn (str "failed to parse javascript file: " url "\n"
-                         (pr-str js-errors)))
-          nil)
-
-      ;; goog.provide('thing')
-      ;; goog.require('foo')
-      ;; goog.module('some.thing')
-      (or (seq goog-module)
-          (seq goog-provides)
-          (seq goog-requires)
-          (= resource-name "goog/base.js"))
-      ;; FIXME: support require/import in ClosureJS
-      (let [deps
-            (-> []
-                (cond->
-                  (not= resource-name "goog/base.js")
-                  (conj 'goog))
-                (into (map util/munge-goog-ns) goog-requires))]
-        (-> rc
-            (assoc :type :goog
-                   :requires (into #{} deps)
-                   :provides (into #{} (map util/munge-goog-ns) goog-provides)
-                   :deps deps)
-            (cond->
-              (seq goog-module)
-              (-> (assoc :goog-module true)
-                  (update :provides conj (util/munge-goog-ns goog-module)))
-
-              (= resource-name "goog/base.js")
-              (update :provides conj 'goog)
-              )))
-
-      ;; require("foo")
-      ;; import ... from "foo"
-      ;; might be no require/import/exports
-      ;; externs files will hit this
-      :else
-      (let [js-deps
-            (->> (concat js-requires js-imports)
-                 ;; FIXME: not sure I want to go down this road or how
-                 ;; require("./some.css") should not break the build though
-                 (remove npm/asset-require?)
-                 (distinct)
-                 (map npm/maybe-convert-goog)
-                 (into []))
-
-            ns (-> (ModuleNames/fileToModuleName resource-name)
-                   (symbol))]
-
-        (assoc rc
-          :source source
-          :js-language js-language
-          :type :js
-          :classpath true
-          :ns ns
-          :provides #{ns}
-          :requires #{}
-          :js-requires js-requires
-          :js-imports js-imports
-          :js-deps js-deps
-          :js-str-offsets js-str-offsets
-          :deps js-deps))
-      )))
+  ;; avoid parsing cljsjs files since they are standalone bundles
+  ;; and can never require/import anything, we don't want to ever include them anyways
+  (when-not (str/starts-with? resource-name "cljsjs/")
+    (let [source
+          (slurp url)
+
+          ;; all requires are collected into
+          ;; :js-requires ["foo" "bar/thing" "./baz]
+          ;; all imports are collected into
+          ;; :js-imports ["react"]
+          {:keys [js-requires
+                  js-imports
+                  js-errors
+                  js-warnings
+                  js-invalid-requires
+                  js-language
+                  js-str-offsets
+                  goog-module
+                  goog-requires
+                  goog-provides]
+           :as info}
+          (JsInspector/getFileInfo
+            compiler
+            ;; SourceFile/fromFile seems to leak file descriptors
+            (SourceFile/fromCode resource-name source))
+
+          ns (-> (ModuleNames/fileToModuleName resource-name)
+                 (symbol))]
+
+      (cond
+        (seq js-errors)
+        (do (log/warn (str "failed to parse javascript file: " url "\n"
+                           (pr-str js-errors)))
+            nil)
+
+        ;; goog.provide('thing')
+        ;; goog.require('foo')
+        ;; goog.module('some.thing')
+        (or (seq goog-module)
+            (seq goog-provides)
+            (seq goog-requires)
+            (= resource-name "goog/base.js"))
+        ;; FIXME: support require/import in ClosureJS
+        (let [deps
+              (-> []
+                  (cond->
+                    (not= resource-name "goog/base.js")
+                    (conj 'goog))
+                  (into (map util/munge-goog-ns) goog-requires))]
+          (-> rc
+              (assoc :type :goog
+                     :requires (into #{} deps)
+                     :provides (into #{} (map util/munge-goog-ns) goog-provides)
+                     :deps deps)
+              (cond->
+                (seq goog-module)
+                (-> (assoc :goog-module true)
+                    (update :provides conj (util/munge-goog-ns goog-module)))
+
+                (= resource-name "goog/base.js")
+                (update :provides conj 'goog)
+                )))
+
+        ;; require("foo")
+        ;; import ... from "foo"
+        ;; might be no require/import/exports
+        ;; externs files will hit this
+        :else
+        (let [js-deps
+              (->> (concat js-requires js-imports)
+                   ;; FIXME: not sure I want to go down this road or how
+                   ;; require("./some.css") should not break the build though
+                   (remove npm/asset-require?)
+                   (distinct)
+                   (map npm/maybe-convert-goog)
+                   (into []))]
+
+          (assoc rc
+            :source source
+            :js-language js-language
+            :type :js
+            :classpath true
+            :ns ns
+            :provides #{ns}
+            :requires #{}
+            :js-requires js-requires
+            :js-imports js-imports
+            :js-deps js-deps
+            :js-str-offsets js-str-offsets
+            :deps js-deps))
+        ))))

 (defn inspect-cljs
   "looks at the first form in a .cljs file, analyzes it if (ns ...) and returns the updated resource


Update example reference to table stats.

--- examples/movie-lens/src/movie_lens/dataset.clj
+++ examples/movie-lens/src/movie_lens/dataset.clj
@@ -7,6 +7,7 @@
     [merkle-db.database :as db]
     [merkle-db.spark.load :as msl]
     [merkle-db.table :as table]
+    [merkle-db.tools.stats :as stats]
     [merkledag.node :as node]
     [movie-lens.movie :as movie]
     [movie-lens.rating :as rating]
@@ -51,10 +52,10 @@
                   init-store
                   movie/table-parameters
                   record-rdd)
-          stats (table/collect-stats table)
+          stats (stats/collect-table-stats table)
           elapsed (/ (- (System/currentTimeMillis) start) 1e3)]
       ;(u/pprint table)
-      (table/print-stats stats)
+      (stats/print-table-stats stats)
       (log/infof "Loaded movies table data (%s) in %s"
                  (multihash/base58 (::node/id table))
                  (u/duration-str elapsed))
@@ -73,9 +74,9 @@
                            csv-path
                            tag/csv-header
                            tag/parse-row))
-          stats (table/collect-stats table)
+          stats (stats/collect-table-stats table)
           elapsed (/ (- (System/currentTimeMillis) start) 1e3)]
-      (table/print-stats stats)
+      (stats/print-table-stats stats)
       (log/infof "Loaded tags table (%s) in %s"
                  (multihash/base58 (::node/id table))
                  (u/duration-str elapsed))
@@ -94,9 +95,9 @@
                            csv-path
                            rating/csv-header
                            rating/parse-row))
-          stats (table/collect-stats table)
+          stats (stats/collect-table-stats table)
           elapsed (/ (- (System/currentTimeMillis) start) 1e3)]
-      (table/print-stats stats)
+      (stats/print-table-stats stats)
       (log/infof "Loaded ratings table (%s) in %s"
                  (multihash/base58 (::node/id table))
                  (u/duration-str elapsed))


handle old chats that are missing session/uuid

--- src-cljs/frontend/colors.cljs
+++ src-cljs/frontend/colors.cljs
@@ -31,4 +31,6 @@

 (defn find-color [uuid->cust cust-uuid alt-uuid]
   (or (get-in uuid->cust [cust-uuid :cust/color-name])
-      (choose-from-uuid color-idents alt-uuid)))
+      (if alt-uuid ;; handles old chats that are missing a session/uuid
+        (choose-from-uuid color-idents alt-uuid)
+        :color.name/gray)))


centered h1 in article.cljs

centered h1 in article.cljs

--- src-cljs/rmfu_ui/article.cljs
+++ src-cljs/rmfu_ui/article.cljs
@@ -4,7 +4,7 @@
 [:div.container.jumbotron.largemain
  [:div.row
   [:div.col-lg-12
-   [:h1
+   [:h1.text-center
     "Article"]
    [:div.pre-scrollable.borderbox
     [:h4.col-lg-9.articleheading


Test the StaticMultiMatcher - no big difference

--- perf-test/clj/reitit/opensensors_perf_test.clj
+++ perf-test/clj/reitit/opensensors_perf_test.clj
@@ -621,8 +621,8 @@

 (comment
   ;; 629ms (arraylist)
-  ;; 395ns (transient)
-  ;; (staticMultiMatcher)
+  ;; 409ns (transient)
+  ;; 409ns (staticMultiMatcher)
   (let [app (ring/ring-handler (ring/router opensensors-routes) {:inject-match? false, :inject-router? false})
         request {:uri "/v1/users/1/devices/1", :request-method :get}]
     (doseq [[p r] (-> app (ring/get-router) (r/routes))]
@@ -631,7 +631,7 @@
     (println (app request))
     (cc/quick-bench
       (app request))
-    #_#_#_(prof/start {})
+    (prof/start {})
     ; "Elapsed time: 9183.657012 msecs"
     ; "Elapsed time: 8674.70132 msecs"
     (time


10% faster in opensensors/real-world test

--- perf-test/clj/reitit/opensensors_perf_test.clj
+++ perf-test/clj/reitit/opensensors_perf_test.clj
@@ -440,6 +440,7 @@
     ;;   723ns (segment-router)
     ;;   702ns (before path-parameters)
     ;;   806ns (decode path-parameters)
+    ;;   735ns (maybe-map-values)
     (b! "reitit-ring" reitit-ring-f)

     ;;  2821ns


Clean up some commas.

Clean up some commas.

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -331,9 +331,9 @@
               [:div.form-group
                [:label "Value"]
                [:input.form-control#env-var-value
-                {:required true,
-                 :type "text",
-                 :value new-env-var-value,
+                {:required true
+                 :type "text"
+                 :value new-env-var-value
                  :auto-complete "off"
                  :on-change #(utils/edit-input owner (conj state/inputs-path :new-env-var-value) %)}]]


setting up the test file for watney.core; adding a fact for the simple.html to simple.md conversion

--- test/watney/core_test.clj
+++ test/watney/core_test.clj
@@ -1,7 +1,6 @@
 (ns watney.core-test
-  (:require [clojure.test :refer :all]
-            [watney.core :refer :all]))
+  (:require [watney.core :as w])
+  (:use midje.sweet))

-(deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))
+(fact "parsing the simple.html file should return a correct simple.md"
+  (w/convert (slurp "fixtures/simple.html")) => (slurp "fixtures/simple.md"))


Fix: get only first parameter when using function ~#geometry

[PDOK-3691]

--- src/main/clojure/pdok/featured/json_reader.clj
+++ src/main/clojure/pdok/featured/json_reader.clj
@@ -102,6 +102,7 @@
     (Integer. srid)))

 (defn create-geometry-atrribute [geometry]
+  (println "Geometry: " geometry)
   (if-let [type (get geometry "type")]
     (GeometryAttribute. type (get geometry type) (get-valid-srid geometry))))

@@ -113,7 +114,7 @@
       "~#int"     (if params (int (first params)) (nilled java.lang.Integer))
       "~#boolean" (if params (boolean (first params)) (nilled java.lang.Boolean))
       "~#double"  (if params (double (first params)) (nilled java.lang.Double))
-      "~#geometry" (if params (create-geometry-atrribute params) (nilled pdok.featured.GeometryAttribute))
+      "~#geometry" (if params (create-geometry-atrribute (first params)) (nilled pdok.featured.GeometryAttribute))
       element ; never fail just return element
       ))
   )


Tweak some options

Tweak some options

--- src/overtone_workspace/grunbles.clj
+++ src/overtone_workspace/grunbles.clj
@@ -25,7 +25,7 @@

 (defn player [beat rates]
   (let [rates (if (empty? rates)
-                [4 6 2 2 1.5 1.5]
+                [2 1.5 1.5 0.75 0.75 1]
                 rates)
         dur (/ 60.0 (metro :bpm))
         attack (* dur 4) ; 1bar
@@ -34,7 +34,7 @@
         (do
           (if (zero? (mod beat 8)) (grumble :freq-mul 0.5 :attack attack :release rel))
           (if (zero? (mod beat 16)) (grumble :freq-mul 1 :attack attack :release rel))
-          (if (zero? (mod beat 32)) (grumble :freq-mul (choose rates) :attack attack :release rel))
+          (if (zero? (mod beat 64)) (grumble :freq-mul (choose rates) :attack attack :release rel))
           ))
     (apply-by (metro (inc beat)) #'player (inc beat) rates [])
     ))


(PDB-5022) engine/get-clause: move orphaned :else clause

--- src/puppetlabs/puppetdb/query_eng/engine.clj
+++ src/puppetlabs/puppetdb/query_eng/engine.clj
@@ -2067,16 +2067,13 @@
 (defn get-clause
   [clause clauses]
   (when-let [candidates (seq (filter #(= (first %) clause) clauses))]
-    (cond
-      (> (count candidates) 1)
+    (when (> (count candidates) 1)
       (throw (IllegalArgumentException.
-              (tru "Multiple ''{0}'' clauses are not permitted" clause)))
-
-      (not (second (first candidates)))
+              (tru "Multiple ''{0}'' clauses are not permitted" clause))))
+    (when (not (second (first candidates)))
       (throw (IllegalArgumentException.
               (tru "Received ''{0}'' clause without an argument" clause))))
-
-      :else (second (first candidates))))
+    (-> candidates first second)))

 (defn process-order-by
   [clauses]


remove nrepl :greeting-fn, doesn't do anything useful anyways

--- src/main/shadow/cljs/devtools/server/nrepl.clj
+++ src/main/shadow/cljs/devtools/server/nrepl.clj
@@ -335,9 +335,10 @@
     (server/start-server
       :bind host
       :port port
-      :greeting-fn
-      (fn [transport]
-        (transport/send transport {:out "Welcome to the shadow-cljs REPL!"}))
+      ;; breaks vim-fireplace, doesn't even show up in Cursive
+      #_:greeting-fn
+      #_(fn [transport]
+          (transport/send transport {:out "Welcome to the shadow-cljs REPL!"}))
       :handler
       (fn [msg]
         (log/debug "nrepl-receive" (pr-str (dissoc msg :transport :session)))


Cleans specs.

Cleans specs.

--- src/active/clojure/match.clj
+++ src/active/clojure/match.clj
@@ -336,42 +336,42 @@
 (s/def ::binding symbol?)

 (s/def ::key-exists-without-binding
-  (s/or :required (s/or :flat ::key
-                        :list (s/coll-of ::key :count 1 :kind list?))))
+  (s/or :flat ::key
+        :list (s/coll-of ::key :count 1 :kind list?)))

 (s/def ::key-exists-with-binding
-  (s/or :required (s/cat :key ::key :binding-key ::binding-key :binding ::binding)))
+  (s/cat :key ::key :binding-key ::binding-key :binding ::binding))

 (s/def ::optional-key-exists-with-binding
-  (s/or :required (s/cat :qmark ::qmark :key ::key :binding-key ::binding-key :binding ::binding)))
+  (s/cat :qmark ::qmark :key ::key :binding-key ::binding-key :binding ::binding))

 (s/def ::path-exists-without-binding
-  (s/or :required (s/or :flat ::path
-                        :list (s/cat :path ::path))))
+  (s/or :flat ::path
+                        :list (s/cat :path ::path)))

 (s/def ::path-exists-with-binding
-  (s/or :required (s/cat :path ::path :binding-key ::binding-key :binding ::binding)))
+  (s/cat :path ::path :binding-key ::binding-key :binding ::binding))

 (s/def ::optional-path-exists-with-binding
-  (s/or :required (s/cat :qmark ::qmark :path ::path :binding-key ::binding-key :binding ::binding)))
+  (s/cat :qmark ::qmark :path ::path :binding-key ::binding-key :binding ::binding))

 (s/def ::key-matches-without-binding
-  (s/or :required (s/cat :key ::key :match-value ::match-value)))
+  (s/cat :key ::key :match-value ::match-value))

 (s/def ::key-matches-with-binding
-  (s/or :required (s/cat :key ::key :match-value ::match-value :binding-key ::binding-key :binding ::binding)))
+  (s/cat :key ::key :match-value ::match-value :binding-key ::binding-key :binding ::binding))

 (s/def ::optional-key-with-default-binding
-  (s/or :required (s/cat :qmark ::qmark :key ::key :default-value ::default-value :binding-key ::binding-key :binding ::binding)))
+  (s/cat :qmark ::qmark :key ::key :default-value ::default-value :binding-key ::binding-key :binding ::binding))

 (s/def ::path-matches-without-binding
-  (s/or :required (s/cat :path ::path :match-value ::match-value)))
+  (s/cat :path ::path :match-value ::match-value))

 (s/def ::path-matches-with-binding
-  (s/or :required (s/cat :path ::path :match-value ::match-value :binding-key ::binding-key :binding ::binding)))
+  (s/cat :path ::path :match-value ::match-value :binding-key ::binding-key :binding ::binding))

 (s/def ::optional-path-with-default-binding
-  (s/or :required (s/cat :qmark ::qmark :path ::path :default-value ::default-value :binding-key ::binding-key :binding ::binding)))
+  (s/cat :qmark ::qmark :path ::path :default-value ::default-value :binding-key ::binding-key :binding ::binding))

 (s/def ::clause
   (s/or :key-exists-without-binding ::key-exists-without-binding
@@ -426,8 +426,7 @@
     (if (s/invalid? parse)
       (c/assertion-violation `match-pattern->clause "not a valid pattern" p (s/explain-str ::clause p))

-      (let [[match parse] parse
-            [mode body]   parse]
+      (let [[match body] parse]
         (case match
           :key-exists-without-binding
           (let [[mode body] body
@@ -509,13 +508,12 @@

 ;; syntax emitter
 (defn parse-emit-syntax
-  [message p rhs]
+  [message p]
   (let [parse (s/conform ::clause p)]
     (if (s/invalid? parse)
       (c/assertion-violation `match-pattern->clause "not a valid pattern" p (s/explain-str ::clause p))

-      (let [[match parse] parse
-            [mode body]   parse]
+      (let [[match body] parse]
         (case match
           :key-exists-without-binding
           (let [[mode body] body
@@ -626,7 +624,7 @@
 (defn parse-emit-match-syntax
   [message [pattern rhs]]
   (let [[lhss rhss] (reduce (fn [[clauses bindings] c]
-                           (let [[clause binding] (parse-emit-syntax message c rhs)]
+                           (let [[clause binding] (parse-emit-syntax message c)]
                              [(conj clauses clause)
                               (conj bindings binding)]))
                          [[] []]


maint - document the expected return values of check-schema and validate-message

This is a little weird, but it's what the tests test for.

--- src/puppetlabs/cthun/validation.clj
+++ src/puppetlabs/cthun/validation.clj
@@ -27,12 +27,17 @@
    (s/required-key :user) s/Str})

 (defn check-schema
-  "Check if the JSON matches the schema"
+  "Check if the JSON matches the ClientMessage schema.
+  Returns message on success.
+  Throws on failure."
   [json]
   (s/validate ClientMessage json))

 (defn validate-message
-  "Validate the structure of a message"
+  "Validates the structure of a message.
+  Returns message on success.
+  Returns false on invalid json.
+  Throws on valid json with an invalid schema"
   [message]
   (let [json (try (cheshire/parse-string message true)
                   (catch Exception e false))]


a whole new world

a whole new world

--- ros/angelic_planning/src/ros/robot_actions.clj
+++ ros/angelic_planning/src/ros/robot_actions.clj
@@ -271,7 +271,7 @@
   (read-string (slurp f)))

 (defn write-plan [f plan]
-   (with-open [#^java.io.PrintWriter w (java.io.File. f)]
+   (with-open [#^java.io.PrintWriter w (java.io.FileOutputStream. (java.io.File. #^String f))]
       (.print w plan)))


pulled out top nav into list

pulled out top nav into list

--- src/cljs/org/broadinstitute/firecloud_ui/main.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/main.cljs
@@ -41,6 +41,20 @@
       spacer
       [Link {:href "#" :text "Support"}]]]))

+
+(def top-nav-bar-items
+  [{:key :workspaces
+    :name "Workspaces"
+    :component workspaces/Page}
+   {:key :methods
+    :name "Method Repository"
+    :component method-repo/Page}
+   {:key :import-data
+    :name "Import Data"
+    :component import-data/Page}
+   ])
+
+
 (react/defc TopNavBarLink
   {:render
    (fn [{:keys [props state]}]
@@ -58,15 +72,10 @@
   {:render
    (fn [{:keys [props]}]
      [:div {:style {:textAlign "right"}}
-      [TopNavBarLink {:name "Import Data"
-                      :selected (= (:selected-item props) :import-data)
-                      :onClick (fn [e] ((:on-nav props) :import-data))}]
-      [TopNavBarLink {:name "Workspaces"
-                      :selected (= (:selected-item props) :workspaces)
-                      :onClick (fn [e] ((:on-nav props) :workspaces))}]
-      [TopNavBarLink {:name "Method Repository"
-                      :selected (= (:selected-item props) :methods)
-                      :onClick (fn [e] ((:on-nav props) :methods))}]])})
+      (map (fn [item] [TopNavBarLink {:name (item :name)
+                                      :selected (= (:selected-item props) (item :key))
+                                      :onClick (fn [e] ((:on-nav props) (item :key)))}])
+            top-nav-bar-items)])})

 ;; Content to display when logged in via Google
 (react/defc LoggedIn
@@ -74,7 +83,7 @@
    (fn [{:keys [props state]}]
      (let [nav-context (nav/parse-segment (:nav-context props))
            page (keyword (:segment nav-context))]
-       (when-not (contains? #{:import-data :workspaces :methods} page)
+       (when-not (contains? (set (map :key top-nav-bar-items)) page)
          (nav/navigate (:nav-context props) "workspaces"))
        [:div {}

@@ -92,11 +101,11 @@
          [:div {}
           [TopNavBar {:selected-item page
                       :on-nav (fn [item] (nav/navigate (:nav-context props) (name item)))}]]]
-        (case page
-          :import-data [import-data/Page {:nav-context nav-context}]
-          :workspaces [workspaces/Page {:nav-context nav-context}]
-          :methods [method-repo/Page {:nav-context nav-context}]
-          [:div {} "Page not found."])]))})
+
+        (let [item (first (filter #(= (% :key) page) top-nav-bar-items))]
+          (if item
+            [(item :component) {:nav-context nav-context}]
+            [:div {} "Page not found."]))]))})

 ;; Content to display when logged out
 (react/defc LoggedOut


fix "hurt"

fix "hurt"

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -678,25 +678,20 @@
     :english {:past "hugged"
               :participle "hugging"}}

-    "hurt" (let [subject-semantics (ref {:human true})]
-               :english {:past "hurt"}
-               {:synsem {:cat :verb
-                         :sem {:pred :hurt-oneself
-                               :subj subject-semantics
-                               :obj subject-semantics}
-                         :subcat {:1 {:sem subject-semantics}
-                                  :2 {:pronoun true
-                                      :reflexive true
-                                      :sem subject-semantics}}}})
-
-
-    "hurt"
-   {:synsem {:cat :verb
-             :sem {:pred :hurt
-                   :subj {:human true}
-                   :obj {:animate true}}}
-    :english {:past "hurt"}}
-
+   "hurt" (let [common {:english {:past "hurt"}
+                        :synsem {:cat :verb}}]
+            [(let [subject-semantics (ref {:human true})]
+               (merge common
+                      {:synsem {:sem {:pred :hurt-oneself
+                                      :subj subject-semantics
+                                      :obj subject-semantics}
+                                :subcat {:1 {:sem subject-semantics}
+                                         :2 {:pronoun true
+                                             :reflexive true
+                                             :sem subject-semantics}}}}))
+             (merge common
+                    {:synsem {:sem {:pred :hurt
+                                    :obj {:animate true}}}})])
     "Juan and I"
       [{:synsem {:cat :noun
                  :pronoun true


add correction function for 'camminare'

add correction function for 'camminare'

--- src/babel/italiano/writer.clj
+++ src/babel/italiano/writer.clj
@@ -7,6 +7,51 @@
 (require '[babel.writer :refer [delete-from-expressions process write-lexicon]])
 (require '[clojure.tools.logging :as log])
 (require '[dag-unify.core :refer (fail? get-in strip-refs unify)])
+
+(defn camminare [ & [count]]
+  (let [count (if count (Integer. count) 10)
+        ;; subset of the lexicon: only verbs which are infinitives and that can be roots:
+        ;; (i.e. those that have a specific (non- :top) value for [:synsem :sem :pred])
+        root-verbs
+        (zipmap
+         (keys @lexicon)
+         (map (fn [lexeme-set]
+                (filter (fn [lexeme]
+                          (and
+                           (= (get-in lexeme [:synsem :cat]) :verb)
+                           (= (get-in lexeme [:synsem :infl]) :top)
+                           (not (= :top (get-in lexeme [:synsem :sem :pred] :top)))))
+                        lexeme-set))
+              (vals @lexicon)))]
+
+    (delete-from-expressions "it" {:root {:italiano {:italiano "camminare"}}})
+
+    (write-lexicon "it" @lexicon)
+    (log/info (str "done writing lexicon."))
+    (.size (map (fn [verb]
+                  (let [root-form (get-in verb [:italiano :italiano])]
+                    (log/debug (str "generating from root-form:" root-form))
+                    (.size (map (fn [tense]
+                                  (let [spec (unify {:root {:italiano {:italiano root-form}}}
+                                                    tense)]
+                                    (log/debug (str "generating from: " spec))
+                                    (process [{:fill
+                                               {:spec spec
+                                                :source-model en/small-plus-vp-pronoun
+                                                :target-model small
+                                                :count count}}] "it")))
+                                (list {:synsem {:sem {:tense :conditional}}}
+                                      {:synsem {:sem {:tense :future}}}
+                                      {:synsem {:sem {:tense :present}}}
+                                      {:synsem {:sem {:aspect :progressive
+                                                      :tense :past}}}
+                                      {:synsem {:sem {:aspect :perfect
+                                                      :tense :past}}})))))
+                (reduce concat
+                        (map (fn [key]
+                               (get root-verbs key))
+                             (filter #(= % "camminare")
+                                     (sort (keys root-verbs)))))))))

 (defn tutti [ & [count]]
   (let [count (if count (Integer. count) 10)


CMR-6318 changed autocomplete value type to search_as_you_type

--- indexer-app/src/cmr/indexer/data/index_set.clj
+++ indexer-app/src/cmr/indexer/data/index_set.clj
@@ -712,7 +712,7 @@
   {:concept-id (-> m/string-field-mapping m/stored m/doc-values)
    :type {:type "text" :store true}
    :fields {:type "text" :store true}
-   :value {:type "text" :analyzer "autocomplete_analyzer" :store true}})
+   :value {:type "search_as_you_type" :store true}})

 (defmapping variable-mapping :variable
   "Defines the elasticsearch mapping for storing variables. These are the


Idiomatically return nil rather than throwing an exception immediately if doing get-resource, get-drawable or get-string allowing e.g. (or (get-drawable key) (get-drawable :default))

--- src/clojure/neko/resource.clj
+++ src/clojure/neko/resource.clj
@@ -54,13 +54,14 @@
   ([res-type res-name]
      (get-resource context/context res-type res-name))
   ([^Context context, res-type res-name]
-     (if (keyword? res-name)
-       (.getIdentifier (.getResources context)
-                       (kw-to-res-name res-name)
-                       (name res-type)
-                       (or (namespace res-name)
-                           (.getPackageName context)))
-       res-name)))
+     (let [resid (if (keyword? res-name)
+                      (.getIdentifier (.getResources context)
+                                      (kw-to-res-name res-name)
+                                      (name res-type)
+                                      (or (namespace res-name)
+                                          (.getPackageName context)))
+                      res-name)]
+       (if (= resid 0) nil resid))))

 (defn get-id
   "Finds the ID for the XML item with the given name. This is simply a
@@ -92,10 +93,10 @@
         [res-name & format-args] args]
     (if (string? res-name)
       res-name
-      (if format-args
-        (.getString context (get-resource context :string res-name)
-                    (to-array format-args))
-        (.getString context (get-resource context :string res-name))))))
+      (when-let [id (get-resource context :string res-name)]
+        (if format-args
+          (.getString context id (to-array format-args))
+          (.getString context id))))))

 (alter-meta! #'get-string
              assoc :arglists '([res-name & format-args?] [context res-name & format-args?]))
@@ -109,8 +110,8 @@
   ([^Context context, res-name]
      (if (instance? Drawable res-name)
        res-name
-       (.getDrawable (.getResources context)
-                     (get-resource context :drawable res-name)))))
+       (when-let [id (get-resource context :drawable res-name)]
+         (.getDrawable (.getResources context) id)))))

 ;; Compile time resource resolution


Better count of number of jobs.

Better count of number of jobs.

--- src/clojure/parkour/graph.clj
+++ src/clojure/parkour/graph.clj
@@ -319,7 +319,8 @@
      (execute conf uvar rargs []))
   ([conf uvar rargs largs]
      (let [[nodes tails] (pgc/job-graph uvar rargs largs)
-           job-name (partial job-name (var-str uvar) (count nodes))
+           njobs (- (count nodes) (count tails))
+           job-name (partial job-name (var-str uvar) njobs)
            graph (->> nodes
                       (r/map (fn [{:keys [jid requires], :as node}]
                                (let [f (job-fn node conf (job-name jid))]


Changed autoconstructive rand enrichment defaults, which were just weird.

--- src/clojush/pushgp/pushgp.clj
+++ src/clojush/pushgp/pushgp.clj
@@ -160,12 +160,12 @@
           ;; :replace-child-that-exceeds-size-limit-with to :empty. You will probably also want to
           ;; provide a high value for :max-generations.

-          :autoconstructive-integer-rand-enrichment 1
+          :autoconstructive-integer-rand-enrichment 0
           ;; The number of extra instances of autoconstructive_integer_rand to include in
           ;; :atom-generators for autoconstruction. If negative then autoconstructive_integer_rand
           ;; will not be in :atom-generators at all.

-          :autoconstructive-boolean-rand-enrichment -1
+          :autoconstructive-boolean-rand-enrichment 0
           ;; The number of extra instances of autoconstructive_boolean_rand to include in
           ;; :atom-generators for autoconstruction. If negative then autoconstructive_boolean_rand
           ;; will not be in :atom-generators at all.


loading of console's commands.js without running server

Former-commit-id: a3de75127aecc0ec3987c53bf3d067aff07e6ab1

--- src/status_im/commands/handlers/loading.cljs
+++ src/status_im/commands/handlers/loading.cljs
@@ -1,4 +1,5 @@
 (ns status-im.commands.handlers.loading
+  (:require-macros [status-im.utils.slurp :refer [slurp]])
   (:require [re-frame.core :refer [register-handler after dispatch subscribe
                                    trim-v debug]]
             [status-im.utils.handlers :as u]
@@ -23,9 +24,11 @@
 (defn fetch-commands!
   [db [identity]]
   (when-let [url (:dapp-url (get-in db [:chats identity]))]
-    (http-get (s/join "/" [url commands-js])
-              #(dispatch [::validate-hash identity %])
-              #(dispatch [::loading-failed! identity ::file-was-not-found]))))
+    (if (= "console" identity)
+      (dispatch [::validate-hash identity (slurp "resources/commands.js")])
+      (http-get (s/join "/" [url commands-js])
+                #(dispatch [::validate-hash identity %])
+                #(dispatch [::loading-failed! identity ::file-was-not-found])))))

 (defn dispatch-loaded!
   [db [identity file]]


reflect non-deterministic ordering of aggregate-xmlns in test

--- src/test/clojure/clojure/data/xml/test_process.clj
+++ src/test/clojure/clojure/data/xml/test_process.clj
@@ -13,4 +13,4 @@

 (deftest process
   (is (= (find-xmlns test-data) #{"" "GEE:" "GOO:"}))
-  (is (= (element-nss (aggregate-xmlns test-data)) {:xmlns/a "GEE:" :xmlns/b "GOO:"})))
+  (is (= (set (vals (element-nss (aggregate-xmlns test-data)))) #{"GEE:" "GOO:"})))


Support CC and BCC in mail system

Support CC and BCC in mail system

--- systems/mail/src/containium/systems/mail.clj
+++ systems/mail/src/containium/systems/mail.clj
@@ -91,6 +91,10 @@
   address, a subject, and the HTML string. The following options are
   also available:

+  :cc - A single string or a seq of strings with CC addresses.
+
+  :bcc - A single string or a seq of strings with Blind CC addresses.
+
   :text - You can supply a plain text version of the message, which
     will be included as an alternative.

@@ -108,10 +112,12 @@
     use. This map overrides the default lookup when inlining. Note
     that the values in this map must support being passed to
     clojure.java.io/file."
-  [mail-system from to subject html & {:keys [text attachments src-root src-map]}]
+  [mail-system from to subject html & {:keys [cc bcc text attachments src-root src-map]}]
   (let [html-contents (make-inline html src-root src-map)
         contents (remove nil? [:alternative
                                (when text {:type "text/plain" :content text})
                                (cons :related html-contents)])
         attachments (map (fn [a] (assoc a :type :attachment)) attachments)]
-    (send-message mail-system from to subject (concat contents attachments))))
+    (send-message mail-system from to subject (concat contents attachments)
+                  (merge (when cc {:cc cc})
+                         (when bcc {:bcc bcc})))))