Normalize features returned across providers

--- domain/src/domain/cv.clj
+++ domain/src/domain/cv.clj
@@ -42,6 +42,21 @@
     (let [res (f image creds)]        ; call f to POST
       (>!! c (:body res)))))          ; put the resulting body in the chan

+(defn normalize-sightcorp [result]
+  (map (fn [x]
+         {:age    (get-in x [:age :value])
+          :gender (get-in x [:gender :value])})
+       (:persons result)))
+
+(defn normalize-microsoft [result]
+  (map :attributes result))
+
+(defn normalize-faceplus [result]
+  (map (fn [x]
+         {:age    (get-in x [:attribute :age :value])
+          :gender (get-in x [:attribute :gender :value])})
+       (:face result)))
+
 (defn get-features [image]
   (let [sightcorp-chan (chan)
         microsoft-chan (chan)


fixing test

fixing test

--- test/celestial/test/vc.clj
+++ test/celestial/test/vc.clj
@@ -21,7 +21,7 @@
                           :password "foobar" :user "ronen" :sudo true
                           :gateway "192.168.5.1" :ip "192.168.5.91" :mask "255.255.255.0"
                           :names ["8.8.8.8"] :network "192.168.5.0" :search "local"
-                          :template "ubuntu-13.04_puppet-3.2.2_with-tools" }))
+                          :template "ubuntu-13.04_puppet-3.2_tools-and-ssh" }))

     (fact "missing datacenter"
           (vconstruct (assoc-in redis-vc-spec [:vcenter :datacenter] nil)) =>


Updating match cycle metric logic for 0 considerable case

--- scheduler/src/cook/scheduler/scheduler.clj
+++ scheduler/src/cook/scheduler/scheduler.clj
@@ -1123,9 +1123,10 @@
           (prom/set prom/scheduler-match-cycle-jobs-count {:pool pool-name :status "considerable"} 0)
           (prom/set prom/scheduler-match-cycle-jobs-count {:pool pool-name :status "unmatched"} 0)
           (prom/set prom/scheduler-match-cycle-jobs-count {:pool pool-name :status "max-considerable"} 0)
-          (prom/set prom/scheduler-match-cycle-matched-percent {:pool pool-name} 0)
-          (prom/set prom/scheduler-match-cycle-all-matched {:pool pool-name} 0)
-          (prom/set prom/scheduler-match-cycle-head-was-matched {:pool pool-name} 0)
+          ; Even though we didn't match anything, set the following values to 1 to make visualizations make sense
+          (prom/set prom/scheduler-match-cycle-matched-percent {:pool pool-name} 1.0)
+          (prom/set prom/scheduler-match-cycle-all-matched {:pool pool-name} 1)
+          (prom/set prom/scheduler-match-cycle-head-was-matched {:pool pool-name} 1)
           (prom/set prom/scheduler-match-cycle-queue-was-full {:pool pool-name} 0))
       ; nonzero considerables case
       (do


reversing the order on the date range from most inclusive to least inclusive

--- src/anyviz/views.clj
+++ src/anyviz/views.clj
@@ -23,7 +23,7 @@
 (def match-operators ["=","!=","<","<=",">",">="])
 (def group-times ["year","month","day","hour","minute"])
 (def reduce-operators ["count","min","max","sum","avg","stdev"])
-(def date-ranges ["last day","last 7 days","last 30 days","last year","all time"])
+(def date-ranges ["all time","last year","last 30 days","last 7 days","last day"])

 (defn dropdown-item [item]
   [:option {:value item} item])


Use find-first

Use find-first

--- resources/orthogonal-rpg/entities.clj
+++ resources/orthogonal-rpg/entities.clj
@@ -115,8 +115,8 @@

 (defn attack-player
   [entities]
-  (if-let [npc (some #(if (npc-attacker? % (find-first :player? entities)) %)
-                     entities)]
+  (if-let [npc (find-first #(npc-attacker? % (find-first :player? entities))
+                           entities)]
     (attack entities npc)
     entities))


compose fixed for "replicas: 0"

compose fixed for "replicas: 0"

--- src/clj/swarmpit/docker/engine/mapper/compose.clj
+++ src/clj/swarmpit/docker/engine/mapper/compose.clj
@@ -17,7 +17,7 @@
 (defn alias
   [key stack-name map]
   (let [name (get map key)]
-    (if (in-stack? stack-name map)
+    (if (and name (in-stack? stack-name map))
       (trim-stack stack-name name)
       name)))

@@ -70,7 +70,7 @@
      :logging {:driver  (-> service :logdriver :name)
                :options (-> service :logdriver :opts (name-value->map))}
      :deploy {:mode           (when-not (= "replicated" (:mode service)) (:mode service))
-              :replicas       (some-> (:replicas service) (#(when (< 1 %) %)))
+              :replicas       (some-> (:replicas service) (#(when (not (= 1 %)) %)))
               :labels         (->> service :labels (name-value->map) (add-swarmpit-labels service))
               :update_config  (-> service :deployment :update
                                   (rename-keys {:failureAction :failure_action})


actually use public interface in test

actually use public interface in test

--- test/cljx/jamesmacaulay/zelkova/signal_test.cljx
+++ test/cljx/jamesmacaulay/zelkova/signal_test.cljx
@@ -327,12 +327,10 @@

 (deftest-async test-world-building
   (go
-    (let [pos (event-constructor :mouse-position)
-          event-source (async/to-chan (map pos [[10 10]
-                                                [20 20]
-                                                [30 30]]))
-          mouse-position (assoc (z/input [0 0] :mouse-position)
-                           :event-sources {:mouse-position (constantly event-source)})
+    (let [event-source (async/to-chan [[10 10]
+                                       [20 20]
+                                       [30 30]])
+          mouse-position (z/input [0 0] :mouse-position (constantly event-source))
           graph (z/spawn mouse-position)
           out (async/tap graph (chan 1 z/fresh-values))]
       (is (= [[10 10] [20 20] [30 30]]


unused file

unused file

--- test/trackit/core_test.clj
+++ test/trackit/core_test.clj
@@ -1,7 +0,0 @@
-(ns trackit.core-test
-  (:require [clojure.test :refer :all]
-            [trackit.core :refer :all]))
-
-(deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))


Implement computing an overall winner add

--- domain/src/domain/core.clj
+++ domain/src/domain/core.clj
@@ -80,6 +80,12 @@
           ; the map we want to reduce over
           current-ad->features))

+(defn get-winning-ad [current-features resulting-features]
+  (let [results (get-scored-ads ads->features-example result-features-example)]
+    (->> results
+         (sort-by (comp :score second))
+         last)))
+
 (defroutes app-routes
   (GET "/" [] "OMG HI!")
   (route/not-found "Not Found"))


Push test case for join bug

Push test case for join bug

--- src/aurora/join.cljs
+++ src/aurora/join.cljs
@@ -893,6 +893,38 @@

          ))

+  (let [tree1 (tree 10)
+        _ (.assoc! tree1 #js ["a" "b"] 0)
+        _ (.assoc! tree1 #js ["b" "c"] 0)
+        _ (.assoc! tree1 #js ["c" "d"] 0)
+        tree2 (tree 10)
+        _ (.assoc! tree2 #js ["b" "a"])
+        _ (.assoc! tree2 #js ["c" "b"])
+        _ (.assoc! tree2 #js ["d" "c"])
+        itr1 (magic-iterator tree1 #js [0 nil 1])
+        itr2 (magic-iterator tree2 #js [nil 0 1])
+        join-itr (join-iterator #js [itr1 itr2])
+        ]
+     (map vec (all-join-results join-itr))
+    )
+
+  (let [tree1 (tree 10)
+        _ (.assoc! tree1 #js ["a" "b"] 0)
+        _ (.assoc! tree1 #js ["b" "c"] 0)
+        _ (.assoc! tree1 #js ["c" "d"] 0)
+        _ (.assoc! tree1 #js ["d" "b"] 0)
+        tree2 (tree 10)
+        _ (.assoc! tree2 #js ["b" "a"])
+        _ (.assoc! tree2 #js ["c" "b"])
+        _ (.assoc! tree2 #js ["d" "c"])
+        _ (.assoc! tree2 #js ["b" "d"])
+        itr1 (magic-iterator tree1 #js [0 nil 1])
+        itr2 (magic-iterator tree2 #js [nil 0 1])
+        join-itr (join-iterator #js [itr1 itr2])
+        ]
+     (map vec (all-join-results join-itr))
+    )
+
 )


+(declare generate)

+(declare generate)

--- src/babel/latin.cljc
+++ src/babel/latin.cljc
@@ -25,6 +25,8 @@

 (defn fo [structure]
   (morph/conjugate (get-in structure [:root]) structure))
+
+(declare generate)

 (def model {:lexicon lexicon
             :fo fo


Fixed typo

Fixed typo

--- agiledox.clj
+++ agiledox.clj
@@ -20,14 +20,14 @@
 (defn as-header [filename]
   (str (.replaceFirst (.replaceFirst filename "\\.java" "") "Test" "") ":"))

-(defn skipTestPerfixIfPresent [feature]
+(defn skipTestPrefixIfPresent [feature]
 	(.replaceFirst feature "- test" "-"))

 (defn formSentense [feature]
 	(str " - " (capitalize (.substring feature 2)) ".") )

 (defn as-feature [line]
-  (formSentense (skipTestPerfixIfPresent (.toLowerCase (.replaceAll line "([A-Z])" " $1")))))
+  (formSentense (skipTestPrefixIfPresent (.toLowerCase (.replaceAll line "([A-Z])" " $1")))))

 (def empty-line "")


tidying

tidying

--- src/clojure/core.clj
+++ src/clojure/core.clj
@@ -181,13 +181,14 @@
                                                       peaks)

                          (let [rms                   (double-array [0])
+                               spectral-irregularity (double-array [0])
+                               spectral-centroid     (double-array [0])
+                               spectral-variance     (double-array [0])
+
+                               ;;TODO
                                noiseness             (double-array [0])
                                loudness              (double-array [0])
                                tonality              (double-array [0])
-                               irregularity_k        (double-array [0])
-                               spectral-irregularity (double-array [0])
-                               spectral-centroid     (double-array [0])
-                               spectral-variance     (double-array [0])

                                spectral-inharmonicity (spectral-inharmonicity
                                                        peaks block-size
@@ -207,10 +208,9 @@
                              (xtract/xtract_variance spectrum block-size (xtract-args (first spectral-mean)) spectral-variance)
                              (xtract/xtract_spectral_standard_deviation spectrum block-size (xtract-args (first spectral-variance)) spectral-std-deviation)

-                             (let [argv (clojure->c-double [(first spectral-mean)
-                                                            (first spectral-std-deviation)])]
-                               (xtract/xtract_spectral_skewness spectrum block-size (xtract/doublea_to_voidp argv) spectral-skewness)
-                               (xtract/xtract_spectral_kurtosis spectrum block-size (xtract/doublea_to_voidp argv) spectral-kurtosis))
+                             (let [argv (xtract-args (first spectral-mean) (first spectral-std-deviation))]
+                               (xtract/xtract_spectral_skewness spectrum block-size argv spectral-skewness)
+                               (xtract/xtract_spectral_kurtosis spectrum block-size argv spectral-kurtosis))

                              ;;(xtract/xtract_noisiness     wav-data block-size (xtract-args NUM_HARMONICS ) noiseness)

@@ -218,15 +218,14 @@
                                    ;;bark-cofficents (clojure->c-double (range 0 xtract-bark-bands))
                                    ]

-                               ;; (println :BAND bark-band-limits)
-                               ;;                                (xtract/xtract_bark_coefficients spectrum half-block-size (xtract-args ) bark-cofficents)
-                               ;;                                (xtract/xtract_loudness      wav-data block-size (apply xtract-args argv) loudness)
+                               ;;(xtract/xtract_bark_coefficients spectrum half-block-size (xtract-args ) bark-cofficents)
+                               ;;(xtract/xtract_loudness      wav-data block-size (apply xtract-args argv) loudness)
                                )

                              ;;TODO
-                             ;;                                (xtract/xtract_tonality      wav-data block-size (xtract-args ) tonality)
-
-                             {(* idx SAMPLE_RATE)
+                             ;;(xtract/xtract_tonality      wav-data block-size (xtract-args ) tonality)
+
+                             {(* idx (int SAMPLE_RATE))
                               {:spectral-inharmonicit  spectral-inharmonicity
                                :spectral-irregularity  (first spectral-irregularity)
                                :spectral-centroid      (first spectral-centroid)
@@ -234,9 +233,9 @@
                                :spectral-kurtosis      (first spectral-kurtosis)
                                :rms_amplitude          (first rms)

-                               ;;                              :noisiness (first noiseness)
-                               ;;                                :loudness (first loudness)
-                               ;;                               :tonality (first tonality)
+                               :todo {:noisiness (first noiseness)
+                                      :loudness (first loudness)
+                                      :tonality (first tonality)}
                                :midi midi
                                :f0 f0}
                               })))


Fix long line in load-push-argmap

Fix long line in load-push-argmap

--- src/clojush/args.clj
+++ src/clojush/args.clj
@@ -861,7 +861,9 @@
                                  (ns-publics 'clojush.globals))]
      (if (contains? @push-argmap (keyword (.substring (name gname) (count "global-"))))
        (reset! @gatom (get @push-argmap (keyword (.substring (str gname) (count "global-")))))
-       (throw (Exception. (str "globals.clj definition " gname " has no matching argument in push-argmap. Only such definitions should use the prefix 'global-'."))))))
+       (throw (Exception. (str "globals.clj definition " gname
+                               " has no matching argument in push-argmap. "
+                               "Only such definitions should use the prefix 'global-'."))))))
   ([argmap]
    (load-push-argmap argmap)
    (reset-globals)))


fix bugs

fix bugs

--- src/codestat/git.clj
+++ src/codestat/git.clj
@@ -76,17 +76,19 @@
   (line-seq (java.io.BufferedReader.
               (java.io.StringReader.
                 (:out (with-sh-dir (get-full-git-dir project-url)
-                        (sh "git" "log" "--numstat" "--format=LOG%nAuthor:%an%nDate:%at%nCommit:%H%nMessage:%s")))))))
+                        (sh "git" "log" "--numstat" "--format=LOG%nAuthor:%an%nDate:%at%nCommit:%H%nMessage:%s%nEND")))))))

 ;;;
 ;;; log format as:
-;;; git log --numstat --format="Author:%an%nDate:%at%nCommit:%H%nMessage:%s"
+;;; git log --numstat --format=LOG%nAuthor:%an%nDate:%at%nCommit:%H%nMessage:%s%nEND"
 ;;;
 (comment "
+LOG
 Author:lx.mao
 Date:1428461520
 Commit:85fa48a1409bb22b70b9d4d6173766d7777e741d
 Message:[TvApp]Show channel logo and current program's thumbnail on channel list.
+END

 6       0       source/TvApp/res/layout/channel_item.xml
 4       2       source/TvApp/res/values/dimens.xml
@@ -94,38 +96,55 @@
 20      16      source/TvApp/src/org/droidtv/playtvapp/browse/ChannelItemView.java
 0       7       source/TvApp/src/org/droidtv/playtvapp/browse/SourceBrowser.java
 1       1       source/TvApp/src/org/droidtv/playtvapp/data/Channel.java
-5       0       source/TvApp/src/org/droidtv/playtvapp/data/Data.java
+5       0       source/TvApp/src/org/droidtv/playtvapp/data/Data.java
+LOG
 Author:Jonathan Jeurissen
 Date:1428422271
 Commit:2e99f048810717b7a49eb328cac95c87bc4691c8
 Message:[ReacTV] Renamed resource file for build issue
+END

 -       -       source/ReacTV/res/drawable/App_icon_original.png
 -       -       source/ReacTV/res/drawable/app_icon_original.png
 Author:Jonathan Jeurissen"

 )
-
-(defn get-commit-author
-  [line]
-  (if-let [ret (clojure.string/split line #":")]
-    (if (= (nth ret 0) "Author")
-      (nth ret 1))))
-(defn get-commit-date
-  [line]
-  (if-let [ret (clojure.string/split line #":")]
-    (if (= (nth ret 0) "Date")
-      (nth ret 1))))
-(defn get-commit-revision
-  [line]
-  (if-let [ret (clojure.string/split line #":")]
-    (if (= (nth ret 0) "Commit")
-      (nth ret 1))))
+;;; "Author:xxxx"
+(defn get-commit-field
+  [lst field]
+  (loop  [ls lst]
+    (if-let [line (first ls)]
+      (if-let [ret (clojure.string/split line #":" 2)]
+        (if (= (nth ret 0) field)
+          (nth ret 1)
+          (recur (rest ls)))))))
+
+
+(defn- find-index-of
+  [s lst]
+  (loop [idx 0 ls lst]
+    (if (.startsWith (first ls) s)
+      idx
+      (recur (inc idx) (rest ls)))))
+
+(defn- get-message-start
+  [lst]
+  (find-index-of "Message:" lst))
+(defn- get-message-end
+  [lst]
+  (find-index-of "END" lst))
+
+(defn- remove-message-head
+  [s]
+  (last (clojure.string/split s #"Message:" 2)))
+
+;;; "Message:xxxx" "..." ... "END" ""
 (defn get-commit-message
-  [line]
-  (if-let [ret (clojure.string/split line #":")]
-    (if (= (nth ret 0) "Message")
-      (nth ret 1))))
+  [lst]
+  (let [s (get-message-start lst) e (get-message-end lst)]
+    (remove-message-head (apply str (map #(str % "\n")
+                                         (drop s (take e lst))
+                                         )))))

 ;;; return [add delete file] vector
 (defn get-change-file
@@ -136,19 +155,6 @@
 (defn is-log?
   [line]
   (.startsWith line "LOG"))
-
-(defn is-author?
-  [line]
-  (.startsWith line "Author"))
-(defn is-date?
-  [line]
-  (.startsWith line "Date"))
-(defn is-commit?
-  [line]
-  (.startsWith line "Commit"))
-(defn is-message?
-  [line]
-  (.startsWith line "Message"))

 (defn get-log-seq
   [project-url ]
@@ -168,10 +174,10 @@
 ;;; lst is like: ("Author:..." "Date:..." ....""...)
 (defn parse-log-head
    [lst ]
-   (->commit-rec (get-commit-author (nth lst 0))
-                 (get-commit-date (nth lst 1))
-                 (get-commit-revision (nth lst 2))
-                 (get-commit-message (nth lst 3))))
+   (->commit-rec (get-commit-field lst "Author")
+                 (get-commit-field lst "Date")
+                 (get-commit-field lst "Commit")
+                 (get-commit-message lst)))

 ;;; "-" "1" ->  0 1
 (defn get-line-count
@@ -203,13 +209,13 @@
 (defn parse-log-rec
   [lst]
 (->log-rec (parse-log-head lst)
-           (parse-changeset lst)))
+           (parse-changeset (drop (+ 2 (find-index-of "END" lst)) lst))))

 ;;; parse output from git log
 (defn parse-git-log
   [project-url]
-  (for [line (get-log-seq project-url)]
-    (parse-log-rec line)))
+  (for [lst (get-log-seq project-url)]
+    (parse-log-rec lst)))

 (defn insert-git-log
   [project-url branch]


refactoring deftask and defcluster

refactoring deftask and defcluster

--- src/control/core.clj
+++ src/control/core.clj
@@ -213,8 +213,8 @@
 "
     :arglists '([name doc-string? [params*] body])
     :added "0.1"}
-  deftask [name & decl ]
-  (let [name (keyword name)
+  deftask [tname & decl ]
+  (let [tname (keyword tname)
         m (if (string? (first decl))
             (next decl)
             decl)
@@ -229,12 +229,12 @@
                                item))
                            body)]
     (when-not (vector? arguments)
-      (throw (IllegalArgumentException. "It's arguments must be a vector")))
+      (throw (IllegalArgumentException. (format "Task %s's arguments must be a vector" (name tname)))))
     (when *debug*
-      (prn name "new-body:" new-body))
+      (prn tname "new-body:" new-body))
     `(swap! tasks
             assoc
-            ~name
+            ~tname
             ~(list 'fn
                    (vec (concat '[host user cluster] arguments))
                    (cons 'do new-body)))))
@@ -274,12 +274,12 @@

       Please see https://github.com/killme2008/clojure-control/wiki/Define-clusters
      "
-    :arglists '([name & options])
+    :arglists '([cname & options])
     :added "0.1"}
-  defcluster [name & args]
-  (let [name (keyword name)]
+  defcluster [cname & args]
+  (let [cname (keyword cname)]
     `(let [m# (apply hash-map ~(cons 'list (unquote-cluster args)))]
-       (swap! clusters assoc ~name (assoc m# :name ~name)))))
+       (swap! clusters assoc ~cname (assoc m# :name ~cname)))))

 (defmacro ^:private when-exit
   ([test error]


Cleaned up and refactored mux examples.

Cleaned up and refactored mux examples.

--- src/examples/mux.clj
+++ src/examples/mux.clj
@@ -1,194 +0,0 @@
- ;; mux.clj
-;; an example problem for clojush, a Push/PushGP system written in Clojure
-;; Lee Spector, lspector@hampshire.edu, 2010
-;;
-;; This is code for multiplexer problems of various sizes, using integers
-;; to index address and data bits (which are Boolean values).
-;;
-;; 20110327: Actually there's code both for the "various sizes" version of the
-;; problem (which uses integer-indexed instructions to push address and data bits)
-;; and also for fixed size versions, with separate instructions for each address/data
-;; bit (see the "int-embedded" instructions below). And there's some other hackage here
-;; too because I've been experimenting. So you really have to look through the code
-;; in this file before running it.
-
-(ns examples.mux
-  (:use [clojush]
-        [clojure.math.numeric-tower]))
-
-;;; HACKS to Clojush stuff for experimentation here
-;;; Hacks for collecting and printing full ancestor lists
-(in-ns 'clojush)
-(def maintain-ancestors true)
-(def print-ancestors-of-solution true)
-(defn crossover
-  "Returns a copy of parent1 with a random subprogram replaced with a random
-   subprogram of parent2."
-  [parent1 parent2 max-points]
-  (let [new-program (insert-code-at-point
-                      (:program parent1)
-                      (select-node-index (:program parent1))
-                      (code-at-point (:program parent2)
-                                     (select-node-index (:program parent2))))]
-    (if (> (count-points new-program) max-points)
-      parent1
-      (make-individual :program new-program :history (:history parent1)
-                       :ancestors (if maintain-ancestors
-                                    (list (list 'XOVER (cons (:program parent1) (:ancestors parent1)) ;;; CHANGED HERE
-                                                (cons (:program parent2) (:ancestors parent2)))) ;;; CHANGED HERE
-                                    (:ancestors parent1))))))
-
-(in-ns 'examples.mux) ;; end of hacks to clojush.clj
-
-;; We store address bits in a vector on top of the auxiliary stack
-;; and data bits in a vector under the address bits vector.
-
-(def number-of-address-bits 2)
-(def number-of-data-bits 4)
-
-(defn valid-address-index
-  [n]
-  (mod (abs n) number-of-address-bits))
-
-(defn valid-data-index
-  [n]
-  (mod (abs n) number-of-data-bits))
-
-(define-registered a ;; push an address bit, indexed by an integer
-                   (fn [state]
-                     (if (not (empty? (:integer state)))
-                       (push-item (nth (first (:auxiliary state))
-                                       (valid-address-index (first (:integer state))))
-                                  :boolean
-                                  (pop-item :integer state))
-                       state)))
-
-(define-registered d ;; push a data bit, indexed by an integer
-                   (fn [state]
-                     (if (not (empty? (:integer state)))
-                       (push-item (nth (second (:auxiliary state))
-                                       (valid-data-index (first (:integer state))))
-                                  :boolean
-                                  (pop-item :integer state))
-                       state)))
-
-(defn int->bits
-  [i num-bits]
-  (let [conversion (Integer/toString i 2)]
-    (concat (repeat (- num-bits (count conversion)) false)
-            (map #(= \1 %) conversion))))
-
-
-;;; int-embedded instructions
-
-(defn a-embedded
-  [i]
-  (fn [state]
-    (push-item (nth (first (:auxiliary state)) i)
-               :boolean state)))
-
-(define-registered a0 (a-embedded 0))
-(define-registered a1 (a-embedded 1))
-(define-registered a2 (a-embedded 2))
-
-(defn d-embedded
-  [i]
-  (fn [state]
-    (push-item (nth (second (:auxiliary state)) i)
-               :boolean state)))
-
-(define-registered d0 (d-embedded 0))
-(define-registered d1 (d-embedded 1))
-(define-registered d2 (d-embedded 2))
-(define-registered d3 (d-embedded 3))
-(define-registered d4 (d-embedded 4))
-(define-registered d5 (d-embedded 5))
-(define-registered d6 (d-embedded 6))
-(define-registered d7 (d-embedded 7))
-
-(defn bits->int
-  [bits]
-  (loop [remaining bits total 0]
-    (if (empty? remaining)
-      total
-      (recur (drop 1 remaining)
-             (+ total (* (if (first remaining) 1 0) (expt 2 (dec (count remaining)))))))))
-
-#_(pushgp
-    :error-function (fn [program]
-                      (let [total-num-bits (+ number-of-address-bits number-of-data-bits)]
-                        (doall
-                          (for [i (range (expt 2 total-num-bits))]
-                            (let [bits (int->bits i total-num-bits)
-                                  address-bits (vec (take number-of-address-bits bits))
-                                  data-bits (vec (drop number-of-address-bits bits))
-                                  state (run-push program
-                                                  (push-item address-bits :auxiliary
-                                                             (push-item data-bits :auxiliary
-                                                                        (make-push-state))))
-                                  top-bool (top-item :boolean state)]
-                              (if (= top-bool :no-stack-item)
-                                1000000
-                                (if (= top-bool (nth data-bits (bits->int address-bits)))
-                                  0
-                                  1)))))))
-    :atom-generators (concat
-                       (list
-                         (tag-instruction-erc [:exec] 1000)
-                         (tagged-instruction-erc 1000))
-                       '(a d exec_if boolean_and boolean_or boolean_not
-                           ;boolean_dup boolean_swap boolean_pop boolean_rot
-                           ;integer_add integer_sub integer_mult integer_div integer_mod
-                           ;integer_dup integer_swap integer_pop integer_rot
-                           ))
-    :population-size 1000
-    :max-points 50
-    :mutation-probability 0.4
-    :crossover-probability 0.4
-    :simplification-probability 0.1
-    :reproduction-simplifications 10
-    :tournament-size 1
-    :decimation-ratio 0.1
-    :decimation-tournament-size 2)
-
-(pushgp
-  :error-function (fn [program]
-                    (let [total-num-bits (+ number-of-address-bits number-of-data-bits)]
-                      (doall
-                        (for [i (range (expt 2 total-num-bits))]
-                          (let [bits (int->bits i total-num-bits)
-                                address-bits (vec (take number-of-address-bits bits))
-                                data-bits (vec (drop number-of-address-bits bits))
-                                state (run-push program
-                                                (push-item address-bits :auxiliary
-                                                           (push-item data-bits :auxiliary
-                                                                      (make-push-state))))
-                                top-bool (top-item :boolean state)]
-                            (if (= top-bool :no-stack-item)
-                              1000000
-                              (if (= top-bool (nth data-bits (bits->int address-bits)))
-                                0
-                                1)))))))
-  :atom-generators (concat
-                     ;(list ;(fn [] (rand-int number-of-data-bits))
-                     (repeat 4 (tag-instruction-erc [:exec] 1000))
-                     (repeat 4 (tagged-instruction-erc 1000))
-                     ;)
-                     '(exec_if boolean_and boolean_or boolean_not
-                               a0 a1 ;a2
-                               d0 d1 d2 d3 ;d4 d5 d6 d7
-                               ;boolean_dup boolean_swap boolean_pop boolean_rot
-                               ))
-  :population-size 5000
-  :max-points 50
-  :evalpush-limit 100
-  :mutation-probability 0.4
-  :crossover-probability 0.4
-  :simplification-probability 0.1
-  :reproduction-simplifications 1
-  :node-selection-method :size-tournament
-  :node-selection-tournament-size 2
-  ;:tournament-size 1
-  ;:decimation-ratio 0.1
-  ;:decimation-tournament-size 2
-  )


Use map options for multi-read and multi-write. Introduce checked-write.

--- src/fleetdb/core.clj
+++ src/fleetdb/core.clj
@@ -32,6 +32,7 @@
     imap imap))

 (defn- q-insert [db {:keys [records]}]
+  (assert records)
   (let [{old-rmap :rmap old-imap :imap} db
         [new-rmap new-imap]
           (reduce
@@ -182,12 +183,12 @@

 (declare exec)

-(defn- q-multi-read [db queries]
+(defn- q-multi-read [db {:keys [queries]}]
   (vec
     (map (fn [query] (exec db query))
          queries)))

-(defn- q-multi-write [db queries]
+(defn- q-multi-write [db {:keys [queries]}]
   (reduce
     (fn [[int-db int-results] query]
       (let [[aug-db result] (exec int-db query)]
@@ -195,19 +196,24 @@
     [db []]
     queries))

+(defn- q-checked-write [db {:keys [check expect write]}]
+  (if (= (exec db check) expect)
+    (exec db write)))
+
 (def- query-fns
-  {:select       q-select
-   :count        q-count
-   :insert       q-insert
-   :update       q-update
-   :delete       q-delete
-   :create-index q-create-index
-   :drop-index   q-drop-index
-   :list-indexes q-list-indexes
-   :multi-read   q-multi-read
-   :multi-write  q-multi-write})
+  {:select        q-select
+   :count         q-count
+   :insert        q-insert
+   :update        q-update
+   :delete        q-delete
+   :create-index  q-create-index
+   :drop-index    q-drop-index
+   :list-indexes  q-list-indexes
+   :multi-read    q-multi-read
+   :multi-write   q-multi-write
+   :checked-write q-checked-write})

 (defn exec [db [query-type opts]]
   (if-let [queryfn (query-fns query-type)]
     (queryfn db opts)
-    (raise "query type not recognized")))
+    (raise (str "query type " query-type " not recognized"))))


Update get-env to use pod/env as the environment source

--- boot/core/src/boot/core.clj
+++ boot/core/src/boot/core.clj
@@ -643,7 +643,7 @@
   `not-found` if the environment doesn't contain key `k` and `not-found` was
   given. Calling this function with no arguments returns the environment map."
   [& [k not-found]]
-  (if k (get @boot-env k not-found) @boot-env))
+  (if k (get pod/env k not-found) pod/env))

 (defn set-env!
   "Update the boot environment atom `this` with the given key-value pairs given


:bug: Add missing import on tests.

:bug: Add missing import on tests.

--- backend/tests/uxbox/tests/helpers.clj
+++ backend/tests/uxbox/tests/helpers.clj
@@ -8,6 +8,7 @@
    [mount.core :as mount]
    [environ.core :refer [env]]
    [uxbox.common.pages :as cp]
+   [uxbox.services.init]
    [uxbox.services.mutations.profile :as profile]
    [uxbox.services.mutations.projects :as projects]
    [uxbox.services.mutations.teams :as teams]


more cleanup: remove grammar-rule-level distinction between passato and trapassato

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -451,32 +451,15 @@
                            (let [obj-agr (atom :top)]
                              {:head {:phrasal false
                                      :synsem {:aux true}}
-                              :rule "vp-aux-22-passato"
+                              :rule "vp-aux-22"
                               :synsem {:aux true
                                        :cat :verb
                                        :infl :present
                                        :sem {:reflexive true
-                                             :tense :past
-                                             :aspect :simple}
+                                             :tense :past}
                                        :subcat {:2 {:agr obj-agr}}}
                               :italiano {:b {:obj-agr obj-agr}}}))

-                   (unify h22
-                           root-is-comp
-                           vp-non-pronoun
-                           (let [obj-agr (atom :top)]
-                             {:head {:phrasal false
-                                     :synsem {:aux true}}
-                              :rule "vp-aux-22-trapassato"
-                              :synsem {:aux true
-                                       :cat :verb
-                                       :infl :imperfect
-                                       :sem {:reflexive true
-                                             :tense :past
-                                             :aspect :perfect}
-                                       :subcat {:2 {:agr obj-agr}}}
-                              :italiano {:b {:obj-agr obj-agr}}}))
-
                    (unify h21
                            root-is-head
                            {:rule "vp-future"
@@ -679,10 +662,9 @@
                      (= (:rule %) "vp-32")
                      (= (:rule %) "vp-aux-nonphrasal-complement-passato")
                      (= (:rule %) "vp-aux-phrasal-complement-passato")
-                     (= (:rule %) "vp-aux-22-passato")
+                     (= (:rule %) "vp-aux-22")
                      (= (:rule %) "vp-aux-nonphrasal-complement")
                      (= (:rule %) "vp-aux-phrasal-complement-trapassato")
-                     (= (:rule %) "vp-aux-22-trapassato")
                      (= (:rule %) "vp-present")
                      (= (:rule %) "vp-pronoun-nonphrasal")
                      (= (:rule %) "vp-pronoun-phrasal")


don't index infl2lex: will exclude infinitive verbs which should not be excluded from generation

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -771,7 +771,6 @@

         ;; indices from paths to subsets of the lexicon
         aux2lex (map-subset-by-path lexicon-for-generation [:synsem :aux])
-        infl2lex (map-subset-by-path lexicon [:synsem :infl])
         pred2lex (map-subset-by-path lexicon-for-generation [:synsem :sem :pred])
         cat2lex (map-subset-by-path lexicon-for-generation [:synsem :cat])
         it2lex (map-subset-by-path lexicon-for-generation [:italiano :italiano])]
@@ -794,9 +793,6 @@
                      (log/debug (str "it2lex: " (count
                                                  (get it2lex (get-in spec [:italiano :italiano]
                                                                      ::undefined)))))
-                     (log/debug (str "infl2lex: " (count
-                                                   (get infl2lex (get-in spec [:synsem :infl]
-                                                                         ::undefined)))))
                      (log/debug (str "pred2lex: " (count
                                                    (get pred2lex (get-in spec [:synsem :sem :pred]
                                                                          ::undefined)))))
@@ -810,11 +806,6 @@
                                                   (sort (map #(fo %)
                                                              (get cat2lex (get-in spec [:synsem :cat]
                                                                                ::undefined)))))))
-                     (log/trace (str "infl2lex: " (clojure.string/join
-                                                   ","
-                                                   (sort (map #(fo %)
-                                                              (get infl2lex (get-in spec [:synsem :infl]
-                                                                                ::undefined)))))))
                      (log/trace (str "pred2lex: " (clojure.string/join
                                                    ","
                                                    (sort (map #(fo %)
@@ -823,11 +814,11 @@
                      (let [result
                            (reduce intersection-with-identity
                                    (filter #(not (empty? %))
-                                           [(get aux2lex (get-in spec [:synsem :aux] ::undefined))
+                                           [(get it2lex (get-in spec [:italiano :italiano] ::undefined))
+                                            (get pred2lex (get-in spec [:synsem :sem :pred] ::undefined))
+                                            (get aux2lex (get-in spec [:synsem :aux] ::undefined))
                                             (get cat2lex (get-in spec [:synsem :cat] ::undefined))
-                                            (get infl2lex (get-in spec [:synsem :infl] ::undefined))
-                                            (get it2lex (get-in spec [:italiano :italiano] ::undefined))
-                                            (get pred2lex (get-in spec [:synsem :sem :pred] ::undefined))]))]
+                                            ]))]
                        (log/debug (str "intersection size: " (count result)))
                        result)))


Extend config protocol to nil type

Extend config protocol to nil type

Everything defaults to nil

--- src/clj/comic_reader/config.clj
+++ src/clj/comic_reader/config.clj
@@ -6,8 +6,14 @@
   (norms-dir [cfg])
   (server-port [cfg]))

-(extend-type clojure.lang.APersistentMap
-  Config
+(extend-protocol Config
+  nil
+  (testing? [cfg])
+  (database-uri [cfg])
+  (norms-dir [cfg])
+  (server-port [cfg])
+
+  clojure.lang.APersistentMap
   (testing? [cfg] (:testing? cfg))

   (database-uri [cfg] (:database-uri cfg))


Nil protect fetch-comic-list

Nil protect fetch-comic-list

--- src/clj/comic_reader/scrape.clj
+++ src/clj/comic_reader/scrape.clj
@@ -10,4 +10,5 @@
   (html/html-resource (java.net.URL. url)))

 (defn fetch-comic-list [{:keys [url selector normalize]}]
-  (map normalize (html/select (fetch-url url) selector)))
+  (when (every? (complement nil?) [url selector normalize])
+    (map normalize (html/select (fetch-url url) selector))))


return var instead of routes itself

return var instead of routes itself

--- src/clj/dokkaa_builder/core.clj
+++ src/clj/dokkaa_builder/core.clj
@@ -21,8 +21,8 @@
 (defn start-server
   ([] (start-server 8080))
   ([port] (let [myapp (if (util/in-dev?)
-                        (reload/wrap-reload route/app)
-                        route/app)]
+                        (reload/wrap-reload #'route/app)
+                        #'route/app)]
             (reset! server (run-server myapp {:port port}))
             (println "Listening on" port))))


Correct whitespace

Correct whitespace

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/main.cljs
+++ src/cljs/cljs_nusmods/main.cljs
@@ -267,8 +267,7 @@
   "Initialize Exhibit3 database and UI for Module Finder page"
   (if (and (not (aget js/window "Exhibit3_Initialized"))
            (aget js/window "Exhibit3_Loaded")
-           (= (aget js/window "ActiveTab") MODULEFINDER-TAB-INDEX)
-           )
+           (= (aget js/window "ActiveTab") MODULEFINDER-TAB-INDEX))
     (let [modulesArray (build-modules-array MODULES AUXMODULES)
           itemsArray   (add-aux-info-to-exhibit-items
                          AUXMODULES


Make type 3 life-cycle name more clojurey

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -108,7 +108,7 @@
                                        "up")
                                 (go-to-comic))})]
           (reset! waypoints [wp-up wp-down])))
-      :componentWillUnmount
+      :component-will-unmount
       (fn []
         (map #(.destroy %) @waypoints))
       :reagent-render


Bug fixes.

Bug fixes.

--- src/clojure/freactive/core.cljc
+++ src/clojure/freactive/core.cljc
@@ -235,7 +235,9 @@
                      (.activate this))
         (unregisterOne [this]
                        (set! watchers (dec watchers))
-                       (when (.-auto-clean this) (.clean this)))
+                       ;; (when (.-auto-clean this) (.clean this))
+                       (.clean this)
+                       )
         (addFWatch [this key f]
                    (when-not (aget (.-fwatches this) key)
                      (aset (.-fwatches this) key f)
@@ -339,16 +341,16 @@
             (new-reactive-id)
             this
             ckey
-            (fn [this] (get (.rawDeref this) ckey))
-            (fn [this f & args]
+            (fn [cur] (get (.rawDeref this) ckey))
+            (fn [cur f & args]
               (.updateChild this ckey f args))
-            (fn [this]
-              (set! child-cursors (update child-cursors ckey conj this)))
-            (fn [this]
+            (fn [cur]
+              (set! child-cursors (update child-cursors ckey conj cur)))
+            (fn [cur]
               (set! child-cursors
                     (update child-cursors ckey
                             (fn [cursors]
-                              (let [cursors (remove #(= % this) cursors)]
+                              (let [cursors (remove #(= % cur) cursors)]
                                 (when-not (empty? cursors)
                                   cursors))))))
             nil
@@ -774,7 +776,7 @@
        (#'clojure.core/setup-reference (ReactiveExpression. f false) options))

      (defmacro reactive [& body]
-       `(freactive.core2/reactive*
+       `(freactive.core/reactive*
          (fn reactive-computation-fn []
            ~@body)))

@@ -786,7 +788,7 @@
      (def rx* reactive*)

      (defmacro rx [& body]
-       `(freactive.core2/rx*
+       `(freactive.core/rx*
          (fn []
            ~@body)))


yeaaah

yeaaah

--- src/clojure_web_app/handler.clj
+++ src/clojure_web_app/handler.clj
@@ -15,7 +15,7 @@
             [environ.core :refer [env]]
             [ring.middleware.defaults :refer [wrap-defaults site-defaults]]))

-(def production (or (env :production) false))
+(def production true)

 (defn location-by-ip [ip]
   (json/read-str ((client/get (format "http://freegeoip.net/json/%s" ip)) :body) :key-fn keyword))


added schema validation for events

added schema validation for events

--- src-cljs/frontend/analytics/core.cljs
+++ src-cljs/frontend/analytics/core.cljs
@@ -81,6 +81,11 @@
     :project-followed
     :project-unfollowed})

+(def SupportedEvents
+  (apply s/enum
+         (concat supported-click-and-impression-events
+                 supported-controller-events)))
+
 (defn- add-properties-to-track-from-state [current-state]
   "Get a map of the mutable properties we want to track out of the
   state. Also add a timestamp."
@@ -126,28 +131,17 @@

 (defmulti track (fn [data]
                   (when (frontend.config/analytics-enabled?)
-                    (cond
-                      (or (supported-click-and-impression-events (:event-type data))
-                          (supported-controller-events (:event-type data)))
-                      :event
-
-                      :else
-                      (:event-type data)))))
-
-(defmethod track :default [data]
-  (when (frontend.config/analytics-enabled?)
-    (merror-unsupported-event (:event-type data))))
+                    (:event-type data))))

 (defn- supplement-tracking-properties [{:keys [properties owner current-state]}]
   (if owner
     (supplement-tracking-properties-from-owner properties owner)
     (supplement-tracking-properties-from-state properties current-state)))

-(s/defmethod track :event [event-data :- AnalyticsEvent]
-  (let [{:keys [event-type properties owner current-state]} event-data]
+(s/defmethod track :default [{:keys [event-type :- SupportedEvents properties owner current-state]} :as event-data :- AnalyticsEvent]
     (segment/track-event event-type (supplement-tracking-properties {:properties properties
                                                                      :owner owner
-                                                                     :current-state current-state}))))
+                                                                     :current-state current-state})))

 (s/defmethod track :external-click [event-data :- ExternalClickEvent]
   (let [{:keys [event properties owner current-state]} event-data]


CMR-7855 Subscription email contents are now logged along with sub-id and email-address (#1615)

--- ingest-app/src/cmr/ingest/services/subscriptions_helper.clj
+++ ingest-app/src/cmr/ingest/services/subscriptions_helper.clj
@@ -237,7 +237,8 @@
          (try
            (send-email email-settings email-content)
            (info (str "Successfully processed subscription [" sub-id "].
-                      Sent subscription email to [" email-address "]."))
+                      Sent subscription email to [" email-address "].
+                      \nSubscription email contents: [" email-content "]."))
            (when update-notification-time?
              (send-update-subscription-notification-time! context sub-id))
            (catch Exception e


Fix circular dependency.

Fix circular dependency.

--- src/afterglow/web/routes/web_repl.clj
+++ src/afterglow/web/routes/web_repl.clj
@@ -1,6 +1,5 @@
 (ns afterglow.web.routes.web-repl
-  (:require [afterglow.examples :as examples]
-            [afterglow.web.layout :as layout]
+  (:require [afterglow.web.layout :as layout]
             [clojure.main :as main]
             [clojure.stacktrace :refer [root-cause]]
             [ring.middleware.anti-forgery :refer [*anti-forgery-token*]]


added try catch to om template with error feedback

--- resources/om.cljs
+++ resources/om.cljs
@@ -11,18 +11,32 @@
   (reify
     om/IRender
     (render [this]
-      (view {:style {:flexDirection "column" :margin 40 :alignItems "center"}}
-        (text
-          {:style {:fontSize 50 :fontWeight "100" :marginBottom 20 :textAlign "center"}}
-          (:text data))
+      (try
+        (view {:style {:flexDirection "column" :margin 40 :alignItems "center"}}
+          (text
+            {:style {:fontSize 50 :fontWeight "100" :marginBottom 20 :textAlign "center"}}
+            (:text data))

-        (image {:source {:uri "https://raw.githubusercontent.com/cljsinfo/logo.cljs/master/cljs.png"}
-                :style {:width 80 :height 80 :marginBottom 30}})
+          (image {:source {:uri "https://raw.githubusercontent.com/cljsinfo/logo.cljs/master/cljs.png"}
+                  :style {:width 80 :height 80 :marginBottom 30}})

-        (touchable-highlight
-          {:style {:backgroundColor "#999" :padding 10 :borderRadius 5}
-           :onPress #(alert "HELLO!")}
-          (text {:style {:color "white" :textAlign "center" :fontWeight "bold"}} "press me"))))))
+          (touchable-highlight
+            {:style {:backgroundColor "#999" :padding 10 :borderRadius 5}
+             :onPress #(alert "HELLO!")}
+            (text {:style {:color "white" :textAlign "center" :fontWeight "bold"}} "press me")))
+
+        (catch :default e
+          (view {:style {:backgroundColor "#cc0814" :flex 1 :padding 20 :paddingTop 40}}
+            (text
+              {:style {:fontWeight "normal" :color "white" :fontSize 24 :marginBottom 10}}
+              "ERROR")
+            (text
+              {:style {:color "white" :fontFamily "Menlo-Regular" :fontSize 16 :lineHeight 24}}
+              (.-message e))
+            (text
+              {:style {:color "white" :marginTop 20 :fontSize 16 :fontWeight "bold"}}
+              "Check REPL log for details.")))))))
+

 (om/root widget app-state {:target 1})


Polish the comment and add a fixme

Polish the comment and add a fixme

--- src/mdr2/archive.clj
+++ src/mdr2/archive.clj
@@ -1,7 +1,7 @@
 (ns mdr2.archive
   "Main entry point into the archive

-For archiving we need to interface with an existing hellish system
+For archiving we need to interface with an existing legacy system
 named agadir. It doesn't do very much in very complicated ways.
 Probably best to replace it at some point. In the mean time we try to
 stay away from it and not to change too much. From reading the source
@@ -24,11 +24,12 @@
 3. place this iso in the magic spool directory
 4. generate the rdf as above
 5. add an entry to a table in a database. The `sektion` should be `cdimage`
+"
+  ;; FIXME: Most likely this should be split off into a separate lib that
+  ;; replaces all of agadir at a later point in time. For instructions on
+  ;; how to do this see
+  ;; https://github.com/technomancy/leiningen/blob/stable/doc/DEPLOY.md

-FIXME: Most likely this should be split off into a separate lib that
-replaces all of agadir at a later point in time. For instructions on
-how to do this see
-https://github.com/technomancy/leiningen/blob/stable/doc/DEPLOY.md"
   (:require [clojure.java.jdbc :as jdbc]
             [clojure.java.io :refer [file]]
             [clojure.tools.logging :as log]
@@ -97,9 +98,9 @@
   archive spool dir"
   [production]
   (let [archive-path (container-path production)]
-    (if (fs/exists? archive-path)
-      (log/error "Container-path %s already exists" archive-path)
-      (fs/copy-dir (path/recorded-path production) (container-path production)))))
+    (if-not (fs/exists? archive-path)
+      (fs/copy-dir (path/recorded-path production) (container-path production))
+      (log/error "Container-path %s already exists" archive-path))))

 (defn copy-distribution-master-files
   "Copy a production to the archive spool dir"
@@ -111,7 +112,7 @@
         ;; FIXME: This will fail in the light of multiple isos
         iso-archive-name (str (container-id production) ".iso")
         iso-archive-path (.getPath (file archive-path iso-archive-name))]
-    (fs/copy+ (path/iso-name production) iso-archive-path)))
+    (fs/copy+ (path/iso-name production) iso-archive-path))) ; FIXME: Multi-CD

 (defn create-rdf
   "Create an rdf file and place it in the archive spool directory"


double twins fix

double twins fix

--- src/ontrail/core.clj
+++ src/ontrail/core.clj
@@ -27,19 +27,16 @@
 (def #^{:private true} request-logger (org.slf4j.LoggerFactory/getLogger (str *ns* ".requests")))

 (defmacro json-response [data & [status]]
-  `(let [start# (System/currentTimeMillis)]
-     (try
-       (let [data# {:status (or ~status 200)
-                   :headers {"Content-Type" "application/json"}
-                   :body (json-str ~data)}]
-         (.trace logger (str "Generating " ~data " consumed " (- (System/currentTimeMillis) start#)))
-         data#)
-       (catch Exception exception#
-         (.error logger (str exception#))
-         (stacktrace/print-stack-trace exception# 100)
-         {:status 500
-          :headers {"Content-Type" "application/text"}
-          :body (str exception#)}))))
+  `(try
+     {:status (or ~status 200)
+      :headers {"Content-Type" "application/json"}
+      :body (json-str ~data)}
+     (catch Exception exception#
+       (.error logger (str exception#))
+       (stacktrace/print-stack-trace exception# 100)
+       {:status 500
+        :headers {"Content-Type" "application/text"}
+        :body (str exception#)})))

 (defmacro is-authenticated? [cookies action]
   `(try
@@ -157,7 +154,7 @@
   (.info logger "Starting to build index")
   (future (.info logger (str "Search terms in index: " (time (rebuild-index)))))
   (newcomment-cache-restore-all)
-  (schedule-work newcomment-cache-store-all 30)
+  (schedule-work newcomment-cache-store-all 30) ;; store new comment cache every 60 s
   (start-http-server (-> app-routes
                          handler/site
                          ring-head/wrap-head


ackMessage should have void return type.

--- src/onyx/interop.clj
+++ src/onyx/interop.clj
@@ -10,7 +10,7 @@

 (gen-interface
   :name onyx.IPipelineInput
-  :methods [[ackMessage [clojure.lang.IPersistentMap java.util.UUID] Object]
+  :methods [[ackMessage [clojure.lang.IPersistentMap java.util.UUID] void]
             [retryMessage [clojure.lang.IPersistentMap java.util.UUID] Object]
             [isPending [clojure.lang.IPersistentMap java.util.UUID] Object]
             [isDrained [clojure.lang.IPersistentMap] boolean]])


Make graphviz ns part of API

Make graphviz ns part of API

--- src/overtone/api.clj
+++ src/overtone/api.clj
@@ -12,7 +12,7 @@
                                line freq beq-suite berlach bhob info]
             [overtone.music rhythm pitch tuning time]
             [overtone.studio mixer inst util fx wavetable midi core]
-            [overtone.repl ugens examples shell inst debug]
+            [overtone.repl ugens examples shell inst debug graphviz]
             [overtone.libs asset event freesound]
             [overtone.gui scope mixer control]))

@@ -69,6 +69,7 @@
    'overtone.repl.shell
    'overtone.repl.inst
    'overtone.repl.debug
+   'overtone.repl.graphviz
    'overtone.libs.asset
    'overtone.libs.event
    'overtone.libs.freesound


sensible bar-chart width scaling. Not final, but a good reference

--- src/prais2/data.cljs
+++ src/prais2/data.cljs
@@ -48,7 +48,7 @@
     (prn column-key)
     (sort-on-column app column-key)))

-(def chart-width 300)
+(def chart-width 100)

 (def min-outer-low  (apply min (map :outer-low (rest content/table1-data))))
 ;;  "the minimum outer-low value across all rows"
@@ -72,24 +72,61 @@
 (r/defc bar < r/static [slider value fill]
   [:div {:style {:padding 0
                  :margin 0
-                 :display "inline-block"
+                 :vertical-align "middle"
+                 :display "inline-table"
                  :background-color fill
                  :height "22px"
-                 :width (str (bar-width slider value) "px")}
+                 :width (str (bar-width slider value) "%")}
          }])

+
+(def colour-map-options
+  {:brewer-RdYlBu
+   {:low "#91bfdb"
+    :inner "#fc8d59"
+    :outer-low "#ffffbf"
+    :outer-high "#ffffbf"
+    :high "#91bfdb"
+    :dot "white"
+    }
+   :brewer-RdYl
+   {:low "white"
+    :inner "#fc8d59"
+    :outer-low "#ffffbf"
+    :outer-high "#ffffbf"
+    :high "white"
+    :dot "black"}
+   :brewer-YlRd
+   {:low "white"
+    :inner "#ffffbf"
+    :outer-low "#fc8d59"
+    :outer-high "#fc8d59"
+    :high "white"
+    :dot "black"}
+   :brewer-YlGnBu
+   {:low "#edf8b1"
+    :inner "#2c7fb8"
+    :outer-low "#7fcdbb"
+    :outer-high "#7fcdbb"
+    :high "#edf8b1"
+    :dot "black"}
+   })
+
+
+
+(def colour-map (:brewer-YlGnBu colour-map-options))
+
 (r/defc bar-chart < r/static [row]
-  (let [slider 1]
+  (let [slider 0.9]
     [:div
-     (bar slider (- (:outer-low row) (* min-outer-low slider)) "red")
-     (bar slider (- (:inner-low row) (:outer-low row)) "cyan")
-     (bar slider (- (:inner-high row) (:inner-low row)) "blue")
-     (bar slider (- (:outer-high row) (:inner-high row)) "cyan")
-     (bar slider (- 100 (:outer-high row)) "orange")
+     (r/with-key (bar slider (- (:outer-low row) (* min-outer-low slider)) (:low colour-map)) :bar1)
+     (r/with-key (bar slider (- (:inner-low row) (:outer-low row)) (:outer-low colour-map)) :bar2)
+     (r/with-key (bar slider (- (:inner-high row) (:inner-low row)) (:inner colour-map)) :bar3)
+     (r/with-key (bar slider (- (:outer-high row) (:inner-high row)) (:outer-high colour-map)) :bar4)
+     (r/with-key (bar slider (- 100 (:outer-high row)) (:high colour-map)) :bar5)
      ])
   )
-

 (r/defc table1 < r/static #_(data-table-on :#table1) [app data sort-key sort-direction]
   (let [ap @app
@@ -101,7 +138,7 @@
         column-keys (keys headers)]
     [:div.row
      [:div.col-md-12
-      [:table#table1.table.table-striped.table-bordered {:cell-spacing "0" :width "100%"}
+      [:table#table1.table.table-striped.table-bordered {:cell-spacing "0"}
        [:thead {:key :thead}
         [:tr
          (for [column-key column-keys :when (-> headers column-key :shown)]
@@ -109,7 +146,7 @@
                  sortable (:sortable header)]
              [:th {:key [column-key "head"]
                    :on-click (when sortable #(handle-sort % app column-key))
-                   :style {:width "10px"
+                   :style {:width "120px"
                            :vertical-align "top"
                            :cursor "pointer"}}
               (when sortable [:i {:key :icon
@@ -128,18 +165,33 @@
                      :aria-label "Hospital: activate to sort column descending"
                      :key [:th col]} (nth headers col)]))
          [:th
-          {:style {:width "300px"
+          {:key :axis
+           :style {:padding 0
+                   :margin 0
+                   :white-space "nowrap"
+                   :display "inline-block"
                    :vertical-align "top"
                    :cursor "pointer"}}
           "chart"]]]

-       [:tbody {:key :tbody}
+       [:tbody {:key :tbody
+                }
         (for [row rows]
-          [:tr {:key (:h-code row)}
+          [:tr {:key (:h-code row)
+                :style {:width "600px"}}
            (for [column-key column-keys :when (-> headers column-key :shown)]
              [:td {:key [column-key "r"]}
               (column-key row)])
            [:td
-            {:style {:background-color "white"}}
+            {:key :bars
+             :style {
+                     :padding 0
+                     :margin 0
+                     :width "100%"
+                     :position "static"
+                     :white-space "nowrap"
+                     :display "inline-block"
+                     :vertical-align "middle"
+                     :background-color "white"}}
             (bar-chart row)]])]]]])
   )


seq -> set (typo)

seq -> set (typo)

--- src/chat/client/views/groups_nav.cljs
+++ src/chat/client/views/groups_nav.cljs
@@ -25,7 +25,7 @@
                                         last)
                                    thread)))
                 (mapcat (fn [thread]
-                          (seq (flatten (concat (->> (thread :tag-ids)
+                          (set (flatten (concat (->> (thread :tag-ids)
                                                      (map (fn [tag-id]
                                                             (get-in @store/app-state [:tags tag-id :group-id]))))
                                                 (->> (thread :mentioned-ids)


Don't 'backfill' selection when creating selection via copy/paste

--- src/cljs/goya/components/drawing.cljs
+++ src/cljs/goya/components/drawing.cljs
@@ -235,13 +235,15 @@
   (om/set-state! owner :selection [0 0 0 0])
   (om/set-state! owner :mouse-offset-in-selection [0 0])
   (om/set-state! owner :selection-image {})
-  (om/set-state! owner :user-is-moving-selection false))
+  (om/set-state! owner :user-is-moving-selection false)
+  (om/set-state! owner :selection-was-pasted false))

 (defn make-selection [app owner doc-x doc-y doc-width]
   (let [[orig-x orig-y] (get-in @guistate/transient-state [:mouse-down-pos])
         selection-rect (geometry/normalize-rect orig-x orig-y doc-x doc-y)
         main-image (canvas/get-current-pixels @app)]
+    (clear-selection-state owner)
     (om/set-state! owner :selection selection-rect)
     (om/set-state! owner :selection-image (clip-sub-image main-image selection-rect doc-width))))

@@ -332,7 +334,8 @@
          (* (- adjusted-doc-y mouse-down-y) zoom-factor))))

   (when (= paint-tool :selection)
-    (let [user-is-moving-selection (om/get-state owner :user-is-moving-selection)]
+    (let [user-is-moving-selection (om/get-state owner :user-is-moving-selection)
+          selection-was-pasted (om/get-state owner :selection-was-pasted)]
       (when (not user-is-moving-selection)
         (clear-preview-canvas)
         (set! (.-fillStyle preview-context) "rgba(127,127,127,0.3)")
@@ -353,11 +356,12 @@
               blit-y (- doc-y offset-y)]
           (clear-preview-canvas)
           (set! (.-fillStyle preview-context) (get-in @app [:tools :paint-color]))
-          (.fillRect preview-context
-             (* x1 zoom-factor)
-             (* y1 zoom-factor)
-             (* (- x2 x1) zoom-factor)
-             (* (- y2 y1) zoom-factor))
+          (when (not selection-was-pasted)
+            (.fillRect preview-context
+               (* x1 zoom-factor)
+               (* y1 zoom-factor)
+               (* (- x2 x1) zoom-factor)
+               (* (- y2 y1) zoom-factor)))
           (blit-sub-image @app (om/get-state owner :selection-image) blit-x blit-y)))))))

@@ -414,9 +418,11 @@
               [x1 y1 x2 y2] (om/get-state owner :selection)
               paste-x (- doc-x xOff)
               paste-y (- doc-y yOff)
+              selection-was-pasted (om/get-state owner :selection-was-pasted)
               backfill (create-sub-image-for-rect (om/get-state owner :selection)
                                                   (get-in @app [:tools :paint-color]))]
-        (paste-image app owner x1 y1 backfill)
+        (when (not selection-was-pasted)
+          (paste-image app owner x1 y1 backfill))
         (paste-image app owner paste-x paste-y (om/get-state owner :selection-image)))
         (clear-selection-state owner)
         (om/transact! app
@@ -444,7 +450,8 @@
   (let [clipboard-image (om/get-state owner :clipboard-image)
         paste-rect [0 0 (:width clipboard-image) (:height clipboard-image)]]
     (om/set-state! owner :selection-image clipboard-image)
-    (om/set-state! owner :selection paste-rect)))
+    (om/set-state! owner :selection paste-rect)
+    (om/set-state! owner :selection-was-pasted true)))

 (defn handle-command [app owner e]
   (when (= e :copy) (copy app owner e))
@@ -458,6 +465,7 @@
       (init-state [_]
         {:mouse-chan (chan)
          :user-is-moving-selection false
+         :selection-was-pasted false
          :selection [0 0 0 0]
          :selection-image {}
          :mouse-offset-in-selection [0 0]})


Update cars.clj

Update cars.clj

--- src/clojure_car_price/models/cars.clj
+++ src/clojure_car_price/models/cars.clj
@@ -1,13 +1,13 @@
 (ns clojure_car_price.models.cars
   (:refer-clojure :exclude [get])
   (:require [clojure.java.jdbc :as j]
-				[clojure.java.jdbc.sql :as s]))
+	    [clojure.java.jdbc.sql :as s]))

 (def mysql-db {:subprotocol "mysql"
-                     :subname "//localhost:3306/carsdb"
-                     :user "root"
-                     :pass " "
-                     :zeroDateTimeBehaviour "convertToNull"})
+               :subname "//localhost:3306/carsdb"
+               :user "root"
+               :pass " "
+               :zeroDateTimeBehaviour "convertToNull"})

 (def now
   (str (java.sql.Timestamp. (System/currentTimeMillis))))


Adding support for DIF.

Adding support for DIF.

--- src/cmr/search/api/search_results.clj
+++ src/cmr/search/api/search_results.clj
@@ -23,6 +23,7 @@
     "application/xml"
     "application/json"
     "application/echo10+xml"
+    "application/dif+xml"
     "text/csv"})

 (defmulti search-results->response
@@ -105,16 +106,22 @@
     (csv/write-csv string-writer response-refs)
     (str string-writer)))

+(defn search-results->metadata-response
+  [context results result-type pretty]
+  (let [{:keys [hits took references]} results
+        metadatas (references->format context references result-type)]
+    (format "<?xml version=\"1.0\" encoding=\"UTF-8\"?><results><hits>%d</hits><took>%d</took>%s</results>"
+            hits took
+            (s/join "" (map reference+metadata->xml-element
+                            references
+                            (map remove-xml-processing-instructions
+                                 metadatas))))))
+
 (defmethod search-results->response :echo10
   [context results result-type pretty]
-  (let [{:keys [hits took references]} results
-        echo10 (references->format context references :echo10)]
-    (format "<?xml version=\"1.0\" encoding=\"UTF-8\"?><results><hits>%s</hits><took>%s</took>%s</results>"
-            (str hits)
-            (str took)
-            (s/join ""
-                    (map (fn [reference echo10-xml]
-                           (reference+metadata->xml-element reference
-                                                            (remove-xml-processing-instructions echo10-xml)))
-                         references echo10)))))
+  (search-results->metadata-response context results result-type pretty))

+(defmethod search-results->response :dif
+  [context results result-type pretty]
+  (search-results->metadata-response context results result-type pretty))
+


Changed range to update other time when From is after To and visa versa.

--- src/re_com/time.cljs
+++ src/re_com/time.cljs
@@ -153,37 +153,35 @@
   "Triggered whenever the input field loses focus.
   Re-validate what has been entered. Then update the model."
   [ev input-model min max callback previous-val]
-  (let [input-val (-> ev .-target .-value)
-        time-int (string->time-integer input-val)
-        validated-int (validated-time-integer time-int (deref-or-value min) (deref-or-value max) previous-val)]
+  (let [time-int (string->time-integer @input-model)
+        validated-int (validated-time-integer time-int @min @max previous-val)]
     (reset! input-model (display-string (time-int->hour-minute validated-int)))
     (when (and callback (not (= validated-int previous-val)))
       (callback validated-int))))

-(defn- updated-range-time
-  "One of the values of a range has changed. Update the min or max of the other input.
-  Return true if the value has been accepted."
-  [model max-or-min-model]
-  (let [new-time-int (string->time-integer @model)]
-    (reset! max-or-min-model new-time-int)))
-
 (defn- updated-range-from-time
-  "The From of a range has changed. Update the min of the other input.
-  Send the new value to the caller using the callback."
-  [model max-or-min-model previous-vals callback]
-  (updated-range-time model max-or-min-model)
-  (when callback
-    (let [new-vals [@max-or-min-model (last previous-vals )]]
-      (callback new-vals))))
+  "The From of a range has changed. If necessary, update the model of the other input.
+  Send the new values to the caller using the callback."
+  [from-model to-model previous-vals callback]
+  (let [from-int (string->time-integer @from-model)
+        to-int   (string->time-integer @to-model)]
+    (if (> from-int to-int)
+      (reset! to-model @from-model))
+    (when callback
+      (let [new-vals [(string->time-integer @from-model)(last previous-vals)]]
+        (callback new-vals)))))

 (defn- updated-range-to-time
-  "The To of a range has changed. Update the max of the other input.
-  Send the new value to the caller using the callback."
-  [model max-or-min-model previous-vals callback]
-  (updated-range-time model max-or-min-model)
-  (when callback
-    (let [new-vals [(first previous-vals) @max-or-min-model]]
-      (callback new-vals))))
+  "The To of a range has changed. If necessary, update the model of the other input.
+  Send the new values to the caller using the callback."
+  [from-model to-model previous-vals callback]
+  (let [from-int (string->time-integer @from-model)
+        to-int   (string->time-integer @to-model)]
+    (if (< to-int from-int )
+      (reset! from-model @to-model))
+    (when callback
+      (let [new-vals [(first previous-vals)(string->time-integer @to-model)]]
+        (callback new-vals)))))

 (defn- atom-on
   [model default]
@@ -206,8 +204,9 @@

 (defn- private-time-input
   "This is the markup for the time input."
-  [model previous-val min max & {:keys [on-change disabled style hide-border show-time-icon :as args]}]
+  [ & {:keys [model previous-val min max on-change disabled style hide-border show-time-icon :as args]}]
   {:pre [(superset? time-api (keys args))]}
+  (println (str "model: " @model " prev: " previous-val " min: " @min " max: " @max)) ;; TODO remove this
   (let [def-style {:flex "none"
                    :margin-top "0px"
                    :padding-left "2px"
@@ -243,7 +242,11 @@
     (if-not (valid-time-integer? deref-model @min @max)
       (throw (js/Error. (str "model " deref-model " is not a valid time integer or is outside the min/max range."))))
      (fn [& {:keys [model disabled hide-border show-time-icon style]}]
-       [private-time-input input-model (deref-or-value model) min max
+       [private-time-input
+         :model input-model
+         :previous-val (deref-or-value model)
+         :min min
+         :max max
          :on-change on-change
          :disabled disabled
          :hide-border hide-border
@@ -266,8 +269,6 @@
     (throw (js/Error. (str "model for TO time: " @input-to-model " is not a valid time integer."))))
   (if-not (< (first deref-model) (last deref-model))
       (throw (js/Error. (str "TO " @input-to-model " is less than FROM " @input-from-model "."))))
-  (let [from-max-model (atom-on (string->time-integer @input-to-model) nil)
-        to-min-model   (atom-on (string->time-integer @input-from-model) nil)]

   (fn [& {:keys [model disabled]}]
       [h-box
@@ -275,23 +276,23 @@
         :align :center
         :children [(when from-label [label :label from-label])
                    [private-time-input
-                    input-from-model
-                    (first (deref-or-value model))
-                    min
-                    from-max-model
-                    :on-change #(updated-range-from-time input-from-model to-min-model (deref-or-value model) on-change)
-                    :disabled disabled
-                    :hide-border hide-border
-                    :show-time-icon show-time-icon
-                    :style style]
+                      :model input-from-model
+                      :previous-val (first (deref-or-value model))
+                      :min min
+                      :max max
+                      :on-change #(updated-range-from-time input-from-model input-to-model (deref-or-value model) on-change)
+                      :disabled disabled
+                      :hide-border hide-border
+                      :show-time-icon show-time-icon
+                      :style style]
                    (when to-label [label :label to-label])
                    [private-time-input
-                    input-to-model
-                    (last (deref-or-value model))
-                    to-min-model
-                    max
-                    :on-change #(updated-range-to-time input-to-model from-max-model (deref-or-value model) on-change)
-                    :disabled disabled
-                    :hide-border hide-border
-                    :show-time-icon show-time-icon
-                    :style style]]]))))
+                      :model input-to-model
+                      :previous-val (last (deref-or-value model))
+                      :min min
+                      :max max
+                      :on-change #(updated-range-to-time input-from-model input-to-model (deref-or-value model) on-change)
+                      :disabled disabled
+                      :hide-border hide-border
+                      :show-time-icon show-time-icon
+                      :style style]]])))


Renamed functions and arguments where word specification was used (specification -> spec).

--- src/clj_formal_specifications_app/core.clj
+++ src/clj_formal_specifications_app/core.clj
@@ -44,35 +44,31 @@
   [map-entry]
   (:spec-ref (meta (var-get (val map-entry)))))

-(defn assoc-action-to-specification
-  [specification action-entry]
-  (assoc-in specification [:actions (key action-entry)] {}))
+(defn assoc-action-to-spec
+  [spec action-entry]
+  (assoc-in spec [:actions (key action-entry)] {}))

-(defn assoc-spec-ref-to-specification
-  [specification spec-ref-entry]
-  (assoc-in specification [:spec-refs (key spec-ref-entry)] {}))
+(defn assoc-spec-ref-to-spec
+  [spec spec-ref-entry]
+  (assoc-in spec [:spec-refs (key spec-ref-entry)] {}))

-(defn assoc-to-specification
- [specification map-entry]
+(defn assoc-to-spec
+ [spec map-entry]
   (cond
-   (action-entry? map-entry)
-   (assoc-action-to-specification specification map-entry)
+   (action-entry? map-entry) (assoc-action-to-spec spec map-entry)
+   (spec-ref-entry? map-entry) (assoc-spec-ref-to-spec spec map-entry)
+   :else spec))

-   (spec-ref-entry? map-entry)
-   (assoc-spec-ref-to-specification specification map-entry)
-
-   :else specification))
-
-(defn ns-specification
+(defn ns-spec
   [ns]
-  (reduce assoc-to-specification {} (ns-publics (symbol ns))))
+  (reduce assoc-to-spec {} (ns-publics (symbol ns))))

 (defn compose
-  [specification]
-  (let [ns-name (get-ns-name specification)]
+  [spec]
+  (let [ns-name (get-ns-name spec)]
   {:body (do
-           (load-string specification)
-           (ns-specification ns-name))}))
+           (load-string spec)
+           (ns-spec ns-name))}))

 (defroutes api-routes
   (GET "/api/examples" [] (example-listing))


clear the chars from a pixelfont text

clear the chars from a pixelfont text

--- src/cljs/infinitelives/pixi/pixelfont.cljs
+++ src/cljs/infinitelives/pixi/pixelfont.cljs
@@ -39,6 +39,9 @@

 (defn get-font [font-key]
   (font-key @pixel-fonts))
+
+(defn clear-text! [batch]
+  (.removeChildren batch))

 (defn make-text [font-key text & {:keys [tint scale anchor rotation
                                          x y visible


fix pixi calls

fix pixi calls

--- src/cljs/infinitelives/pixi/resources.cljs
+++ src/cljs/infinitelives/pixi/resources.cljs
@@ -90,20 +90,20 @@
 ;; setup a pixi texture keyed by the tail of its filename
 (defn- register-texture
   [url img]
-  (when (ends-with? url ".png")
-    (swap! =textures=
+  (when (string/ends-with? url ".png")
+    (swap! !textures
            assoc (url-keyword url)
            {
             :linear
             (PIXI/Texture.fromImage
-             url true (aget js/PIXI.scaleModes "LINEAR"))
+             url true (aget PIXI/scaleModes "LINEAR"))

             ;; this is a hack adding # to the tail of a url so pixi doesnt use the other
             ;; linear version
             ;; SEE: https://github.com/GoodBoyDigital/pixi.js/issues/1724
             :nearest
             (PIXI/Texture.fromImage
-             (str url "#") true (aget js/PIXI.scaleModes "NEAREST"))})))
+             (str url "#") true (aget PIXI/scaleModes "NEAREST"))})))

 (defn load-urls
   "loads each url in the passed in list as an image. Updates the progress


optimize autocomplete

optimize autocomplete

--- src/cljs/material/component/composite.cljs
+++ src/cljs/material/component/composite.cljs
@@ -1,9 +1,8 @@
 (ns material.component.composite
-  (:require [goog.object]
+  (:require [goog.object :as gobject]
             [material.icon :as icon]
             [material.component :as cmp]
-            [sablono.core :refer-macros [html]]
-            [clojure.walk :refer [keywordize-keys]]))
+            [sablono.core :refer-macros [html]]))

 (defn progress-button [action action-fn processing?]
   (html
@@ -19,20 +18,20 @@
           :className "Swarmpit-progress-button"}))]))

 (defn autocomplete-input [props]
-  (let [{:keys [inputRef] :as p} (keywordize-keys (js->clj props))]
+  (let [{:keys [inputRef] :as p} (js->clj props :keywordize-keys true)]
     (html
       [:div (merge {:ref inputRef}
                    (dissoc p :inputRef))])))

 (defn autocomplete-no-options-mssg [props]
-  (let [{:keys [innerProps children]} (keywordize-keys (js->clj props))]
+  (let [{:keys [innerProps children]} (js->clj props :keywordize-keys true)]
     (cmp/typography
       (merge innerProps
              {:color "textSecondary"
               :style {:padding "8px 16px"}}) children)))

 (defn autocomplete-placeholder [props]
-  (let [{:keys [innerProps children]} (keywordize-keys (js->clj props))]
+  (let [{:keys [innerProps children]} (js->clj props :keywordize-keys true)]
     (cmp/typography
       (merge innerProps
              {:color "textSecondary"
@@ -42,12 +41,12 @@
                       :padding  "10px 15px"}}) children)))

 (defn autocomplete-single-value [props]
-  (let [{:keys [children]} (keywordize-keys (js->clj props))]
+  (let [{:keys [children]} (js->clj props :keywordize-keys true)]
     (cmp/typography
       {:style {:fontSize 16}} children)))

 (defn autocomplete-multi-value [props]
-  (let [{:keys [removeProps children]} (keywordize-keys (js->clj props))]
+  (let [{:keys [removeProps children]} (js->clj props :keywordize-keys true)]
     (cmp/chip
       {:tabIndex   -1
        :onDelete   (:onClick removeProps)
@@ -55,14 +54,14 @@
        :label      children})))

 (defn autocomplete-menu [props]
-  (let [{:keys [innerProps]} (keywordize-keys (js->clj props))]
-    (cmp/paper
-      (merge innerProps
-             {:style {:position  "absolute"
-                      :zIndex    2
-                      :marginTop 8
-                      :left      0
-                      :right     0}}) (goog.object/get props "children"))))
+  (cmp/paper
+    (js/Object.assign (gobject/get props "innerProps")
+           #js {:style #js {:position  "absolute"
+                            :zIndex    2
+                            :marginTop 8
+                            :left      0
+                            :right     0}})
+    (gobject/get props "children")))

 (defn autocomplete-value-container [props]
   (html
@@ -72,10 +71,10 @@
        :flexWrap   "wrap"
        :flex       1
        :alignItems "center",
-       :overflow   "hidden"}} (goog.object/get props "children")]))
+       :overflow   "hidden"}} (gobject/get props "children")]))

 (defn autocomplete-control [props]
-  (let [{:keys [innerRef innerProps children selectProps]} (keywordize-keys (js->clj props))
+  (let [{:keys [innerRef innerProps children selectProps]} (js->clj props :keywordize-keys true)
         margin (get-in selectProps [:textFieldProps :margin])]
     (cmp/text-field
       (merge (:textFieldProps selectProps)
@@ -93,13 +92,13 @@
                                                    :children children})}}))))

 (defn autocomplete-option [props]
-  (let [{:keys [innerRef isFocused children isSelected innerProps]} (keywordize-keys (js->clj props))]
-    (cmp/menu-item
-      (merge innerProps
-             {:buttonRef innerRef
-              :selected  isFocused
-              :component "div"
-              :style     {:fontWeight (if isSelected 500 400)}}) children)))
+  (cmp/menu-item
+    (js/Object.assign (gobject/get props "innerProps")
+      #js {:buttonRef (gobject/get props "innerRef")
+           :selected  (gobject/get props "isFocused")
+           :component "div"
+           :style     #js {:fontWeight (if (gobject/get props "isSelected") 500 400)}})
+    (gobject/get props "children")))

 (defn autocomplete [props]
   (cmp/no-ssr


pretty color grid

pretty color grid

--- src/cljs/reagent_demo/views/home_page.cljs
+++ src/cljs/reagent_demo/views/home_page.cljs
@@ -2,29 +2,18 @@
   (:require [reagent.core :as reagent :refer [atom]]
             [hum.core :as hum]))

-(defn rand-hex-char []
-  (char (rand-nth (concat (range 48 58) (range 66 72)))))
-
-(defn rand-hex []
-  (str "#" (rand-hex-char) (rand-hex-char) (rand-hex-char)))
-
-(defn swap-color! [color]
-  (reset! color (rand-hex)))
-
 (def ctx (hum/create-context))
 (def vco (hum/create-osc ctx :square))
+(def vco2 (hum/create-osc ctx :sine))
 (def vcf (hum/create-biquad-filter ctx))
+(def vcf2 (hum/create-biquad-filter ctx))
 (def output (hum/create-gain ctx))
+(def output2 (hum/create-gain ctx))

 (hum/connect vco vcf)
 (hum/connect vcf output)
 (hum/start-osc vco)
 (hum/connect-output output)
-
-(def ctx2 (hum/create-context))
-(def vco2 (hum/create-osc ctx :triangle))
-(def vcf2 (hum/create-biquad-filter ctx))
-(def output2 (hum/create-gain ctx))

 (hum/connect vco2 vcf2)
 (hum/connect vcf2 output2)
@@ -39,34 +28,56 @@
         a 440]
   (* multiplier a)))

-(defn note-on [note] (hum/note-on output vco (note-to-frequency note)))
-(defn note-on2 [note] (hum/note-on output2 vco2 (note-to-frequency note)))
-(defn note-on3 [a b]
+(defn note-on [a b]
   (hum/note-on output vco (note-to-frequency a))
   (hum/note-on output2 vco2 (note-to-frequency b)))

-(defn note-off [] (hum/note-off output))
-(defn note-off2 [] (hum/note-off output2))
-(defn note-off3 [] (note-off) (note-off2))
+(defn note-off []
+  (hum/note-off output)
+  (hum/note-off output2))

-(defn note-button [note] [:button {:on-mouse-down #(note-on note) :on-mouse-up note-off} note])
-(defn note-button2 [note] [:button {:on-mouse-down #(note-on2 note) :on-mouse-up note-off2} (str note " 2")])
-(defn note-button3 [n1 n2] [:button {:style {:height "40px" :border 0 :margin "1px"} :on-mouse-down #(note-on3 n1 n2) :on-mouse-up note-off3} (str n1 "-" n2)])
+(def timeout-atom (atom []))
+
+(defn delayed-off []
+  (js/clearTimeout @timeout-atom)
+  (reset! timeout-atom (js/setTimeout note-off 300)))
+
+(defn rand-hex-char []
+  (char (rand-nth (concat (range 48 58) (range 66 72)))))
+
+(defn rand-hex []
+  (str "#" (rand-hex-char) (rand-hex-char) (rand-hex-char)))
+
+(defn hex-char [n]
+  (let [chars (concat (range 48 58) (range 66 71))]
+    (char (nth chars (quot n 5)))))
+
+(defn make-hex [a b]
+  (str "#" (hex-char a) (hex-char b) 7))
+
+(defn button-style [a b]
+  {:width "25px" :height "25px" :font-size "12px" :outline 0 :border 0 :background-color (make-hex a b)})
+
+(defn note-button [n1 n2]
+  [:button {:key (rand) :style (button-style n1 n2) :on-mouse-down #(note-on n1 n2) :on-mouse-up delayed-off}])
+
+(def grid-range (range 5 70 5))

 (defn button-row [n]
-  [:span (map #(note-button3 n %) (range 10 100 8))
-    [:br]])
+  [:div {:key (rand)} (map #(note-button n %) grid-range) [:br]])

-(defn button-grid [n]
-  (map #(button-row %) (range 10 n 8)))
+(defn button-grid []
+  (map #(button-row %) grid-range))

 (defn main []
    [:div [:h2 "Welcome to reagent_demo"]
     [:div [:a {:href "#/about"} "go to about page"]]
-    (button-grid 100)
-    ])
+    [:br]
+    (button-grid)])

-
+;
+; (defn swap-color! [color]
+;   (reset! color (rand-hex)))

 ; (defn main []
 ;   (let [color (atom "red")]


Setup default cookie attr as `:redef`.

Setup default cookie attr as `:redef`.

That helps use this with direct linking.


[#1142] Switch to HSL color generation in sql statement

--- backend/src/akvo/lumen/lib/visualisation/map_config.clj
+++ backend/src/akvo/lumen/lib/visualisation/map_config.clj
@@ -125,21 +125,14 @@
                   'grey'
                 ELSE
                   concat(
-                    'rgb(255,',
-                    255 - floor(
+                    'hsl(0, 100%%, ',
+                    100 - floor(
                       (
                         (aggregation::decimal - (select min(aggregation) from temp_table)::decimal) /
                         ((select max(aggregation) from temp_table)::decimal - (select min(aggregation) from temp_table)::decimal)
-                      ) * 255
+                      ) * 50
                     ),
-                    ',',
-                    255 - floor(
-                      (
-                        (aggregation::decimal - (select min(aggregation) from temp_table)::decimal) /
-                        ((select max(aggregation) from temp_table)::decimal - (select min(aggregation) from temp_table)::decimal)
-                      ) * 255
-                    ),
-                    ')'
+                    '%%)'
                   )
               END as shapefill
             from


timer now runs!!!!!!

timer now runs!!!!!!

--- src/clojure/com/example/gt/metime/main.clj
+++ src/clojure/com/example/gt/metime/main.clj
@@ -29,9 +29,11 @@
           text-time-view
           :text
           (str (format "%02d:%02d:%02d"
-                       (.toHours TimeUnit/MICROSECONDS millis-until-finished)
-                       (- (.toMinutes TimeUnit/MICROSECONDS millis-until-finished) (.toMinutes TimeUnit/HOURS (.toHours TimeUnit/MICROSECONDS millis-until-finished)))
-                       (- (.toSeconds TimeUnit/MICROSECONDS millis-until-finished) (.toSeconds TimeUnit/MINUTES (.toMinutes TimeUnit/MICROSECONDS millis-until-finished))))))))
+                       (.toHours TimeUnit/MILLISECONDS millis-until-finished)
+                       (- (.toMinutes TimeUnit/MILLISECONDS millis-until-finished) (.toMinutes TimeUnit/HOURS (.toHours TimeUnit/MILLISECONDS millis-until-finished)))
+                       (- (.toSeconds TimeUnit/MILLISECONDS millis-until-finished) (.toSeconds TimeUnit/MINUTES (.toMinutes TimeUnit/MILLISECONDS millis-until-finished))))))
+        )
+      )
     (onFinish []
       (on-ui config text-time-view :text "Completed."))))


Remove obsolete comments

Remove obsolete comments

--- src/clojure/frereth_cp/server/initiate.clj
+++ src/clojure/frereth_cp/server/initiate.clj
@@ -464,14 +464,6 @@
                              ::shared-long-secret (b-t/->string shared-secret)
                              ::K/inner-i-nonce (b-t/->string inner-i-nonce)
                              ::specs/crypto-text (b-t/->string hidden-client-short-pk)})
-        ;; This next line is failing.
-        ;; Q: Could it possibly be a subtle difference between box-after and whatever
-        ;; open-box does?
-        ;; I have verified that the nonces, crypto-text, and shared secrets are
-        ;; the same.
-        ;; FIXME: Take those values and write up a unit test that calls
-        ;; client.initiate/encrypt-inner-vouch and then this to verify
-        ;; the round trip
         {log-state ::log/state
          ;; It seems tempting to use decompose-box here.
          ;; That would be pointless: the clear text is just the client's
@@ -877,7 +869,6 @@
                   {::log/state (log/warn log-state
                                          ::do-handle
                                          "Unable to build a new client"
-                                         ;; FIXME: Find the standard ns for each of these keys
                                          {::shared/network-packet packet
                                           ::K/initiate-packet-spec initiate
                                           ::client-builder (select-keys state [::state/cookie-cutter


Removed debug output.

Removed debug output.

--- src/cmr/indexer/services/index_service.clj
+++ src/cmr/indexer/services/index_service.clj
@@ -37,10 +37,6 @@
   (let [concepts (filter #(#{"ECHO10"} (:format %)) concepts)]
     (map (fn [concept]
            (let [umm-concept (parse-concept concept)
-                 _ (println (get-in umm-concept [:product :short-name]))
-                 _ (when (nil? (get-in umm-concept [:product :short-name]))
-                     (do (println "nil short-name:" umm-concept)
-                       (println concept)))
                  concept-id (:concept-id concept)
                  revision-id (:revision-id concept)
                  index-name (idx-set/get-concept-index-name context concept-id revision-id umm-concept)


Added support for aql granule conditions that are derived from collection conditions.

--- src/cmr/search/services/aql/conversion.clj
+++ src/cmr/search/services/aql/conversion.clj
@@ -182,6 +182,10 @@
          (qm/or-conds
            (map (partial string-element->condition concept-type key operator) (:content element))))))))

+(defmethod element->condition :string
+  [concept-type element]
+  (string-element->condition concept-type element))
+
 (defmethod element->condition :dif-entry-id
   [concept-type element]
   (qm/or-conds
@@ -196,6 +200,11 @@
       {:field condition-key
        :start-date start-date
        :end-date stop-date})))
+
+(defmethod element->condition :collection-query
+  [concept-type element]
+  (let [condition (element->condition :collection element)]
+    (qm/->CollectionQueryCondition condition)))

 (defmethod element->condition :equator-crossing-date
   [concept-type element]


saving state

saving state

--- cljs-admin/tourneybot_admin/core.cljs
+++ cljs-admin/tourneybot_admin/core.cljs
@@ -46,7 +46,7 @@

 (def tournament-state-keys
   "These keys represent the tournament state and should always be reflected in
-   tourmanet.json."
+   tournament.json."
   #{:title
     :tiesAllowed
     :divisions
@@ -206,7 +206,9 @@
      :on-touch-start prevent-default}
     txt])

-(defn- click-back-btn [])
+(defn- click-back-btn []
+  ;; TODO: write this
+  nil)

 (rum/defc GameInput < rum/static
   [game-id game]
@@ -251,10 +253,22 @@
 ;; Games Page
 ;;------------------------------------------------------------------------------

+(rum/defc GameRow < rum/static
+  [[game-id game]]
+  (let [games-vec nil]
+    [:div.game-row
+      (name game-id)]))
+
+(defn- compare-games [a b]
+  (compare (-> a second :start-time)
+           (-> b second :start-time)))
+
 (rum/defc GamesPage < rum/static
   [games-map]
-  [:article.games-container
-    (GameInput :game11 (get-in @page-state [:games :game11]))])
+  (let [games-vec (vec games-map)
+        sorted-games (sort compare-games games-vec)]
+    [:article.games-container
+      (map GameRow sorted-games)]))

 ;;------------------------------------------------------------------------------
 ;; Teams Page


remove useless function

remove useless function

--- clojure/src/usedbooks_search/core.clj
+++ clojure/src/usedbooks_search/core.clj
@@ -55,20 +55,17 @@
 (defn fetch-url [url]
   (html/html-resource (java.net.URL. url)))

-(defn html-select [html element]
-  (html/select html element))
-
 (defn select-titles [html]
-  (html-select html [:a.bo_l :b]))
+  (html/select html [:a.bo_l :b]))

 (defn select-each-prices [html]
-  (html-select html [:span.ss_p2]))
+  (html/select html [:span.ss_p2]))

 (defn select-each-nbooks [html]
-  (html-select html [:span.ss_p4]))
+  (html/select html [:span.ss_p4]))

 (defn select-total-nbooks [html]
-  (html-select html [:span.ss_f_g_l]))
+  (html/select html [:span.ss_f_g_l]))

 (defn parse-total-nbooks [html]
   (let [result (first (:content (first (select-total-nbooks html))))]


reflexive=true for: get angry, change clothes, get ready, get up

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -334,6 +334,7 @@

    "change clothes" {:synsem {:cat :verb
                               :sem {:pred :change-clothes
+                                    :reflexive true
                                     :subj {:human true}}}
                      :english {:present {:3sing "changes clothes"}
                                :participle "changing clothes"
@@ -557,6 +558,7 @@
    (let [subject-semantics (atom {:animate true})]
      {:synsem {:cat :verb
                :sem {:pred :get-angry
+                     :reflexive true
                      :subj subject-semantics
                      :obj subject-semantics}
                :subcat {:1 {:sem subject-semantics}
@@ -611,6 +613,7 @@
    (let [subject-semantics (atom {:human true})]
      {:synsem {:cat :verb
                :sem {:pred :get-ready
+                     :reflexive true
                      :subj subject-semantics
                      :obj subject-semantics}
                :subcat {:1 {:sem subject-semantics}
@@ -622,6 +625,7 @@
    (let [subject-semantics (atom {:animate true})]
      {:synsem {:cat :verb
                :sem {:pred :get-up
+                     :reflexive true
                      :subj subject-semantics
                      :obj subject-semantics}
                :subcat {:1 {:sem subject-semantics}


fix typos

fix typos

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -564,8 +564,8 @@
                       :sem {:pred :finish}}}

    "first" (unify adjective
-                  {:sem {:mod {:pred :first}
-                         :comparative false}})
+                  {:synsem {:sem {:mod {:pred :first}
+                                  :comparative false}}})

    "fold" {:synsem {:cat :verb
                     :sem {:pred :fold}}}
@@ -899,10 +899,10 @@
    "house" (unify agreement-noun
                   common-noun
                   countable-noun
-                  {:synsem {:sem (unify animal {:pred :house
-                                                :buyable true
-                                                :artifact true
-                                                :place true})}})
+                  {:synsem {:sem {:pred :house
+                                  :buyable true
+                                  :artifact true
+                                  :place true}}})
    "hug"
    {:synsem {:cat :verb
              :sem {:pred :hug
@@ -1471,8 +1471,8 @@
                       :past "scrubbed"}}

    "second" (unify adjective
-                  {:sem {:mod {:pred :first}
-                         :comparative false}})
+                   {:synsem {:sem {:mod {:pred :first}
+                                   :comparative false}}})

    "see"  {:synsem {:cat :verb
                     :sem {:pred :see}}


subcategorization of "want"

subcategorization of "want"

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1938,8 +1938,16 @@
    "walk" {:synsem {:cat :verb
                 :sem {:pred :walk}}}

-   "want" {:synsem {:cat :verb
-                    :sem {:pred :want}}}
+   "want" (let [modal-subject (atom {:cat :noun
+                                     :sem {:animate true}})]
+            {:synsem {:cat :verb
+                      :sem {:pred :want}
+                      :subcat {:1 modal-subject
+                               :2 {:cat :verb
+                                   :infl :infinitive
+                                   :subcat {:1 modal-subject
+                                            :2 '()}}
+                               :3 '()}}})

    "warm" {:synsem {:cat :verb
                 :sem {:pred :warm}}}


be + PP: pred and obj of PP are shared with verb

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -181,9 +181,17 @@
                      } ;; end of map
                     ))

-           (unify common
-                  {:synsem {:sem {:pred :be}
-                            :subcat {:2 {:cat :prep}}}})])
+           (let [pred (atom :top)
+                 obj (atom :top)]
+             (unify common
+                    {:synsem {:cat :verb
+                              :sem {:obj obj
+                                    :pred pred}
+                              :subcat {:1 {:cat :noun}
+                                       :2 {:cat :prep
+                                           :sem {:obj obj
+                                                 :pred pred}
+                                           }}}}))])

    "be able to" {:english {:imperfect {:1sing "was able to"
                                        :2sing "were able to"
@@ -2212,13 +2220,6 @@
                   {:synsem {:cat :verb
                             :subcat {:2 {:subcat '()}}}})

-                 (default
-                  (let [location (atom :top)]
-                    {:synsem {:cat :verb
-                              :sem {:location location}
-                              :subcat {:2 {:cat :prep
-                                           :sem location}}}}))
-
                  ))))


include thread last open time when getting by tag

addresses https://github.com/braidchat/meta/issues/330

--- src/braid/server/db/thread.clj
+++ src/braid/server/db/thread.clj
@@ -127,7 +127,8 @@
                          (take limit))]
     {:threads (into ()
                     (comp (map db->thread)
-                          (filter #(user-can-see-thread? conn user-id (% :id))))
+                          (filter #(user-can-see-thread? conn user-id (% :id)))
+                          (map #(thread-add-last-open-at conn % user-id)))
                     (d/pull-many (d/db conn) thread-pull-pattern thread-eids))
      :remaining (- (count all-thread-eids) (+ skip (count thread-eids)))}))


add irregular present tense for "dormir"

--- src/babel/francais/lexicon.cljc
+++ src/babel/francais/lexicon.cljc
@@ -245,7 +245,14 @@
                       :sem {:pred :give}}}

    "dormir" {:synsem {:cat :verb
-                      :sem {:pred :sleep}}}
+                      :sem {:pred :sleep}}
+             :français {:past-participle "dit"
+                        :present {:1sing "dors"
+                                  :2sing "dors"
+                                  :3sing "dort"
+                                  :1plur "dormons"
+                                  :2plur "dormez"
+                                  :3plur "dorment"}}}

    "echapper" {:synsem {:cat :verb
                         :sem {:pred :escape}}}


make path to lexicon.edn relative to current directory

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -47,7 +47,7 @@
    [clojure.core.cache :as cache]
    [dag_unify.core :refer (fail? get-in merge remove-matching-keys unifyc)]))

-(def lexicon (edn2lexicon "/Users/ekoontz/babel/src/babel/italiano/lexicon.edn"))
+(def lexicon (edn2lexicon (str (-> (java.io.File. ".") .getAbsolutePath) "/src/babel/italiano/lexicon.edn")))

 (defn exception [error-string]
   #?(:clj