[examples/scrabble] Add documentation.

[examples/scrabble] Add documentation.

--- examples/scrabble/src/scrabble/core.clj
+++ examples/scrabble/src/scrabble/core.clj
@@ -4,28 +4,49 @@
     [cortex.optimise :as opt]
     [cortex.network :as net]))

+;; This is an example of a very simple network that is designed to learn the
+;; values for given scrabble pieces. Inspired by the following talk:
+;;  - "Machine Learning Live" by Mike Anderson (see: https://www.youtube.com/watch?v=QJ1qgCr09j8)
+;;
+;; It is a bit of a degenerate case as the "test" data is the same as the
+;; training data, however it shows how a neural network can learn an arbitrary
+;; function.
+
 (mat/set-current-implementation :vectorz)

+;; scrabble pieces and their values
 (def scrabble-values {\a 1 \b 3 \c 3 \d 2 \e 1 \f 4 \g 2 \h 4 \i 1 \j 8 \k 5
                       \l 1 \m 3 \n 1 \o 1 \p 3 \q 10 \r 1 \s 1 \t 1 \u 1 \v 4
                       \w 4 \x 8 \y 4 \z 10})

 (defn run-experiment []
-  (let [training-data   (mapv #(into [] [[(- (int %) (int \a))]]) (keys scrabble-values))
+  (let [;; convert the values from the scrabble pieces into 1x1 matrices
+        training-data   (mapv #(into [] [[(- (int %) (int \a))]]) (keys scrabble-values))
+
+        ;; convert the "labels" of the scrabble pieces into 1x1 matrices
         training-labels (mapv #(into [] [[%]])                    (vals scrabble-values))
+
+        ;; This defines the shape of the network
+        ;; TODO: add some explanation for the intution of the size of the various layers
         network (net/sequential-network
                   [(net/linear-layer :n-inputs 1 :n-outputs 10)
                    (net/sigmoid-activation 10)
                    (net/linear-layer :n-inputs 10 :n-outputs 1)])
-        n-epochs 10000
+
+        n-epochs 10000            ;; Number of iterations to train
         learning-rate 0.3
         momentum 0.9
         batch-size 1
         loss-fn (opt/quadratic-loss)
         optimizer (net/sgd-optimizer network loss-fn learning-rate momentum)]
+
+    ;; Run the training portion of the algorithm using the parameters from above
     (println "Training network...")
     (net/train-network optimizer n-epochs batch-size training-data training-labels)

+    ;; Once the network has been evaluated, use the same input data to test to see
+    ;; how the neural network has learned the target function. We use the same
+    ;; data for testing as training for this degenerate case.
     (println "Evaluating network...")
     (let [[results score] (net/evaluate network training-data training-labels)
           label-count (count training-data)


Reformat todomvc.views ns

Reformat todomvc.views ns

--- examples/todomvc/src/todomvc/views.cljs
+++ examples/todomvc/src/todomvc/views.cljs
@@ -1,5 +1,5 @@
 (ns todomvc.views
-  (:require [reagent.core  :as reagent]
+  (:require [reagent.core :as reagent]
             [re-frame.core :refer [subscribe dispatch]]
             [clojure.string :as str]))

@@ -30,57 +30,57 @@
     (fn [{:keys [id done title]}]
       [:li {:class (str (when done "completed ")
                         (when @editing "editing"))}
-        [:div.view
-          [:input.toggle
-            {:type "checkbox"
-             :checked done
-             :on-change #(dispatch [:toggle-done id])}]
-          [:label
-            {:on-double-click #(reset! editing true)}
-            title]
-          [:button.destroy
-            {:on-click #(dispatch [:delete-todo id])}]]
-        (when @editing
-          [todo-input
-            {:class "edit"
-             :title title
-             :on-save #(if (seq %)
-                          (dispatch [:save id %])
-                          (dispatch [:delete-todo id]))
-             :on-stop #(reset! editing false)}])])))
+       [:div.view
+        [:input.toggle
+         {:type      "checkbox"
+          :checked   done
+          :on-change #(dispatch [:toggle-done id])}]
+        [:label
+         {:on-double-click #(reset! editing true)}
+         title]
+        [:button.destroy
+         {:on-click #(dispatch [:delete-todo id])}]]
+       (when @editing
+         [todo-input
+          {:class   "edit"
+           :title   title
+           :on-save #(if (seq %)
+                       (dispatch [:save id %])
+                       (dispatch [:delete-todo id]))
+           :on-stop #(reset! editing false)}])])))

 (defn task-list
   []
   (let [visible-todos @(subscribe [:visible-todos])
         all-complete? @(subscribe [:all-complete?])]
-      [:section#main
-        [:input#toggle-all
-          {:type "checkbox"
-           :checked all-complete?
-           :on-change #(dispatch [:complete-all-toggle])}]
-        [:label
-          {:for "toggle-all"}
-          "Mark all as complete"]
-        [:ul#todo-list
-          (for [todo  visible-todos]
-            ^{:key (:id todo)} [todo-item todo])]]))
+    [:section#main
+     [:input#toggle-all
+      {:type      "checkbox"
+       :checked   all-complete?
+       :on-change #(dispatch [:complete-all-toggle])}]
+     [:label
+      {:for "toggle-all"}
+      "Mark all as complete"]
+     [:ul#todo-list
+      (for [todo visible-todos]
+        ^{:key (:id todo)} [todo-item todo])]]))

 (defn footer-controls
   []
   (let [[active done] @(subscribe [:footer-counts])
-        showing       @(subscribe [:showing])
-        a-fn          (fn [filter-kw txt]
-                        [:a {:class (when (= filter-kw showing) "selected")
-                             :href (str "#/" (name filter-kw))} txt])]
+        showing @(subscribe [:showing])
+        a-fn    (fn [filter-kw txt]
+                  [:a {:class (when (= filter-kw showing) "selected")
+                       :href  (str "#/" (name filter-kw))} txt])]
     [:footer#footer
      [:span#todo-count
       [:strong active] " " (case active 1 "item" "items") " left"]
      [:ul#filters
-      [:li (a-fn :all    "All")]
+      [:li (a-fn :all "All")]
       [:li (a-fn :active "Active")]
-      [:li (a-fn :done   "Completed")]]
+      [:li (a-fn :done "Completed")]]
      (when (pos? done)
        [:button#clear-completed {:on-click #(dispatch [:clear-completed])}
         "Clear completed"])]))
@@ -89,12 +89,12 @@
 (defn task-entry
   []
   [:header#header
-    [:h1 "todos"]
-    [todo-input
-      {:id "new-todo"
-       :placeholder "What needs to be done?"
-       :on-save #(when (seq %)
-                    (dispatch [:add-todo %]))}]])
+   [:h1 "todos"]
+   [todo-input
+    {:id          "new-todo"
+     :placeholder "What needs to be done?"
+     :on-save     #(when (seq %)
+                     (dispatch [:add-todo %]))}]])

 (defn todo-app


Add all sample data companies in a directory with 1 command.

--- src/open_company/util/sample_data.clj
+++ src/open_company/util/sample_data.clj
@@ -70,20 +70,23 @@

 (defn usage [options-summary]
   (s/join \newline
-     ["This program imports OPENcompany data from an EDN file."
+     ["This program imports OPENcompany data from EDN file(s)."
       ""
-      "Usage: lein run -m open-company.util.sample-data -- [options] company-data.edn"
+      "Usage:"
+      "  lein run -m open-company.util.sample-data -- [options] company-data.edn"
+      "  lein run -m open-company.util.sample-data -- [options] /directory/"
       ""
       "Options:"
       options-summary
       ""
       "Company data: an EDN file with company and sections"
+      "Directory: a directory of comany data EDN files"
       ""
       "Please refer to ./opt/samples for more information on the file format."
       ""]))

 (defn data-msg []
-  "\nThe data file must be an EDN file with a :company map and :sections vector.\n")
+  "\nNOTE: The data file(s) must be an EDN file with a :company map and :sections vector.\n")

 (defn error-msg [errors]
   (str "The following errors occurred while parsing your command:\n\n"
@@ -97,12 +100,19 @@
       (:help options) (exit 0 (usage summary))
       (not= (count arguments) 1) (exit 1 (usage summary))
       errors (exit 1 (error-msg errors)))
-    ;; Try the import
+    ;; Get the list of files to import
     (try
-      (let [data (read-string (slurp (first arguments)))]
-        (if (and (map? data) (:company data) (:sections data))
-          (import-company options data)
-          (exit 1 (data-msg))))
+      (let [arg (first arguments)
+            edn-file #".*\.edn$"
+            filenames (if (re-matches edn-file arg)
+                        [arg]
+                        (filter #(re-matches edn-file %) (map #(.toString %) (file-seq (clojure.java.io/file arg)))))]
+        ;; Import each file
+        (doseq [filename filenames]
+          (let [data (read-string (slurp filename))]
+            (if (and (map? data) (:company data) (:sections data))
+              (import-company options data)
+              (exit 1 (data-msg))))))
       (catch Exception e
         (println e)
         (exit 1 (data-msg))))))


Fix wrong requirement for generators

Fix wrong requirement for generators

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/algorithms/concepts.clj
+++ src/conexp/contrib/algorithms/concepts.clj
@@ -8,8 +8,8 @@

 (ns conexp.contrib.algorithms.concepts
   (:use [conexp.main :only (ns-doc, illegal-argument, improve-basic-order)]
+        conexp.util.generators
         conexp.contrib.algorithms.bitwise
-        conexp.contrib.algorithms.generators
         [conexp.contrib.algorithms.next-closure :only (next-closed-set)])
   (:use [conexp.fca.contexts :only (context?, objects, attributes,
                                     incidence, attribute-derivation,


Fix cljs dependencies.

Fix cljs dependencies.

--- src/replikativ/crdt/lwwr/realize.cljc
+++ src/replikativ/crdt/lwwr/realize.cljc
@@ -8,12 +8,14 @@
             [replikativ.crdt.materialize :refer [ensure-crdt]]
             [replikativ.crdt.lwwr.core :as core]
             [replikativ.crdt.lwwr.stage :as ors]
-            #?(:clj [kabel.platform-log :refer [debug info warn]])
+            #?(:clj [kabel.platform-log :refer [debug]])
             #?(:clj [superv.async :refer [<? go-try go-loop-super >?]])
             #?(:clj [clojure.core.async :as async
                      :refer [>! timeout chan alt! put! sub unsub pub close!]]
                :cljs [cljs.core.async :as async
-                      :refer [>! timeout chan put! sub unsub pub close!]])))
+                      :refer [>! timeout chan put! sub unsub pub close!]]))
+  #?(:cljs (:require-macros [superv.async :refer [<? go-try go-loop-super >?]]
+                            [kabel.platform-log :refer [debug]])))

 (defn stream-into-atom! [stage [u id] val-atom]
   (let [{{[p _] :chans
@@ -31,21 +33,21 @@
                                     :op (-handshake lwwr S)}
                        :user u :crdt-id id}))
        (go-loop-super S [{{{register :register :as op} :op
-                         method :method}
-                        :downstream :as pub
-                        :keys [user crdt-id]} (<? S pub-ch)
-                       lwwr lwwr]
-                      (when pub
-                        (debug {:event :streaming-lwwr :id (:id pub)})
-                        (cond (not (and (= user u)
-                                        (= crdt-id id)))
-                              (recur (<? S pub-ch) lwwr)
+                           method :method}
+                          :downstream :as pub
+                          :keys [user crdt-id]} (<? S pub-ch)
+                         lwwr lwwr]
+         (when pub
+           (debug {:event :streaming-lwwr :id (:id pub)})
+           (cond (not (and (= user u)
+                           (= crdt-id id)))
+                 (recur (<? S pub-ch) lwwr)

-                              :else
-                              (let [lwwr (-downstream lwwr op)]
-                                (reset! val-atom register)
-                                (>? S applied-ch pub)
-                                (recur (<? S pub-ch)
-                                       lwwr)))))))
+                 :else
+                 (let [lwwr (-downstream lwwr op)]
+                   (reset! val-atom (get-in lwwr [:register]))
+                   (>? S applied-ch pub)
+                   (recur (<? S pub-ch)
+                          lwwr)))))))
     {:close-ch pub-ch
      :applied-ch applied-ch}))


Add button-color key to brand-color schema.

--- src/oc/storage/resources/common.clj
+++ src/oc/storage/resources/common.clj
@@ -79,7 +79,8 @@

 (def Color
   {:rgb RGBColor
-   :hex (schema/pred hex-color?)})
+   :hex (schema/pred hex-color?)
+   (schema/optional-key :button-color) schema/Str})

 (def BrandColor
   {:light Color


add inferred values step for configuration

--- src/polismath/components/config.clj
+++ src/polismath/components/config.clj
@@ -38,7 +38,6 @@
                 ;; Hmmm should be able to specify a dep on port; aero?
                 :private-url-base "http://localhost:8080"}
                 ;; Shit... should be able to specify dependency on preprod as well!
-   :webserver-url "https://preprod.pol.is/api/v3"
    :database   {:pool-size 3}
    :poller     {:votes {:polling-interval 1000}
                 :moderation {:polling-interval 1000}
@@ -64,7 +63,6 @@
    :aws-access-key             {:path [:aws :access-key]}
    :webserver-username         {:path [:webserver-username]}
    :webserver-pass             {:path [:webserver-pass]}
-   :webserver-url              {:path [:webserver-url]}
    :export-server-auth-username {:path [:darwin :server-auth-username]}
    :export-server-auth-pass {:path [:darwin :server-auth-pass]}
    :math-matrix-implementation {:path [:math :matrix-implementation] :parse ->keyword}
@@ -104,7 +102,20 @@
    ;; Mini batch sizes (see polismath.math.conversation)

+(defn assoc-inferred-values
+  [{:as config-map :keys [math-env]}]
+  (let [math-env-string (name math-env)
+        webserver-url (str "https://"
+                           (when-not (= math-env :prod) (str math-env-string "."))
+                           "pol.is/api/v3")]
+    (assoc config-map
+      :math-env-string (str math-env)
+      :webserver-url webserver-url)))
+
+
+
 (defn get-environ-config [rules env]
+  ;; reduce over rules and assoc-in mappings into empty map
   (reduce
     (fn [config [name {:keys [parse path] :or {parse identity}}]]
       (if-let [env-var-val (get env name)]
@@ -122,10 +133,12 @@

 (defn get-config
   ([overrides]
-   (deep-merge defaults
-               ;(read-string (slurp "config.edn"))
-               (get-environ-config rules environ/env)
-               overrides))
+    ;; Then infer additional values
+   (assoc-inferred-values
+     (deep-merge defaults
+                 ;(read-string (slurp "config.edn"))
+                 (get-environ-config rules environ/env)
+                 overrides)))
   ([] (get-config {})))

 (defrecord Config [overrides]


Fixed Incorrect arriety on header fn in timeline

--- src/redbrick_20/views/timeline.cljs
+++ src/redbrick_20/views/timeline.cljs
@@ -36,7 +36,10 @@

 (defn render-page []
   [:div {:class "mdl-layout mdl-js-layout mdl-layout--fixed-header"}
-    [header/render-header]
+  [header/render-header
+    (if (< 570 @browser-width)
+      "Redbrick: DCU's Networking Society"
+      "Redbrick")]
    [:main {:class "mdl-layout__content"}
     (render-content-wrapper)
     [:div {:class "padder"}]]])


Don't care about output for inactive containers

We no longer care about output arriving for containers that aren't active. Firstly, it shouldn't happen any more, and secondly, when we switch containers we backfill actions via API.

--- test-cljs/frontend/controllers/ws_test.cljs
+++ test-cljs/frontend/controllers/ws_test.cljs
@@ -48,13 +48,4 @@
                                    :build/append-action
                                    {:data (clj->js [{:index 0 :step 3}])}
                                    dummy-container-state)]
-        (is (= 4 (count (get-in new-state (state/actions-path 0))))))
-      (testing "we create filler steps if output comes out of order on a container that's not active"
-        (let [dummy-state (assoc-in dummy-container-state state/selected-containers-path 0)
-              ;; ^^ make sure we're ignoring the container that the output is coming in on
-              new-state (ws/ws-event dummy-pusher-imp
-                                     :build/append-action
-                                     {:data (clj->js [{:index 1 :step 3}])}
-                                     dummy-state)]
-          (is (= 4 (count (get-in new-state (state/actions-path 1)))))
-          (is (:missing-pusher-output (last (get-in new-state (state/actions-path 1))))))))))
+        (is (= 4 (count (get-in new-state (state/actions-path 0)))))))))


Fix frontend.models.test-feature require

Add `:include-macros true` to the require for `bond.james`, since we use
macros from `bond.james`

--- test-cljs/frontend/models/test_feature.cljs
+++ test-cljs/frontend/models/test_feature.cljs
@@ -1,7 +1,7 @@
 (ns frontend.models.test-feature
-  (:require [frontend.models.feature :as feature]
-            [bond.james :as bond]
-            [cljs.test :refer-macros [is deftest testing]]))
+  (:require [bond.james :as bond :include-macros true]
+            [cljs.test :refer-macros [is deftest testing]]
+            [frontend.models.feature :as feature]))

 (deftest enabled?-works
   (is (not (feature/enabled? :foo)))


Update test pipeline; we need to see errors

The pipeline `transforms/csv-validations` includes `csv/branch-on-spec-version`,
which gets us to `process/process-v{3,5}-validations`, an async handler for
errors; we'd get nothing when calling `(all-errors errors-chan)`, and perhaps
pass the test when we should have failed.

--- test/vip/data_processor/output/xml_test.clj
+++ test/vip/data_processor/output/xml_test.clj
@@ -5,6 +5,7 @@
             [vip.data-processor.db.sqlite :as sqlite]
             [vip.data-processor.pipeline :as pipeline]
             [vip.data-processor.validation.csv :as csv]
+            [vip.data-processor.validation.csv.file-set :as csv-files]
             [vip.data-processor.validation.data-spec :as data-spec]
             [vip.data-processor.validation.data-spec.v3-0 :as v3-0]
             [vip.data-processor.validation.transforms :as transforms]
@@ -27,8 +28,14 @@
                       :spec-version (atom "3.0")
                       :errors-chan errors-chan
                       :pipeline (concat [(data-spec/add-data-specs
-                                          v3-0/data-specs)]
-                                        transforms/csv-validations
+                                          v3-0/data-specs)
+                                         csv/error-on-missing-files
+                                         csv/determine-spec-version
+                                         csv/remove-bad-filenames
+                                         sqlite/attach-sqlite-db
+                                         (csv-files/validate-dependencies
+                                          csv-files/v3-0-file-dependencies)
+                                         csv/load-csvs]
                                         pipeline)} db)
           results-ctx (pipeline/run-pipeline ctx)
           xml-doc (-> results-ctx


Fixed typo in uniprot swissprot protein labels

--- resources/rules/post_identifier_merge/bio_labels/uniprot_trembl_protein_labels.clj
+++ resources/rules/post_identifier_merge/bio_labels/uniprot_trembl_protein_labels.clj
@@ -18,7 +18,7 @@
          (?/protein_symbol_field_value rdf/type ccp/IAO_EXT_0000991) ; ccp:Sparse_UniProt_record__name_field_value
          (?/protein_symbol_field_value rdfs/label ?/protein_symbol))

-   ;; In this case no `:reify` entry is required, since all of the data required to form the new triples already exist
+   ;; In this case no :reify entry is required, since all of the data required to form the new triples already exist

    :options {:magic-prefixes [["franzOption_chunkProcessingAllowed" "franz:yes"]]}
    }


Fix flaky unit tests (#132)

Fix flaky unit tests (#132)

--- waiter/test/waiter/shell_scheduler_test.clj
+++ waiter/test/waiter/shell_scheduler_test.clj
@@ -254,6 +254,7 @@
       ;; No need to scale down, instances: 2
       (is (= {:success false, :result :scaling-not-needed, :message "Unable to scale foo"}
              (scheduler/scale-app scheduler "foo" 1)))
+      (ensure-agent-finished scheduler)
       ;; Successfully kill one instance, instances: 1
       (let [instance (first (:active-instances (scheduler/get-instances scheduler "foo")))]
         (is (= {:killed? true, :success true, :result :deleted, :message (str "Deleted " (:id instance))}
@@ -278,12 +279,14 @@
                                            :work-directory (work-dir)})]
     (is (= {:success true, :result :created, :message "Created foo"}
            (create-test-service scheduler "foo")))
+    (ensure-agent-finished scheduler)
     (with-redefs [perform-health-check (constantly true)]
       (let [instance (first (:active-instances (scheduler/get-instances scheduler "foo")))]
         (is (= {:killed? true, :success true, :result :deleted, :message (str "Deleted " (:id instance))}
                (scheduler/kill-instance scheduler instance)))
         (is (= {:success true, :result :deleted, :message "Deleted foo"}
                (scheduler/delete-app scheduler "foo")))
+        (ensure-agent-finished scheduler)
         (is (= {:success false, :result :no-such-service-exists, :message "foo does not exist!"}
                (scheduler/kill-instance scheduler instance)))))))

@@ -322,6 +325,7 @@
         health-check-count-atom (atom 0)]
     (is (= {:success true, :result :created, :message "Created foo"}
            (create-test-service scheduler "foo" {"cmd" "sleep 100000"})))
+    (ensure-agent-finished scheduler)
     (with-redefs [http/get (fn [_ _]
                              (swap! health-check-count-atom inc)
                              (let [c (async/chan)]


State.

State.

--- test/com/nomistech/clojure_the_language/c_400_state_and_concurrency/s_020_atoms.clj
+++ test/com/nomistech/clojure_the_language/c_400_state_and_concurrency/s_020_atoms.clj
@@ -52,26 +52,26 @@
 ;;;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ;;;; Storing maps in atoms

-;;;; When we have maps in atoms, we use functions like `assoc`, `assoc-in` and
-;;;; `update` for the data function.
+;;;; When we have maps in atoms, we use functions like `assoc`, `assoc-in`,
+;;;; `update` and `update-in` for the data function:

 ;;;; Something about films:

 (def jaws-atom (atom {}))

-;; Set the title:
+;; Set a value in the map (using `assoc`):

 (do (swap! jaws-atom assoc :title "Paws")
     ;; does this: (assoc {} :title "Paws"}
     (fact @jaws-atom => {:title "Paws"}))

-;; Whoops; we got the title wrong. Fix it:
+;; Whoops; we got the title wrong. Fix it (using `assoc`):

 (do (swap! jaws-atom assoc :title "Jaws")
     ;; does this: (assoc {:title "Paws"} :title "Jaws")
     (fact @jaws-atom => {:title "Jaws"}))

-;; A nested map for the director:
+;; Set up a nested map for the director (using `assoc-in`):

 (do (swap! jaws-atom assoc-in [:director :name] "Karl Zwicky")
     ;; does this:
@@ -79,27 +79,37 @@
     (fact @jaws-atom => {:title "Jaws"
                          :director {:name "Karl Zwicky"}}))

-;; Whoops; we got the director wrong. Fix it:
+;; Whoops; we got the director wrong. Fix it (using `assoc-in`):

 (do (swap! jaws-atom assoc-in [:director :name] "Steven Spielberg")
     (fact @jaws-atom => {:title "Jaws"
                          :director {:name "Steven Spielberg"}}))

-;; Add more detail to the director:
+;; Add more detail to the director (using `assoc-in`):

 (do (swap! jaws-atom assoc-in [:director :date-of-birth] 1946)
     (fact @jaws-atom => {:title "Jaws"
                          :director {:name "Steven Spielberg"
                                     :date-of-birth 1946}}))

-;; We can apply a function to part of a map in an atom:
+;; We can apply a function to part of a map in an atom (using `update`):

 (do (swap! jaws-atom assoc :n-likes 0)
-    (swap! jaws-atom update :n-likes inc)
-    (swap! jaws-atom update :n-likes inc)
+    (swap! jaws-atom update :n-likes + 2)
     (fact @jaws-atom => {:title "Jaws"
                          :director {:name "Steven Spielberg"
                                     :date-of-birth 1946}
+                         :n-likes 2}))
+
+;; We can apply a function to part of a nested map in an atom (using
+;; `update-in`):
+
+(do (swap! jaws-atom assoc-in [:director :n-movies-as-director] 52)
+    (swap! jaws-atom update-in [:director :n-movies-as-director] + 3)
+    (fact @jaws-atom => {:title "Jaws"
+                         :director {:name "Steven Spielberg"
+                                    :date-of-birth 1946
+                                    :n-movies-as-director 55}
                          :n-likes 2}))

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


escape query chars properly so ANDing works

--- app/src/semtag_web/services.cljs
+++ app/src/semtag_web/services.cljs
@@ -118,7 +118,7 @@
   (put-search-title input-queue params)

   (GET
-    (str "/search?query=" (:query params) "&search_type=" (:search-type params))
+    (str "/search?" (params-to-str params))
     (partial put-value-and-spinner-off [(search-id params) :search-results] input-queue)
     input-queue))


Strip domain mode from the slim distribution.

--- support/build-support/src/main/clojure/immutant/build/tools.clj
+++ support/build-support/src/main/clojure/immutant/build/tools.clj
@@ -461,21 +461,19 @@
          #(and (looking-at? :logger %)
                (attr= :category "jacorb.config" %))))

-(defn extract-extensions-from-xml []
+(defn extract-extensions-from-standalone-xml []
   (reduce
    (fn [acc ext]
      (if-let [exts (seq (extract-extensions ext))]
        (set (concat acc exts))
        acc))
    #{}
-   ["domain/configuration/domain.xml"
-    "domain/configuration/host.xml"
-    "standalone/configuration/standalone.xml"
+   ["standalone/configuration/standalone.xml"
     "standalone/configuration/standalone-ha.xml"]))

 (defn slim-modules []
   (let [all-modules (extract-all-module-deps (jboss-dir))
-        required-modules (-> (extract-extensions-from-xml)
+        required-modules (-> (extract-extensions-from-standalone-xml)
                              (conj
                               ;; add a few modules that aren't mentioned in any config,
                               ;; but are required at runtime
@@ -495,7 +493,7 @@
                 "bin/appclient.conf" "bin/appclient.sh" "bin/client"
                 "bin/jconsole.bat" "bin/jconsole.sh" "bin/jdr.bat" "bin/jdr.sh"
                 "bin/wsconsume.bat" "bin/wsconsome.sh" "bin/wsprovide.bat" "bin/wsprovide.sh"
-                "bundles" "docs/examples" "docs/schema" "welcome-content"]]
+                "bundles" "docs/examples" "docs/schema" "domain" "welcome-content"]]
     (let [f (io/file (jboss-dir) path)]
       (with-message (str"Deleting " path)
         (if (.isDirectory f)


Use triples, repeats and runs for the bassline.

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -44,9 +44,12 @@
     (map vector (sums (:length line)) (:pitch line))))

 (def bassline
-  (map vector
-       (sums (mapcat repeat [21 12] [1 1/4]))
-       (concat (mapcat (partial repeat 3) (mapcat run [[0 -3] [-5 -3]])) (run [12 0]))))
+  (let [triples (partial mapcat (partial repeat 3))
+        repeats (partial mapcat (partial apply repeat))
+        runs (partial mapcat run)]
+    (map vector
+       (sums (repeats [[21 1] [12 1/4]]))
+       (concat (triples (runs [[0 -3] [-5 -3]])) (run [12 0])))))

 (defn play# [notes]
   (let [play-at# #(at (% 0) (piano# (% 1)))]


Even more work on chapter 01

Even more work on chapter 01

--- clojure-programming/src/clojure_programming/chapter01.clj
+++ clojure-programming/src/clojure_programming/chapter01.clj
@@ -405,3 +405,498 @@
 (fact (let [{a :a b :b} m]
         (+ a b))
   => 11)
+
+
+(facts "Keynames don't have to match"
+  (fact
+    (let [{f "foo"} m]
+      (+ f 12))
+    => 100)
+  (fact
+    (let [{v 42} m]
+      (if v 1 0))
+    => 0))
+
+(fact "Matrix destructuring"
+  (let [{x 3, y 8} [12 0 0 -18 44 6 0 0 1]]
+    (+ x y))
+  => -17)
+
+(fact  "Map entries may also be composed:"
+  (let [{{e :e} :d} m]
+    (* 2 e))
+  => 20)
+
+(fact "Map and sequence destructuring:"
+  (let [{[x _ y] :c} m]
+    (+ x y))
+  => 16)
+
+
+;; TODO: mistake on page 32-33
+(def map-in-vector ["James" {:birthday (java.util.Date. 73 1 6)}])
+
+(fact "map in vector"
+  (let [[name {bd :birthday}] map-in-vector]
+    (str name " was born on " bd))
+  => "James was born on Tue Feb 06 00:00:00 EST 1973")
+
+
+"Retaining the destructured value
+ ':as retains the sourced collection"
+(let [{r1 :x r2 :y :as randoms}
+      (zipmap [:x :y :z] (repeatedly (partial rand-int 10)))]
+  (assoc randoms :sum (+ r1 r2)))
+"=> {:sum 17, :z 3, :y 8, :x 9}"
+
+" Use ':or' to provide default values for destructuring"
+(fact "default values:"
+  (let [{k :unknown x :a
+         :or {k 50}} m]
+    (+ k x))
+  => 55)
+
+"manually setting defualits is"
+(fact "more tiring:"
+  (let [{k :unknown x :a} m
+        k (or k 50)]
+    (+ k x))
+  => 55)
+
+(fact ":or knows the differnce between no value and 'false' value"
+  (let [{opt1 :option} {:option false}
+        opt1 (or opt1 true)
+        {opt2 :option :or {opt2 true}} {:option false}]
+    {:opt1 opt1 :opt2 opt2})
+  => {:opt1 true, :opt2 false})
+
+
+"Binding values to there key's names  page 34"
+
+(def chas {:name "Chas" :age 31 :location "Massachesetts"})
+
+(fact "binding values using the same names can get repetittive:"
+  (let [{name :name age :age location :location} chas]
+    (format "%s is %s years old and lives in %s." name age location))
+  => "Chas is 31 years old and lives in Massachesetts.")
+
+(fact "using the ':keys' option:"
+  (let [{:keys [name age location]} chas]
+    (format "%s is %s years old and lives in %s." name age location))
+  => "Chas is 31 years old and lives in Massachesetts.")
+
+"switch when we know we are using strings or symbols as keys"
+
+(def brian {"name" "Brian" "age" 31 "location" "British Columbia"})
+
+(fact "using the ':strs' option:"
+  (let [{:strs [name age location]} brian]
+    (format "%s is %s years old and lives in %s." name age location))
+  => "Brian is 31 years old and lives in British Columbia.")
+
+(def christophe {'name "Christophe" 'age 33 'location "Rhône-Alpes"})
+
+(fact "the ':syms option:"
+  (let [{:syms [name age location]} christophe]
+    (format "%s is %s years old and lives in %s." name age location))
+  => "Christophe is 33 years old and lives in Rhône-Alpes.")
+
+"Destructuring rest sequences s map key/value pairs  page: 35"
+
+(def user-info ["robert8990" 2011 :name "Bob" :city "Boston"])
+
+(fact "the manual approach is tolerable"
+  (let [[username account-year & extra-info] user-info
+        {:keys [name city]} (apply hash-map extra-info)]
+    (format "%s is in %s" name city))
+  => "Bob is in Boston")
+
+(fact "use map destructured of rest seqs"
+  (let [[username account-year & {:keys [name city]}] user-info]
+    (format "%s is in %s" name city))
+  => "Bob is in Boston")
+
+
+
+[[:subsection {:title "Creating Functions:fn -- page: 36"}]]
+
+"Functions are first class so Clojure can create annonymous
+functions as a data type"
+
+(fn [x]
+  (+ 10 x))
+
+"The parameters are passed in a 'let' style vector that can be destructured
+ The body is inserted into an implicit 'do' form that can contain any
+ number of forms"
+
+(fact "arguments are matched to each name or destructuring form based on position"
+  ((fn [x] (+ 10 x)) 8)
+  => 18)
+
+(fact "these are equivalent:"
+  ((fn [x] (+ 10 x)) 8)
+  =>
+  (let [x 8]
+    (+ 10 x)))
+
+(fact "multiple arguments"
+  ((fn [x y z] (+ x y z)) 3 4 12)
+  => 19)
+
+(fact "is equivalent to this 'let' form:"
+  (let [x 3
+        y 4
+        z 12]
+    (+ x y z))
+  => 19)
+
+"multiple arities:   page 37"
+
+(def strange-adder (fn adder-self-reference
+                     ([x] (adder-self-reference x 1))
+                     ([x y] (+ x y))))
+
+(fact (strange-adder 10)
+  => 11)
+
+(fact (strange-adder 10 50)
+  => 60)
+
+"notice that the single arity version references it self so that it
+ can call the two arity version to do its work."
+
+
+(fact "Mutally recursive funtions with letfn:"
+  (letfn [(odd? [n]
+            (even? (dec n)))
+          (even? [n]
+            (or (zero? n)
+                (odd? (dec n))))]
+    (odd? 11))
+  => true)
+
+
+"
+'defn' builds on 'fn'  page: 37"
+
+(fact "these are equivalent:"
+  (def strange-adder (fn strange-adder
+                       ([x] (strange-adder x 1))
+                       ))
+  =>
+  (defn strange-adder
+    ([x] (strange-adder x 1))
+    ([x y] (+ x y))))
+
+"single arity eliminates extra parantheses:"
+
+(fact "these are also equivalent:"
+  (def redundant-adder (fn redundant-adder
+                         [x y z]
+                         (+ x y z)))
+  =>
+  (defn redundant-adder
+    [x y z]
+    (+ x y z)))
+
+
+"
+Destructuring function arguments:   page: 38
+
+Variadic functions:  functions can gather additional arguments
+into a seq:
+"
+
+(defn concat-rest
+  "ignore first argument"
+  [x & rest]
+  (apply str (butlast rest)))
+
+(fact (concat-rest 0 1 2 3 4)
+  => "123")
+
+
+(defn make-user
+  [& [user-id]]
+  {:user-id (or user-id
+                (str (java.util.UUID/randomUUID)))})
+
+(make-user)
+;; => {:user-id "85a7db56-c7c2-4fc6-942d-bfc7ba6f840c"}
+
+(fact (make-user "Bobby")
+  => {:user-id "Bobby"})
+
+
+"Keyword arguments"
+
+(defn  make-usr
+  [username & {:keys [email join-date]
+               :or {join-date (java.util.Date.)}}]
+  {:username username
+   :join-date join-date
+   :email email
+   ;; 2.592e9 -> one month in ms.
+   :exp-date (java.util.Date. (long (+ 2.592e9 (.getTime join-date))))})
+
+(make-usr "Bobby")
+;=> {:username "Bobby", :join-date #inst "2014-08-19T18:32:26.929-00:00", :email nil, :exp-date #inst "2014-09-18T18:32:26.929-00:00"}
+(fact
+  (make-usr "Bobby"
+            :join-date (java.util.Date. 111 0 1)
+            :email "bobby@example.com")
+  => {:username "Bobby",
+      :join-date #inst "2011-01-01T05:00:00.000-00:00",
+      :email "bobby@example.com",
+      :exp-date #inst "2011-01-31T05:00:00.000-00:00"})
+
+"
+Function literals:    page: 40"
+
+"both are equivalent:"
+(fn [x y] (Math/pow x y))
+
+#(Math/pow %1 %2)
+
+"This is just reader sugar for the former"
+(read-string "#(Math/pow $1 %2)")
+" => (fn* [p1__15465# p2__15464#] (Math/pow $1 p2__15464#))"
+
+"Function literals don't have an implicit 'do' form.
+"
+(fn [x y]
+  (println (str x \^ y))'\
+  (Math/pow x y))
+
+" is equivalent to:
+"
+#(do (println (str %1 \^ %2))
+     (Math/pow %1 %2))
+
+"
+Function literals also have rest agruments (%&):"
+
+(fn [x & rest]
+  (- x (apply + rest)))
+
+" is equivalent to:
+"
+#(- % (apply + %&))
+
+
+[[:subsection {:title "Conditionals: if  --  page: "}]]
+
+"
+If is Clojures sole primative conditionsal operator.
+"
+(facts "Conditionals determine logical truth to be any thing other than 'nil' or 'false"
+  (fact (if "hi" \t)
+    => \t)
+  (fact (if 42 \t)
+    => \t )
+  (fact nil "unevaluated" \f
+    => \f)
+  (fact false "unevaluated" \f
+    => \f)
+  (fact (if (not true) \t)
+    =>  nil))
+
+"If a condition is false and no else expression is provided
+ the result will be 'nil'.
+
+Other refinements of the if conditional:
+
+when - if 'nil' should be returned or no other action should be taken with
+       a false conditional.
+cond - similar to else-if alows testing of multiple conditions.
+
+if-let and when-let - compositions of 'if' and 'when' and 'let'
+
+Clojure provides 'true?' and 'false?' predicates but they are unrelated to
+to the conditionals:
+"
+(fact (true? "string")
+  => false)
+
+(fact (if "string" \t \t)
+  => \t)
+
+
+[[:subsection {:title "Looping: loop recure -- page: 43"}]]
+
+"
+Several useful imperative looping constructs (doseq and dotimes) are based on recure
+'recure' transferes controle without consuming stack space.
+"
+
+
+(fact "a very simple coundown loop:"
+  (loop [x 5]
+    (if (neg? x)
+      x
+      (recur (dec x))))
+  => -1)
+
+(defn countdown
+  [x]
+  (if (zero? x)
+    :blastoff!
+    (do (println x)
+        (recur (dec x)))))
+
+(fact (countdown 5) => :blastoff!)
+
+"
+Prefer the higher level 'doseq' or 'dotimes' to using 'recur'.
+When 'iterating' over a collection use the functionals 'map', 'reduce' or 'for'
+
+Because 'recur' doesn't use stack space it is preferable to use inplace of natural recursion. It also alows you to do numerics without using boxed representations.
+
+"
+
+
+[[:subsection {:title "Reffering to Vars: var -- page:  page: 44"}]]
+
+"Sybols name a var evaluate to that vars value:"
+
+(def x 5)
+
+(fact x
+  => 5)
+
+(fact "reference to a 'var' itself"
+  (var x)
+  => #'clojure-programming.chapter01/x)
+
+(fact "reader syntax shorthand for var reference"
+  #'x
+  => #'clojure-programming.chapter01/x)
+
+
+
+[[:subsection {:title "Java Interop: . and new  -- page: 44"}]]
+
+"
+All Java interop (intantiation, static, instance method invocations) is based on 'new' and '.' special forms.
+Since Clojure provides reader sugar it't rare to see 'new' and '.' used.
+
+"
+
+"Object instantiation:"
+(facts "Java: new java.util.ArrayList(100)"
+  (fact  "sugared interop form"
+    (java.util.ArrayList. 100)
+    => [])
+  (fact "equivalent special form"
+    (new java.util.ArrayList 100)
+    => []))
+
+"Static method invocation"
+(facts "Java: Math.pow(2, 10)"
+  (fact "sugared interop form"
+    (Math/pow 2 10)
+    => 1024.0)
+  (fact "equivalent special form"
+    (. Math pow 2 10)
+    => 1024.0))
+
+"Instance method invocation"
+(facts "Java: 'hello'.substring(1, 3)"
+  (fact "sugared interop form"
+    (.substring "hello" 1 3)
+    => "el")
+  (fact "equivalent special form"
+    (. "hello" substring 1 3)
+    => "el"))
+
+"Static field access:"
+(facts "Java Integer.MAX_VALUE"
+  (fact "sugared interop form"
+    Integer/MAX_VALUE
+    => 2147483647)
+  (fact "equivalent special form"
+    (. Integer MAX_VALUE)
+    => 2147483647))
+"
+ Instance field access
+  someObject.someField       ; Java code
+  (.someField some-object)   ; sugared interop form
+  (. some-object some-field) ; equivalent special form
+"
+
+
+[[:subsection {:title "Exception Handling: try, throw -- page: 44"}]]
+
+"see page: 362"
+
+
+[[:subsection {:title "Special Mutation: set! -- page: 44"}]]
+
+"Exception to Clojure using immutable data.  Useful for Java interop.
+
+- Dyanmic Scope: page: 210
+- Accessing object fields: page: 359
+- deftype: page: 277
+"
+
+[[:subsection {:title "Primative Locking: monitor-enter, monitor-exit -- page: 45"}]]
+"Primatives for Java Object locking:  page: 225"
+
+
+[[:section {:title "Putting If All Together --  page:  46"}]]
+
+(defn average
+  "Average a list of numbers"
+  [numbers]
+  (/ (apply + numbers) (count numbers)))
+
+"
+This structure is simply a List data structure that may be evaluated to produce a result.
+
+defn is shorthand for:
+"
+(def average
+  (fn average
+    [numbers]
+    (/ (apply + numbers) (count numbers))))
+
+"fn creates a function data type and def assigns it to the average var"
+
+[[:subsection {:title "Eval -- page: 46"}]]
+
+"
+encapsulate evauation semantics
+"
+(facts "evaluation of literals:"
+  (fact (eval :foo)
+    => :foo)
+  (fact (eval [1 2 3])
+    => [1 2 3])
+  (fact (eval "text")
+    => "text"))
+
+(fact "a list evaluates to the return value of the call it describes"
+  (eval '(average [60 80 100 400]))
+  => 160)
+
+(fact "one step further- read-string:"
+  (eval (read-string "(average [60 80 100 400])"))
+  => 160)
+
+"Example 1-4:  a reimplented Clojure REPL:"
+
+(defn embedded-repl
+  "A naive Clojure REPL implementation. Enter ':quit' to exit."
+  []
+  (print (str (ns-name *ns*) ">>> "))
+  (flush)
+  (let [expr (read)
+        value (eval expr)]
+    (when (not= :quit value)
+      (println value)
+      (recur))))
+
+(comment
+  (embedded-repl)
+  )


Remove unused code

Remove unused code


Remove direct usage of state atom from events page


A more idiomatic default.

A more idiomatic default.

--- modules/messaging/src/main/clojure/immutant/messaging.clj
+++ modules/messaging/src/main/clojure/immutant/messaging.clj
@@ -65,13 +65,12 @@
     :port       the remote port to connect to (requires :host to be set) [nil, or 5445 if :host is set]
     :username   the username to use to auth the connection (requires :password to be set) [nil]
     :password   the password to use to auth the connection (requires :username to be set) [nil]"
-  [dest-name & {:keys [timeout selector] :as opts}]
+  [dest-name & {:keys [timeout selector] :or {timeout 10000} :as opts}]
   (with-connection opts
     (let [session (session)
           destination (destination session dest-name)
-
           consumer (.createConsumer session destination selector)
-          encoded (.receive consumer (or timeout 10000))]
+          encoded (.receive consumer timeout)]
       (and encoded (codecs/decode encoded)))))

 (defn message-seq


Fix default background on iOS

Fix default background on iOS

--- src/status_im/ui/screens/routing/core.cljs
+++ src/status_im/ui/screens/routing/core.cljs
@@ -73,10 +73,9 @@
   (nav-reagent/stack-navigator
    routes
    (cond->
-    (merge {:headerMode "none"}
-           (prepare-config config))
-     platform/android?
-     (assoc :cardStyle {:backgroundColor nil}))))
+    (merge {:headerMode "none"
+            :cardStyle  {:backgroundColor (when platform/ios? :white)}}
+           (prepare-config config)))))

 (defn switch-navigator [routes config]
   (nav-reagent/switch-navigator


Add a bio placeholder for Jonathan

Add a bio placeholder for Jonathan


fix \r\n handling

fix \r\n handling

--- src/main/clojure/clojure/tools/reader/reader_types.clj
+++ src/main/clojure/clojure/tools/reader/reader_types.clj
@@ -98,7 +98,8 @@
 (defn- normalize-newline [rdr ch]
   (if (identical? \return ch)
     (let [c (peek-char rdr)]
-      (when (identical? \formfeed c)
+      (when (or (identical? \formfeed c)
+                (identical? \newline c))
         (read-char rdr))
       \newline)
     ch))


add tutorial link

add tutorial link

--- playground-example.clj
+++ playground-example.clj
@@ -1,3 +1,6 @@
+; https://github.com/nathanmarz/cascalog/wiki/Introductory-tutorial%2C-part-1
+
+
 (use 'cascalog.playground) (bootstrap)


fix small gui bugs

fix small gui bugs

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

--- plugins/DataBrowser/src/org/micromanager/browser/core.clj
+++ plugins/DataBrowser/src/org/micromanager/browser/core.clj
@@ -139,7 +139,8 @@
   (proxy [AbstractTableModel] []
     (getRowCount [] (count @current-data))
     (getColumnCount [] (count (first @current-data)))
-    (getValueAt [row column] (nth (nth @current-data row) column))
+    (getValueAt [row column] (when (pos? (count @current-data))
+                               (nth (nth @current-data row) column)))
     (getColumnName [column] (nth headings column))))

 (defn create-locations-table-model []
@@ -185,7 +186,9 @@
     (let [location-column (.indexOf tags "Location")]
       (alter current-data
              (fn [coll] (vec (remove #(= (nth % location-column) loc) coll))))))
-  (awt-event (-> @browser :table .getModel .fireTableDataChanged)))
+  (awt-event (-> @browser :table .getModel .fireTableDataChanged)
+             (-> @settings-window :locations :table .getModel .fireTableDataChanged)
+))

 (defn remove-selected-locations []
   (let [location-table (-> @settings-window :locations :table)


OO: Rename Saved Charts tab to Dashboard


CMR-599: resolved merge conflicts with remote.

--- search-app/src/cmr/search/api/routes.clj
+++ search-app/src/cmr/search/api/routes.clj
@@ -4,6 +4,7 @@
             [compojure.core :refer :all]
             [clojure.string :as str]
             [clojure.java.io :as io]
+            [clojure.set :as set]
             [ring.util.response :as r]
             [ring.util.request :as request]
             [ring.util.codec :as codec]
@@ -174,10 +175,10 @@
 (defn process-params
   "Processes the parameters by removing unecessary keys and adding other keys like result format."
   [params path-w-extension headers default-mime-type]
-   (-> params
-       (dissoc :path-w-extension)
-       (dissoc :token)
-       (assoc :result-format (get-search-results-format path-w-extension headers default-mime-type))))
+  (-> params
+      (dissoc :path-w-extension)
+      (dissoc :token)
+      (assoc :result-format (get-search-results-format path-w-extension headers default-mime-type))))

 (defn- search-response
   "Generate the response map for finding concepts by params or AQL."


CMR-6161 added result handler for autocomplete to routes

--- search-app/src/cmr/search/api/routes.clj
+++ search-app/src/cmr/search/api/routes.clj
@@ -26,6 +26,7 @@
    [cmr.search.data.elastic-results-to-query-results]
    ;;
    ;; Result handlers - required here to avoid circular dependency in query service
+   [cmr.search.results-handlers.autocomplete-results-handler]
    [cmr.search.results-handlers.atom-json-results-handler]
    [cmr.search.results-handlers.atom-results-handler]
    [cmr.search.results-handlers.csv-results-handler]


pos-int? not required in clj any longer, as of 1.9-alpha7

--- iwaswhere-web/src/cljc/iwaswhere_web/specs.cljc
+++ iwaswhere-web/src/cljc/iwaswhere_web/specs.cljc
@@ -12,7 +12,7 @@
     (and (number? val) (<= start val) (< val end))))
 (def possible-timestamp? (number-in-range? 0 5000000000000))

-(defn pos-int? [n] (and (integer? n) (pos? n)))
+#?(:cljs (defn pos-int? [n] (and (integer? n) (pos? n))))

 (defn is-tag?
   "Check if string is a tag, such as a hashtag with the '#' prefix or  a mention with the '@' prefix."


clean-tokyo task is not needed anymore since we copy files before compiling


CMR-1387: Update parsing of science keywords and setup response generation

--- search-app/src/cmr/search/services/query_execution/facets_results_feature.clj
+++ search-app/src/cmr/search/services/query_execution/facets_results_feature.clj
@@ -73,6 +73,7 @@

 (def facet-aggregations
   "TODO: Temp to switch easily"
+  ; new-facet-aggregations)
   old-facet-aggregations)

@@ -97,138 +98,47 @@
       {:field (csk/->snake_case_string field-name)
        :value-counts (buckets->value-count-pairs (get bucket-map field-name))})))

-
-;; Sample
-(comment
-  (def science-keywords-bucket-map
-    {:doc_count 1
-     :category {:doc_count_error_upper_bound 0
-                :sum_other_doc_count 0
-                :buckets [{:key "Hurricane"
-                           :doc_count 1
-                           :topic {:doc_count_error_upper_bound 0
-                                   :sum_other_doc_count 0
-                                   :buckets [{:key "Popular"
-                                              :doc_count 1
-                                              :coll-count {:doc_count 1
-                                                           :concept-id {:doc_count_error_upper_bound 0
-                                                                        :sum_other_doc_count 0
-                                                                        :buckets [{:key "C1200000003-PROV1"
-                                                                                :doc_count 1}]}}
-                                              :term {:doc_count_error_upper_bound 0
-                                                     :sum_other_doc_count 0
-                                                     :buckets [{:key "UNIVERSAL"
-                                                                :doc_count 1
-                                                                :coll-count {:doc_count 1
-                                                                             :concept-id {:doc_count_error_upper_bound 0
-                                                                                :sum_other_doc_count 0
-                                                                                :buckets [{:key "C1200000003-PROV1"
-                                                                                :doc_count 1}]}}
-                                                                :variable-level-1 {:doc_count_error_upper_bound 0
-                                                                                :sum_other_doc_count 0
-                                                                                :buckets []}}]}}]}
-                           :coll-count {:doc_count 1
-                                        :concept-id {:doc_count_error_upper_bound 0
-                                                     :sum_other_doc_count 0
-                                                     :buckets [{:key "C1200000003-PROV1"
-                                                                :doc_count 1}]}}}]}})
-
-
-
-  ;; Test this function - initially just pull out the collection count for all of the category keys
-  (let [category-facets (get science-keywords-bucket-map :category)
-        category-buckets (get category-facets :buckets)
-        map-key-to-collection-count (for [bucket category-buckets
-                                          :let [category-key (get bucket :key)
-                                                coll-count (get-in bucket [:coll-count :doc_count])
-                                                sub-field-bucket (get bucket :topic)]]
-                                      [category-key {:count coll-count
-                                                     :sub-field sub-field-bucket}])]
-    (into {} map-key-to-collection-count))
-
-  (defn- example-with-recursion
-    "Build the science keyword aggregations query."
-    [field-hierarchy]
-    (when-let [field (first field-hierarchy)]
-      (let [remaining-fields (rest field-hierarchy)
-            next-field (first remaining-fields)
-            terms {:field (str "science-keywords." (name field))}
-            aggs (if next-field
-                   {:coll-count collection-count-aggregation
-                    next-field (science-keyword-aggregations-helper remaining-fields)}
-                   {:coll-count collection-count-aggregation})]
-        {:terms terms
-         :aggs aggs})))
-  (into)
-  )
-
 (defn- science-keywords-bucket-helper
   "Helper to parse the elasticsearch aggregations response for science-keywords."
-  [field-hierarchy aggregations-for-field ^java.util.Map facet-map-response]
+  [field-hierarchy aggregations-for-field]
   (when-let [field (first field-hierarchy)]
     (let [remaining-fields (rest field-hierarchy)
           next-field (first remaining-fields)
-          buckets (get aggregations-for-field :buckets)]
-      (for [bucket buckets
-            :let [field-key (get bucket :key)
-                  coll-count (get-in bucket [:coll-count :doc_count])
-                  sub-aggregations-for-field (when next-field (select-keys (get bucket next-field) [:coll-count :buckets]))]]
-        (let [new-response (into facet-map-response {field-key coll-count})]
-          ; (println "CDD: response " field-key coll-count)
-          (when (= field :category)
-            (println "Category: " field-key)
-            (println "Coll-count: " coll-count)
-            (println "Sub-aggs: " sub-aggregations-for-field)
-            (println "New response: " new-response))
-          (if (and sub-aggregations-for-field (seq (get sub-aggregations-for-field :buckets)))
-            (science-keywords-bucket-helper remaining-fields
-                                            sub-aggregations-for-field new-response)
-            new-response))))))
-
-(comment
-  (def the-result (cmr.common.dev.capture-reveal/reveal result))
-  (def sci-key-bucket (cmr.common.dev.capture-reveal/reveal science-keywords-bucket))
-  (science-keywords-bucket->facets sci-key-bucket)
-  (second the-result )
-  (seq the-result)
-  (flatten the-result)
-  (doseq [one-result the-result]
-    (when (seq one-result) (println "Result" one-result)))
-(pr-str)
-  )
+          buckets (get aggregations-for-field :buckets)
+          response {:field field
+                    :value-count-maps []}]
+      (->> (for [bucket buckets
+                 :let [field-key (get bucket :key)
+                       coll-count (get-in bucket [:coll-count :doc_count])
+                       sub-aggregations-for-field (when next-field
+                                                    (select-keys (get bucket next-field)
+                                                                 [:coll-count :buckets]))]]
+             (if (seq (get sub-aggregations-for-field :buckets))
+               {:value field-key
+                :count coll-count
+                :facets (science-keywords-bucket-helper
+                          remaining-fields
+                          sub-aggregations-for-field)}
+               {:value field-key
+                :count coll-count}))
+             (into [])
+             (assoc response :value-count-maps)))))
+

 (defn- science-keywords-bucket->facets
   "Takes a map of elastic aggregation results for science keywords. Returns a hierarchical facet
   map of science keywords."
   [bucket-map]
-  (let [result (flatten (science-keywords-bucket-helper science-keyword-hierarchy
-                                                        (get bucket-map (first science-keyword-hierarchy))
-                                                        {}))]
-    (cmr.common.dev.capture-reveal/capture result)
-    result))
-
-; (defn- science-keywords-bucket->facets
-;   "Takes a map of elastic aggregation results for science keywords. Returns a hierarchical facet
-;   map of science keywords."
-;   [bucket-map]
-;   (let [sub-field-bucket (get bucket-map (first science-keyword-hierarchy))]
-;   (for [field-name science-keyword-hierarchy
-;         :let [field-buckets (get sub-field-bucket :buckets)]]
-;     (for [bucket field-buckets
-;           :let [field-key (get bucket :key)
-;                 coll-count (get-in bucket [:coll-count :doc_count])
-;                 sub-field-bucket]])
-;     (r/map->Facet
-;       {:field (csk/->snake_case_string field-name)
-;        :value-counts (buckets->value-count-pairs (get bucket-map field-name))}))))
+  (science-keywords-bucket-helper science-keyword-hierarchy
+                                  (get bucket-map (first science-keyword-hierarchy))))

 (defmethod query-execution/post-process-query-result-feature :facets
   [context query elastic-results query-results feature]
   (let [aggs (:aggregations elastic-results)
         science-keywords-bucket (:science-keywords aggs)
         science-keywords-facets (science-keywords-bucket->facets science-keywords-bucket)
-        ; _ (println "CDD - this is the bucket:" science-keywords-bucket)
-        _(cmr.common.dev.capture-reveal/capture science-keywords-bucket)
+        ; _ (cmr.common.dev.capture-reveal/capture science-keywords-bucket)
+        _ (cmr.common.dev.capture-reveal/capture science-keywords-facets)
         facets (bucket-map->facets
                  aggs
                  ;; Specified here so that order will be consistent with results


Add no-cache header to figwheel server

Add no-cache header to figwheel server


Added description of ingest lifecycle integration test.

--- system-int-test/test/cmr/system_int_test/ingest/ingest_lifecycle_integration_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/ingest_lifecycle_integration_test.clj
@@ -79,6 +79,19 @@
   [coll gran attribs]
   (ingest-gran coll (merge gran attribs)))

+
+;; Tests that over the lifecycle of a collection and granule the right data will be found.
+;; Test Outline
+;; - Ingest collections
+;; - Ingest granules
+;; - update collection
+;; - update granule
+;; - delete granule
+;; - re-ingest granule
+;; - delete collection
+;; - re-ingest collection
+;; At each step the data that is indexed is checked. It also verifies validation works at every step
+;; as well
 (deftest ingest-lifecycle-test
   ;; Nothing should be found yet.
   (assert-collections-and-granules-found [] [])


Fix metadata on wrong line

Fix metadata on wrong line

--- src/toucan/db.clj
+++ src/toucan/db.clj
@@ -741,7 +741,8 @@

    NOTE: This function assumes objects have an `:id` column. There's an [open
    issue](https://github.com/metabase/toucan/issues/3) to support objects that don't have one; until that is resolved,
-   you'll have to use `simple-delete!` instead when deleting objects with no `:id`." {:style/indent 1}
+   you'll have to use `simple-delete!` instead when deleting objects with no `:id`."
+  {:style/indent 1}
   [model & conditions]
   (let [model (resolve-model model)]
     (doseq [object (apply select model conditions)]


Get values to conference detail page | cb

--- src/cljs/conference_rating/conference_detail_page/conference_detail_page.cljs
+++ src/cljs/conference_rating/conference_detail_page/conference_detail_page.cljs
@@ -72,7 +72,7 @@
         (conference-information/display-conference-information conference)
         (add-rating-button (:_id conference))]
        [:div {:class "col-lg-4 col-md-4 aggregated-ratings-container"}
-        (aggregated-ratings/display-aggregated-ratings aggregated-ratings)]]
+        (aggregated-ratings/display-aggregated-ratings (:aggregated-ratings conference))]]
       [:div {:class "row"}
        [:div {:class "col-lg-12 col-md-12"}
         (rating-list/display-rating-list list-of-ratings)]]]]))


Replace deprecated lambdad.execution/run function with the current alternative

--- backend/src/lambdaui/trigger.clj
+++ backend/src/lambdaui/trigger.clj
@@ -1,7 +1,7 @@
 (ns lambdaui.trigger
   (:require [clojure.core.async :as async]
-            [lambdacd.execution :as execution]
-            [clojure.walk :refer [keywordize-keys]]))
+            [clojure.walk :refer [keywordize-keys]]
+            [lambdacd.execution.core :as execution-core]))

 ;{:post [(v/is-not-nil-or-empty? (:branch (:global %)))
@@ -13,5 +13,5 @@

     ;(println "Starting new build " )
     ;(when-let [git-commit (:git (keywordize-keys query-param))] (println "requested commit was" git-commit))
-    (execution/run pipeline-def context)
+    (execution-core/run-pipeline pipeline-def context)
     ))


Terminate stack listings when the speclj functions are reached

--- dev-resources/user.clj
+++ dev-resources/user.clj
@@ -2,6 +2,7 @@
   (:use
     clojure.repl
     io.aviso.repl
+    io.aviso.exception
     io.aviso.logging
     speclj.config))

@@ -10,3 +11,10 @@
 (install-uncaught-exception-handler)

 (alter-var-root #'default-config assoc :color true :reporters ["documentation"])
+
+(alter-var-root #'*default-frame-filter*
+                (fn [default]
+                  (fn [frame]
+                    (if (-> frame :name (.startsWith "speclj."))
+                      :terminate
+                      (default frame)))))


[#2384] Decrease flow form-instances page_size to 30

--- backend/src/akvo/lumen/lib/import/flow_common.clj
+++ backend/src/akvo/lumen/lib/import/flow_common.clj
@@ -30,7 +30,7 @@
 (defn form-instances
   "Returns a lazy sequence of form instances"
   [headers-fn form]
-  (let [initial-url (str (:formInstancesUrl form) "&page_size=300")]
+  (let [initial-url (str (:formInstancesUrl form) "&page_size=30")]
     (form-instances* headers-fn initial-url)))

 (defn data-points*


Roll back and add a time delay to handshake test

This approach is fishy, at best. It just manually delays one portion of
a known race condition to give the other side plenty of time to finish
first.

This really shows a weakness in the current API. But, without updating
that, there aren't a lot of alternatives.

--- test/frereth_cp/message/handshake_test.clj
+++ test/frereth_cp/message/handshake_test.clj
@@ -177,7 +177,7 @@
     bs))

 (defn server-child-processor
-  [server-atom state-atom succeeded? chzbrgr-length incoming]
+  [server-atom state-atom chzbrgr-length incoming]
   (is incoming)
   (is (or (keyword? incoming)
           (and (bytes? incoming)
@@ -207,32 +207,7 @@
                           "Giving up on forwarding to child"
                           {::response rsp
                            ::request incoming})
-        (do
-          ;; Houston, We have a problem.
-          ;; This indicates that we received the EOF from the
-          ;; Client.
-          ;; So we're following it up with "OK, fine, we're
-          ;; done too."
-          ;; Marking the test complete here can't work.
-          ;; The client told us that it's done.
-          ;; We've probably sent back the appropriate ACK,
-          ;; but it really isn't (and shouldn't!) be possible
-          ;; to know at this level.
-          ;; We still need to send back our ACK (which gets
-          ;; triggered by closing the socket in the step below).
-          (dfrd/success! succeeded? ::kthxbai)
-          ;; The test really isn't done after this.
-          ;; This message needs to
-          ;; a) get to the server's parent
-          ;; b) get to the client's parent
-          ;; c) get the client-parent's ACK to the server
-          ;; d) notify the client-child that it's all done
-          ;; No matter what, we have a race condition between
-          ;; c and d
-          ;; In a real-world scenario, d will trigger first,
-          ;; due to network latency.
-          ;; And, really it won't matter.
-          (message/child-close! @server-atom)))
+        (message/child-close! @server-atom))
       (when (= incoming ::icanhazchzbrgr?)
         ;; One of the main points is that this doesn't need to be a lock-step
         ;; request/response.
@@ -263,7 +238,7 @@

 (defn client-child-processor
   "Process the messages queued by mock-client-child"
-  [client-atom client-state-atom chzbrgr-length incoming]
+  [client-atom client-state-atom succeeded? chzbrgr-length incoming]
   (is incoming)
   (is (or (keyword? incoming)
           ;; Implementation detail:
@@ -321,6 +296,7 @@
               5 (do
                   (is (= incoming ::specs/normal))
                   (log/info "Received server EOF")
+                  (dfrd/success! succeeded? ::kthxbai)
                   ;; At this point, we signalled the end of the transaction.
                   ;; We closed our outbound pipe in the previous step,
                   ;; which is what closed this.
@@ -508,12 +484,12 @@
       (strm/consume (partial client-child-processor
                              client-atom
                              client-state
+                             succeeded?
                              chzbrgr-length)
                     clnt-decode-sink)
       (strm/consume (partial server-child-processor
                              server-atom
                              server-state-atom
-                             succeeded?
                              chzbrgr-length)
                     srvr-decode-sink)

@@ -549,6 +525,8 @@
                         "handshake-test run through. Need to see what happened\n"
                         "=====================================================")
               (let [client-message-state (message/get-state client-io time-out ::timed-out)]
+                ;; This seems inside-out.
+                ;; TODO: Check really-succeeded? first.
                 (when (or (= client-message-state ::timed-out)
                           (instance? Throwable client-state)
                           (nil? client-message-state))
@@ -562,6 +540,15 @@
                     ;; Q: Is that true? Or have I just not studied its
                     ;; docs thoroughly enough?
                     (is (not flow-control) "Client flow-control behind a timeout"))))
+              ;; FIXME: This next step is evil, but we deliberately don't have access to the
+              ;; details at this level.
+              ;; Digging in to get them would be worse.
+              ;; Add some sort of hooks (promise/deferred seems like the most
+              ;; appropriate choice) to let the io-loop broadcast when a particular
+              ;; state has finished.
+              ;; Or maybe this is already there.
+              ;; TODO: Clean this mess up.
+              (Thread/sleep 25)   ; Give the server side a chance to flush
               (let [{:keys [::specs/flow-control]
                      :as srvr-state} (message/get-state server-io time-out ::timed-out)]
                 (when (or (= srvr-state ::timed-out)


Adapt handling of optional source paths to a more recent version of CCW

--- ccw.leiningen/src/clj/ccw/leiningen/nature.clj
+++ ccw.leiningen/src/clj/ccw/leiningen/nature.clj
@@ -160,8 +160,8 @@
         _ (println "(lein-source-folders lein-proj): " (lein-source-folders lein-proj))
         _ (println "source-entries: " source-entries)

-        ;; TODO remove this hack once CCW 0.7.0 has been delivered with the Builder correction for missing source folders
-        optional-entry-start-version (b/version :major 0 :minor 7 :micro 0 :qualifier "201203300000")
+        ;; TODO remove this hack once CCW 0.8.0 has been delivered with the Builder correction for missing source folders
+        optional-entry-start-version (b/version :major 0 :minor 8 :micro 0 :qualifier "201204121312")
         ccw-version (or (ccw-bundle-version) (b/version :major 9999 :minor 9999 :micro 9999))
         optional-entries? (b/> ccw-version optional-entry-start-version)


uncomment reset watch count

uncomment reset watch count

--- server/src/gratefulplace/controllers/topics.clj
+++ server/src/gratefulplace/controllers/topics.clj
@@ -47,8 +47,8 @@
   :available-media-types ["application/json"]
   :exists? (exists? (record (id)))
   :handle-ok (fn [ctx]
-               (comment (if auth
-                          (watch-tx/reset-watch-count (id) (:id auth))))
+               (if auth
+                 (watch-tx/reset-watch-count (id) (:id auth)))
                (record-in-ctx ctx)))

 (defresource create! [params auth]


minor refactoring

minor refactoring

--- cljs/src/main/plastic/cogs/editor/ops/cursor.cljs
+++ cljs/src/main/plastic/cogs/editor/ops/cursor.cljs
@@ -28,21 +28,21 @@
     (if-let [result-id (op (get structural-web cursor-id))]
       (editor/set-cursor editor result-id))))

-(defn find-first-non-empty-line-in-given-direction [spatial-web line op]
-  (first (drop-while #(and (not (nil? %)) (empty? %)) (map spatial-web (iterate op (op line))))))
+(defn find-first-non-empty-line-in-given-direction [spatial-web line direction-fn]
+  (first (drop-while #(and (not (nil? %)) (empty? %)) (map spatial-web (iterate direction-fn (direction-fn line))))))

-(defn spatial-movement-up-down [editor dir-fun]
+(defn spatial-movement-up-down [editor direction-fn]
   (let [cursor-id (editor/get-cursor editor)
         form-id (editor/get-focused-form-id editor)
         selectables (editor/get-selectables-for-form editor form-id)
         spatial-web (editor/get-spatial-web-for-form editor form-id)
         sel-node (get selectables cursor-id)
-        line-selectables (find-first-non-empty-line-in-given-direction spatial-web (:line sel-node) dir-fun)
+        line-selectables (find-first-non-empty-line-in-given-direction spatial-web (:line sel-node) direction-fn)
         line-selections (map :id line-selectables)]
     (if-let [result (resolve-best-spatial-match (editor/get-id editor) form-id (:id sel-node) line-selections)]
       (editor/set-cursor editor result))))

-(defn spatial-movement-left-right [editor dir-fun]
+(defn spatial-movement-left-right [editor direction-fn]
   (let [cursor-id (editor/get-cursor editor)
         form-id (editor/get-focused-form-id editor)
         selectables (editor/get-selectables-for-form editor form-id)
@@ -50,25 +50,25 @@
         sel-node (get selectables cursor-id)]
     (if (empty? (:children sel-node))
       (let [line-selectables (get spatial-web (:line sel-node))]
-        (if-let [result (dir-fun #(= (:id %) cursor-id) line-selectables)]
+        (if-let [result (direction-fn #(= (:id %) cursor-id) line-selectables)]
           (editor/set-cursor editor (:id result)))))))

-(defn move-to-form [editor dir-fun next-sel-fun]
+(defn move-to-form [editor direction-fn next-selection-fn]
   (let [focused-form-id (editor/get-focused-form-id editor)
         top-level-ids (editor/get-top-level-form-ids editor)
-        next-focused-form-id (dir-fun #(= % focused-form-id) top-level-ids)]
+        next-focused-form-id (direction-fn #(= % focused-form-id) top-level-ids)]
     (if next-focused-form-id
-      (let [next-selection (next-sel-fun editor next-focused-form-id)]
+      (let [next-selection (next-selection-fn editor next-focused-form-id)]
         (-> editor
           (editor/set-focused-form-id next-focused-form-id)
           (editor/set-cursor next-selection))))))

-(defn token-movement-prev-next [editor dir-fun]
+(defn token-movement-prev-next [editor direction-fn]
   (let [cursor-id (editor/get-cursor editor)
         form-id (editor/get-focused-form-id editor)
         spatial-web (editor/get-spatial-web-for-form editor form-id)
         all-lines (apply concat (vals spatial-web))]
-    (if-let [result (dir-fun #(= (:id %) cursor-id) all-lines)]
+    (if-let [result (direction-fn #(= (:id %) cursor-id) all-lines)]
       (editor/set-cursor editor (:id result)))))

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


cleanup

cleanup


add TODO

add TODO

--- src/babel/francais/morphology/verbs.cljc
+++ src/babel/francais/morphology/verbs.cljc
@@ -8,6 +8,7 @@
    #?(:cljs [babel.logjs :as log])
    [dag_unify.core :refer (copy dissoc-paths fail? get-in ref? strip-refs unifyc)]))

+;; TODO: convert to (babel.morphology/conjugation) (see babel.latin.morphology for an example of how to use conjugation)
 (def present-nonreflexive-er-verb
   [
    {:p [#"^([^' ]+)e$"         "$1er"]


analysis rules fixes for plural masculine nouns

--- src/babel/italiano/morphology/nouns.cljc
+++ src/babel/italiano/morphology/nouns.cljc
@@ -15,8 +15,13 @@
                                 :number :plur}}}}})

 (def plural-to-singular-noun-masc-1
-  {#"i$"
-   {:replace-with "o"
+  {
+   #"ii$" ;; e.g. "braccio" => "bracci"
+   {:replace-with "io"
+    :unify-with {:synsem {:cat :noun
+                          :agr {:number :plur}}}}
+   #"([^i])i$"
+   {:replace-with "$1o"
     :unify-with {:synsem {:cat :noun
                           :agr {:number :plur}}}}})


Throw error on bad HTTP verb in Clojure

Throw error on bad HTTP verb in Clojure

--- src/clj/puppetlabs/http/client/async.clj
+++ src/clj/puppetlabs/http/client/async.clj
@@ -185,7 +185,8 @@
     :patch HttpMethod/PATCH
     :post HttpMethod/POST
     :put HttpMethod/PUT
-    :trace HttpMethod/TRACE))
+    :trace HttpMethod/TRACE
+    (throw (IllegalArgumentException. (format "Unsupported request method: %s" (:method opts))))))

 (defn- parse-url
   [{:keys [url query-params]}]


Cosmetic fix on websocket impl.

Cosmetic fix on websocket impl.

--- src/clojure/catacumba/impl/websocket.clj
+++ src/clojure/catacumba/impl/websocket.clj
@@ -86,7 +86,7 @@

 (defn websocket
   [context handler]
- (let [in (a/chan 16)
+  (let [in (a/chan 16)
         out (a/chan 16)
         ctrl (a/chan (a/sliding-buffer 1))]
     (->> (WebSocketSession. in out ctrl context handler)


adding some memory info from JVM Runtime and getting cache information from Intent POC

--- src/clojure/my/company/superapp/main.clj
+++ src/clojure/my/company/superapp/main.clj
@@ -24,6 +24,7 @@
              fi.iki.elonen.NanoWSD$WebSocket
              java.util.UUID
              java.util.HashMap
+             java.lang.Runtime
              com.couchbase.lite.Manager
              com.couchbase.lite.Mapper
              com.couchbase.lite.Query
@@ -341,10 +342,16 @@

     ;; caching tests
+    (def info (Runtime/getRuntime))
+    (log/i "free memory in the device:" (.freeMemory info) "with max memory of:" (.maxMemory info) "and total memory:" (.totalMemory info))
+
+    ;; needs to add to intent main activity the "EXTRA_ID_CACHE, AND SIZES"
+    (def main-intent (.getIntent (*a)))
+    ;; (def mCacheId (.getStringExtra main-intent "EXTRA_ID_CACHE"))
     (def mCacheId (uuid))
     ;; TODO - needs to check how to get disk-size and memory using the Android API
-    (def mDiskCacheSize 1000)
-    (def mRamCacheSize 500)
+    (def mDiskCacheSize (.getIntExtra main-intent "EXTRA_DISK_CACHE_SIZE" 100))
+    (def mRamCacheSize (.getIntExtra main-intent "EXTRA_RAM_CACHE_SIZE", 50))
     ;; default serializer
     (def defaultjsonSerializer (JsonSerializer. HashMap))
     ;; Testing default serializer


flexible handing of log resource

flexible handing of log resource

--- src/clojure/zensols/actioncli/log4j2.clj
+++ src/clojure/zensols/actioncli/log4j2.clj
@@ -35,11 +35,15 @@

 (defn configure
   "Congigure the Log4j2 system with **res**, which can be anything usable
-  with [[clojure.java.io/input-stream]]."
+  with [[clojure.java.io/input-stream]].  If **res** is a string, interpret as
+  a resource."
   [res]
-  (with-open [in (io/input-stream res)]
-    (LogUtil/config in))
-  (log/debugf "configured with XML resource: %s" res))
+  (let [res (if (string? res)
+              (io/resource res)
+              res)]
+    (with-open [in (io/input-stream res)]
+      (LogUtil/config in))
+    (log/debugf "configured with XML resource: %s" res)))

 (defn log-level-set-option
   "Create an option that sets the Log4j2 level.  Note that all you need to do


Remove meta-data from parent genomes in autoconstruction

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -823,7 +823,9 @@
    (produce-child-genome-by-autoconstruction
      parent1-genome parent1-genome parent2-genome argmap))
   ([genome-to-run parent1-genome parent2-genome argmap]
-   (let [run-result (top-item :genome
+   (let [parent1-genome (with-meta parent1-genome {})
+         parent2-genome (with-meta parent2-genome {})
+         run-result (top-item :genome
                               (run-push
                                 (translate-plush-genome-to-push-program
                                   {:genome


Add artifact name input check.

Add artifact name input check.

--- src/cljs/hatnik/web/client/form/add_action.cljs
+++ src/cljs/hatnik/web/client/form/add_action.cljs
@@ -8,17 +8,47 @@
   (om/detach-root
    (om/get-node component)))

+(defn library-check-handler [reply callback]
+  (let [resp (js->clj reply)]
+    (if (= "ok" (get resp "result"))
+      (callback "has-success" nil)
+      (callback "has-error" nil))))
+
+(defn check-input-value [data-handler check-handler timer new-val]
+  (js/clearTimeout timer)
+  (check-handler
+   "has-warning"
+   (js/setTimeout
+    (fn []
+      (action/get-library new-val #(library-check-handler % check-handler)))
+    2000))
+  (data-handler new-val))
+
 (defn artifact-input-component [data owner]
   (reify
-    om/IRender
-    (render [this]
-      (dom/div #js {:className "form-group has-warning"
+    om/IInitState
+    (init-state [this]
+      {:timer nil
+       :form-status (if (= "" (:value data))
+                      "has-warning"
+                      "has-success")
+       :value (:value data)})
+
+    om/IRenderState
+    (render-state [this state]
+      (dom/div #js {:className (str "form-group " (:form-status state))
                     :id "artifact-input-group"}
                (dom/label #js {:htmlFor "artifact-input"} "Library")
                (dom/input #js {:type "text"
                                :className "form-control"
                                :placeholder "e.g. org.clojure/clojure"
-                               :onChange #((:handler data) (.. % -target -value))
+                               :onChange #(check-input-value
+                                           (:handler data)
+                                           (fn [x timer]
+                                             (om/set-state! owner :form-status x)
+                                             (om/set-state! owner :timer timer))
+                                           (:timer state)
+                                           (.. % -target -value))
                                :value (:value data)})))))

 (defn user-email-component [data owner]


whitespace

whitespace

--- src/cljx/jamesmacaulay/async_tools/signals.cljx
+++ src/cljx/jamesmacaulay/async_tools/signals.cljx
@@ -158,7 +158,7 @@
   [switch-sig false-init value-sig]
   (->> value-sig
        (lift vector (sample-on value-sig switch-sig))
-       (keep-if first [false, false-init])
+       (keep-if first [false false-init])
        (lift second)))

 (defn drop-repeats


License header

License header

--- src/clojure/clojurewerkz/cassaforte/aliases.clj
+++ src/clojure/clojurewerkz/cassaforte/aliases.clj
@@ -1,3 +1,12 @@
+;; Copyright (c) 2012-2014 Michael S. Klishin, Alex Petrov, and the ClojureWerkz Team
+;;
+;; The use and distribution terms for this software are covered by the
+;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+;; which can be found in the file epl-v10.html at the root of this distribution.
+;; By using this software in any fashion, you are agreeing to be bound by
+;; the terms of this license.
+;; You must not remove this notice, or any other, from this software.
+
 (ns clojurewerkz.cassaforte.aliases)

 (defn alias-var


Helper function to clean stats from data bank

--- src/com/wsscode/pathom/connect/test.cljc
+++ src/com/wsscode/pathom/connect/test.cljc
@@ -45,6 +45,9 @@
           m))
       a
       multi-args)))
+
+(defn dissoc-stats-keys [data-bank]
+  (dissoc data-bank ::call-history ::call-log ::out-shape-mismatch ::unreachable))

 (defn bank-add
   "Adds new information to a data bank, the data bank is feed by resolver outputs


Sort results during post-processing

Sort results during post-processing

--- src/com/puppetlabs/puppetdb/query/resources.clj
+++ src/com/puppetlabs/puppetdb/query/resources.clj
@@ -70,18 +70,55 @@
 (def v3-query->sql
   (partial query->sql resource-operators-v3))

+(defn- aggregate-resource-parameters
+  "TODO docs & conditions"
+  [query-results]
+  (let [metadata_cols [:certname :resource :type :title :tags :exported :file :line]
+        metadata      (apply juxt metadata_cols)
+        groupings     (group-by metadata query-results)]
+    (vec (for [[resource params] groupings]
+           (assoc (zipmap metadata_cols resource)
+                  :parameters
+                  (into {} (for [param params :when (:name param)]
+                             [(:name param) (json/parse-string (:value param))])))))))
+
+(defn- build-comp-fn
+  "TODO docs & conditions"
+  [{:keys [field order]}]
+  {:pre  [(keyword? field)
+          (or (= order "ASC")
+              (= order "DESC")
+              (nil? order))]}
+  (fn [x y]
+    (if (or (= order "ASC") (nil? order))
+      (compare (x field) (y field))
+      (compare (y field) (x field)))))
+
+(defn- combine-comp-fns
+  "TODO docs & conditions"
+  [comp-fn1 comp-fn2]
+  (fn [x y]
+    (let [val1 (comp-fn1 x y)]
+      (if (= val1 0)
+        (comp-fn2 x y)
+        val1))))
+
+(defn- sort-on-order-by
+  "TODO docs & conditions"
+  [query-results order-bys]
+  (let [order-bys  (mapv #(update-in % [:field] keyword) order-bys)
+        comp-fns   (map build-comp-fn order-bys)
+        final-comp (reduce combine-comp-fns comp-fns)
+        sorted     (sort final-comp query-results)]
+    (vec sorted)))
+
 (defn- post-process-results
   "TODO docs & conditions"
   [query-results {:keys [order-by]}]
-  (let [metadata_cols [:certname :resource :type :title :tags :exported :file :line]
-        metadata      (apply juxt metadata_cols)
-        result        (vec
-                        (for [[resource params] (group-by metadata query-results)]
-                           (assoc (zipmap metadata_cols resource) :parameters
-                             (into {} (for [param params :when (:name param)]
-                                        [(:name param) (json/parse-string (:value param))])))))]
-    (prn "TODO: sort the results")
-    {:result result}))
+  (let [aggregated-results (aggregate-resource-parameters query-results)]
+    (if (empty? order-by)
+      aggregated-results
+      (sort-on-order-by aggregated-results order-by))))

 (defn limited-query-resources
   "Take a limit, a map of paging options, and a map of SQL queries as
@@ -103,7 +140,7 @@
     (let [[query & params] results-query
           limited-query (add-limit-clause limit query)
           query-results (limited-query-to-vec limit (apply vector limited-query params))
-          results       (post-process-results query-results paging-options)]
+          results       {:result (post-process-results query-results paging-options)}]
       (if count-query
         (assoc results :count (get-result-count count-query))
         results))))


More dead code

More dead code

--- modules/reitit-core/src/reitit/coercion.cljc
+++ modules/reitit-core/src/reitit/coercion.cljc
@@ -132,15 +132,6 @@
          [status (response-coercer coercion body opts)])
        (into {})))

-(defn- coercers-not-compiled! [match]
-  (throw
-    (ex-info
-      (str
-        "Match didn't have a compiled coercion attached.\n"
-        "Maybe you should have defined a router option:\n"
-        "{:compile reitit.coercion/compile-request-coercers}\n")
-      {:match match})))
-
 ;;
 ;; api-docs
 ;;


Fix connection stats display

Fix connection stats display

Signed-off-by: Vitaliy Vlasov <e49d0217baed7632d034fb41cd352d74cf7c0ec8@gmail.com>

--- src/status_im/ui/screens/desktop/main/tabs/profile/views.cljs
+++ src/status_im/ui/screens/desktop/main/tabs/profile/views.cljs
@@ -115,9 +115,9 @@
     [react/text {:style styles/connection-stats-title}
      "Mailserver requests"]
     [react/text {:style styles/connection-stats-entry}
-     (str "errors " p2p-inbound-traffic)]
-    [react/text {:style styles/connection-stats-entry}
-     (str "process time " p2p-outbound-traffic)]]
+     (str "errors " mailserver-request-errors)]
+    [react/text {:style styles/connection-stats-entry}
+     (str "process time " mailserver-request-process-time)]]
    [react/view
     [react/text {:style styles/connection-stats-title}
      "p2p traffic"]


use eastwood 0.2.9

use eastwood 0.2.9

--- dot/lein/profiles.clj
+++ dot/lein/profiles.clj
@@ -2,7 +2,7 @@
  {:plugins [[lein-vanity "0.2.0" :exclusions [org.clojure/clojure]]
             [lein-ancient "0.6.15"]
             [lein-kibit "0.1.6"]
-            [jonase/eastwood "0.2.8"]
+            [jonase/eastwood "0.2.9"]
             ;;[com.billpiel/sayid "0.0.10"]
             [lein-cljfmt "0.6.0"]]
   :dependencies [[slamhound "1.5.5"]]


ensure pid file gets deleted on shutdown

--- src/main/shadow/cljs/devtools/server.clj
+++ src/main/shadow/cljs/devtools/server.clj
@@ -229,7 +229,8 @@
             (rt/start-all))

         pid-file
-        (io/file cache-root "server.pid")]
+        (doto (io/file cache-root "server.pid")
+          (.deleteOnExit))]

     (vreset! app-ref app)


PRS: take only service offers of type VM

--- jar-placement-lib/src/sixsq/slipstream/placement/core.clj
+++ jar-placement-lib/src/sixsq/slipstream/placement/core.clj
@@ -242,13 +242,14 @@
    {cpu :cpu.nb, ram :ram.GB, disk :disk.GB, os :operating-system,
     connector-instance-types :connector-instance-types :as component}
    connector]
-  (let [clause-flexible   "schema-org:flexible='true'"
+  (let [clause-vm         "resource:type='VM'"
+        clause-flexible   "schema-org:flexible='true'"
         clause-os         (format "resource:operatingSystem='%s'" os)
         clause-size       (if (or cpu ram disk)
                             (clause-cpu-ram-disk component)
                             (clause-connector-specific ((keyword connector) connector-instance-types)))
         clause-connector  (format "connector/href='%s'" connector)
-        clause-request    (->> (cimi-and [clause-os clause-size])
+        clause-request    (->> (cimi-and [clause-vm clause-os clause-size])
                                (conj [clause-flexible])
                                cimi-or
                                (conj [clause-connector clause-placement])


consider build-defaults, target-defaults for :watch-dir

fixes #803

--- src/main/shadow/cljs/devtools/server/worker.clj
+++ src/main/shadow/cljs/devtools/server/worker.clj
@@ -261,7 +261,10 @@

         {:keys [watch-dir watch-exts]
          :or {watch-exts #{"css"}}}
-        (:devtools build-config)
+        (merge
+          (get-in config [:build-defaults :devtools])
+          (get-in config [:target-defaults (:target build-config) :devtools])
+          (:devtools build-config))

         status-ref
         (atom {:status :pending


Day 19 part 1 solved

Day 19 part 1 solved

--- src/adventofcode/solutions.clj
+++ src/adventofcode/solutions.clj
@@ -783,27 +783,32 @@
              ))

 ;day 19
-(defn ^{:private true} d19-processor [s f t]
-  (let [where (.indexOf s f)]
-    (when (>= where 0)
-      (let [remainder (subs s (inc where))]
-        [where (str (subs s 0 where) t remainder) remainder]))))
+(defn ^{:private true} d19-processor-maker
+  [src [^String from to]]
+  (fn [ppos]
+    (when (< ppos (count src))
+      (let [nx-src (subs src ppos)
+            where (.indexOf nx-src from)]
+        (when (>= where 0)
+          (let [next-pos (+ 1 where (- (count src) (count nx-src)))
+                left (subs src 0 ppos)
+                right (str (subs nx-src 0 where) to (subs nx-src (+ where (count from))))]
+            [next-pos (str left right)]))))))

 (defn ^{:private true} d19-input-iterator-maker
-  [src from to]
-  (fn [[_ _ ns]]
-    (when-let [[w rep remainder] (d19-processor ns from to)]
-      (let [src-len (count src)
-            rep-len (count rep)
-            pos-in-src (- src-len rep-len)]
-        [(+ w pos-in-src) (str (subs src 0 w) rep) remainder]))))
+  [d19-processor]
+  (fn [[ppos _]]
+    (when-let [outcome (d19-processor ppos)]
+      outcome)))

 (defn ^{:private true} d19-replacements
-  [from to src first-input]
+  [processor first-input]
   (reduce (fn [a v]
-            (if v
-              (conj a (second v))
-              (reduced a))) #{} (iterate (d19-input-iterator-maker src from to) first-input)))
+                (if v
+                  (conj a (second v))
+                  (reduced a)))
+              #{}
+              (iterate (d19-input-iterator-maker processor) first-input)))

 (defn day19
   []
@@ -812,7 +817,11 @@
         replacements (map #(let [[_ from to] (first (re-seq #"(\w+) => (\w+)" %))]
                             [from to]) (take (- size 2) input))
         src (last input)]
-    (reduce (fn [a [from to]]
-              (let [first-input (d19-processor src from to)]
-                (into a
-                      (d19-replacements from to src first-input)))) #{} replacements)))+    (disj
+      (reduce (fn [a rep]
+                (let [d19-processor (d19-processor-maker src rep)
+                      first-input (d19-processor 0)]
+                  (into a
+                        (d19-replacements d19-processor first-input)))) #{} replacements)
+      src)
+    ))


bug #4518 - configured correct number of decimals for POWR, TGT and TIME

--- src/status_im/utils/ethereum/tokens.cljs
+++ src/status_im/utils/ethereum/tokens.cljs
@@ -41,7 +41,7 @@
                    {:symbol   :POWR
                     :name     "PowerLedger"
                     :address  "0x595832f8fc6bf59c85c527fec3740a1b7a361269"
-                    :decimals 18}
+                    :decimals 6}
                    {:symbol   :PAY
                     :name     "TenXPay"
                     :address  "0xB97048628DB6B661D4C2aA833e95Dbe1A905B280"
@@ -293,7 +293,7 @@
                    {:symbol   :TGT
                     :name     "Target Coin"
                     :address  "0xac3da587eac229c9896d919abc235ca4fd7f72c1"
-                    :decimals 0}
+                    :decimals 1}
                    {:symbol   :EVX
                     :name     "Everex"
                     :address  "0xf3db5fa2c66b7af3eb0c0b782510816cbe4813b8"
@@ -333,7 +333,7 @@
                    {:symbol   :TIME
                     :name     "TIME"
                     :address  "0x6531f133e6deebe7f2dce5a0441aa7ef330b4e53"
-                    :decimals 18}
+                    :decimals 8}
                    {:symbol   :CND
                     :name     "Cindicator Token"
                     :address  "0xd4c435f5b09f855c3317c8524cb1f586e42795fa"


Throw exception if sc-arg-flag can't be found - rather than creating malformed scsynth arglists.

--- src/overtone/sc/machinery/server/connection.clj
+++ src/overtone/sc/machinery/server/connection.clj
@@ -229,9 +229,14 @@

     path))

-(defn- sc-arg-flag
+(defn- find-sc-arg-flag!
+  "Retrieves the SC argument flag for sc-arg. Throws exception if flag
+   can't be found."
   [sc-arg]
-  (-> sc-arg SC-ARG-INFO :flag))
+  (let [flag (-> sc-arg SC-ARG-INFO :flag)]
+    (when-not flag
+      (throw (Exception. (str "Error booting external SuperCollider server: unable to find flag for SC argument: " sc-arg))))
+    flag))

 (defn- scsynth-arglist
   "Returns a sequence of args suitable for use as arguments to the scsynth command"
@@ -252,7 +257,7 @@
                            (assoc args :ugens-paths ugens-paths))
         arg-list         (reduce
                           (fn [res [flag val]] (if val
-                                                (concat res [(sc-arg-flag flag) val])
+                                                (concat res [(find-sc-arg-flag! flag) val])
                                                 res))
                           []
                           args)]


small refactoring

small refactoring

--- resources/clj/new/closp/src/clj/routes/user.clj
+++ resources/clj/new/closp/src/clj/routes/user.clj
@@ -128,7 +128,7 @@
 (defn signup-user [db config {:keys [email password displayname re-captcha-token localize] :as req}]
   (let [validation-errors (validate-signup email password localize db
                                            (:captcha-enabled? config) re-captcha-token
-                                           private-recaptcha-key)]
+                                           (:private-recaptcha-key config))]
     (if (empty? validation-errors)
       (do (create-new-user! email password displayname db)
           (update-session-and-redirect (db/get-user-by-email db email) nil))


make reflexive pronouns semantically reflexive too

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -865,7 +865,8 @@
              :agr {:person :3rd
                    :gender :fem
                    :number :sing}
-             :sem {:human true}
+             :sem {:human true
+                   :reflexive true}
              :subcat '()}}
     "him"
     {:synsem {:cat :noun
@@ -875,10 +876,11 @@
               :agr {:person :3rd
                     :gender :masc
                     :number :sing}
-              :sem {:human true}
+              :sem {:human true
+                    :pred :lui}
               :subcat '()}}

-    "himself"
+   "himself"
    {:synsem {:cat :noun
              :pronoun true
              :case :acc
@@ -886,7 +888,8 @@
              :agr {:person :3rd
                    :gender :masc
                    :number :sing}
-             :sem {:human true}
+             :sem {:human true
+                   :reflexive true}
              :subcat '()}}

    "his" [{:synsem {:cat :det
@@ -1254,6 +1257,7 @@
              :cat :noun
              :sem {:pred :music
                    :animate false
+                   :place false
                    :mass true}}}
    "my"
    (map #(unify %
@@ -1692,7 +1696,8 @@
               :agr {:person :3rd
                     :number :plur
                     :gender :fem}
-              :sem {:human true}
+              :sem {:human true
+                    :reflexive true}
               :subcat '()}}

     {:note "♂"
@@ -1703,9 +1708,10 @@
               :agr {:person :3rd
                     :number :plur
                     :gender :masc}
-              :sem {:human true}
+              :sem {:human true
+                    :reflexive true}
               :subcat '()}}
-{:note "♀"
+    {:note "♀"
      :synsem {:cat :noun
               :pronoun true
               :case :acc
@@ -1713,7 +1719,8 @@
               :agr {:person :3rd
                     :number :plur
                     :gender :fem}
-              :sem {:human false}
+              :sem {:human false
+                    :reflexive true}
               :subcat '()}}

     {:note "♂"
@@ -1724,7 +1731,8 @@
               :agr {:person :3rd
                     :number :plur
                     :gender :masc}
-              :sem {:human false}
+              :sem {:human false
+                    :reflexive true}
               :subcat '()}}
     ]


Pass pull pattern to stops-search

Pass pull pattern to stops-search

--- src/clj/gtfve/data/queries.clj
+++ src/clj/gtfve/data/queries.clj
@@ -30,18 +30,18 @@
          (map d/touch))))

 (defn stops-search
-  [name]
-  (let [db (d/db conn)
-        pattern (re-pattern (str "(?i)" name))
-        match? #(not (nil? (re-find pattern %)))]
-    (d/q '[:find [(pull ?s [:stop/name
-                            :stop/latitude
-                            :stop/longitude]) ...]
-           :in $ ?pattern
-           :where
-           [?s :stop/name ?name]
-           [(re-find ?pattern ?name)]]
-         db pattern)))
+  ([name]
+   (stops-search name [:stop/id :stop/name]))
+  ([name p]
+   (let [db (d/db conn)
+         pattern (re-pattern (str "(?i)" name))
+         match? #(not (nil? (re-find pattern %)))]
+     (d/q '[:find [(pull ?s p) ...]
+            :in $ ?pattern p
+            :where
+            [?s :stop/name ?name]
+            [(re-find ?pattern ?name)]]
+          db pattern p))))

 (defn trips []
   (let [db (d/db conn)]


Don't need non-secretary routing for persons page


using try/catch with file slurp

using try/catch with file slurp


Formatting.

Formatting.


Remove redef'd fn

Remove redef'd fn

--- src/wonko/export/prometheus/register.clj
+++ src/wonko/export/prometheus/register.clj
@@ -14,11 +14,6 @@
       (.observe (double metric-value))))

 (defn summary [metric label-values metric-value]
-  (-> metric
-      (maybe-set-label-values label-values)
-      (.observe (double metric-value))))
-
-(defn stream [metric label-values metric-value]
   (-> metric
       (maybe-set-label-values label-values)
       (.observe (double metric-value))))


(PE-4308) Use fs/base-name

(PE-4308) Use fs/base-name

--- src/clj/puppetlabs/puppetserver/certificate_authority.clj
+++ src/clj/puppetlabs/puppetserver/certificate_authority.clj
@@ -907,10 +907,8 @@
 (schema/defn ^:always-validate get-certificate-statuses :- [CertificateStatusResult]
   "Get the status of all certificates and certificate requests."
   [{:keys [csrdir signeddir] :as settings} :- CaSettings]
-  (let [path->subject #(let [name (.getName %)]
-                         (.substring name 0 (- (count name) 4)))
-        pem-pattern   #"^.+\.pem$"
-        all-subjects  (map path->subject
+  (let [pem-pattern   #"^.+\.pem$"
+        all-subjects  (map #(fs/base-name % ".pem")
                            (concat (fs/find-files csrdir pem-pattern)
                                    (fs/find-files signeddir pem-pattern)))]
     (map (partial get-certificate-status settings) all-subjects)))


Test both found packages and present packages for hoisting

--- src/degasolv/resolver_core.clj
+++ src/degasolv/resolver_core.clj
@@ -309,9 +309,13 @@
                                            absent-specs
                                            id)
                                           :absent
-                                          (get
-                                           present-packages
-                                           id)
+                                          (or
+                                            (get
+                                              found-packages
+                                              id)
+                                            (get
+                                              present-packages
+                                              id))
                                           :present
                                           :else
                                           :unspecified)))