GAWB-2064: filter and sort workspaces when first loaded. (#961)

Use the new `WorkspaceSelector` component to sort and filter workspaces correctly.

--- src/cljs/main/broadfcui/page/method_repo/method_config_importer.cljs
+++ src/cljs/main/broadfcui/page/method_repo/method_config_importer.cljs
@@ -1,7 +1,6 @@
 (ns broadfcui.page.method-repo.method-config-importer
   (:require
    [dmohs.react :as react]
-   [clojure.string :as string]
    [broadfcui.common :as common]
    [broadfcui.common.components :as comps]
    [broadfcui.common.flex-utils :as flex]
@@ -12,6 +11,7 @@
    [broadfcui.components.buttons :as buttons]
    [broadfcui.components.sticky :refer [Sticky]]
    [broadfcui.components.modals :as modals]
+   [broadfcui.components.workspace-selector :refer [WorkspaceSelector]]
    [broadfcui.endpoints :as endpoints]
    [broadfcui.nav :as nav]
    [broadfcui.page.method-repo.create-method :as create]
@@ -81,20 +81,10 @@

 (react/defc ConfigExporter
-  {:component-will-mount
-   (fn [{:keys [state props]}]
-     (when-not (:workspace-id props)
-       (endpoints/call-ajax-orch
-        {:endpoint endpoints/list-workspaces
-         :on-done (fn [{:keys [success? get-parsed-response status-text]}]
-                    (if success?
-                      (let [ws-list (get-parsed-response)]
-                        (swap! state assoc :workspaces-list ws-list :selected-workspace (first ws-list)))
-                      (swap! state assoc :error status-text)))})))
-   :render
-   (fn [{:keys [props state locals refs]}]
+  {:render
+   (fn [{:keys [props state refs]}]
      (let [{:keys [workspace-id entity perform-copy]} props
-           {:keys [workspaces-list]} @state]
+           {:keys [selected-workspace]} @state]
        [:div {:style {:border style/standard-line
                       :backgroundColor (:background-light style/colors)
                       :borderRadius 8 :padding "1em" :marginTop "1em"}}
@@ -124,35 +114,17 @@
                      {:label "Root Entity Type" :key :rootEntityType :type "identity-select" :options common/root-entity-types})]))
         (common/clear-both)
         (when-not workspace-id
-          (let [sorted-ws-list (sort-by (comp (partial mapv string/lower-case)
-                                              (juxt :namespace :name)
-                                              :workspace)
-                                        workspaces-list)]
-            [:div {:style {:marginBottom "1em"}}
-             [:div {:style {:fontSize "120%" :margin "1em 0"}}
-              "Destination Workspace:"]
-             (if-not workspaces-list
-               [comps/Spinner {:text "Loading workspaces..."}]
-               (style/create-select
-                {:defaultValue ""
-                 :ref (common/create-element-ref-handler
-                       {:store locals
-                        :element-key :workspace-select
-                        :did-mount
-                        #(.on (.select2 (js/$ %)) "select2:select"
-                              (fn [event]
-                                (swap! state assoc :selected-workspace
-                                       (nth sorted-ws-list (js/parseInt (.-value (.-target event)))))))
-                        :will-unmount
-                        #(.off (js/$ %))})
-                 :style {:width 500}}
-                (map (fn [ws] (clojure.string/join "/" (replace (:workspace ws) [:namespace :name])))
-                     sorted-ws-list)))]))
+          [:div {:style {:marginBottom "1em"}}
+           [:div {:style {:fontSize "120%" :margin "1em 0"}}
+            "Destination Workspace:"]
+           [WorkspaceSelector {:style {:width "50%"}
+                               :filter #(common/access-greater-than-equal-to? (:accessLevel %) "WRITER")
+                               :on-select #(swap! state assoc :selected-workspace %)}]])
         (style/create-validation-error-message (:validation-error @state))
         [comps/ErrorViewer {:error (:server-error @state)}]
         [buttons/Button {:text (if workspace-id "Import" "Export")
-                         :disabled? (not (or workspace-id workspaces-list))
-                         :onClick #(perform-copy (:selected-workspace @state) refs)}]]))})
+                         :disabled? (not (or workspace-id selected-workspace))
+                         :onClick #(perform-copy selected-workspace refs)}]]))})

 (defn- create-import-form [state props entity config? perform-copy]
   (let [{:keys [workspace-id on-delete]} props


buckets: ttl is stored in resolution as period

--- src/io/cyanite/engine/buckets.clj
+++ src/io/cyanite/engine/buckets.clj
@@ -24,7 +24,7 @@
      (= (.path this) (.path other))
      (= (.slot this) (.slot other)))))

-(defrecord MetricSnapshot [path time mean max min sum resolution ttl])
+(defrecord MetricSnapshot [path time mean max min sum resolution])

 (defprotocol Mutable
   (add! [this metric]))
@@ -82,7 +82,6 @@
                                         maxval
                                         minval
                                         sum
-                                        nil
                                         nil)))))))

 (defn time-slot


list的一些操作实例

list的一些操作实例

--- src/learnclojure/chapt3/core1.clj
+++ src/learnclojure/chapt3/core1.clj
@@ -20,3 +20,17 @@
 ;;clojure数据结构有两个特色
 ;;1.是根据抽象来使用的，而不是具体的实现细节
 ;;2.数据结构是不可改变和持久的
+
+;;list的操作
+(def lst '(1 2 3))
+;;list的conj操作是把要插入的数据放在list前面的
+(conj lst 0)
+;;=(0 1 2 3)
+(conj lst 0 -1)
+;;=(-1 0 1 2 3)
+(seq lst)
+
+;;显然，seq和conj对于它们所操作的集合类型是多态的
+;;clojure的精髓是小而易用的编程接口，在接口上再构建辅助函数
+;;例如into函数,它是建立在conj和seq之上的,所以能用于任何支撑conj和seq的值
+


selector needs a string

selector needs a string

--- src/lt/plugins/ltfiles/sacha.cljs
+++ src/lt/plugins/ltfiles/sacha.cljs
@@ -216,7 +216,7 @@

 (def type-selector
   (selector/selector {:items (fn []
-                               (map #(hash-map :name %) (keys (:types config))))
+                               (map #(hash-map :name (str %)) (keys (:types config))))
                       :key :name}))

 (defn check-types-counts [ed editor-fn]


Small changes to support LiveRamp extensions

--- pigpen-cascading/src/main/clojure/pigpen/cascading.clj
+++ pigpen-cascading/src/main/clojure/pigpen/cascading.clj
@@ -12,13 +12,14 @@
             [pigpen.cascading.runtime :as cs]
             [pigpen.raw :as raw]
             [pigpen.oven :as oven]
-            [taoensso.nippy :refer [freeze thaw]]))
+            [taoensso.nippy :refer [freeze thaw]]
+            [clojure.pprint]))

 (defmulti get-tap-fn
           identity)

 (defmethod get-tap-fn :string [_]
-  (fn [location] (Hfs. (TextLine.) location)))
+  (fn [location opts] (Hfs. (TextLine.) location)))

 (defmethod get-tap-fn :default [_]
   (throw (Exception. (str "Unrecognized tap type: " name))))
@@ -67,7 +68,7 @@
   {:pre [id location storage fields]}
   (let [pipe (Pipe. (str id))]
     (-> flowdef
-        (update-in [:sources] (partial merge {id ((get-tap-fn storage) location)}))
+        (update-in [:sources] (partial merge {id ((get-tap-fn storage) location opts)}))
         (update-in [:pipes] (partial merge {id pipe})))))

 (defmethod command->flowdef :store
@@ -75,7 +76,7 @@
   {:pre [id ancestors location storage]}
   (-> flowdef
       (update-in [:pipe-to-sink] (partial merge {(first ancestors) id}))
-      (update-in [:sinks] (partial merge {id ((get-tap-fn storage) location)}))))
+      (update-in [:sinks] (partial merge {id ((get-tap-fn storage) location opts)}))))

 (defn- cascading-field [name-or-number]
   (if (number? name-or-number)
@@ -87,7 +88,7 @@
   {:pre [expr args]}
   (let [{:keys [init func]} expr
         fields (if field-projections
-                 (Fields. (into-array (map #(cascading-field (:alias %)) field-projections)))
+                 (Fields. (into-array (map #(cascading-field %) field-projections)))
                  Fields/UNKNOWN)
         get-group-info #(cond (instance? CoGroup %) {:num-streams (alength (.getPrevious %))
                                                      :type        (if (.startsWith (.getName %) "join") :join :group)}
@@ -126,7 +127,7 @@
 (defmethod command->flowdef :projection-flat
   [{:keys [code alias pipe field-projections]} flowdef]
   {:pre [code alias]}
-  (command->flowdef (assoc code :pipe pipe :field-projections field-projections) flowdef))
+  (command->flowdef (assoc code :pipe pipe :field-projections (or field-projections [alias])) flowdef))

 (defmethod command->flowdef :generate
   [{:keys [id ancestors projections field-projections opts]} flowdef]


Disable boot in build pane

Disable boot in build pane

--- src/net/sekao/nightcode/utils.clj
+++ src/net/sekao/nightcode/utils.clj
@@ -63,7 +63,7 @@
   (let [file (io/file path)
         dir? (.isDirectory file)
         types #{}
-        types (if (and dir? (.exists (io/file file "build.boot")))
+        types (if false ;(and dir? (.exists (io/file file "build.boot")))
                 (conj types :boot)
                 types)
         types (if (and dir? (.exists (io/file file "project.clj")))


Added additional tests for collection keyword searching.

--- test/cmr/system_int_test/search/collection_keyword_search_test.clj
+++ test/cmr/system_int_test/search/collection_keyword_search_test.clj
@@ -26,7 +26,8 @@
                                  :term "Term1"
                                  :variable-level-1 "Level1-1"
                                  :variable-level-2 "Level1-2"
-                                 :variable-level-3 "Level1-3"})
+                                 :variable-level-3 "Level1-3"
+                                 :detailed-variable "SUPER DETAILED!"})
         sk2 (dc/science-keyword {:category "Hurricane"
                                  :topic "Laser spoonA"
                                  :term "Extreme"
@@ -35,7 +36,7 @@
                                  :variable-level-3 "Level2-3"})
         tdcs1 (dc/two-d "XYZ")
         coll1 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "coll1" }))
-        coll2 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "coll2" :short-name "ABC!XYZ"}))
+        coll2 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "coll2" :short-name "ABC!XYZ" :version-id "V001"}))
         coll3 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "coll3" :collection-data-type "Foo"}))
         coll4 (d/ingest "CMR_PROV2" (dc/collection {:entry-title "coll4" :collection-data-type "Bar"}))
         coll5 (d/ingest "CMR_PROV2" (dc/collection {:entry-title "coll5" :long-name "ABC" :short-name "Space!Laser"}))
@@ -48,7 +49,10 @@
         coll12 (d/ingest "CMR_PROV2" (dc/collection {:entry-title "coll12" :product-specific-attributes [psa1 psa2 psa3 psa4]}))
         coll13 (d/ingest "CMR_PROV2" (dc/collection {:entry-title "coll13" :two-d-coordinate-systems [tdcs1]}))
         coll14 (d/ingest "CMR_PROV2" (dc/collection {:entry-title "coll14" :long-name "spoonA laser"}))
-        coll15 (d/ingest "CMR_PROV2" (dc/collection {:entry-title "coll15" :platforms [p1]}))]
+        coll15 (d/ingest "CMR_PROV2" (dc/collection {:entry-title "coll15" :processing-level-id "plid1"
+                                                     :collection-data-type "cldt" :platforms [p1]
+                                                     :summary "summary"}))
+        coll16 (d/ingest "CMR_PROV2" (dc/collection {:entry-id "entryid4"}) :dif)]

     (index/refresh-elastic-index)

@@ -69,6 +73,38 @@

            ;; Checking specific fields

+           ;; entry title
+           "coll1" [coll1]
+
+           ;; entry id
+           "entryid4" [coll16]
+
+           ;; short name
+           "XYZ" [coll2 coll13]
+
+           ;; long name
+           "ABC" [coll5 coll2]
+
+           ;; version id
+           "V001" [coll2]
+
+           ;; processing level id
+           "plid1" [coll15]
+
+           ;; collection data type
+           "cldt" [coll15]
+
+           ;; summary
+           "summary" [coll15]
+
+           ;; TODO
+           ;; spatial keywords
+           ;; temporal keywords
+           ;; associated dif
+           ;; two d coord
+           ;; archive center
+           ;; attributes
+
            ;; Platforms
            ;; - short name
            "platform_SnA" [coll11]
@@ -85,7 +121,25 @@
            ;; - short name
            "ssnA" [coll15]
            ;; - long name
-           "slnB" [coll11]))
+           "slnB" [coll11]
+
+           ;; Science keywords
+           ;; - category
+           "Cat1" [coll9]
+           ;; - topic
+           "Topic1" [coll9]
+           ;; - term
+           "Term1" [coll9]
+           ;; - variable-levels
+           "Level2-1" [coll9]
+           "Level2-2" [coll9]
+           "Level2-3" [coll9]
+           ;; - detailed-variable
+           "SUPER" [coll9]
+
+
+
+           ))

     (testing "search by keywords using wildcard *."
       (are [keyword-str items]


Removed a comment

Removed a comment

--- resources/rules/post_identifier_merge/temp/goa/goa.clj
+++ resources/rules/post_identifier_merge/temp/goa/goa.clj
@@ -28,7 +28,7 @@
          ;; retrieve the process participant identifier
          (?/record obo/BFO_0000051 ?/bioentity_field_value) ; BFO:has_part
          (?/bioentity_field_value rdf/type ccp/IAO_EXT_0000010) ; ccp:database_object_identifier_field_value
-         (?/bioentity_field_value rdf/type ?/bioentity_ice_id) ; ccp:database_object_identifier_field_value
+         (?/bioentity_field_value rdf/type ?/bioentity_ice_id)
          (?/bioentity_ice_id obo/IAO_0000219 ?/participating_bioentity) ; IAO:denotes

          ;;filter out the negations


removing unused requires

removing unused requires

--- backend/specs/akvo/lumen/specs/db/dataset_version/column.clj
+++ backend/specs/akvo/lumen/specs/db/dataset_version/column.clj
@@ -1,7 +1,5 @@
 (ns akvo.lumen.specs.db.dataset-version.column
-  (:require [akvo.lumen.specs :as lumen.s]
-            [akvo.lumen.util :as u]
-            [clojure.spec.alpha :as s]))
+  (:require [clojure.spec.alpha :as s]))

 (s/def ::key boolean?)


[#3073] Return data-groups-to-be-created

Co-authored-by: Iván Perdomo <a15f8b81a160b4eebe5c84e9e3b65c87b9b2f18e@perdomo.me>
Co-authored-by: Emmanuel Mulo <bd234ba4276433f0e5fc7a8fa2d18274fa711567@akvo.org>

--- backend/src/akvo/lumen/lib/transformation/merge_datasets.clj
+++ backend/src/akvo/lumen/lib/transformation/merge_datasets.clj
@@ -193,7 +193,7 @@
                                (conj columns instance-id))
                     :table-name (util/gen-table-name "ds")
                     :source-table-name (:table-name dg)
-                    :imported-table-name nil))) columns-by-group)))
+                    :imported-table-name "MERGE_DATASET"))) columns-by-group)))

 (defn get-source-dataset [conn source]
   (let [source-dataset-id (get source "datasetId")]
@@ -247,6 +247,7 @@

     (map #(dissoc % :original-table-name) data-groups-to-be-created)
     {:success? true
+     :data-groups-to-be-created data-groups-to-be-created
      :execution-log [(format "Merged columns from %s into %s"
                              "(:table-name source-dataset)"
                              table-name)]


Story ID: develop Summary: Namespace folding is done through localState

--- src/untangled_spec/dom/suite.cljs
+++ src/untangled_spec/dom/suite.cljs
@@ -87,24 +87,22 @@
 (defn make-testreport
   ([] (make-testreport []))
   ([initial-items]
-   {
-    :id            (uuid/uuid-string (uuid/make-random-uuid))
+   {:id            (uuid/uuid-string (uuid/make-random-uuid))
     :report/filter :all
     :summary       ""
     :namespaces    []
     :passed        0
     :failed        0
-    :error         0 }))
+    :error         0}))

 (defn make-testitem
   [name]
-  {
-   :id           (uuid/uuid-string (uuid/make-random-uuid))
+  {:id           (uuid/uuid-string (uuid/make-random-uuid))
    :name         name
    :status       :pending
    :test-items   []
-   :test-results [] })
+   :test-results []})

 (defn make-manual [name] (make-testitem (str name " (MANUAL TEST)")))

@@ -121,12 +119,10 @@
   [name]
   {:id         (uuid/uuid-string (uuid/make-random-uuid))
    :name       name
-   :folded?    false
    :test-items []
-   :status     :pending })
+   :status     :pending})

 (defn item-path [item index] [:test-items :id (:id item) index])
-

 (defn result-path [item index] [:test-results :id (:id item) index])
 (defn itemclass [status]
@@ -187,9 +183,11 @@

 (declare test-item)

-(defui TestItem Object (render [this] (let [test-item-data (om/props this)
-                     filter (:report/filter test-item-data)
-                     ]
+(defui TestItem
+       Object
+       (render [this]
+               (let [test-item-data (om/props this)
+                     filter (:report/filter test-item-data) ]
                  (dom/li #js {:className "test-item "}
                          (dom/div #js {:className (filter-class test-item-data)}
                                   (dom/span #js {:className (itemclass (:status test-item-data))}
@@ -199,25 +197,23 @@
                                                 (:test-results test-item-data)))
                                   (dom/ul #js {:className "test-list"}
                                           (mapv (comp test-item #(assoc % :report/filter filter))
-                                                (:test-items test-item-data)))
-                                  )
-                         ))))
+                                                (:test-items test-item-data))))))))

 (def test-item (om/factory TestItem {:keyfn :id}))

 (defui TestNamespace
        Object
+       (initLocalState [this] {:folded? false})
        (render
          [this]
          (let [tests-by-namespace (om/props this)
                filter (:report/filter tests-by-namespace)
-               folded? (:folded? tests-by-namespace)
-               toggle-folded! (:toggle-folded! tests-by-namespace)]
+               {:keys [folded?]} (om/get-state this)]
            (dom/li #js {:className "test-item"}
                    (dom/div #js {:className "test-namespace"}
                             (dom/a #js {:href "#"
                                         :style #js {:textDecoration "none"} ;; TODO: refactor to css
-                                        :onClick   toggle-folded!}
+                                        :onClick   #(om/update-state! this update :folded? not)}
                                    (dom/h2 #js {:className (itemclass (:status tests-by-namespace))}
                                            (if folded? \u25BA \u25BC)
                                            " Testing " (:name tests-by-namespace)))
@@ -229,15 +225,14 @@

 (defui TestReport
        static om/IQuery
-       (query [this] [:top :report/filter :folded/namespaces])
+       (query [this] [:top :report/filter])
        Object
        (render [this]
                (let [props (om/props this)
                      test-report-data (-> props :top)
-                     current-filter (-> props :report/filter)
-                     folded-namespaces (-> props :folded/namespaces)
-                     make-toggle-fn (fn [n] #(om/transact! this `[(~'toggle-folded {:ns-name ~n})]))]
+                     current-filter (-> props :report/filter)]
                  (dom/section #js {:className "test-report"}
+                              ;TODO: move to defui filters
                               (dom/div #js {:name "filters" :className "filter-controls"}
                                        (dom/label #js {:htmlFor "filters"} "Filter: ")
                                        (dom/a #js {:className (if (= current-filter :all) "selected" "")
@@ -249,12 +244,11 @@
                                        (dom/a #js {:className (if (= current-filter :failed) "selected" "")
                                                    :onClick   #(om/transact! this '[(filter-failed)])}
                                               "Failed"))
-                              (dom/ul #js {:className "test-list"} (mapv (comp test-namespace
-                                                                               #(assoc %
-                                                                                :report/filter current-filter
-                                                                                :toggle-folded! (make-toggle-fn (:name %))
-                                                                                :folded? (contains? folded-namespaces (:name %))))
-                                                                         (:namespaces test-report-data)))
+                              (dom/ul #js {:className "test-list"}
+                                      (mapv (comp test-namespace
+                                                  #(assoc % :report/filter current-filter))
+                                            (:namespaces test-report-data)))
+                              ;TODO: move to defui test-count
                               (let [rollup-stats (reduce (fn [acc item]
                                                            (let [counts [(:passed item) (:failed item) (:error item)
                                                                          (+ (:passed item) (:failed item) (:error item))]]
@@ -360,10 +354,6 @@
 (defmethod om-write 'filter-all [{:keys [state]} _ _] (swap! state assoc :report/filter :all))
 (defmethod om-write 'filter-failed [{:keys [state]} _ _] (swap! state assoc :report/filter :failed))
 (defmethod om-write 'filter-manual [{:keys [state]} _ _] (swap! state assoc :report/filter :manual))
-(defmethod om-write 'toggle-folded [{:keys [state]} _ {:keys [ns-name]}]
-  {:action #(swap! state update :folded/namespaces (fn [nss]
-                                                     ((if (nss ns-name) disj conj) nss ns-name)))
-   :value [:folded/namespaces]})

 (def test-parser (om/parser {:read om-read :mutate om-write}))

@@ -383,7 +373,6 @@
   [target]
   (let [state (atom {:top (make-testreport)
                      :report/filter :all
-                     :folded/namespaces #{}
                      :time (js/Date.)})]
     (map->TestSuite {:app-state      state
                      :reconciler     (om/reconciler {:state state :parser test-parser})


Changed some defn-typecheck to defn- + assert

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

--- src/conexp/contrib/gui/editors/context_editor/util.clj
+++ src/conexp/contrib/gui/editors/context_editor/util.clj
@@ -113,9 +113,17 @@
     (class-to-keyword (type (first x))))
   :default nil)

-(defn-typecheck get-selected-objects ::context-editor-widget
+(defmethod get-table ::context-editor-widget
+  [widget]
+  (:table widget))
+
+(defmethod get-table :conexp.contrib.gui.editors.util/table-control
+  [x] x)
+
+(defn- get-selected-objects
   "Returns the set of selected objects in the context-editor-widget."
   [widget]
+  (assert (instance? context-editor-widget widget))
   (let [table (get-table widget),
         view  (get-row-index-permutator table),
         sel   (seq (.getSelectedRows (get-control table))),
@@ -127,9 +135,10 @@
                        %)]
     (set (fltr (map #(names (view %)) sel)))))

-(defn-typecheck get-selected-attributes ::context-editor-widget
+(defn- get-selected-attributes
   "Returns the set of selected attributes in the context-editor-widget."
   [widget]
+  (assert (instance? context-editor-widget widget))
   (let [table (get-table widget),
         view  (get-column-index-permutator table),
         sel   (seq (.getSelectedColumns (get-control table))),
@@ -303,29 +312,25 @@

   nil)

-(defn- get-ectx
+;;;
+
+(defn get-ectx
   "Returns the editable-context that is currently associated with the
    context-editor-widget."
   [widget]
-  (assert (isa? widget context-editor-widget))
+  (assert (instance? context-editor-widget widget))
   @(:e-ctx widget))

 (defmethod get-context ::context-editor-widget
   [widget]
   (get-context @(:e-ctx widget)))

-(defn-typecheck set-ectx ::context-editor-widget
+(defn- set-ectx
   "Sets the editable-context that is currently associated with the
    context-editor-widget to the second parameter."
   [widget e-ctx]
+  (assert (instance? context-editor-widget widget))
   (dosync (ref-set (:e-ctx widget) e-ctx)))
-
-(defmethod get-table ::context-editor-widget
-  [widget]
-  (:table widget))
-
-(defmethod get-table :conexp.contrib.gui.editors.util/table-control
-  [x] x)

 (declare change-attribute-name change-object-name change-incidence-cross)

@@ -387,7 +392,7 @@
   [ctx]
   (deref (:context ctx)))

-(defmethod  get-context :conexp.fca.contexts/Context
+(defmethod get-context :conexp.fca.contexts/Context
   [x] x)

 (defn make-context-compatible
@@ -468,23 +473,26 @@
        (ref-set (:attr-cols e-ctx) new-attr-cols))
       e-ctx)))

-(defn-typecheck get-order ::editable-context
+(defn- get-order
   "Returns the current order of the objects and attributes of the context."
   [ectx]
+  (assert (instance? editable-context ectx))
   {:attr-cols (deref (:attr-cols ectx)),
    :obj-rows (deref (:obj-rows ectx))})

-(defn-typecheck get-dual-order ::editable-context
+(defn- get-dual-order
   "Returns the current order of the objects and attributes of the dual of the
    context."
   [ectx]
+  (assert (instance? editable-context ectx))
   {:obj-rows (deref (:attr-cols ectx)),
    :attr-cols (deref (:obj-rows ectx))})

-(defn-typecheck add-widget ::editable-context
+(defn- add-widget
   "Adds a context-editor-widget to an editable context, and sets the
    editor windows table to represent the new context."
   [e-ctx editor]
+  (assert (instance? editable-context e-ctx))
   (let [ctx (get-context e-ctx),
         att-cols (:attr-cols e-ctx),
         obj-rows (:obj-rows e-ctx),
@@ -518,9 +526,10 @@
               (fn [r c s]
                 (ectx-cell-value-hook e-ctx r c s)))))

-(defn-typecheck set-context-keep-order ::editable-context
+(defn- set-context-keep-order
   "Sets the bound fca-context of an editable context object to ctx."
   [ectx ctx keep-order]
+  (assert (instance? editable-context ectx))
   (let [new     (make-editable-context ctx keep-order),
         widgets @(:widgets ectx)]
     (dosync
@@ -530,15 +539,17 @@
      (ref-set (:obj-rows ectx) @(:obj-rows new)))
     (call-many widgets #(add-widget ectx %))))

-(defn-typecheck set-context ::editable-context
+(defn- set-context
   "Sets the bound fca-context of an editable context object to ctx."
   [ectx ctx]
+  (assert (instance? editable-context ectx))
   (set-context-keep-order ectx ctx (get-order ectx)))

-(defn-typecheck change-incidence-cross ::editable-context
+(defn- change-incidence-cross
   "Sets or unsets the cross in the incidence relation of the
   editable-context."
   [ectx obj att cross]
+  (assert (instance? editable-context ectx))
   (let [ostr (if (= (type obj) String)
                obj
                (@(:obj-rows ectx) obj)),
@@ -563,11 +574,12 @@
                                           col
                                           (if cross "X" " ")))))))

-(defn-typecheck change-attribute-name ::editable-context
- "Changes the attributes name of given to requested, if requested is
-  not taken by another attribute. In this case, -# with a unique # is
-  appended to the requested name. Returns the new attribute name."
+(defn- change-attribute-name
+  "Changes the attributes name of given to requested, if requested is
+   not taken by another attribute. In this case, -# with a unique # is
+   appended to the requested name. Returns the new attribute name."
   [ectx given requested]
+  (assert (instance? editable-context ectx))
   (let [att-cols @(:attr-cols ectx)]
     (if (= (type given) String)
       (change-attribute-name ectx (att-cols given) requested)
@@ -596,11 +608,12 @@
                                                   given new-name)))))
           new-name)))))

-(defn-typecheck change-object-name ::editable-context
- "Changes the object's name of given to requested, if requested is
+(defn- change-object-name
+  "Changes the object's name of given to requested, if requested is
   not taken by another object. In this case, -# with a unique # is
   appended to the requested name. Returns the new attribute name."
   [ectx given requested]
+  (assert (instance? editable-context ectx))
   (let [obj-cols @(:obj-rows ectx)]
     (if (= (type given) String)
       (change-object-name ectx (obj-cols given) requested)


Demonstrate plurals

Demonstrate plurals

--- test-cljs/frontend/test_send.cljs
+++ test-cljs/frontend/test_send.cljs
@@ -369,6 +369,16 @@
            (update :user/vehicle
                    #(parser {:state (atom %)} (mapv om/ast->query (:children ast)))))))

+   :user/pets
+   (fn [context ast]
+     (p/alet [get-user-pets (get-in context [:apis :get-user-pets])
+              pets (p/await (get-user-pets {:name (:user/name context)}))]
+       (->> pets
+            (map #(set/rename-keys % {:name :pet/name
+                                      :species :pet/species
+                                      :description :pet/description}))
+            (mapv #(parser {:state (atom %)} (mapv om/ast->query (:children ast)))))))
+
    :user/favorite-fellow-user
    (fn [context ast]
      (let [c (chan)]
@@ -391,21 +401,39 @@
                                        :vehicle {:color :color/white
                                                  :make "Toyota"
                                                  :model "Hilux"}
+                                       :pets [{:name "Milo"
+                                               :species :pet-species/cat
+                                               :description "orange tabby"}
+                                              {:name "Otis"
+                                               :species :pet-species/dog
+                                               :description "pug"}]
                                        :favorite-fellow-user-name "jburnford"}
                  {:name "jburnford"} {:favorite-color :color/red
                                       :favorite-number 7}}
+          user-pets {{:name "nipponfarm"} [{:name "Milo"
+                                            :species :pet-species/cat
+                                            :description "orange tabby"}
+                                           {:name "Otis"
+                                            :species :pet-species/dog
+                                            :description "pug"}]}
           data-chan (resolve {:channel (chan)
                               :apis {:get-user (memoize
                                                 (fn [params]
                                                   (p/do*
                                                    (swap! api-calls conj [:get-user params])
-                                                   (get users params))))}}
+                                                   (get users params))))
+                                     :get-user-pets (memoize
+                                                     (fn [params]
+                                                       (p/do*
+                                                        (swap! api-calls conj [:get-user-pets params])
+                                                        (get user-pets params))))}}
                              resolvers '[{(:root/user {:user/name "nipponfarm"})
                                           [:user/name
                                            :user/favorite-color
                                            :user/favorite-number
                                            {:user/vehicle [:vehicle/make
                                                            (:the-model {:< :vehicle/model})]}
+                                           {:user/pets [:pet/name]}
                                            {:user/favorite-fellow-user [:user/name
                                                                         :user/favorite-color
                                                                         :user/favorite-number]}]}
@@ -420,6 +448,8 @@
                   {:root/user {:user/favorite-number 42}}
                   {:root/user {:user/vehicle {:vehicle/make "Toyota"
                                               :the-model "Hilux"}}}
+                  {:root/user {:user/pets [{:pet/name "Milo"}
+                                           {:pet/name "Otis"}]}}
                   {:root/user {:user/favorite-fellow-user {:user/name "jburnford"}}}
                   {:root/user {:user/favorite-fellow-user {:user/favorite-color :color/red}}}
                   {:root/user {:user/favorite-fellow-user {:user/favorite-number 7}}}
@@ -427,6 +457,7 @@
                   {:jamie {:user/favorite-color :color/red}}}
                 v))
          (is (= [[:get-user {:name "nipponfarm"}]
+                 [:get-user-pets {:name "nipponfarm"}]
                  [:get-user {:name "jburnford"}]]
                 @api-calls))
          (done))))))


Add snippets.transform tests to ClojureScript.

--- test/cljx/snippets/transform.cljx
+++ test/cljx/snippets/transform.cljx
@@ -4,15 +4,6 @@
             [quil.core :as q :include-macros true])
   #+cljs
   (:use-macros [quil.snippet :only [defsnippet]]))
-
-
-#+cljs
-(defsnippet hello {:renderer :p3d}
-  (q/background 0 90 102)
-  (q/translate 58 48 0)
-  (q/rotate-y (/ q/PI 3.0))
-  (q/box 40)
-  )

 #+clj
 (defsnippet apply-matrix {:renderer :p3d}
@@ -79,7 +70,6 @@
   (q/box 50)
   (q/pop-matrix))

-#+clj
 (defsnippet rotate-x-y-z {:renderer :p3d}
   (q/camera 200 200 200 0 0 0 0 0 -1)
   (q/no-fill)
@@ -103,7 +93,6 @@
   (q/box 50)
   (q/pop-matrix))

-#+clj
 (defsnippet scale {:renderer :p3d}
   (q/camera 200 200 200 0 0 0 0 0 -1)
   (q/no-fill)
@@ -123,7 +112,6 @@
     (q/box 50)
     (q/scale 2 1 0.75)))

-#+clj
 (defsnippet shear-x-y {}
   (q/with-translation [125 125]
     (q/rect 0 0 100 50))
@@ -134,7 +122,6 @@
     (q/shear-x 0.5)
     (q/rect 0 0 100 50)))

-#+clj
 (defsnippet translate {:renderer :p3d}
   (q/camera 200 200 200 0 0 0 0 0 -1)
   (q/no-fill)


Prepare parametric testing.

Prepare parametric testing.

The last two tests have the same code layout now.
Hopefully this will allow to write a single parametric test for them.

--- test/flo_invest/database_test.clj
+++ test/flo_invest/database_test.clj
@@ -98,3 +98,4 @@
       (is (= (set (db-read-date test-conn (date-time 2012 6 1))) #{res1 res2}))
       (is (= (set (db-read-date test-conn (date-time 2013 6 1))) #{res2 res3}))
       )))
+


Check for CljRbUtil before executing

Check for CljRbUtil before executing

--- src/clj/rb.clj
+++ src/clj/rb.clj
@@ -182,7 +182,8 @@
      (doseq [[k v] env]
        (setenv rt k v))
      (require rt "rubygems")
-     (load rt (-> "clj-ruby-helpers/clj_rb_util.rb" io/resource))
+     (when-not (-> rt ruby-runtime (.isClassDefined "CljRbUtil"))
+       (eval rt (-> "clj-ruby-helpers/clj_rb_util.rb" io/resource slurp)))
      rt)))

 (defn install-gem


Only open devcards the first time the build is started.

--- dev-src/clj/comic_reader/frontend_dev.clj
+++ dev-src/clj/comic_reader/frontend_dev.clj
@@ -35,11 +35,13 @@
                   :output-to "resources/public/js/compiled/devcards.js"
                   :output-dir (str (cwd) "/resources/public/js/compiled/devcards_out")
                   :asset-path "js/compiled/devcards_out"}}]})
+(defn- start-dev*! [& args]
+  (apply system/go args)
+  (start-figwheel! figwheel-config)
+  (start-autobuild))

 (defn start-dev! [& args]
-  (apply system/go args)
-  (start-figwheel! figwheel-config)
-  (start-autobuild)
+  (apply start-dev*! args)
   (browse-url "http://localhost:10555/devcards"))

 (defn stop-dev! []
@@ -49,4 +51,4 @@

 (defn reset []
   (stop-dev!)
-  (refresh :after 'comic-reader.frontend-dev/start-dev!))
+  (refresh :after 'comic-reader.frontend-dev/start-dev*!))


Timing tests are the worst

Timing tests are the worst

--- modules/scheduling/src/test/clojure/wunderboss/scheduling_tests.clj
+++ modules/scheduling/src/test/clojure/wunderboss/scheduling_tests.clj
@@ -117,8 +117,8 @@
   (deftest in-should-fire-once-in-x-ms
     (let [q (promise)]
       (with-job #(deliver q "ping") {:in 1000}
-        (is (nil? (deref q 900 nil)))
-        (is (= "ping" (deref q 200 :fail))))))
+        (is (nil? (deref q 800 nil)))
+        (is (= "ping" (deref q 300 :fail))))))

   (deftest at-should-fire-once-then
     (let [q (promise)]


Major improvements to audio harness.

Major improvements to audio harness.

--- test/org/playasophy/wonderdome/input/audio_harness.clj
+++ test/org/playasophy/wonderdome/input/audio_harness.clj
@@ -5,6 +5,9 @@
     [org.playasophy.wonderdome.input.audio :as audio]
     [org.playasophy.wonderdome.util.color :as color]
     [quil.core :as quil]))
+
+
+(def ^:constant ^:private history-size 100)

 (def system nil)
@@ -21,24 +24,34 @@
   []
   (quil/background 0)
   (when-let [audio (some-> system :state deref)]
-    (let [spectrum (:freq/spectrum audio)
-          band-height (/ (- (quil/height) 40) (inc (count spectrum)))]
-      (doseq [i (range (count spectrum))]
-        (quil/with-translation [20 (+ 20 (* i band-height))]
-          (let [power (nth spectrum i)]
-            (quil/fill (color/rgb 0 0 1))
-            (quil/rect 20 5 (* power 10) (- band-height 10))
-            (quil/fill (color/gray 0.8))
-            (quil/text (str i) 0 5) ; TODO: frequency?
-            (quil/text (format "%4.1f" power) 25 5)))))
     (let [beat-elapsed (- (System/currentTimeMillis) (:beat/at audio))
-          decay-r 0.2
-          saturation (/ (Math/pow (+ 1.0 decay-r) (/ beat-elapsed 100.0)))]
-      (quil/with-translation [(- (quil/width) 30) (- (quil/height) 30)]
-        (quil/fill (color/rgb saturation 0 0))
-        (quil/ellipse 0 0 20 20)
-        (quil/fill (color/gray 0.8))
-        (quil/text (format "%4.1f" (:beat/power audio)) -30 5)))))
+          saturation (/ (Math/pow 1.5 (/ beat-elapsed 100.0)))]
+      (quil/stroke 0)
+      (quil/fill (color/rgb saturation 0 0))
+      (quil/rect 0 0 (quil/width) 20)
+      (quil/fill (color/gray 0.8))
+      (quil/text (format "%4.1f" (:beat/power audio)) 20 15))
+    (let [spectrums (:freq/spectrum audio)
+          slice-width (/ (quil/width) history-size)]
+      (dotimes [t history-size]
+        (let [index (mod (+ t (:freq/pos audio)) history-size)
+              bands (nth spectrums index)
+              band-height (/ (quil/height) (count bands))
+              x-pos (* index slice-width)]
+          (dotimes [f (count bands)]
+            (let [power (nth bands f)
+                  exposure (- 1.0 (Math/exp (- (/ power 4))))
+                  y-pos (+ 20 (* (- (count bands) f) band-height))
+                  color (color/rainbow (* 0.8 (- 1.0 exposure)))]
+              (quil/fill color)
+              (quil/stroke color)
+              (quil/rect x-pos y-pos slice-width band-height)))))
+      (when-let [current (nth spectrums (:freq/pos audio))]
+        (dotimes [f (count current)]
+          (let [band-height (/ (quil/height) (count current))
+                y-pos (+ 20 (* (dec (- (count current) f)) band-height))]
+            (quil/fill (color/gray 0.0))
+            (quil/text (format "%2d: %4.1f" f (nth current f)) 0 (+ 15 y-pos))))))))

 (defn init!
@@ -51,7 +64,8 @@
               state (atom {:beat/at 0
                            :beat/power 0.0
                            :freq/at 0
-                           :freq/spectrum []})]
+                           :freq/spectrum (vec (repeat history-size [0.0]))
+                           :freq/pos 0})]
           (component/system-map
             :state state
             :input (audio/audio-input channel 100)
@@ -64,7 +78,12 @@
                   :audio/beat
                   (swap! state assoc :beat/at now :beat/power (:power event))
                   :audio/freq
-                  (swap! state assoc :freq/at now :freq/spectrum (:spectrum event))))
+                  (swap! state
+                    (fn [s]
+                      (-> s
+                          (assoc :freq/at now)
+                          (update-in [:freq/spectrum] assoc (or (:freq/pos s) 0) (:spectrum event))
+                          (update-in [:freq/pos] #(mod (inc (or % 0)) history-size)))))))
               (recur))

             :sketch


CMR-2112 Multiple warnings unit test

CMR-2112 Multiple warnings unit test

--- system-int-test/test/cmr/system_int_test/ingest/collection_validation_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/collection_validation_test.clj
@@ -633,17 +633,22 @@

           "DIF9 with no version - has warnings, but passes ingest"
           :dif (assoc-in (dc/collection-dif {}) [:product :version-id] nil)
-          "object has missing required properties ([\"Platforms\",\"ProcessingLevel\",\"RelatedUrls\",\"SpatialExtent\",\"TemporalExtents\",\"Version\"])")
-
-          ; "Multiple Warnings"
-          ; :dif10 (dc/collection-dif10 {:product (dc/product {:short-name (apply str (repeat 81 "x"))
-          ;                                                    :processing-level-id "1"})
-          ;                              :platforms [(dc/platform {:short-name (apply str (repeat 81 "x"))})]})
-          ;     "/Platforms/0/ShortName string \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\" is too long (length: 81, maximum allowed: 80)/ShortName string \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\" is too long (length: 81, maximum allowed: 80)")
-   (testing "Warnings returned in JSON format"
+          "object has missing required properties ([\"Platforms\",\"ProcessingLevel\",\"RelatedUrls\",\"SpatialExtent\",\"TemporalExtents\",\"Version\"])"))
+
+  (testing "Multiple warnings"
+     (let [collection (dc/collection-dif10 {:platforms [(dc/platform {:short-name (apply str (repeat 81 "x"))})]
+                                            :purpose (apply str (repeat 12000 "y"))
+                                            :product (dc/product {:processing-level-id "1"})})
+           ingest-response (d/ingest "PROV1" collection {:format :dif10})
+           validation-response (ingest/validate-concept (dc/collection-concept collection :dif10))]
+       (is (some? (re-find #"/Platforms/0/ShortName string.*is too long \(length: 81, maximum allowed: 80\)" (:warnings ingest-response))))
+       (is (some? (re-find #"/Platforms/0/ShortName string.*is too long \(length: 81, maximum allowed: 80\)" (:warnings validation-response))))
+       (is (some? (re-find #"/Purpose string.*is too long \(length: 12000, maximum allowed: 10000\)" (:warnings ingest-response))))
+       (is (some? (re-find #"/Purpose string.*is too long \(length: 12000, maximum allowed: 10000\)" (:warnings validation-response))))))
+  (testing "Warnings returned in JSON format"
      (let [response (d/ingest "PROV1" (dc/collection-dif10 {}) {:format :dif10 :accept-format :json})]
        (is (= 201 (:status response)))
-       (is (= ["object has missing required properties ([\"ProcessingLevel\"])"] (:warnings response)))))))
+       (is (= ["object has missing required properties ([\"ProcessingLevel\"])"] (:warnings response))))))

 (comment
   (ingest/delete-provider "PROV1")


load cost asynchronously on workflow detail page (#1457)

--- src/cljs/main/broadfcui/page/workspace/monitor/workflow_details.cljs
+++ src/cljs/main/broadfcui/page/workspace/monitor/workflow_details.cljs
@@ -305,7 +305,27 @@
                   [Failures {:data failures}])]])
             (:data props)))]))})

-(defn- render-workflow-detail [workflow raw-data workflow-name submission-id use-call-cache workflow-cost workspace-id gcs-path-prefix]
+(react/defc- WorkflowCost
+  {:render
+   (fn [{:keys [state props]}]
+     (let [cost-response (:cost-response @state)
+           workflow-cost (:response cost-response)
+           rendered-cost (if cost-response
+                           (moncommon/render-cost workflow-cost)
+                           (spinner {:style {:fontSize "1rem" :margin 0}} "Loading..."))]
+         (create-field "Total Run Cost" rendered-cost)))
+   :component-did-mount
+   (fn [{:keys [props state]}]
+     (endpoints/call-ajax-orch
+      {:endpoint
+       (endpoints/get-workflow-cost
+        (:workspace-id props) (:submission-id props) (:workflow-id props))
+       :on-done (fn [{:keys [success? get-parsed-response status-text]}]
+                  (swap! state assoc :cost-response
+                         {:success? success?
+                          :response (if success? (:cost (get-parsed-response)) (str "Error: " (or (:message (get-parsed-response)) status-text)))}))}))})
+
+(defn- render-workflow-detail [workflow raw-data workflow-name submission-id use-call-cache workspace-id gcs-path-prefix]
   (let [inputs (ffirst (workflow "calls"))
         input-names (string/split inputs ".")
         workflow-name-for-path (first input-names)
@@ -315,7 +335,9 @@
      (create-field "Workflow ID" (links/create-external {:href (render-gcs-path workflow-path-components)} (workflow "id")))
      (let [status (workflow "status")]
        (create-field "Status" (moncommon/icon-for-wf-status status) status))
-     (create-field "Total Run Cost" (moncommon/render-cost workflow-cost))
+     [WorkflowCost {:workspace-id workspace-id
+                    :submission-id submission-id
+                    :workflow-id (workflow "id")}]
      (when-let [submission (workflow "submission")]
        (create-field "Submitted" (moncommon/render-date submission)))
      (when-let [start (workflow "start")]
@@ -339,15 +361,12 @@
 (react/defc- WorkflowDetails
   {:render
    (fn [{:keys [state props]}]
-     (let [metadata-response (:metadata-response @state)
-           cost-response (:cost-response @state)]
+     (let [metadata-response (:metadata-response @state)]
        (cond
          (nil? metadata-response)
          (spinner "Loading workflow details...")
          (not (:success? metadata-response))
          (style/create-server-error-message (:response metadata-response))
-         (nil? cost-response)
-         (spinner "Loading workflow cost...")
          :else
          ;; generate this workflow's GCS path prefix
          ;; subworkflows receive them as props from parent workflows
@@ -355,8 +374,7 @@
          (let [workflow-path-prefix [(:bucketName props) (:submission-id props)]]
            (render-workflow-detail (:response metadata-response) (:raw-response metadata-response)
                                    (:workflow-name props) (:submission-id props) (:use-call-cache props)
-                                   (:response cost-response) (:workspace-id props)
-                                   workflow-path-prefix)))))
+                                   (:workspace-id props) workflow-path-prefix)))))
    :component-did-mount
    (fn [{:keys [props state]}]
      (endpoints/call-ajax-orch
@@ -367,15 +385,7 @@
                   (swap! state assoc :metadata-response
                          {:success? success?
                           :response (if success? (get-parsed-response false) status-text)
-                          :raw-response raw-response}))})
-     (endpoints/call-ajax-orch
-      {:endpoint
-       (endpoints/get-workflow-cost
-        (:workspace-id props) (:submission-id props) (:workflow-id props))
-       :on-done (fn [{:keys [success? get-parsed-response status-text]}]
-                  (swap! state assoc :cost-response
-                         {:success? success?
-                          :response (if success? (:cost (get-parsed-response)) (str "Error: " (or (:message (get-parsed-response)) status-text)))}))}))})
+                          :raw-response raw-response}))}))})

 (defn render [props]


had comp order reversed

had comp order reversed


core.async: Add a/mapcat example.

core.async: Add a/mapcat example.

--- test/com/nomistech/clojure_the_language/core_async_mapping_etc_test.clj
+++ test/com/nomistech/clojure_the_language/core_async_mapping_etc_test.clj
@@ -62,3 +62,8 @@
       (a/close! wrapping-ch))
     (chan->seq wrapped-ch))
   => [0 2 4])
+
+(fact "About `a/mapcat< (N.B. This is deprecated)"
+  (chan->seq (a/mapcat< (fn [x] [x :plop])
+                        (a/to-chan (range 5))))
+  => [0 :plop 1 :plop 2 :plop 3 :plop 4 :plop])


keep drag origin in center of window

keep drag origin in center of window

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

--- plugins/SlideExplorer2/src/slide_explorer/display.clj
+++ plugins/SlideExplorer2/src/slide_explorer/display.clj
@@ -246,7 +246,8 @@
   (let [g (.getGraphics canvas)
         original-transform (.getTransform g)]
     (doto g
-      (.translate (:x @screen-state) (:y @screen-state))
+      (.translate (+ (:x @screen-state) (/ (:width @screen-state) 2))
+                  (+ (:y @screen-state) (/ (:height @screen-state) 2)))
       (.rotate @angle)
       enable-anti-aliasing
       (paint-tiles @available-tiles (:zoom @screen-state))


Switch to alt-test.

Switch to alt-test.

--- project/scrape-summitpost-data/build.boot
+++ project/scrape-summitpost-data/build.boot
@@ -6,9 +6,9 @@
                   [org.clojure/data.csv "0.1.3"]
                   [org.clojure/tools.cli "0.3.5"]
                   [reaver "0.1.2"]
-                  [adzerk/boot-test "1.2.0" :scope "test"]])
+                  [metosin/boot-alt-test "0.3.1" :scope "test"]])

-(require '[adzerk.boot-test :refer [test]])
+(require '[metosin.boot-alt-test :refer [alt-test]])

 (task-options!
     aot {:all true}
@@ -16,7 +16,7 @@
          :version "0.0.0"}
     jar {:main 'scrape-summitpost-data.core})

-(deftask build
+(deftask build
   "Build scrape-summitpost-data uberjar."
   []
   (comp (aot) (pom) (uber) (jar) (target)))


Improve error messages

Improve error messages

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -72,9 +72,11 @@
    :>  gt
    >   gt
    :>= gte
+   >=  gte
    :<  lt
    <   lt
-   :<= lte})
+   :<= lte
+   <=  lte})

 (defprotocol WhereBuilder
   (build-where [construct query-builder]))
@@ -84,7 +86,10 @@
   (build-where [construct ^Select$Where query-builder]
     (reduce
      (fn [^Select$Where builder [query-type column value]]
-       (.and builder ((query-type-map query-type) (name column) value)))
+       (if-let [eq-type (query-type-map query-type)]
+         (.and builder ((query-type-map query-type) (name column) value))
+         (throw (IllegalArgumentException. (str query-type " is not a valid Clause")))
+         ))
      query-builder
      construct))
   clojure.lang.IPersistentMap


Removed old Sum of Squares problem file

Removed old Sum of Squares problem file

--- src/clojush/problems/software/sum_of_squares_backup.clj
+++ src/clojush/problems/software/sum_of_squares_backup.clj
@@ -1,149 +0,0 @@
-;; sum_of_squares.clj
-;; Tom Helmuth, thelmuth@cs.umass.edu
-;;
-;; Problem Source: iJava (http://ijava.cs.umass.edu/)
-;;
-;; Given integer 0 < n <= 100, return the sum of squaring each positive integer
-;; between 1 and n inclusive.
-;;
-;; input stack has integer n
-
-(ns clojush.problems.software.sum-of-squares
-  (:use clojush.pushgp.pushgp
-        [clojush pushstate interpreter random util globals]
-        clojush.instructions.tag
-        [clojure.math numeric-tower]
-        ))
-
-; Atom generators
-(def sum-of-squares-atom-generators
-  (concat (list
-            0
-            1
-            ;;; end constants
-            (fn [] (- (lrand-int 201) 100)) ;Integer ERC [-100,100]
-            ;;; end ERCs
-            (tag-instruction-erc [:integer :boolean :exec] 1000)
-            (tagged-instruction-erc 1000)
-            ;;; end tag ERCs
-            'in1
-            ;;; end input instructions
-            )
-          (registered-for-stacks [:integer :boolean :exec])))
-
-
-;; A list of data domains for the problem. Each domain is a vector containing
-;; a "set" of inputs and two integers representing how many cases from the set
-;; should be used as training and testing cases respectively. Each "set" of
-;; inputs is either a list or a function that, when called, will create a
-;; random element of the set.
-(def sum-of-squares-data-domains
-  [[(range 1 6) 5 0] ; Small cases
-   [(list 100) 1 0] ; Last case
-   [(fn [] (+ 6 (lrand-int 94))) 14 0] ; Random cases [6,99]
-   [(range 1 101) 0 100] ; Test all integers in [1,100]
-   ])
-
-;;Can make Sum Of Squares test data like this:
-;(test-and-train-data-from-domains sum-of-squares-data-domains)
-
-; Helper function for error function
-(defn sum-of-squares-test-cases
-  "Takes a sequence of inputs and gives IO test cases of the form
-   [input output]."
-  [inputs]
-  (map (fn [in]
-         (vector in
-                 (apply +' (map #(*' % %) (range (inc in))))))
-       inputs))
-
-; Define error function. For now, each run uses different random inputs
-(defn sum-of-squares-error-function
-  "Returns the error function for the Sum Of Squares problem. Takes as
-   input Sum Of Squares data domains."
-  [data-domains]
-  (let [[train-cases test-cases] (map sort (map sum-of-squares-test-cases
-                                                (test-and-train-data-from-domains data-domains)))]
-    (when true ;; Change to false to not print test cases
-      (doseq [[i case] (map vector (range) train-cases)]
-        (println (format "Train Case: %3d | Input/Output: %s" i (str case))))
-      (doseq [[i case] (map vector (range) test-cases)]
-        (println (format "Test Case: %3d | Input/Output: %s" i (str case)))))
-    (fn the-actual-sum-of-squares-error-function
-      ([program]
-        (the-actual-sum-of-squares-error-function program :train))
-      ([program data-cases] ;; data-cases should be :train or :test
-        (the-actual-sum-of-squares-error-function program data-cases false))
-      ([program data-cases print-outputs]
-        (let [behavior (atom '())
-              errors (doall
-                       (for [[input1 correct-output] (case data-cases
-                                                                  :train train-cases
-                                                                  :test test-cases
-                                                                  [])]
-                         (let [final-state (run-push program
-                                                     (->> (make-push-state)
-                                                       (push-item input1 :input)))
-                               result (stack-ref :integer 0 final-state)]
-                           (when print-outputs
-                             (println (format "Correct output: %6d | Program output: %s" correct-output (str result))))
-                           ; Record the behavior
-                           (when @global-print-behavioral-diversity
-                             (swap! behavior conj result))
-                           ; Error is integer distance
-                           (if (number? result)
-                             (abs (- result correct-output)) ;distance from correct integer
-                             1000000000) ;penalty for no return value
-                           )))]
-          (when @global-print-behavioral-diversity
-            (swap! population-behaviors conj @behavior))
-          errors)))))
-
-(defn sum-of-squares-report
-  "Custom generational report."
-  [best population generation error-function report-simplifications]
-  (let [best-program (not-lazy (:program best))
-        best-test-errors (error-function best-program :test)
-        best-total-test-error (apply +' best-test-errors)]
-    (println ";;******************************")
-    (printf ";; -*- Sum Of Squares problem report - generation %s\n" generation)(flush)
-    (println "Test total error for best:" best-total-test-error)
-    (println (format "Test mean error for best: %.5f" (double (/ best-total-test-error (count best-test-errors)))))
-    (when (zero? (:total-error best))
-      (doseq [[i error] (map vector
-                             (range)
-                             best-test-errors)]
-        (println (format "Test Case  %3d | Error: %s" i (str error)))))
-    (println ";;------------------------------")
-    (println "Outputs of best individual on training cases:")
-    (error-function best-program :train true)
-    (println ";;******************************")
-    )) ;; To do validation, could have this function return an altered best individual
-       ;; with total-error > 0 if it had error of zero on train but not on validation
-       ;; set. Would need a third category of data cases, or a defined split of training cases.
-
-
-; Define the argmap
-(def argmap
-  {:error-function (sum-of-squares-error-function sum-of-squares-data-domains)
-   :atom-generators sum-of-squares-atom-generators
-   :max-points 400
-   :max-points-in-initial-program 200
-   :evalpush-limit 4000
-   :population-size 1000
-   :max-generations 300
-   :parent-selection :lexicase
-   :genetic-operator-probabilities {:alternation 0.2
-                                    :uniform-mutation 0.2
-                                    :uniform-close-mutation 0.1
-                                    [:alternation :uniform-mutation] 0.5
-                                    }
-   :alternation-rate 0.01
-   :alignment-deviation 10
-   :uniform-mutation-rate 0.01
-   :problem-specific-report sum-of-squares-report
-   :print-behavioral-diversity true
-   :report-simplifications 0
-   :final-report-simplifications 5000
-   :max-error 1000000000
-   })


make sure we have distinct files

make sure we have distinct files

--- sidecar/src/figwheel_sidecar/watching.clj
+++ sidecar/src/figwheel_sidecar/watching.clj
@@ -77,7 +77,7 @@
     (go-loop []
       (when-let [v (<! throttle-chan)]
         (let [files (<! (take-until-timeout throttle-chan))]
-          (when-let [result-files (not-empty (filter valid-file? (map :file (cons v files))))]
+          (when-let [result-files (not-empty (distinct (filter valid-file? (map :file (cons v files)))))]
             (callback result-files)))
         (recur)))


remove pprn

remove pprn

--- src/atom_finder/location_dump.clj
+++ src/atom_finder/location_dump.clj
@@ -48,7 +48,7 @@
                                      (->> root flatten-tree-context (map (fn [[ctx n]] (assoc ctx :node n))))
                                      all-atoms)]
     (map (partial merge {:file filename})
-         (concat all-atoms (map #(merge {:type :non-atom} %1 (loc-data (:node %1))) (pprn non-atoms))))))
+         (concat all-atoms (map #(merge {:type :non-atom} %1 (loc-data (:node %1))) non-atoms)))))

 ;(->> "/Users/dgopstein/opt/src/gcc/contrib/paranoia.cc" location-dump-atoms-and-non-atoms (map prn))


cleanup

cleanup

--- src/atom_finder/location_dump.clj
+++ src/atom_finder/location_dump.clj
@@ -10,9 +10,6 @@
    [org.eclipse.cdt.core.dom.ast IASTNode]
    )
   )
-
-(offset node)
-(def node big-root)

 (s/defn find-all :- [{:type s/Keyword s/Any s/Any}]
   "Apply every classifier to this node"


Add docstrings to user db

Add docstrings to user db

--- src/braid/core/server/db/user.clj
+++ src/braid/core/server/db/user.clj
@@ -60,12 +60,13 @@
   (some? (d/entity (db/db) [:user/id id])))

 (defn user-with-email
-  "get the user with the given email address or nil if no such user registered"
+  "Get the user with the given email address or nil if no such user registered"
   [email]
   (some-> (d/pull (db/db) user-pull-pattern [:user/email (string/lower-case email)])
           db->user))

 (defn user-email
+  "Get the email address for the user with the given id"
   [user-id]
   (:user/email (d/pull (db/db) [:user/email] [:user/id user-id])))


Fix typo

Fix typo

--- src/braid/server/email_digest.clj
+++ src/braid/server/email_digest.clj
@@ -5,8 +5,8 @@
     [clj-time.format :as format]
     [clj-time.coerce :refer [to-date-time]]
     [clojurewerkz.quartzite.jobs :as j :refer [defjob]]
-    [clojureworkz.quartzite.scheduler :as qs]
     [clojurewerkz.quartzite.schedule.cron :as cron]
+    [clojurewerkz.quartzite.scheduler :as qs]
     [clojurewerkz.quartzite.triggers :as t]
     [clostache.parser :refer [render-resource]]
     [inliner.core :refer [inline-css]]


Automatically accept uploaded badges

Automatically accept uploaded badges

--- src/clj/salava/badge/importer.clj
+++ src/clj/salava/badge/importer.clj
@@ -175,7 +175,7 @@
   (try
     (log/info "upload-badge: got new upload from user id" user-id)
     (b/save-badge-from-assertion! ctx
-                                  {:assertion (a/baked-image uploaded-file)}
+                                  {:assertion (a/baked-image uploaded-file) :_status "accepted"}
                                   user-id
                                   (u/verified-email-addresses ctx user-id))
     {:status "success" :message "badge/Badgeuploaded" :reason "badge/Badgeuploaded"}


rework accounts/before-validation

rework accounts/before-validation

--- src/clj_money/models/accounts.clj
+++ src/clj_money/models/accounts.clj
@@ -40,18 +40,17 @@
 (defn- before-validation
   "Adjust account data for validation"
   [storage account]
-  (cond-> account
-    true (coercion/coerce coercion-rules)
-
-    ; If no entity is specified, try to look it up
-    (and (:id account)
-         (nil? (:entity-id account)))
-    (assoc :entity-id (:entity-id (find-by-id storage (:id account))))
-
-    ; strip out empty string for parent-id
-    (and (string? (:parent-id account))
-         (empty? (:parent-id account)))
-    (dissoc :parent-id)))
+  (let [coerced (coercion/coerce account coercion-rules)]
+    (cond-> coerced
+      ; If no entity is specified, try to look it up
+      (and (:id coerced)
+           (nil? (:entity-id coerced)))
+      (assoc :entity-id (:entity-id (find-by-id storage (:id coerced))))
+
+      ; strip out empty string for parent-id
+      (and (string? (:parent-id coerced))
+           (empty? (:parent-id coerced)))
+      (dissoc :parent-id))))

 (defn- before-create
   "Adjust account data prior to creation"


Adjust rat and frog values

Adjust rat and frog values

--- src/cljc/robinson/monstergen.cljc
+++ src/cljc/robinson/monstergen.cljc
@@ -122,7 +122,7 @@
   ;;        |               |                |                |    | | |     |     |    toughness
   ;;        |               |                |                |    | | |     |     |    | body-parts                                  attacks                       temperament             movement policy                        range-threshold
   ;;        |               |                |                |    | | |     |     |    | |                                           |                             |                       |                                       | status
-  (Monster. :rat            "rat"            "rats"           nil  7 0 0.6   0.2   5    5 #{:face :head :neck :body :leg :tail}       #{:bite :claw}                :hostile                :follow-player-in-range-or-random       5 #{:hostile})
+  (Monster. :rat            "rat"            "rats"           nil  7 0 0.9   0.2   5    5 #{:face :head :neck :body :leg :tail}       #{:bite :claw}                :hostile                :follow-player-in-range-or-random       8 #{:hostile})
   (Monster. :spider         "spider"         "spiders"        nil  8 0 0.9   0.01  7    3 #{:face :leg :abdomen}                      #{:bite-venom}                :retreat-after-attacked :random                                 5 #{:docile})
   (Monster. :scorpion       "scorpion"       "scorpions"      nil  6 0 0.3   0.01  7    3 #{:head :claw :leg :abdomen :tail}          #{:bite :claw :sting-venom}   :hostile-after-attacked :random                                 4 #{:hostile})
   (Monster. :snake          "snake"          "snakes"         nil  3 0 0.8   1     7    8 #{:head :body :tail}                        #{:bite :bite-venom}          :retreat-after-attackd  :random                                 5 #{:hostile})
@@ -133,12 +133,12 @@
   (Monster. :bird           "bird"           "birds"          nil  9 0 2.1   1     6    4 #{:head :body :tail :leg :beak :wing}       #{:bite :claw}                :retreat-after-sound    :random                                 8 #{:docile})
   (Monster. :centipede      "centipede"      "centipedes"     nil 10 0 0.5   0.1   7    3 #{:head :body :leg}                         #{:bite}                      :hostile-after-attacked :random                                 3 #{:hostile})
   (Monster. :turtle         "turtle"         "turtles"        nil  4 0 0.5  10     8   20 #{:head :neck :body :leg :face :shell}      #{:bite}                      :retreat-after-attacked :random                                 5 #{:hostile})
-  (Monster. :red-frog       "red frog"       "red frogs"      nil  5 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:hostile})
-  (Monster. :orange-frog    "orange frog"    "orange frogs"   nil  5 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:hostile})
-  (Monster. :yellow-frog    "yellow frog"    "yellow frogs"   nil  5 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:hostile})
-  (Monster. :green-frog     "green frog"     "green frogs"    nil  5 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:hostile})
-  (Monster. :blue-frog      "blue frog"      "blue frogs"     nil  5 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:hostile})
-  (Monster. :purple-frog    "purple frog"    "purple frogs"   nil  5 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:hostile})
+  (Monster. :red-frog       "red frog"       "red frogs"      nil  5 0 1.1   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :follow-player-in-range-or-random       4 #{:hostile})
+  (Monster. :orange-frog    "orange frog"    "orange frogs"   nil  5 0 1.1   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :follow-player-in-range-or-random       4 #{:hostile})
+  (Monster. :yellow-frog    "yellow frog"    "yellow frogs"   nil  5 0 1.1   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :follow-player-in-range-or-random       4 #{:hostile})
+  (Monster. :green-frog     "green frog"     "green frogs"    nil  5 0 1.1   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :follow-player-in-range-or-random       4 #{:hostile})
+  (Monster. :blue-frog      "blue frog"      "blue frogs"     nil  5 0 1.1   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :follow-player-in-range-or-random       4 #{:hostile})
+  (Monster. :purple-frog    "purple frog"    "purple frogs"   nil  5 0 1.1   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :follow-player-in-range-or-random       4 #{:hostile})
   (Monster. :parrot         "parrot"         "parrots"        nil 15 0 2.1   1     6    9 #{:head :body :leg :face :wing :tail}       #{:claw :bite}                :hostile-during-day     :random                                10 #{:hostile})
   (Monster. :shark          "shark"          "sharks"         nil 16 0 1.4 800     9   15 #{:head :body :fin :nose :tail}             #{:bite}                      :hostile                :follow-player-in-range-or-random      10 #{:hostile})
   (Monster. :fish           "fish"           "fish"           nil  9 0 1.0   4     7    8 #{:head :body :fin :tail}                   #{:bite}                      :retreat-after-attacked :random                                 1 #{:hostile})


Hack not needed anymore

Hack not needed anymore

--- src/cljs/gc_api_browser/core.cljs
+++ src/cljs/gc_api_browser/core.cljs
@@ -53,25 +53,21 @@
 (defn render-schema-select [app]
   [(schema-select/schema-file (:request app))])

+(defn load-stored-schema! [app]
+  (when-not (get-in app [:request :schema])
+    (when-let [json-string (.getItem js/localStorage "schema")]
+      (schema-select/set-schema! (:request app) (.parse js/JSON json-string)))))
+
 (defn main []
   (om/root
     (fn [app _]
       (reify
-        om/IWillMount
-        (will-mount [_]
-          ;; Hack! See https://github.com/omcljs/om/issues/336
-          (js/setTimeout
-            (fn []
-              (when-let [json (.getItem js/localStorage "schema")]
-                (schema-select/set-schema! (:request app) (.parse js/JSON json))))))
         om/IDidMount
         (did-mount [_]
-          ;; Hack! See https://github.com/omcljs/om/issues/336
-          (js/setTimeout
-            (fn []
-              (om/update! app [:request :headers]
-                          (or (js->clj (.parse js/JSON (.getItem js/localStorage "headers")))
-                              default-headers)))))
+          (load-stored-schema! app)
+          (om/update! app [:request :headers]
+                      (or (js->clj (.parse js/JSON (.getItem js/localStorage "headers")))
+                          default-headers)))
         om/IRender
         (render [_]
           (let [schema (get-in app [:request :schema])]


remove old useless functions

remove old useless functions

--- src/cljs/western_music/views.cljs
+++ src/cljs/western_music/views.cljs
@@ -57,20 +57,6 @@
             (when (= id (p/id @selected-composer))
               [composition-list])]))])))

-(defn track-composer
-  "SUPER BIG HACK separating notion of display value and internal ref id
-   will go a long way towards fixing this"
-  [track]
-  (first (clojure.string/split track #" - ")))
-
-(defn track-composition
-  "SUPER BIG HACK separating notion of display value and internal ref id
-   will go a long way towards fixing this"
-  [track]
-  (->> (clojure.string/split track #" - ")
-       (rest)
-       (clojure.string/join " - ")))
-
 (defn track-queue
   []
   (let [queue (subscribe [:track-queue])


Add missing license preamble on crypto ns.

--- src/clojure/buddy/core/crypto.clj
+++ src/clojure/buddy/core/crypto.clj
@@ -1,3 +1,17 @@
+;; Copyright (c) 2013-2015 Andrey Antukh <niwi@niwi.be>
+;;
+;; Licensed under the Apache License, Version 2.0 (the "License")
+;; you may not use this file except in compliance with the License.
+;; You may obtain a copy of the License at
+;;
+;;     http://www.apache.org/licenses/LICENSE-2.0
+;;
+;; Unless required by applicable law or agreed to in writing, software
+;; distributed under the License is distributed on an "AS IS" BASIS,
+;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+;; See the License for the specific language governing permissions and
+;; limitations under the License.
+
 (ns buddy.core.crypto
   "Modes implementation"
   (:import org.bouncycastle.crypto.engines.TwofishEngine


Don't run parinfer if not necessary

Don't run parinfer if not necessary

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -376,8 +376,10 @@
                         (str (join spaces) (join code))))))
                 lines
                 lines-to-change)
-        text (join \newline lines)
-        state (get-parinfer-state text-area false {:text text :cursor-position cursor-position})
+        state (if (= :return (:indent-type state))
+                (assoc state :lines lines)
+                (get-parinfer-state text-area false
+                  {:text (join \newline lines) :cursor-position cursor-position}))
         lines (:lines state)
         text (join \newline lines)]
     (assoc state


Added error handling when getting elasticsearch cluster health.

--- src/cmr/elastic_utils/connect.clj
+++ src/cmr/elastic_utils/connect.clj
@@ -30,11 +30,21 @@
       (errors/internal-error!
         (format "Unable to connect to elasticsearch at: %s. with %s" config e)))))

+(defn- get-elastic-health
+  "Returns the elastic health by calling elasticsearch cluster health api"
+  [conn]
+  (try
+    (admin/cluster-health conn :wait_for_status "yellow" :timeout "30s")
+    (catch Exception e
+      {:status "Unaccessible"
+       :problem (format "Unable to get elasticsearch cluster health, caught exception: %s"
+                        (.getMessage e))})))
+
 (defn health
   "Returns the health state of elasticsearch."
   [context elastic-key-in-context]
   (let [conn (get-in context [:system elastic-key-in-context :conn])
-        health-detail (admin/cluster-health conn :wait_for_status "yellow" :timeout "30s")
+        health-detail (get-elastic-health conn)
         status (:status health-detail)]
     (if (some #{status} ["green" "yellow"])
       {:ok? true}


fix comment syntax

fix comment syntax

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -52,39 +52,39 @@
            [:div.menu-footer
             (common/mixpanel-badge)]])))))

-; (defn shortcuts [app owner]
-;   (reify
-;     om/IRender
-;     (render [_]
-;       (let [cast! (om/get-shared owner :cast!)]
-;         (html
-;           [:div.menu-view {:class (str "menu-view-" "shortcuts")}
-;            [:div.menu-view-frame
-;             [:div.shortcuts-item
-;              [:div.shortcuts-key "S"]
-;              [:div.shortcuts-result "Select"]]
-;             [:div.shortcuts-item
-;              [:div.shortcuts-key "R"]
-;              [:div.shortcuts-result "Rectangle"]]
-;             [:div.shortcuts-item
-;              [:div.shortcuts-key "C"]
-;              [:div.shortcuts-result "Circle"]]
-;             [:div.shortcuts-item
-;              [:div.shortcuts-key "L"]
-;              [:div.shortcuts-result "Line"]]
-;             [:div.shortcuts-item
-;              [:div.shortcuts-key "P"]
-;              [:div.shortcuts-result "Pen"]]
-;             [:div.shortcuts-item
-;              [:div.shortcuts-key "T"]
-;              [:div.shortcuts-result "Text"]]
-;             [:div.shortcuts-item
-;              [:div.shortcuts-key "1"]
-;              [:div.shortcuts-result "Snap to origin"]]
-;             [:div.shortcuts-item
-;              [:div.shortcuts-key "Cmd"]
-;              [:div.shortcuts-key "Z"]
-;             [:div.shortcuts-result "Undo"]]]])))))
+;; (defn shortcuts [app owner]
+;;   (reify
+;;     om/IRender
+;;     (render [_]
+;;       (let [cast! (om/get-shared owner :cast!)]
+;;         (html
+;;           [:div.menu-view {:class (str "menu-view-" "shortcuts")}
+;;            [:div.menu-view-frame
+;;             [:div.shortcuts-item
+;;              [:div.shortcuts-key "S"]
+;;              [:div.shortcuts-result "Select"]]
+;;             [:div.shortcuts-item
+;;              [:div.shortcuts-key "R"]
+;;              [:div.shortcuts-result "Rectangle"]]
+;;             [:div.shortcuts-item
+;;              [:div.shortcuts-key "C"]
+;;              [:div.shortcuts-result "Circle"]]
+;;             [:div.shortcuts-item
+;;              [:div.shortcuts-key "L"]
+;;              [:div.shortcuts-result "Line"]]
+;;             [:div.shortcuts-item
+;;              [:div.shortcuts-key "P"]
+;;              [:div.shortcuts-result "Pen"]]
+;;             [:div.shortcuts-item
+;;              [:div.shortcuts-key "T"]
+;;              [:div.shortcuts-result "Text"]]
+;;             [:div.shortcuts-item
+;;              [:div.shortcuts-key "1"]
+;;              [:div.shortcuts-result "Snap to origin"]]
+;;             [:div.shortcuts-item
+;;              [:div.shortcuts-key "Cmd"]
+;;              [:div.shortcuts-key "Z"]
+;;             [:div.shortcuts-result "Undo"]]]])))))

 (defn shortcuts [app owner]
   (reify
@@ -151,8 +151,8 @@
 (def overlay-components
   {:info {:component info
           :menu-type :prompt}
-   ; :shortcuts {:component shortcuts
-   ;             :menu-type :view}
+   ;; :shortcuts {:component shortcuts
+   ;;             :menu-type :view}
    :shortcuts {:component shortcuts
                :menu-type :prompt}
    :username {:component username


Ditto

Ditto

--- src/clojure/clojurewerkz/cassaforte/multi/cql.clj
+++ src/clojure/clojurewerkz/cassaforte/multi/cql.clj
@@ -21,7 +21,7 @@
 ;;

 (defn drop-keyspace
-  "Executes `DROP KEYSPACE` statement, which results in the immediate, irreversible removal of an existing keyspace,
+  "Drops a keyspace: results in immediate, irreversible removal of an existing keyspace,
    including all column families in it, and all data contained in those column families.

    Example:
@@ -31,8 +31,9 @@
   (execute- session [ks] query/drop-keyspace-query))

 (defn create-keyspace
-  "Executes `CREATE KEYSPACE` statement, which creates a new top-level keyspace. A keyspace is a namespace that
-   defines a replication strategy and some options for a set of tables.
+  "Creates a new top-level keyspace. A keyspace is a namespace that
+   defines a replication strategy and some options for a set of tables,
+   similar to a database in relational databases.

    Example:

@@ -44,7 +45,7 @@
   (execute- session query-params query/create-keyspace-query))

 (defn create-index
-  "Executes `CREATE INDEX` statement, which creates a new (automatic) secondary index for a given (existing)
+  "Creates a new (automatic) secondary index for a given (existing)
    column in a given table.If data already exists for the column, it will be indexed during the execution
    of this statement. After the index is created, new data for the column is indexed automatically at
    insertion time.
@@ -56,7 +57,7 @@
   (execute- session query-params query/create-index-query))

 (defn drop-index
-  "Executes `DROP INDEX` statement is used to drop an existing secondary index. The argument of the statement
+  "Drop an existing secondary index. The argument of the statement
    is the index name.

    Example, drop index on `users` table, `city` column:
@@ -66,9 +67,11 @@
   (execute- session query-params query/drop-index-query))

 (defn create-table
-  "Executes `CREATE TABLE` statement, which creates a new table. Each such table is a set of rows (usually
-   representing related entities) for which it defines a number of properties. A table is defined by a name,
-   it defines the columns composing rows of the table and have a number of options.
+  "Creates a new table. A table is a set of rows (usually
+   representing related entities) for which it defines a number of properties.
+
+   A table is defined by a name, it defines the columns composing rows
+   of the table and have a number of options.

    Example:

@@ -83,8 +86,8 @@
 (def create-column-family create-table)

 (defn drop-table
-  "Executes the `DROP TABLE` statement results in the immediate, irreversible removal of a table, including
-   all data contained in it.
+  "Drops a table: this results in the immediate, irreversible removal of a table, including
+   all data in it.

    Example:

@@ -104,14 +107,14 @@
   (execute- session [ks] query/use-keyspace-query))

 (defn alter-table
-  "Executes `ALTER` statement, which is used to manipulate table definitions. It allows to add new
+  "Alters a table definition. Use it to add new
    columns, drop existing ones, change the type of existing columns, or update the table options."
   [^Session session & query-params]
   (execute- session query-params query/alter-table-query))

 (defn alter-keyspace
-  "Executes `ALTER KEYSPACE` statement, which  alters the properties of an existing keyspace. The
-   supported properties are the same that for the CREATE KEYSPACe statement."
+  "Alters properties of an existing keyspace. The
+   supported properties are the same that for `create-keyspace`"
   [^Session session & query-params]
   (execute- session query-params query/alter-keyspace-query))

@@ -120,15 +123,16 @@
 ;;

 (defn insert
-  "Executes the `INSERT` statement, which writes one or more columns for a given row in a table.
-   Note that since a row is identified by its PRIMARY KEY, the columns that compose it must be
+  "Inserts a row in a table.
+
+   Note that since a row is identified by its primary key, the columns that compose it must be
    specified. Also, since a row only exists when it contains one value for a column not part of
-   the PRIMARY KEY, one such value must be specified too."
+   the primary key, one such value must be specified too."
   [^Session session & query-params]
   (execute- session query-params query/insert-query))

 (defn insert-batch
-  "Executes batch of `INSERT` queries."
+  "Performs a batch insert (inserts multiple records into a table at the same time)"
   [^Session session table records]
   (->> (map #(query/insert-query table %) records)
        (apply query/queries)
@@ -137,14 +141,14 @@
        client/execute))

 (defn update
-  "Executes `UPDATE` statement writes one or more columns for a given row in a table. Where clause
+  "Updates one or more columns for a given row in a table. The `where` clause
    is used to select the row to update and must include all columns composing the PRIMARY KEY.
    Other columns values are specified through assignment within the `set` clause."
   [^Session session & query-params]
   (execute- session query-params query/update-query))

 (defn delete
-  "Executes `DELETE` statement that deletes columns and rows. If `columns` clause is provided,
+  "Deletes columns and rows. If the `columns` clause is provided,
    only those columns are deleted from the row indicated by the `where` clause, please refer to
    KV guide (http://clojurecassandra.info/articles/kv.html) for more details. Otherwise whole rows
    are removed. The `where` allows to specify the key for the row(s) to delete."
@@ -152,14 +156,14 @@
   (execute- session query-params query/delete-query))

 (defn select
-  "Executes `SELECT` statements, which reads one or more columns for one or more rows in a table.
-   It returns a resultset of rows, where each row contains the collection of columns corresponding
-   to the query."
+  "Retrieves one or more columns for one or more rows in a table.
+   It returns a result set, where every row is a collection of columns returned by the query."
   [^Session session & query-params]
   (execute- session query-params query/select-query))

 (defn truncate
-  "Executes `TRUNCATE` statement, which permanently and irreversably removes all data from a table."
+  "Truncates a table: permanently and irreversably removes all rows from the table,
+   not removing the table itself."
   [^Session session table]
   (execute- session [table] query/truncate-query))


Changed implementation of equals for Fuzzy-Set

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

--- src/conexp/contrib/fuzzy/sets.clj
+++ src/conexp/contrib/fuzzy/sets.clj
@@ -14,18 +14,12 @@
 ;;;

 (deftype Fuzzy-Set [^clojure.lang.APersistentMap hashmap]
+  ;; Contract: hashmap does not contain elements whose values are
+  ;; not-numbers or smaller-equal 0 or greater 1.
   ;;
   Object
   (equals [this other]
-    (boolean (or (identical? this other)
-                 (when (= (class this) (class other))
-                   (let [ohashmap (.hashmap ^Fuzzy-Set other)]
-                     (and (forall [k (keys hashmap)]
-                            (=> (not (zero? (hashmap k)))
-                                (= (hashmap k) (ohashmap k))))
-                          (forall [k (keys ohashmap)]
-                            (=> (not (zero? (ohashmap k)))
-                                (= (hashmap k) (ohashmap k))))))))))
+    (generic-equals [this other] Fuzzy-Set [hashmap]))
   (hashCode [this]
     (hash-combine-hash Fuzzy-Set hashmap))
   (toString [this]
@@ -41,8 +35,7 @@
       n
       ()))
   (cons [this [k v]]
-    (when-not (and (number? v)
-                   (<= 0 v 1))
+    (when-not (and (number? v) (<= 0 v 1))
       (illegal-argument "Fuzzy sets only support real values in [0,1]"))
     (if (zero? v)
       (Fuzzy-Set. (dissoc hashmap k))
@@ -72,6 +65,8 @@
     (.entryAt hashmap o))
   (assoc [this k v]
     (.cons this [k v])))
+
+;;; Constructors

 (defmulti make-fuzzy-set
   "Constructs a fuzzy set from a given collection."


Added a default content-type of */* where this is not already specified by the web function metadata.

--- src/main/clojure/plugboard/webfunction/plugboards.clj
+++ src/main/clojure/plugboard/webfunction/plugboards.clj
@@ -51,7 +51,7 @@
 (defn
   ^{:doc "Get the content type from the web function metadata"}
   get-content-type-fragment [^ContentFunction cf]
-  (:type (conneg/accept-fragment (get (meta (:webfn cf)) web/content-type))))
+  (:type (conneg/accept-fragment (or (get (meta (:webfn cf)) web/content-type) "*/*"))))

 (defn get-headers-from-webfn [webfn]
   (if-let [ct (get (meta webfn) web/content-type)]


Pretty-print cljs files - fixes issue #6

--- src/dalap/leiningen/transform.clj
+++ src/dalap/leiningen/transform.clj
@@ -1,9 +1,10 @@
 (ns dalap.leiningen.transform
   (:require [clojure.string :as str]
+            [clojure.pprint :as pp]
             [dalap.walk]
             [dalap.rules]
             [dalap.leiningen.rules :refer
-             [cljs-default-rules -mappend]])
+            [cljs-default-rules -mappend]])
   (:import [clojure.lang LineNumberingPushbackReader]))

 (defn visit-clj-form [form w]
@@ -59,10 +60,16 @@
        clj-file-path " @ " (java.util.Date.)
        "\n;;\n"))

-(defn transform-to-cljs-file
-  [clj-file-path rules]
+(defn pretty-print [form]
+  (with-out-str
+    (pp/write form :dispatch pp/code-dispatch)))
+
+(defn transform-to-cljs-file [clj-file-path rules]
   (str (cljs-generated-file-notice clj-file-path)
-       (str/join "\n" (clj-forms-to-cljs-forms
-                       (read-clj-forms-from-input clj-file-path)
-                       (-mappend cljs-default-rules
-                                 rules)))))
+       (str/join
+         "\n\n"
+         (map
+           pretty-print
+           (clj-forms-to-cljs-forms
+             (read-clj-forms-from-input clj-file-path)
+             (-mappend cljs-default-rules rules))))))


Adjustment to address new replumb version

--- src/cljs/cljs_repl_web/replumb_proxy.cljs
+++ src/cljs/cljs_repl_web/replumb_proxy.cljs
@@ -25,7 +25,7 @@
 (defn multiline?
   [input]
   (try
-    (replumb-repl/repl-read-string input)
+    (replumb-repl/read-string {:features #{:cljs}} input)
     false
     (catch :default _
       true)))


wip: fix NON_NULL kind

wip: fix NON_NULL kind

--- src/graphql_clj/introspection.clj
+++ src/graphql_clj/introspection.clj
@@ -66,23 +66,29 @@
           (format "field tag is null for field: %s" field))
   (let [type-name (or (:type-name field)
                       (get-in field [:type :name]))
+        type (:type field)
         kind (field-kind field)
         inner-type (get-in field [:type :inner-type])]
     (assert kind (format "field kind is nil for field: %s" field))
+    (if (#{:LIST} kind)
+      (assert inner-type (format "field inner-type is nil for field: %s" field)))
     (assert (or type-name inner-type) (format "field type-name and inner-type are both nil for field: %s" field))
-    {:name (:name field)
-     :description (:description field)
-     :args (:arguments field) ; defer resolving of arguments
-
-     ;; :type nil ; defer resolving of type
-     :type-name type-name
-     :kind kind
-     :inner-type inner-type
-     :required (:required field)
-
-     :isDeprecated false ; TODO
-     :deprecationReason nil ; TODO
-     }))
+    (if (= :NON_NULL kind)
+      {:kind kind
+       :inner-type (dissoc type :required)}
+      {:name (:name field)
+       :description (:description field)
+       :args (:arguments field) ; defer resolving of arguments
+
+       ;; :type nil ; defer resolving of type
+       :type-name type-name
+       :kind kind
+       :inner-type inner-type
+       :required (:required field)
+
+       :isDeprecated false ; TODO
+       :deprecationReason nil ; TODO
+       })))

 (defn type-resolver [type]
   (let [kind (type-kind type)
@@ -90,6 +96,7 @@
                       (if (:tag type)
                         (case (:tag type)
                           :basic-type (:name type)
+                          :list-type nil
                           (throw (ex-info (format "Unhandled type in type-resolver:%s" type) {:type type}))))
                       ;; (cond
                       ;;   (contains? #{:type-definition
@@ -101,10 +108,10 @@
                       ;;   :default (throw (ex-info (format "Unhandled type in type-resolver:%s" type) {:type type})))
                       )
         inner-type (:inner-type type)]
-    (when (not (contains? #{:LIST :NON_NULL} kind))
+    (when (not (#{:LIST :NON_NULL} kind))
       (assert type-name (format "type-name is null for type: %s." type))
       (assert kind (format "kind is nil for type: %s" type)))
-    (when (= :LIST kind)
+    (if (#{:LIST} kind)
       (assert inner-type (format "inner-type is nil for type: %s" type)))
     (assert (or type-name inner-type) (format "Both type-name and inner-type are nil for type:%s" type))
     (if (:required type)
@@ -189,17 +196,20 @@
         kind (type-kind (:type arg))
         inner-type (get-in arg [:type :inner-type])]
     (assert kind (format "argument kind is nil for: %s" arg))
-    (when (= :LIST kind)
+    (when (#{:LIST} kind)
       (assert inner-type (format "inner-type is nil for type: %s" arg)))
     (assert (or type-name inner-type) (format "Both type-name and inner-type are nil for arg:%s" arg))
     (println "args-resolver: arg:" arg)
-    {:name (:name arg)
-     :description (:description arg)
-
-     ;; defer resolving of type for argument
-     :type-name type-name
-     :kind kind
-     :inner-type inner-type
-     :required (:required arg)
-
-     :defaultValue (:default-value arg)}))
+    (if (= :NON_NULL kind)
+      {:kind kind
+       :inner-type (dissoc type :required)}
+      {:name (:name arg)
+       :description (:description arg)
+
+       ;; defer resolving of type for argument
+       :type-name type-name
+       :kind kind
+       :inner-type inner-type
+       :required (:required arg)
+
+       :defaultValue (:default-value arg)})))


Adding comment of message that splunk monitors.

--- message-queue-lib/src/cmr/message_queue/queue/rabbit_mq.clj
+++ message-queue-lib/src/cmr/message_queue/queue/rabbit_mq.clj
@@ -56,6 +56,7 @@
     (if (queue/retry-limit-met? msg (count (config/rabbit-mq-ttls)))
       (do
         ;; give up
+        ;; Splunk alert "Indexing from message queue failed and all retries exhausted" dependent on this log message
         (warn "Max retries exceeded for processing message:" (pr-str msg))
         (lb/nack ch delivery-tag false false))
       (let [msg (assoc msg :retry-count (inc retry-count))


Small bugfix that prevented regression tests from being run in RC1.

--- src/leiningen/ancient/upgrade.clj
+++ src/leiningen/ancient/upgrade.clj
@@ -204,7 +204,6 @@
   (fn [project settings path]
     (when-let [r (upgrade-fn project settings path)]
       (or (= r ::nothing)
-          (not (:root project))
           (not (:tests settings))
           (:print settings)
           (run-regression-tests! path)))))


Correct some typos in documentation

Correct some typos in documentation

--- src/main/clojure/cascade/internal/viewbuilder.clj
+++ src/main/clojure/cascade/internal/viewbuilder.clj
@@ -73,72 +73,72 @@
             attributes (->> {} (extract "." :class) (extract "#" :id))]
         [simple-element-name attributes]))))

-        (defn combine
-          "Given the results of rendering (where each step provides a render result), combine the results
-    into a single sequence of DOM nodes. Each of the render results should be a DOM node,
-    or a collection of DOM nodes (or a nested collection of DOM nodes, etc.). Strings are also allowed,
-    which are converted into :text DOM nodes."
-          [& render-results]
-          (loop [output (transient [])
-                 queue render-results]
-            (let [current (first queue)
-                  remainder (next queue)]
-              (cond
-                (nil? current) (if (empty? remainder) (persistent! output) (recur output remainder))
-                (sequential? current) (recur output (concat current remainder))
-                :otherwise (recur (conj! output (convert-render-result current)) remainder)))))
+(defn combine
+  "Given the results of rendering (where each step provides a render result), combine the results
+into a single sequence of DOM nodes. Each of the render results should be a DOM node,
+or a collection of DOM nodes (or a nested collection of DOM nodes, etc.). Strings are also allowed,
+which are converted into :text DOM nodes."
+  [& render-results]
+  (loop [output (transient [])
+         queue render-results]
+    (let [current (first queue)
+          remainder (next queue)]
+      (cond
+        (nil? current) (if (empty? remainder) (persistent! output) (recur output remainder))
+        (sequential? current) (recur output (concat current remainder))
+        :otherwise (recur (conj! output (convert-render-result current)) remainder)))))

-        (with-monad parser-m
-          (declare parse-embedded-template)
+(with-monad parser-m
+  (declare parse-embedded-template)

-          (def parse-text
-            (domonad [text match-string]
-              ; The encode-string occurs just once, at macro expansion time
-              `(raw-node ~(encode-string text))))
+  (def parse-text
+    (domonad [text match-string]
+      ; The encode-string occurs just once, at macro expansion time
+      `(raw-node ~(encode-string text))))

-          (def parse-name
-            ; An attribute or element name is either a keyword or a form that yields a keyword.
-            (match-first match-keyword))
+  (def parse-name
+    ; An attribute or element name is either a keyword or a form that yields a keyword.
+    (match-first match-keyword))

-          (def parse-body
-            (domonad [body match-vector]
-              (parse-embedded-template body)))
+  (def parse-body
+    (domonad [body match-vector]
+      (parse-embedded-template body)))

-          (def parse-entity
-            (domonad [entity-name match-keyword :when (.startsWith (name entity-name) "&")]
-              `(raw-node ~(str (name entity-name) ";"))))
+  (def parse-entity
+    (domonad [entity-name match-keyword :when (.startsWith (name entity-name) "&")]
+      `(raw-node ~(str (name entity-name) ";"))))

-          (def parse-element
-            (domonad [name parse-name
-                      attributes (optional match-map)
-                      body (optional parse-body)]
-              (let [[factored-element-name implicit-attributes] (factor-element-name name)
-                    assembled-attributes (merge implicit-attributes attributes)]
-                `(element-node ~factored-element-name ~assembled-attributes ~body))))
+  (def parse-element
+    (domonad [name parse-name
+              attributes (optional match-map)
+              body (optional parse-body)]
+      (let [[factored-element-name implicit-attributes] (factor-element-name name)
+            assembled-attributes (merge implicit-attributes attributes)]
+        `(element-node ~factored-element-name ~assembled-attributes ~body))))

-          ; Accept a single form that will act as a renderer, returning a render
-          ; result, which will be combined with other render results via the
-          ; parse-forms parser. This form may be a symbol or a list (a function call).
-          (def parse-form
-            (domonad [form match-form]
-              form))
+  ; Accept a single form that will act as a renderer, returning a render
+  ; result, which will be combined with other render results via the
+  ; parse-forms parser. This form may be a symbol or a list (a function call).
+  (def parse-form
+    (domonad [form match-form]
+      form))

-          (def parse-single-form
-            (match-first parse-text parse-entity parse-element parse-form))
+  (def parse-single-form
+    (match-first parse-text parse-entity parse-element parse-form))

-          (def parse-forms
-            (domonad [forms (none-or-more parse-single-form)]
-              ; Evaluation order means that the DOM tree is effectively constructed bottom-to-top
-              ; (because combine is not lazy).
-              ; This may be be relevent in terms of ordering of CSS stylesheets & JavaScript libraries,
-              ; since that information is "collected on the side" (in an atom) and therefore not
-              ; purely functional. Perhaps there's a monadic approach that will allow the construction
-              ; of the DOM tree and the collection of CSS/JS data to occur in a stricly functional way?
-              `(combine ~@forms)))
-          ) ; with-monad parser-m
+  (def parse-forms
+    (domonad [forms (none-or-more parse-single-form)]
+      ; Evaluation order means that the DOM tree is effectively constructed bottom-to-top
+      ; (because combine is not lazy).
+      ; This may be be relevant in terms of ordering of CSS stylesheets & JavaScript libraries,
+      ; since that information is "collected on the side" (in an atom) and therefore not
+      ; purely functional. Perhaps there's a monadic approach that will allow the construction
+      ; of the DOM tree and the collection of CSS/JS data to occur in a strictly functional way?
+      `(combine ~@forms)))
+  ) ; with-monad parser-m

-        (defn parse-embedded-template
-          "Used as part of (defview) or (template) to convert the a form, the embedded template, into
+(defn parse-embedded-template
+  "Used as part of (defview) or (template) to convert the a form, the embedded template, into
 a new list of forms that constructs the structure layed out by the template."
-          [forms]
-          (run-parse parse-forms forms "embedded template forms"))+  [forms]
+  (run-parse parse-forms forms "embedded template forms"))


actually disable the require removal compiler pass

--- src/main/shadow/build/closure.clj
+++ src/main/shadow/build/closure.clj
@@ -853,7 +853,8 @@

     (let [require-clear-pass (ClearUnassignedJsRequires. cc)]
-      (.addCustomPass closure-opts CustomPassExecutionTime/AFTER_OPTIMIZATION_LOOP require-clear-pass)
+      ;; FIXME: can't use this until I figure out how to detect side-effect only JS requires
+      #_ (.addCustomPass closure-opts CustomPassExecutionTime/AFTER_OPTIMIZATION_LOOP require-clear-pass)

       ;; (fn [closure-compiler compiler-options state])
       (doseq [cfg (:closure-configurators compiler-options)]