Mostly a copy/paste job from the submit analysis dialog

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/data_tab.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/data_tab.cljs
@@ -7,54 +7,48 @@
     [org.broadinstitute.firecloud-ui.common.table :as table]
     [org.broadinstitute.firecloud-ui.common.style :as style]
     [org.broadinstitute.firecloud-ui.page.import-data :as import-data]
-    [org.broadinstitute.firecloud-ui.paths :refer [list-all-entities-path]]
+    [org.broadinstitute.firecloud-ui.paths :refer [get-entities-by-type-path]]
     [org.broadinstitute.firecloud-ui.utils :as utils]))

-
-(defn- filter-entities [entities active-filter]
-  (case active-filter
-    :sample (filter (fn [entity] (= "sample" (entity "entityType"))) entities)
-    :aliquot (filter (fn [entity] (= "aliquot" (entity "entityType"))) entities)
-    entities))

 (defn- create-mock-entities []
   (map
     (fn [i]
       {:entityType (rand-nth ["sample" "participant"])
        :name (str "entity" (inc i))
-       :attributes (str "entity" (inc i) " has no attributes")})
+       :attributes {}})
     (range (rand-int 20))))

 (react/defc EntitiesList
   {:get-initial-state
-   (fn []
-     {:active-filter :sample})
+   (fn [{:keys [props]}]
+     {:entities (get (:entity-map props) (first (keys (:entity-map props))))})
    :render
-   (fn [{:keys [props state]}]
-     (let [filtered-entities (filter-entities (:entities props) (:active-filter @state))
-           make-button (fn [name filter]
-                         {:text name
-                          :active? (= filter (:active-filter @state))
-                          :onClick #(swap! state assoc :active-filter filter)})]
-       [:div {}
-        [:div {:style {:margin "2em 0" :textAlign "center"}}
-         [comps/FilterButtons {:buttons [(make-button "Sample" :sample)
-                                         (make-button "Aliquot" :aliquot)
-                                         (make-button "All" :all)]}]]
-        (if (zero? (count filtered-entities))
-          (style/create-message-well "No entities to display.")
-          (let [attribute-keys (apply union (map (fn [e] (set (keys (e "attributes")))) filtered-entities))]
-            [table/Table
-             {:columns (concat
-                         [{:header "Entity Type" :starting-width 100 :sort-by :value}
-                          {:header "Entity Name" :starting-width 120 :sort-by :value}]
-                         (map (fn [k] {:header k :starting-width 100 :sort-by :value}) attribute-keys))
-              :data (map (fn [m]
-                           (concat
-                             [(m "entityType")
-                              (m "name")]
-                             (map (fn [k] (get-in m ["attributes" k])) attribute-keys)))
-                      filtered-entities)}]))]))})
+   (fn [{:keys [props state refs]}]
+     [:div {}
+      [:div {:style {:padding "0 0 0.5em 1em"}}
+       (style/create-form-label "Select Entity Type")
+       (style/create-select
+         {:style {:width "50%" :minWidth 50 :maxWidth 200} :ref "filter"
+          :onChange #(let [value (-> (@refs "filter") .getDOMNode .-value)
+                           entities (get-in props [:entity-map value])]
+                      (swap! state assoc :entities entities :entity-type value))}
+         (keys (:entity-map props)))]
+      (if (zero? (count (:entities @state)))
+        (style/create-message-well "No entities to display.")
+        (let [attribute-keys (apply union (map (fn [e] (set (keys (e "attributes")))) (:entities @state)))]
+          [table/Table
+           {:key (:entity-type @state)
+            :columns (concat
+                       [{:header "Entity Type" :starting-width 100 :sort-by :value}
+                        {:header "Entity Name" :starting-width 100 :sort-by :value}]
+                       (map (fn [k] {:header k :starting-width 100 :sort-by :value}) attribute-keys))
+            :data (map (fn [m]
+                         (concat
+                           [(m "entityType")
+                            (m "name")]
+                           (map (fn [k] (get-in m ["attributes" k])) attribute-keys)))
+                    (:entities @state))}]))])})

 (react/defc WorkspaceData
@@ -70,11 +64,11 @@
                :onClick #(swap! state merge
                           {:show-import? false}
                           (when (react/call :did-load-data? (@refs "data-import"))
-                            {:entities-loaded? false}))}
+                            {:entity-map false}))}
            "< Back to Data List"]]
          [import-data/Page {:ref "data-import" :workspace-id (:workspace-id props)}]]
-        (:entities-loaded? @state) [EntitiesList {:entities (:entities @state)}]
-        (:error @state) (style/create-server-error-message (get-in @state [:error :message]))
+        (:entity-map @state) [EntitiesList {:entity-map (:entity-map @state)}]
+        (:error @state) (style/create-server-error-message (:error @state))
         :else [:div {:style {:textAlign "center"}} [comps/Spinner {:text "Loading entities..."}]])
       (when-not (:show-import? @state)
         [:div {:style {:margin "1em 0 0 1em"}}
@@ -85,16 +79,16 @@
      (react/call :load-entities this))
    :component-did-update
    (fn [{:keys [this state]}]
-     (when-not (or (:entities-loaded? @state) (:error @state))
+     (when-not (or (:entity-map @state) (:error @state))
        (react/call :load-entities this)))
    :load-entities
    (fn [{:keys [state props]}]
      (utils/call-ajax-orch
-       (list-all-entities-path (:workspace-id props) "sample")
+       (get-entities-by-type-path (:workspace-id props))
        {:on-success (fn [{:keys [parsed-response]}]
-                      (swap! state assoc :entities-loaded? true :entities parsed-response))
+                      (swap! state assoc :entity-map (group-by #(% "entityType") parsed-response)))
         :on-failure (fn [{:keys [status-text]}]
-                      (swap! state assoc :error {:message status-text}))
+                      (swap! state assoc :error status-text))
         :mock-data (create-mock-entities)}))})

 (defn render [workspace]


Formatting

Formatting

--- src/clojure/clojurewerkz/cassaforte/client.clj
+++ src/clojure/clojurewerkz/cassaforte/client.clj
@@ -159,7 +159,7 @@
     (if (string? keyspace-or-opts)
       (connect hosts keyspace-or-opts {})
       (let [keyspace (:keyspace keyspace-or-opts)
-            opts (dissoc keyspace-or-opts :keyspace)]
+            opts     (dissoc keyspace-or-opts :keyspace)]
         (if keyspace
           (connect hosts keyspace opts)
           (connect-or-close (-> opts (merge {:hosts hosts}) build-cluster))))))


Making activator constructor less weird

Making activator constructor less weird

--- src/yadic/core.clj
+++ src/yadic/core.clj
@@ -164,17 +164,17 @@
   (keys [this]
         (keys m)))

+(def empty-activators (Activators. {}))
+
 (defn ->activators
-  ([& keys-and-activators]
-   (if (and (map? (first keys-and-activators))
-            (= 1 (count keys-and-activators)))
-     (Activators. (first keys-and-activators))
-     (reduce
-       (fn [as [k v]] (assoc as k v))
-       (Activators. {})
-       (partition 2 keys-and-activators)))))
-
-(def empty-activators (->activators))
+  ([] empty-activators)
+  ([m]
+   (Activators. m))
+  ([k activator & keys-and-activators]
+   (reduce
+     (fn [as [k v]] (assoc as k v))
+     (assoc (Activators. {}) k activator)
+     (partition 2 keys-and-activators))))

 ; Container
 ; ==================================


Add a registry for query fragments

Add a registry for query fragments

Query fragments can e.g. be registered using

  (workflo.macros.query/register-query-fragment! <name> <query>)

and resolved using

  (workflo.macros.query/resolve-query-fragment <name>).

--- src/main/workflo/macros/query.cljc
+++ src/main/workflo/macros/query.cljc
@@ -3,9 +3,16 @@
             #?(:cljs [cljs.spec.impl.gen :as gen]
                :clj  [clojure.spec.gen :as gen])
             [workflo.macros.query.bind :as bind]
+            [workflo.macros.registry :refer [defregistry]]
             [workflo.macros.specs.conforming-query :as conforming-query]
             [workflo.macros.specs.parsed-query :as parsed-query]
             [workflo.macros.specs.query :as q]))
+
+(declare conform-and-parse)
+
+;;;; Registry for query fragments
+
+(defregistry query-fragment)

 ;;;; Query parsing


删除没用的import

删除没用的import

--- src/learnclojure/chapt3/core5.clj
+++ src/learnclojure/chapt3/core5.clj
@@ -1,5 +1,4 @@
-(ns learnclojure.chapt3.core5
-  (:import (java.util Collections ArrayList)))
+(ns learnclojure.chapt3.core5)
 ;;Indexed接口
 ;;到目前为止，我们一直回避讨论怎么直接获取vector的第n个值，或者直接修改vector的第n个值
 ;;原因是下标是新的指针


CMR-1387: Refactoring and cleanup

CMR-1387: Refactoring and cleanup

--- search-app/src/cmr/search/services/query_execution/facets_results_feature.clj
+++ search-app/src/cmr/search/services/query_execution/facets_results_feature.clj
@@ -41,7 +41,7 @@
   {:nested {:path :science-keywords}
    :aggs {:category (science-keyword-aggregations-helper science-keyword-hierarchy)}})

-(def flat-facet-aggregations
+(def ^:private flat-facet-aggregations
   "This is the aggregations map that will be passed to elasticsearch to request facetted results
   from a collection search."
   {:archive-center (terms-facet :archive-center)
@@ -59,7 +59,7 @@
    :variable-level-3 (terms-facet :variable-level-3)
    :detailed-variable (terms-facet :detailed-variable)})

-(def hierarchical-facet-aggregations
+(def ^:private hierarchical-facet-aggregations
   "This is the aggregations map that will be passed to elasticsearch to request facetted results
   from a collection search."
   {:archive-center (terms-facet :archive-center)
@@ -131,123 +131,129 @@
   (science-keywords-bucket-helper science-keyword-hierarchy
                                   (get bucket-map (first science-keyword-hierarchy))))

+(defn- create-hierarchical-facets
+  "Create the facets response with hierarchical facets. Takes an elastic aggregations result and
+  returns the facets."
+  [elastic-aggregations]
+  (let [science-keywords-bucket (:science-keywords elastic-aggregations)
+        science-keywords-facets (science-keywords-bucket->facets science-keywords-bucket)]
+    (concat (bucket-map->facets
+              (dissoc elastic-aggregations :science-keywords)
+              [:archive-center :project :platform :instrument :sensor
+               :two-d-coordinate-system-name :processing-level-id])
+            [(r/map->ScienceKeywordsFacet {:field "science_keywords"
+                                           :facets science-keywords-facets})])))
+
+(defn- create-flat-facets
+  "Create the facets response with flat facets. Takes an elastic aggregations result and returns
+  the facets."
+  [elastic-aggregations]
+  (bucket-map->facets
+    elastic-aggregations
+    ;; Specified here so that order will be consistent with results
+    [:archive-center :project :platform :instrument :sensor
+     :two-d-coordinate-system-name :processing-level-id :category :topic :term
+     :variable-level-1 :variable-level-2 :variable-level-3 :detailed-variable]))
+
 (defmethod query-execution/post-process-query-result-feature :facets
-  [context query elastic-results query-results feature]
-  (let [aggs (:aggregations elastic-results)]
-    (if (:nested-science-keywords? query)
-      (let [science-keywords-bucket (:science-keywords aggs)
-            science-keywords-facets (science-keywords-bucket->facets science-keywords-bucket)]
-        (assoc query-results
-               :facets (concat (bucket-map->facets
-                                 (dissoc aggs :science-keywords)
-                                 [:archive-center :project :platform :instrument :sensor
-                                  :two-d-coordinate-system-name :processing-level-id])
-                               ;; TODO Refactor out to have a create hierarchical facet function
-                               [(r/map->ScienceKeywordsFacet {:field (csk/->snake_case_string :science-keywords)
-                                                              :facets science-keywords-facets})])))
-      (let [facets (bucket-map->facets
-                     aggs
-                     ;; Specified here so that order will be consistent with results
-                     [:archive-center :project :platform :instrument :sensor
-                      :two-d-coordinate-system-name :processing-level-id :category :topic :term
-                      :variable-level-1 :variable-level-2 :variable-level-3 :detailed-variable])]
-        (assoc query-results :facets facets)))))
-
-(defn key-with-prefix
+  [_ {:keys [nested-science-keywords?]} {:keys [aggregations]} query-results _]
+  (let [facets (if nested-science-keywords?
+                 (create-hierarchical-facets aggregations)
+                 (create-flat-facets aggregations))]
+    (assoc query-results :facets facets)))
+
+(defn- key-with-prefix
   [prefix k]
   (if prefix
     (symbol (str prefix ":" (name k)))
     k))

-(defn facet->xml-element
-  [ns-prefix facet]
-  (let [{:keys [field value-counts value-count-maps facets]} facet
-        with-prefix (partial key-with-prefix ns-prefix)]
-    (println "****** CDD: Facet is" facet)
-    (x/element (with-prefix :facet) {:field (name field)}
-               (cond value-count-maps
-                     (do
-                       (println "CDD : value-count-maps are:" value-count-maps)
-                       (for [value-count-map value-count-maps
-                         :let [xml-element (x/element (with-prefix :value-count-maps) {}
-                                                      (x/element (with-prefix :value) {:count (:count value-count-map)} (:value value-count-map)))]]
-                         (do
-                           (println "CDD: XML element is:" xml-element)
-                           (when-let [facets (:facets value-count-map)]
-                             (println "*** CDD: facets are:" facets)
-                             ; (cmr.common.dev.capture-reveal/capture facets)
-                             (let [child-facets (x/element (key-with-prefix ns-prefix :facets) {} (facet->xml-element ns-prefix facets))]
-                               ; (cmr.common.dev.capture-reveal/capture-all)
-                               (x/element (with-prefix :value-count-maps) {}
-                                                      [(x/element (with-prefix :value) {:count (:count value-count-map)} (:value value-count-map))
-                                                      child-facets]))))))
-                       facets
-                       (x/element (key-with-prefix ns-prefix :facets) {} (facet->xml-element ns-prefix facets))
-                       :else
-                       (for [[value value-count] value-counts]
-                         (x/element (with-prefix :value) {:count value-count} value))))))
-
-
-  (defn facets->xml-element
-    "Helper function for converting a facet result into an XML element"
-    ([facets]
-     (facets->xml-element nil facets))
-    ([ns-prefix facets]
-     (when facets
-       (x/element (key-with-prefix ns-prefix :facets) {}
-                  (map (partial facet->xml-element ns-prefix) facets)))))
-
-  (def cmr-facet-name->echo-facet-keyword
-    "A mapping of CMR facet names to ECHO facet keywords"
-    {"archive_center" :archive-center
-     "project" :campaign-sn
-     "platform" :platform-sn
-     "instrument" :instrument-sn
-     "sensor" :sensor-sn
-     "two_d_coordinate_system_name" :twod-coord-name
-     "processing_level_id" :processing-level
-     "category" :category-keyword
-     "topic" :topic-keyword
-     "term" :term-keyword
-     "variable_level_1" :variable-level-1-keyword
-     "variable_level_2" :variable-level-2-keyword
-     "variable_level_3" :variable-level-3-keyword
-     "detailed_variable" :detailed-variable-keyword
-     "science_keywords" :science-keywords})
-
-  (defn facet->echo-xml-element
-    [facet]
-    (let [{:keys [field value-counts]} facet
-          field-key (cmr-facet-name->echo-facet-keyword field)]
-      (x/element field-key {:type "array"}
-                 (for [[value value-count] value-counts]
-                   (x/element field-key {}
-                              (x/element :term {} value)
-                              (x/element :count {:type "integer"} value-count))))))
-
-  (defn facets->echo-xml-element
-    "Helper function for converting facets into an XML element in echo format"
-    [facets]
-    (when facets
-      (x/element :hash {}
-                 (map facet->echo-xml-element facets))))
-
-  (defn- value-count->echo-json
-    "Returns value count in echo json format"
-    [value-count]
-    (let [[value value-count] value-count]
-      {:count value-count
-       :term value}))
-
-  (defn facet->echo-json
-    [facet]
-    (let [{:keys [field value-counts]} facet
-          field-key (csk/->snake_case_string (cmr-facet-name->echo-facet-keyword field))]
-      [field-key (map value-count->echo-json value-counts)]))
-
-  (defn facets->echo-json
-    "Helper function for converting facets into an XML element in echo format"
-    [facets]
-    (when facets
-      (into {} (map facet->echo-json facets))))
-
+(defn- value-count-maps->xml-element
+  "Converts a list of value-count-maps into an XML element."
+  [ns-prefix with-prefix value-count-maps]
+  (for [value-count-map value-count-maps
+        :let [xml-element (x/element (with-prefix :value-count-maps) {}
+                                     (x/element (with-prefix :value) {:count (:count value-count-map)} (:value value-count-map)))]]
+    (do
+      (when-let [facets (:facets value-count-map)]
+        (let [child-facets (x/element (key-with-prefix ns-prefix :facets) {} (facet->xml-element ns-prefix facets))]
+          (x/element (with-prefix :value-count-maps) {}
+                     [(x/element (with-prefix :value) {:count (:count value-count-map)} (:value value-count-map))
+                      child-facets]))))))
+
+(defn- facet->xml-element
+  [ns-prefix {:keys [field value-counts value-count-maps facets]}]
+  (let [with-prefix (partial key-with-prefix ns-prefix)
+        xml-element-content
+        (cond value-count-maps (value-count-maps->xml-element ns-prefix with-prefix value-count-maps)
+              facets (x/element (key-with-prefix ns-prefix :facets) {}
+                                (facet->xml-element ns-prefix facets))
+              :else
+              (for [[value value-count] value-counts]
+                (x/element (with-prefix :value) {:count value-count} value)))]
+    (x/element (with-prefix :facet) {:field (name field)} xml-element-content)))
+
+
+(defn facets->xml-element
+  "Helper function for converting a facet result into an XML element"
+  ([facets]
+   (facets->xml-element nil facets))
+  ([ns-prefix facets]
+   (when facets
+     (x/element (key-with-prefix ns-prefix :facets) {}
+                (map (partial facet->xml-element ns-prefix) facets)))))
+
+(def cmr-facet-name->echo-facet-keyword
+  "A mapping of CMR facet names to ECHO facet keywords"
+  {"archive_center" :archive-center
+   "project" :campaign-sn
+   "platform" :platform-sn
+   "instrument" :instrument-sn
+   "sensor" :sensor-sn
+   "two_d_coordinate_system_name" :twod-coord-name
+   "processing_level_id" :processing-level
+   "category" :category-keyword
+   "topic" :topic-keyword
+   "term" :term-keyword
+   "variable_level_1" :variable-level-1-keyword
+   "variable_level_2" :variable-level-2-keyword
+   "variable_level_3" :variable-level-3-keyword
+   "detailed_variable" :detailed-variable-keyword
+   "science_keywords" :science-keywords})
+
+(defn- facet->echo-xml-element
+  [facet]
+  (let [{:keys [field value-counts]} facet
+        field-key (cmr-facet-name->echo-facet-keyword field)]
+    (x/element field-key {:type "array"}
+               (for [[value value-count] value-counts]
+                 (x/element field-key {}
+                            (x/element :term {} value)
+                            (x/element :count {:type "integer"} value-count))))))
+
+(defn facets->echo-xml-element
+  "Helper function for converting facets into an XML element in echo format"
+  [facets]
+  (when facets
+    (x/element :hash {}
+               (map facet->echo-xml-element facets))))
+
+(defn value-count->echo-json
+  "Returns value count in echo json format"
+  [value-count]
+  (let [[value value-count] value-count]
+    {:count value-count
+     :term value}))
+
+(defn- facet->echo-json
+  [facet]
+  (let [{:keys [field value-counts]} facet
+        field-key (csk/->snake_case_string (cmr-facet-name->echo-facet-keyword field))]
+    [field-key (map value-count->echo-json value-counts)]))
+
+(defn facets->echo-json
+  "Helper function for converting facets into an XML element in echo format"
+  [facets]
+  (when facets
+    (into {} (map facet->echo-json facets))))
+


Add additional reserved board slugs.

Add additional reserved board slugs.

--- src/oc/storage/resources/board.clj
+++ src/oc/storage/resources/board.clj
@@ -37,7 +37,7 @@

 ;; ----- Board Slug -----

-(def reserved-slugs #{"create-board"})
+(def reserved-slugs #{"create-board" "settings" "boards" "updates"})

 (declare list-boards-by-org)
 (defn taken-slugs


remove old comment

remove old comment

--- src/gangway/util.clj
+++ src/gangway/util.clj
@@ -2,27 +2,6 @@
   (:require [immutant.messaging :as msg]
             [gangway.worker]
             [gangway.disembark]))
-
-;; TODO: Figure out how to support incoming and outgoing queues with
-;; the same key in a reasonable way.
-;; Before this question can be answered, must figure out how outgoing
-;; queues would be presented via REST.
-
-#_
-(def queues-v2
-  [{:name "showevidence"
-    :in-fn blah
-    :out-fn blah}
-   {:name "genius"
-    :in-fn g-blah}])
-
-#_
-(def queues
-  {:showevidence {:name "queue.showevidence-in"
-                  ;; having a :worker-fn implies that galleon should start a listener
-                  :worker-fn gangway.worker/do-work}
-   :genius {:name "queue.genius-in"
-            :worker-fn gangway.worker/do-work}})

 (defn start-queue! [system {n :name worker :worker}]
   (msg/start n)
@@ -37,7 +16,7 @@

 ;; TODO: handle exceptions
 (defn start-queues! [system]
-  (let [qids (get-in system [:flare :queues])
+  (let [qids (get-in system [:flare :attaches])
         queues (reduce (fn start-queues!- [c v]
                          (assoc c v (queue-definitions v)))
                        {} qids)


indentation

indentation

--- src/gce/provider.clj
+++ src/gce/provider.clj
@@ -17,8 +17,7 @@
     (com.google.api.client.json.jackson2 JacksonFactory)
     (com.google.api.client.googleapis.auth.oauth2 GoogleCredential)
     (com.google.api.services.compute Compute$Builder ComputeScopes)
-    )
- )
+    ))

 (timbre/refer-timbre)


Support aliases

Support aliases

--- test-cljs/frontend/test_send.cljs
+++ test-cljs/frontend/test_send.cljs
@@ -298,26 +298,21 @@

 (defn resolve* [context mapping children]
-  (p/map (fn [[& vals]]
-           (into {}
-                 (map #(vector (:key %1) %2)
-                      children vals)))
-         (p/all (map (fn [ast]
-                       (let [result-promise
-                             (fn [resolver]
-                               (let [result (resolver context ast)]
-                                 (if (p/promise? result)
-                                   result
-                                   (p/promise result))))]
-                         (if (contains? mapping (:key ast))
-                           (let [resolver (get mapping (:key ast))]
-                             (result-promise resolver))
-
-                           (if-let [[keys resolver]
-                                    (first (filter #(contains? (key %) (:key ast)) mapping))]
-                             (p/map #(get % (:key ast)) (result-promise resolver))
-                             (throw "Unknown key")))))
-                     children))))
+  (p/alet [values
+           (p/await
+            (p/all
+             (for [ast children
+                   :let [read-from-key (get-in ast [:params :<] (:key ast))]]
+               (if (contains? mapping read-from-key)
+                 (let [resolver (get mapping read-from-key)]
+                   (resolver context ast))
+                 (if-let [[keys resolver]
+                          (first (filter #(contains? (key %) read-from-key) mapping))]
+                   (p/then (resolver context ast) #(get % read-from-key))
+                   (throw "Unknown key"))))))]
+    (into {}
+          (map #(vector (:key %1) %2)
+               children values))))

 (defn resolve [context root-mapping query]
@@ -331,21 +326,18 @@

    #{:user/favorite-color :user/favorite-number}
    (fn [context ast]
-     (let [get-user (get-in context [:apis :get-user])]
-       (p/map
-        #(set/rename-keys % {:favorite-color :user/favorite-color
-                             :favorite-number :user/favorite-number})
-        (get-user {:name (:user/name context)}))))
+     (p/alet [get-user (get-in context [:apis :get-user])
+              user (p/await (get-user {:name (:user/name context)}))]
+       (set/rename-keys user {:favorite-color :user/favorite-color
+                              :favorite-number :user/favorite-number})))

    :user/favorite-fellow-user
    (fn [context ast]
-     (let [get-user (get-in context [:apis :get-user])
-           user-promise (get-user {:name (:user/name context)})]
-       (p/then user-promise
-               (fn [user]
-                 (resolve* (assoc context :user/name (:favorite-fellow-user-name user))
-                           User
-                           (:children ast))))))})
+     (p/alet [get-user (get-in context [:apis :get-user])
+              user (p/await (get-user {:name (:user/name context)}))]
+       (resolve* (assoc context :user/name (:favorite-fellow-user-name user))
+                 User
+                 (:children ast))))})

 (def Root
@@ -374,7 +366,10 @@
                               :user/favorite-number
                               {:user/favorite-fellow-user [:user/name
                                                            :user/favorite-color
-                                                           :user/favorite-number]}]}])]
+                                                           :user/favorite-number]}]}
+                            {(:jamie {:< :root/user :user/name "jburnford"})
+                             [:user/name
+                              :user/favorite-color]}])]
       (p/then
        p
        (fn [v]
@@ -383,7 +378,9 @@
                              :user/favorite-number 42
                              :user/favorite-fellow-user {:user/name "jburnford"
                                                          :user/favorite-color :color/red
-                                                         :user/favorite-number 7}}}
+                                                         :user/favorite-number 7}}
+                 :jamie {:user/name "jburnford"
+                         :user/favorite-color :color/red}}
                 v))
          (is (= [[:get-user {:name "nipponfarm"}]
                  [:get-user {:name "jburnford"}]]


Problem 0103.clj.

Problem 0103.clj.

--- src/project_euler/problem_0103.clj
+++ src/project_euler/problem_0103.clj
@@ -52,7 +52,7 @@

 (defn search-optimum [xs]
   (let [cnt (count xs)]
-    (->> (combo/selections [-3 -2 -1 0 1 2 3] cnt)
+    (->> (combo/selections [-3 -2 -1 0 1] cnt)
          (filter (fn [ds] (< (reduce + ds) 0)))
          (map (fn [ds] (map + xs ds)))
          (filter #(apply distinct? %))
@@ -63,6 +63,10 @@
          )))

 (defn solution []
-  (->> (next-near-optimum-set [11 18 19 20 22 25])
-       (search-optimum)
-       ))
+  (or (->> (next-near-optimum-set [11 18 19 20 22 25])
+          (search-optimum)
+          (seq)
+          )
+      (next-near-optimum-set [11 18 19 20 22 25])))
+
+;;-> 20 31 38 39 40 42 45


Added four more def test

Added four more def test

--- test/clj_flotr/generator_test.clj
+++ test/clj_flotr/generator_test.clj
@@ -38,6 +38,22 @@
     (testing "Test if bool->string function exists"
         (is (function? bool->string))))

+(deftest test-data-series-for-pie-chart-existence
+    (testing "Test if data-series-for-pie-chart function exists"
+        (is (function? data-series-for-pie-chart))))
+
+(deftest test-vals->js-existence
+    (testing "Test if vals->js function exists"
+        (is (function? vals->js))))
+
+(deftest test-data-series-for-line-chart-existence
+    (testing "Test if data-series-for-line-chart function exists"
+        (is (function? data-series-for-line-chart))))
+
+(deftest test-data-series-for-stacked-bars-existence
+    (testing "Test if data-series-for-stacked-bars function exists"
+        (is (function? data-series-for-stacked-bars))))
+
 ;
 ; Unit tests
 ;


Test for the function data-series-for-pie-chart

--- test/clj_flotr/generator_test.clj
+++ test/clj_flotr/generator_test.clj
@@ -158,3 +158,9 @@
             (data-series-for-line-chart nil) '()
             (data-series-for-line-chart [])  '())))

+(deftest test-data-series-for-stacked-bars-1
+    (testing "Test the function data-series-for-stacked-bars"
+        (are [x y] (= x y)
+            (data-series-for-stacked-bars nil) '()
+            (data-series-for-stacked-bars [])  '())))
+


adding missing test

adding missing test

--- test/desdemona/ui/server_test.clj
+++ test/desdemona/ui/server_test.clj
@@ -2,6 +2,10 @@
   (:require [clojure.test :refer [deftest is]]
             [desdemona.ui.server :as s]
             [ring.mock.request :refer [request]]))
+
+(deftest page-test
+  (is (= s/page
+         "<!DOCTYPE html>\n<title>Desdemona</title><meta charset=\"utf-8\"><meta content=\"width=device-width, initial-scale=1\" name=\"viewport\"><link href=\"/css/main.css\" rel=\"stylesheet\" type=\"text/css\">

")))

 (deftest handler-test
   (let [response (s/handler (request :get "/"))


rework recalculate-account-item

rework recalculate-account-item

--- src/clj_money/models/transactions.clj
+++ src/clj_money/models/transactions.clj
@@ -521,13 +521,15 @@
                   storage
                   (assoc item
                          :index new-index
-                         :balance new-balance))
-        updated (assoc context
-                       :last-index new-index
-                       :last-balance new-balance)]
-    (if changed ; if the index and balance didn't change, we can short circuit the update
-      updated
-      (reduced (dissoc updated :last-balance)))))
+                         :balance new-balance))]
+    ; if the index and balance didn't change, we can short circuit the update
+    (if changed
+      (assoc context
+             :last-index new-index
+             :last-balance new-balance)
+      (-> context
+          (dissoc :last-balance)
+          reduced))))

 (defn- recalculate-account-items
   "Accepts a tuple containing an account-id and a base item,


Preserve open in new tab on middle click, cmd-click, or ctrl-click on autocomplete results. Fixes #89.

--- src/cljs/clojuredocs/mods/search.cljs
+++ src/cljs/clojuredocs/mods/search.cljs
@@ -50,7 +50,13 @@
   [:div.ac-entry
    [:span.ac-type type " / " examples-count " ex"  #_[:br] #_(util/pluralize examples-count "Example" "Examples")]
    [:h4
-    [:a {:href href} name " (" ns ")"]]
+    [:a {:href href
+         :on-click #(do
+                      (when (or (.-ctrlKey %)
+                                (.-metaKey %)
+                                (= 1 (.-button %))) ; middle click
+                        (.stopPropagation %)))}
+     name " (" ns ")"]]
    [:p (ellipsis 100 doc)]
    ($ac-see-alsos see-alsos)])


WIP: add a function for set the client in a fatal state.

--- src/igorle/core.cljs
+++ src/igorle/core.cljs
@@ -135,6 +135,27 @@
   [frame]
   (not (nil? (get-in frame :headers :id))))

+(defn debug-mode?
+  "Return true if a client is set into a debug mode."
+  [client]
+  (get-in client [:options :debug] false))
+
+(defn- fatal-state!
+  "Set a client in fatal state.
+
+  This can hapens in client initialization, initial handshake
+  and other similar situations where the user can't take any
+  action.  This closes the socket and set a client into no
+  usable state."
+  [client data]
+  (let [sock (:socket client)
+        input (:input client)
+        output (:output client)]
+    (.close sock)
+    (a/put! input {:type :client/error :payload data})
+    (a/close! input)
+    (a/close! output)))
+
 (defn client
   "Creates a new client instance from socket."
   ([uri]
@@ -147,6 +168,7 @@
          msgbus (a/chan)
          msgbuspub (a/pub msgbus :command)
          open (volatile! false)
+         options (merge *default-config* options)
          client (map->Client {:socket socket
                               :options options
                               :open open


Test the defdispatch dispatcher function

--- test/useful/experimental_test.clj
+++ test/useful/experimental_test.clj
@@ -15,6 +15,10 @@
              even true  false]
       (is (= even (even? a)))
       (is (= odd  (odd?  a))))))
+
+(deftest test-dispatcher-fn
+  (let [dispatch (dispatcher (fn [f & args] (symbol "clojure.core" f)))]
+    (is (= "str5" (dispatch "str" 5)))))

 (deftest test-dispatch
   (testing "simple dispatch"


Properly close connection on initialize transactor implementation.

--- src/continuo/postgresql/bootstrap.clj
+++ src/continuo/postgresql/bootstrap.clj
@@ -62,15 +62,15 @@

 (defn initialize
   [tx]
-  (let [conn (impl/-get-connection tx)
-        schema (impl/-get-schema tx)]
-    (letfn [(on-error [e]
-              (if (instance? org.postgresql.util.PSQLException e)
-                (throw (ex-info "Database not initialized."
-                                {:type :error/db-not-initialized}))
-                (throw e)))
-            (do-initialize []
-              (schema/refresh-schema-data! tx)
-              tx)]
-      (-> (exec/submit do-initialize)
-          (p/catch on-error)))))
+  (with-open [conn (impl/-get-connection tx)]
+    (let [schema (impl/-get-schema tx)]
+      (letfn [(on-error [e]
+                (if (instance? org.postgresql.util.PSQLException e)
+                  (throw (ex-info "Database not initialized."
+                                  {:type :error/db-not-initialized}))
+                  (throw e)))
+              (do-initialize []
+                (schema/refresh-schema-data! tx)
+                tx)]
+        (-> (exec/submit do-initialize)
+            (p/catch on-error))))))


simplify git-checkout

simplify git-checkout

--- src/lambdacd/git.clj
+++ src/lambdacd/git.clj
@@ -46,7 +46,6 @@
       (json/read-str (slurp git-state-file))
       {})))

-
 (defn- last-seen-revision-for [ctx repo-uri branch]
   (let [git-state-data (read-git-state ctx)
         last-seen-revision (get (get (get git-state-data "last-seen") repo-uri) branch)]
@@ -72,30 +71,23 @@
       (persist-last-seen-revision ctx repo-uri branch current-revision)
       wait-for-result)))

-
-(defn- checkout-step [ctx repo-uri revision]
-    (let [cwd (util/create-temp-dir)
-          sh-result (shell/bash ctx cwd
-                               (str "echo \"Cloning " revision " of " repo-uri "\"")
-                               (str "git clone " repo-uri )
-                               "cd $(ls)"
-                               (str "git checkout " revision))]
-      (assoc sh-result :cwd cwd)))
-
-(defn- async-checkout [ctx repo-uri revision]
-  (let [output (checkout-step ctx repo-uri revision)
-        git-tmp-dir (:cwd output)
-        content-of-git-tmp-dir (first (.list (File. git-tmp-dir)))
-        checkout-folder-name (str git-tmp-dir "/" content-of-git-tmp-dir)]
-    (assoc output :cwd checkout-folder-name)))
-
+(defn- checkout [ctx repo-uri revision]
+  (let [base-dir (util/create-temp-dir)
+        sh-result (shell/bash ctx base-dir
+                              (str "echo \"Cloning " revision " of " repo-uri "\"")
+                              (str "git clone " repo-uri )
+                              "cd $(ls)"
+                              (str "git checkout " revision))
+        content-of-git-tmp-dir (first (.list (File. base-dir)))
+        checkout-folder-name (str base-dir "/" content-of-git-tmp-dir)]
+    (assoc sh-result :cwd checkout-folder-name)))

 (defn with-git
   "creates a container-step that checks out a given revision from a repository.
    the revision number is passed on as the :revision value in the arguments-map"
   [repo-uri steps]
   (fn [args ctx]
-    (let [checkout-result (async-checkout ctx repo-uri (:revision args))  ;; TODO: wouldn't it be better to pass in the revision?
+    (let [checkout-result (checkout ctx repo-uri (:revision args))  ;; TODO: wouldn't it be better to pass in the revision?
           repo-location (:cwd checkout-result)
           checkout-exit-code (:exit checkout-result)]
       (if (= 0 checkout-exit-code)


Removed extra space that was breaking (browser-repl)

--- src/leiningen/new/chestnut/env/dev/clj/chestnut/dev.clj
+++ src/leiningen/new/chestnut/env/dev/clj/chestnut/dev.clj
@@ -17,7 +17,7 @@
 (defn browser-repl []
   (let [repl-env (weasel/repl-env :ip "0.0.0.0" :port 9001)]
     (piggieback/cljs-repl :repl-env repl-env)
-    (piggieback/cljs-eval repl-env '(in-ns '{{project-ns}} .core) {})))
+    (piggieback/cljs-eval repl-env '(in-ns '{{project-ns}}.core) {})))

 (defn start-figwheel []
   (future


Return name of Subject, instead of it's index

--- src/fp_contest_solution_tree/core.clj
+++ src/fp_contest_solution_tree/core.clj
@@ -5,6 +5,8 @@
             [clojure.pprint :refer [pprint print-table]]))

 (def undefined "—")
+
+(def beetles-names ["Ауата сетуньская" "Десятилиньята лепая" "Семипунктата Коха" "Популий грыжомельский" "Гортикола филопетьевая"])

 (def beetles-matrix  [["Наличие бомбурий",         ["Да",      "Да",        "Нет",       "Да",    "Нет"]],
                       ["Количество клептиконов",   ["1",       "1",         "0",         "3",     "5"]],
@@ -90,7 +92,7 @@
         chosen-subtree (get-subtree tree chosen-option)]
     (if-let [children (:children chosen-subtree)]
       (find-out children)
-      (:alternatives chosen-subtree))))
+      (map #(get beetles-names %) (:alternatives chosen-subtree)))))

 ;; (find-out (solve-tree beetles-matrix))


almost working - without last test case

almost working - without last test case

--- src/4clojure/pascal_trapezoid.clj
+++ src/4clojure/pascal_trapezoid.clj
@@ -14,7 +14,7 @@

 (defn nex [coll]
   (concat [(first coll)]
-          (map-indexed #(+ %2 (if (>= (inc %1) (count coll)) 0 (nth coll (inc %1)))) coll)))
+          (map-indexed #(+ %2 (if (>= (inc' %1) (count coll)) 0 (nth coll (inc' %1)))) coll)))

 (nex [1 2 3])
 (nex [1 3 3 1])
@@ -22,11 +22,31 @@
 (defn red [a b]
   (conj a b))

-(defn __
-  ([] [])
-  ([coll] (lazy-seq (conj coll (vec (concat [(first coll)]
-                            (map-indexed #(+ %2 (if (>= (inc %1) (count coll)) 0 (nth coll (inc %1)))) coll)))))))
+;; (defn __
+;;   ([] [])
+;;   ([coll]
+;;    (lazy-seq
+;;      (conj [coll]
+;;            (concat [(first coll)]
+;;            (__ (map-indexed #(+ %2 (if (>= (inc %1) (count coll)) 0 (nth coll (inc %1)))) coll)))))))

+;; (defn __ [coll]
+;;    (lazy-seq
+;;      (conj [coll]
+;;            (__ (concat [(first coll)]
+;;                        (map-indexed #(+ %2 (if (>= (inc' %1) (count coll)) 0 (nth coll (inc' %1))))
+;;                                     coll))))))
+
+
+(defn __ [coll]
+   (lazy-seq (cons coll (__ (nex coll)))))
+
+
+(defn positive-numbers
+	([] (positive-numbers 1))
+	([n] (lazy-seq (cons n (positive-numbers (inc n))))))
+
+(positive-numbers)

 (= (second (__ [2 3 2])) [2 5 5 2])

@@ -34,4 +54,4 @@

 (= (take 2 (__ [3 1 2])) [[3 1 2] [3 4 3 2]])

-(= (take 100 (__ [2 4 2])) (rest (take 101 (__ [2 2]))))+(= (take 100 (__ [2 4 2])) (rest (take 101 (__ [2 2]))))


Better documentation in lazytest.clj source

--- src/main/clojure/com/stuartsierra/lazytest.clj
+++ src/main/clojure/com/stuartsierra/lazytest.clj
@@ -15,20 +15,25 @@

 (ns #^{:doc "Lazy Testing Framework"
        :author "Stuart Sierra"}
-  com.stuartsierra.lazytest)
+  com.stuartsierra.lazytest
+  (:require clojure.stacktrace))

 ;;; PROTOCOLS

+;; Generic reporting function for any Test/Assertion Result
 (defprotocol TestSuccess
   (success? [r] "Returns true if r is a 100% successful result."))

+;; Generic entry-point for running tests.
 (defprotocol Testable
   (run-tests [x] "Runs tests defined for the Namespace, Var, or TestCase."))

+;; Internal generic Test/Assertion invocation.
 (defprotocol TestInvokable
   (invoke-test [t states strategy active]
                "(private) Executes the TestCase or Assertion."))

+;; Fn is assumed to be a compiled Assertion
 (extend-class clojure.lang.Fn TestInvokable
               (invoke-test [f states strategy active] (apply f states)))

@@ -36,8 +41,19 @@

 (declare run-test-case compile-assertion)

+;; Context sets up state for TestCases that depend on it.  parents is
+;; a vector of parent Contexts.  before and after are functions.
+;; before takes the same number of arguments as there are parent
+;; Contexts.  after takes the same arguments, plus an additional first
+;; argument, which is the state returned by the before function.
 (deftype Context [parents before after])

+;; TestCase represents either a "test", which associates Contexts
+;; and Assertions, or a "test suite", which is a collection of tests.
+;;
+;; contexts is a vector of Contexts.  children is a vector of
+;; Assertions (optionally compiled into Fns) or a vector of other
+;; TestCases.
 (deftype TestCase [contexts children] :as this
   clojure.lang.IFn
   (invoke [] (run-test-case this))
@@ -46,24 +62,40 @@
   TestInvokable (invoke-test [states strategy active]
                              (run-test-case this strategy active)))

+;; Assertion is like a function.  locals is a vector of (quoted)
+;; symbols.  form is a (quoted) expression using those symbols,
+;; returning logical true or false.  When compiled, an Assertion
+;; becomes a function like (fn [locals] form).
 (deftype Assertion [locals form] :as this
   TestInvokable
   (invoke-test [states strategy active]
                (invoke-test (compile-assertion this)
                             states strategy active)))

+;; TestResult represents the result of executing a TestCase.  source
+;; is the TestCase.  children is a sequence of results from child
+;; TestCases or Assertions.
 (deftype TestResult [source children]
   TestSuccess (success? [] (every? success? children)))

+;; TestThrown represents that a TestCase threw an exception somewhere
+;; NOT in an Assertion, such as during setup or in a Context function.
+;; source is the TestCase, error is the java.lang.Throwable.
 (deftype TestThrown [source error]
   TestSuccess (success? [] false))
-
+
+;; AssertionPassed is returned by an Assertion whose expression
+;; evaluates logical true.
 (deftype AssertionPassed [source]
   TestSuccess (success? [] true))
-
+
+;; AssertionFailed is returned by an Assertion whose expression
+;; evaluates logical false without throwing an exception.
 (deftype AssertionFailed [source]
   TestSuccess (success? [] false))
-
+
+;; AssertionThrown is returned by an Assertion whose expression threw
+;; an exception.  error is the java.lang.Throwable.
 (deftype AssertionThrown [source error]
   TestSuccess (success? [] false))

@@ -81,10 +113,14 @@
             (catch Throwable t#
               (AssertionThrown '~form t#))))))

-(defn compile-assertion [a]
+(defn compile-assertion
+  "Compiles an Assertion a into a function of its locals."
+  [a]
   (eval (format-assertion a)))

-(defmacro assertion [locals & body]
+(defmacro assertion
+  "Returns a compiled Assertion function like (fn [locals] body)."
+  [locals & body]
   (format-assertion (Assertion locals (if (= 1 (count body))
                                         (first body) `(do ~@body)))))

@@ -129,7 +165,8 @@

 (defmacro defcontext
   "Defines a context.
-  decl => docstring? [bindings*] before-body* (:after [state] after-body*)?"
+  decl => docstring? [bindings*] before-body* after-fn?
+  after-fn => :after [state] after-body*"
   [name & decl]
   (let [m {:name name, :ns *ns*}
         m (if (string? (first decl)) (assoc m :doc (first decl)) m)
@@ -169,7 +206,9 @@
   "Truly lazy test execution strategy; uses (unchunked) map1."
   [map1 lazy-strategy])

-(defn parallel-strategy []
+(defn parallel-strategy
+  "Parallel execution strategy; uses pmap."
+  []
   [pmap parallel-strategy])

 (defn parallel-upto
@@ -191,8 +230,8 @@

 (defn run-test-case
   "Executes a test case in context.  active is the map of currently
-  active Contexts.  strategy is a function that determines how tests
-  are executed."
+  active Contexts, empty by default.  strategy is a function that
+  determines how tests are executed, default-strategy by default."
   ([t] (run-test-case t default-strategy))
   ([t strategy] (run-test-case t strategy {}))
   ([t strategy active]
@@ -267,8 +306,6 @@
   [r]
   (tree-seq :children :children r))

-(require 'clojure.stacktrace)
-
 (defn result-identifier [r]
   (let [m (meta (:source r))]
     (or (:name m) (:form m)


Add spec? and find-spec

Add spec? and find-spec

--- src/main/clojure/com/stuartsierra/lazytest.clj
+++ src/main/clojure/com/stuartsierra/lazytest.clj
@@ -332,3 +332,47 @@
          ~(when (:name m) `(intern *ns* '~(:name m) ~sym))
          ~sym))))

+(defn spec?
+  "Returns true if x is a spec, meaning it satisfies the TestInvokable
+  protocol."
+  [x] (satisfies? TestInvokable x))
+
+(defn find-spec
+  "Finds and returns a spec object for a namespace, var, collection,
+  or symbol.  If x is a symbol, attempts to reload the namespace named
+  by the symbol."
+  [x]
+  (cond (coll? x)
+        (let [xs (filter identity (map find-spec x))]
+          (if (seq xs)
+            (SimpleContainer (vec xs)
+                             {:doc "Generated from collection by find-spec."
+                              :generator `find-spec}
+                             nil)))
+
+        (instance? clojure.lang.Namespace x)
+        (if-let [t (:spec (meta x))]
+          (find-spec t)
+          (find-spec (vals (ns-interns x))))
+
+        (var? x)
+        (let [m (meta x)]
+          (if-let [t (:spec m)]
+            (find-spec t)
+            (if-let [t (:test m)]
+              (SimpleAssertion t {:doc "Generated from :test function by find-spec."
+                                  :generator `find-spec
+                                  :name (:name m)
+                                  :ns (:ns m)
+                                  :file (:file m)
+                                  :line (:line m)}
+                               nil)
+              (let [v (var-get x)]
+                (when (spec? v) v)))))
+
+        (symbol? x)
+        (find-spec (find-ns x))
+
+        (spec? x) x
+
+        :else nil))


proper wording for role descriptions

proper wording for role descriptions

--- src/cljs/conference_rating/conference_detail_page/conference_detail_page.cljs
+++ src/cljs/conference_rating/conference_detail_page/conference_detail_page.cljs
@@ -1,6 +1,6 @@
 (ns conference-rating.conference-detail-page.conference-detail-page
   (:require [reagent.core :as reagent :refer [atom]]
-            [conference-rating.view-utils.header :as header]
+            [conference-rating.view-utils.navbar :as navbar]
             [conference-rating.conference-detail-page.rating-list :as rating-list]
             [conference-rating.conference-detail-page.conference-information :as conference-information]
             [conference-rating.conference-detail-page.aggregated-ratings :as aggregated-ratings]
@@ -12,7 +12,7 @@

 (defn display-conference-detail-page [conference ratings]
   [:div
-   (header/nav-bar)
+   (navbar/nav-bar)
    [:div {:class "container-fluid content-container pad-top conference-container"}
     [:div {:class "row"}
      [:div {:class "col-lg-1 col-md-1"}]


Accept messages that have extra extensions you don't know

--- src/mavlink/core.clj
+++ src/mavlink/core.clj
@@ -719,18 +719,15 @@
     (let [low-byte (byte-to-long (new Long (.get buffer 7)))
           middle-byte (byte-to-long (new Long (.get buffer 8)))
           high-byte (byte-to-long (new Long (.get buffer 9)))
-          {:keys [messages-by-id]} mavlink
           msg-id (+ (bit-and (bit-shift-left high-byte 16) 0xff0000)
                     (bit-and (bit-shift-left middle-byte 8) 0xff00)
                     (bit-and low-byte 0xff))
-          message-info (get messages-by-id msg-id)
-          msg-payload-size (byte-to-long (new Long (.get buffer 1)))]
+          message-info (get (:messages-by-id mavlink) msg-id)]
       ; select and then return function to execute the next state
-      (if (and message-info
-               (<= msg-payload-size (:extension-payload-size message-info)))
+      (if message-info
         #(mavlink2-payload-state channel
                                  buffer
-                                 msg-payload-size
+                                 (byte-to-long (new Long (.get buffer 1)))
                                  input-stream
                                  output-channel
                                  {:message'id (:msg-key message-info)


Add metrics lifecycles to schema.

Add metrics lifecycles to schema.

--- src/onyx/schema.cljc
+++ src/onyx/schema.cljc
@@ -648,6 +648,7 @@
    (s/optional-key :onyx.messaging/external-addr) s/Str
    (s/optional-key :onyx.peer/subscriber-liveness-timeout-ms) PosInt
    (s/optional-key :onyx.peer/storage) Storage
+   (s/optional-key :onyx.peer.metrics/lifecycles) [s/Keyword]
    (s/optional-key :onyx.peer/storage.timeout) s/Int
    (s/optional-key :onyx.peer/storage.s3.auth-type) (s/enum :provider-chain :config)
    (s/optional-key :onyx.peer/storage.s3.auth.access-key) s/Str


test with ubuntu_large DB

test with ubuntu_large DB

--- src/pg_demo/core.clj
+++ src/pg_demo/core.clj
@@ -15,24 +15,21 @@

 (def large-db true)

-(if large-db
-  (def ora-spec
-    { :classname    "oracle.jdbc.OracleDriver"  ; must be in classpath
-      :subprotocol  "oracle"
-      :subname      "thin:@//10.100.6.231:1521/pvram"
-      :user         "mart_user_bkp"
-      :password     "rxlogix" } )
-  (def ora-spec
-    { :classname    "oracle.jdbc.OracleDriver"  ; must be in classpath
-      :subprotocol  "oracle"
-      :subname      "thin:@//10.100.6.231:1521/pvram"
-      :user         "mart_user"
-      :password     "rxlogix" } ))
+(def ora-spec
+  { :classname    "oracle.jdbc.OracleDriver"  ; must be in classpath
+    :subprotocol  "oracle"
+    :subname      "thin:@//10.100.6.231:1521/pvram"
+    :user         (if large-db  "mart_user_bkp"
+                                "mart_user" )
+    :password     "rxlogix"
+  } )

 (def pg-spec
   { :classname    "org.postgresql.Driver"
     :subprotocol  "postgresql"
-    :subname      "//localhost:5432/ubuntu_large" } )
+    :subname      (if large-db  "//localhost:5432/ubuntu_large"
+                                "//localhost:5432/ubuntu" )
+  } )

 (def insert-chunk-size 1000)


Better way of mapping automaton values to note durations; use separate automata for rhythm and pitch

--- src/pianola/core.clj
+++ src/pianola/core.clj
@@ -28,38 +28,39 @@
        (nth aut avg)))
    cur-gen))

-(def automaton [1 2 0 4 5 6 3])
+(def rhythm-automaton [2 0 1 3 5 4 6])
+(def note-automaton [1 2 0 4 5 6 3])

-(def rhythm [4 8 4 8 2 4 4 4])
+(def rhythm [2 3 2 3 1 2 2 2])
 (def notes [2 1 2 1 2 3 4 5])

-(def run-automaton (partial next-gen automaton))
+(def automate-notes (partial next-gen note-automaton))
+(def automate-rhythm (partial next-gen rhythm-automaton))

 (defn scale-rhythm [note]
-  (if (= 0 note)
-          0
-          (/ 1 note)))
+  (/ 1 (bit-shift-left 1 note)))

 (next-gen notes)

-(run-automaton [1 1 1 1 1 4 4 4])
+(automate-notes [1 1 1 1 1 4 4 4])

 (automate-rhythm [1 1 1 1 1 4 4 4])

-(automate-rhythm rhythm)
+(map scale-rhythm rhythm)
+(map scale-rhythm (automate-notes rhythm))

-(take 5 (iterate run-automaton notes))
+(take 5 (iterate automate-notes notes))

 (def melody
-  (phrase (scale-rhythm rhythm)
+  (phrase (map scale-rhythm rhythm)
           notes))

-(take 5 (iterate run-automaton rhythm))
-(map scale-rhythm (flatten (take 5 (iterate run-automaton rhythm))))
+(take 5 (iterate automate-rhythm rhythm))
+(map scale-rhythm (flatten (take 5 (iterate automate-rhythm rhythm))))

 (def melodic-automaton
-  (phrase (map scale-rhythm (flatten (iterate run-automaton rhythm)))
-          (flatten (iterate run-automaton notes))))
+  (phrase (map scale-rhythm (flatten (iterate automate-rhythm rhythm)))
+          (flatten (iterate automate-notes notes))))

 (play-tune melody)


Refactored filtered-entries to be more partial-friendly.

--- src/lambda_blog/templates/entries.clj
+++ src/lambda_blog/templates/entries.clj
@@ -56,11 +56,11 @@
          "Continue reading "
          (i {:class [:fa :fa-arrow-right]})))))

-(defn filtered-entries [{:keys [archives path-to-root] :as ent} entries]
+(defn filtered-entries [entry-filter ent]
   (page
-   (fn [_]
+   (fn [{:keys [archives entries path-to-root]}]
      [(map (juxt entry-summary (constantly (hr)))
-           entries)
+           (entry-filter entries))
       (-> (a {:href (pathcat path-to-root (:path archives))}
              "Further reading...")
           h1
@@ -69,17 +69,18 @@
           well)])
    ent))

-(defn recent-entries [{:keys [entries] :as ent}]
-  (filtered-entries ent
-                    (->> entries
-                         (sort-by :timestamp)
-                         reverse
-                         (take 15))))
+(def recent-entries (partial filtered-entries
+                             #(->> %
+                                   (sort-by :timestamp)
+                                   reverse
+                                   (take 15))))

-(defn entries-by-tag [{:keys [entries id] :as env}]
-  (filtered-entries env
-                    (->> entries
-                         (filter (fn [{:keys [tags]}]
-                                   (contains? (into #{} (map :id tags)) id)))
-                         (sort-by :timestamp)
-                         reverse)))
+(defn entries-by-tag [{:keys [id] :as ent}]
+  (filtered-entries #(->> %
+                          (filter (fn [{:keys [tags]}]
+                                    (contains? (into #{}
+                                                     (map :id tags))
+                                               id)))
+                          (sort-by :timestamp)
+                          reverse)
+                    ent))


Fix for 'cljx once' is not a task. See 'lein help'.

--- src/leiningen/new/reagent/project.clj
+++ src/leiningen/new/reagent/project.clj
@@ -50,7 +50,7 @@
                    :env {:dev? true}

                    {{#cljx-hook?}}
-                   :prep-tasks ["cljx once"]
+                   :prep-tasks [["cljx" "once"]]
                    {{/cljx-hook?}}
                    {{#cljx-build?}}
                    :cljx {:builds [{:source-paths ["src/cljx"]


Add Up Link to Error Representation

Add Up Link to Error Representation

--- src/lens/middleware/wan_exception.clj
+++ src/lens/middleware/wan_exception.clj
@@ -10,4 +10,6 @@
       (catch Throwable e
         (pst-on *err* false e)
         {:status 500
-         :body {:error (.getMessage e)}}))))
+         :body
+         {:links {:up {:href "/"}}
+          :error (.getMessage e)}}))))


Fix typo

Fix typo

--- src/search/utils.clj
+++ src/search/utils.clj
@@ -122,6 +122,7 @@
   the first value first, then the second value, and so on.

       (= [1 2 1] (repeatedely 3 (seq->fn (cycle [1 2]))))
+      (= [1 2 1] (repeatedly 3 (seq->fn (cycle [1 2]))))
   "
   [s]
   (let [a (atom (conj (seq s) nil))]


clean up tests a bit

clean up tests a bit

--- src/test/self/self_host/test.cljs
+++ src/test/self/self_host/test.cljs
@@ -70,19 +70,19 @@
       (cljs/compile-str st "(+ 1 1)"
         (fn [{:keys [error value]}]
           (is (nil? error))
-          (is (= value "(1 + 1);\n"))
+          (is (= "(1 + 1);\n" value))
           (inc! l)))
       (cljs/compile-str st "(fn [])" nil
         {:context :expr}
         (fn [{:keys [error value]}]
           (is (nil? error))
-          (is (= value "(function (){\nreturn null;\n})"))
+          (is (= "(function (){\nreturn null;\n})" value))
           (inc! l)))
       (cljs/compile-str st "(if cljs.core.first 1 2)" nil
         {:context :expr}
         (fn [{:keys [error value]}]
           (is (nil? error))
-          (is (= value "(cljs.core.truth_(cljs.core.first)?1:2)"))
+          (is (= "(cljs.core.truth_(cljs.core.first)?1:2)" value))
           (inc! l))))))

 (deftest test-eval-str
@@ -92,7 +92,7 @@
         {:eval node-eval}
         (fn [{:keys [error value]}]
           (is (nil? error))
-          (is (== value 2))
+          (is (== 2 value))
           (inc! l)))
       (cljs/eval-str st "(def x 1)" nil
         {:eval node-eval
@@ -116,7 +116,7 @@
          :def-emits-var true}
         (fn [{:keys [error value]}]
           (is (nil? error))
-          (is (== 3))
+          (is (== 3 value))
           (inc! l)))
       #_(cljs/eval-str st "(ns foo.bar)" nil
           {:eval node-eval
@@ -132,7 +132,7 @@
          :def-emits-var true}
         (fn [{:keys [error value]}]
           (is (nil? error))
-          (is (== (js/cljs.user.foo 1 2) 3))
+          (is (== 3 (js/cljs.user.foo 1 2)))
           (inc! l))))))

 #_(deftest test-eval-str-with-require


Fixed broken call

Fixed broken call

--- src/tango/broker.clj
+++ src/tango/broker.clj
@@ -14,10 +14,10 @@
 (defn select-activity [conn activity]
   (do
     (d/select-round conn activity)
-    (log/info (str "Application selected round changed : " (d/get-selected-activity conn)))))
+    (log/info (str "Application selected round changed : " ))))

 (defn selected-activity [conn]
-  (log/info (str "Application selected round : " (d/get-selected-activity conn))))
+  (log/info (str "Application selected round : " (d/get-selected-activity conn '[:activity/name]))))

 (defn start-result-rules-engine [in-ch out-ch client-in-channel datomic-storage-uri]
   (async/go-loop []
@@ -35,10 +35,10 @@
                      (log/info (str "Select activity " payload))
                      ;; TODO - should the connection be kept open?
                      (select-activity (d/create-connection datomic-storage-uri) payload))
-                   [:app/selected-activity _]
-                   (do
-                     (log/info (str "Selected activity " (:app/selected-activity payload)))
-                     (selected-activity (d/create-connection datomic-storage-uri)))
+                   ;[:app/selected-activity _]
+                   ;(do
+                   ;  (log/info (str "Selected activity " (:app/selected-activity payload)))
+                   ;  (selected-activity (d/create-connection datomic-storage-uri)))
                    [:set-result p]
                    (log/info "Mark X")
                    :else (async/>!!


Convenience functions

Convenience functions

--- src/telldus/core.clj
+++ src/telldus/core.clj
@@ -132,3 +132,14 @@
 (defmethod device-method-value->map String [arg]
   (device-method-value->map (Integer. arg)))

+
+(defn turn-on
+  "Turn on an device"
+  [conn device-id]
+  (telldus conn "tdTurnOn" device-id))
+
+(defn turn-off
+  "Turn on an device"
+  [conn device-id]
+  (telldus conn "tdTurnOff" device-id))
+


Add ?!

Add ?!

--- src/useful/debug.clj
+++ src/useful/debug.clj
@@ -1,10 +1,23 @@
-(ns useful.debug)
+(ns useful.debug
+  (:use clojure.stacktrace))

-(defmacro ?
-  "A useful debugging tool when you can't figure out what's going on:
+(letfn [(interrogate-form [list-head form]
+          `(let [display# (fn [val#]
+                            (~@list-head (prn-str '~form '~'is val#)))]
+             (try (doto ~form display#)
+                  (catch Throwable t#
+                    (display# {:thrown t#
+                               :trace (with-out-str
+                                        (print-cause-trace t#))})
+                    (throw t#)))))]
+
+  (defmacro ?
+    "A useful debugging tool when you can't figure out what's going on:
   wrap a form with ?, and the form will be printed alongside
   its result. The result will still be passed along."
-  [val]
-  `(let [x# ~val]
-     (prn '~val '~'is x#)
-     x#))
+    [val]
+    (interrogate-form `(print) val))
+
+  (defmacro ?!
+    [file val]
+    (interrogate-form `(spit ~file) val)))


SER-1546 | add thumb path generation tests

--- test/vignette/media_types_test.clj
+++ test/vignette/media_types_test.clj
@@ -143,3 +143,27 @@
         (hlrh/route->thumb-map
           (route-matches hlr/thumbnail-route request) request)]
     (thumbnail-path new-thumbnail-map) => (thumbnail-path legacy-thumbnail-map)))
+
+(def static-assets-map {:uuid           "d6f0194a-ea6a-410d-9c45-81411b43bcab"
+                        :thumbnail-mode "thumbnail"
+                        :width          "200"
+                        :height         "300"
+                        :image-type     "images"
+                        :options        {}})
+
+(facts :static-assets-thumb-map->dir-path
+  (let [data static-assets-map]
+    (static-assets-thumb-map->dir-path data) => "images/thumb/d6f0194a-ea6a-410d-9c45-81411b43bcab"))
+
+(facts :static-assets-thumbnail-path
+  (let [data static-assets-map]
+    (static-assets-thumbnail-path data) => "images/thumb/d6f0194a-ea6a-410d-9c45-81411b43bcab/200px-300px-thumbnail"))
+
+(def static-assets-minimal-map {:uuid           "d6f0194a-ea6a-410d-9c45-81411b43bcab"
+                                :thumbnail-mode "thumbnail"
+                                :image-type     "images"
+                                :options        {}})
+
+(facts :static-assets-thumbnail-path-minimal
+  (let [data static-assets-minimal-map]
+    (static-assets-thumbnail-path data) => "images/thumb/d6f0194a-ea6a-410d-9c45-81411b43bcab/nullpx-nullpx-thumbnail"))


todomvc renders! interactivity isn't there yet though

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/aurora/examples/todomvc2.cljs
+++ src/aurora/examples/todomvc2.cljs
@@ -1,5 +1,5 @@
 (ns aurora.examples.todomvc2
-  (:require [aurora.btree :refer [tree iterator least greatest key-lt key-lte key-gt key-gte key-compare key=]]
+  (:require [aurora.btree :as btree :refer [tree iterator least greatest key-lt key-lte key-gt key-gte key-compare key=]]
             [aurora.join :refer [magic-iterator join-iterator all-join-results transform constant-filter context pretend-tree fixpoint-tick infinirator]]
             [aurora.language :refer [knowledge compile]]
             [aurora.util.core :refer [now]]
@@ -163,11 +163,10 @@

 (defn fill-todos [env num]
   (dotimes [x num]
-    (know env "todo" #js ["todo-id" "text"] #js [x (str "foo" x)]))
-  (dotimes [x num]
-    (know env "todo-editing" #js ["todo-id" "editing?"] #js [x "saved"]))
-  (dotimes [x num]
-    (know env "todo-completed" #js ["todo-id" "completed?"] #js [x "active"])))
+    (know env "todo" #js ["todo-id" "text"] #js [x (str "foo" x)])
+    (know env "todo-editing" #js ["todo-id" "editing?"] #js [x "saved"])
+    (know env "todo-completed" #js ["todo-id" "completed?"] #js [x "active"]))
+  )

 (defn click! [env elem]
   (.assoc! (index env "ui/onClick") #js[elem] 0))
@@ -184,6 +183,11 @@
   (know env "current-toggle" #js ["value"] #js ["false"])
   (know env "todo-to-edit" #js ["value"] #js ["hi"])
   (know env "filter" #js ["filter"] #js ["all"])
+
+  (remember env "todo-to-add" #js ["value"] #js ["hey"])
+  (remember env "current-toggle" #js ["value"] #js ["false"])
+  (remember env "todo-to-edit" #js ["value"] #js ["hi"])
+  (remember env "filter" #js ["filter"] #js ["all"])
   )

 (def todomvc (env))
@@ -240,7 +244,7 @@
              (when "filter" {:filter "all"})
              (pretend "todo-displayed" {:todo-id 'todo}))

-       (rule filter-all-display
+       (rule filter-display
              (when "todo" {:todo-id 'todo :text 'text})
              (when "todo-completed" {:todo-id 'todo :completed? 'complete?})
              (when "filter" {:filter 'complete?})
@@ -250,8 +254,8 @@
              (when "todo-displayed" {:todo-id 'todo})
              (when "todo-completed" {:todo-id 'todo :completed? 'complete})
              (func 'active?  "complete == \"completed\" ? \"checked\" : \"\"")
-             (func 'child-id "\"todo-checkbox\" + todo")
-             (func 'parent-id "\"todo\" + todo")
+             (func 'child-id "\"todo-checkbox-\" + todo")
+             (func 'parent-id "\"todo-\" + todo")
              (pretend "ui/child" {:parent-id 'parent-id :pos -1 :child-id 'child-id})
              (draw [:input {:id 'child-id
                             :type "checkbox"
@@ -264,9 +268,9 @@
              (when "todo-displayed" {:todo-id 'todo})
              (when "todo" {:todo-id 'todo :text 'text})
              (when "todo-editing" {:todo-id 'todo :editing? "saved"})
-             (func 'removeId "\"todo-remove\" + todo")
-             (func 'todoId "\"todo\" + todo")
-             (pretend "ui/child" {:parent-id "todo-list" :pos 'todo :child-id 'child-id})
+             (func 'removeId "\"todo-remove-\" + todo")
+             (func 'todoId "\"todo-\" + todo")
+             (pretend "ui/child" {:parent-id "todo-list" :pos 'todo :child-id 'todoId})
              (draw [:li {:id 'todoId
                          :event-key "edit-todo"
                          :entity 'todo
@@ -276,9 +280,10 @@
                               :event-key "remove-todo"
                               :entity 'todo
                               :events ["onClick"]}
-                     "x"]]))
-
-       (rule draw-todo-item
+                     "x"]])
+             )
+
+       (rule draw-todo-item-editor
              (when "todo-displayed" {:todo-id 'todo})
              (when "todo" {:todo-id 'todo :text 'cur})
              (when "todo-editing" {:todo-id 'todo :editing? "editing"})
@@ -290,7 +295,7 @@
                             :entity 'todo
                             :events ["onBlur" "onChange" "onKeyDown"]}]))

-       (rule draw-todo-item
+       (rule draw-todo-input
              (when "todo-to-add" {:value 'cur})
              (pretend "ui/child" {:parent-id "app" :pos 1 :child-id "todo-input"})
              (draw [:input {:id "todo-input"
@@ -299,7 +304,7 @@
                             :events ["onChange" "onKeyDown"]}]))

        (rule draw-interface
-             (when "curren-toggle" {:value 'toggle})
+             (when "current-toggle" {:value 'toggle})
              (draw [:div {:id "app"}
                     [:h1 {:id "todo-header"} "Todos"]
                     [:input {:id "toggle-all"
@@ -422,7 +427,10 @@
             pos (aget cur 1)
             parent-el (aget built-els parent)
             child-el (aget built-els child)]
-        (.push (.-props.children parent-el) child-el)
+        (if (and parent-el (.-props parent-el))
+          (.push (.-props.children parent-el) child-el)
+          ;(println "UI FAIL: " x parent child pos)
+          )
         (js-delete roots child)))

@@ -551,7 +559,7 @@

 (defn re-run [program]
-  (let [compiled (compile program)]
+  (let [compiled (perf-time (compile program))]
     (prep-compiled compiled)
     (perf-time
      (do
@@ -562,7 +570,7 @@
                                           dommied (perf-time (dommy/node tree))
                                           ]
                                       (when container
-                                        (js/React.renderComponent dommied container)
+                                        (perf-time (js/React.renderComponent dommied container))
                                         ;(perf-time (do
                                         ;             (dom/empty container)
                                         ;             (dom/append container tree)))
@@ -578,10 +586,15 @@

 (comment

+  (.-kind->name->fields->index todomvc)
+  (index todomvc "todo-displayed")
+
   ;;Try to run todomvc and it blows up with "Can't split anything"
-  (do (defaults todomvc)
-    (fill-todos todomvc 5)
-    (re-run todomvc))
+  (perf-time
+   (do (defaults todomvc)
+     (init-std-lib todomvc)
+     (fill-todos todomvc 10)
+     (re-run todomvc)))

   ;;Trying to get the thing to run CRAZINESS, queued events cause re-run to be called
   ;;if I .quiesce the ui disappears, just calling .run is fine though
@@ -589,19 +602,19 @@
 (let [program (env)]
   (rules program

-         (rule draw-incr
-               (when "incr" {:value value})
-               (draw [:button {:id "incr" :events ["onClick"]} "increment: " 'value]))
-
-         (rule clicked
-               (when "ui/onClick" {:elem-id "incr"})
-               (func 'new-val "value + 1")
-               (change "incr" {:value 'value} {:value 'new-val}))
-
-;;                       (rule this-is-awesome
-;;                             (func 'x "1 + 2")
-;;                             (pretend "x-val" {:val x})
-;;                             )
+;;          (rule draw-incr
+;;                (when "incr" {:value value})
+;;                (draw [:button {:id "incr" :events ["onClick"]} "increment: " 'value]))
+
+;;          (rule clicked
+;;                (when "ui/onClick" {:elem-id "incr"})
+;;                (func 'new-val "value + 1")
+;;                (change "incr" {:value 'value} {:value 'new-val}))
+
+                      (rule this-is-awesome
+                            (func 'cur "cur > -1 ? (cur < 10 ? cur + 1 : 10) : 0")
+                            (remember "x-val" {:val 'x})
+                            )

          )
   (let [compiled (compile program)]
@@ -629,10 +642,11 @@
        )))

   (get-in (.-kind->name->fields->index program) ["remember" "incr"])
-  (index program "ui/elem")
-  )
-
-
-
-
-  )
+  (index program "x-val")
+  (.-kind->name->fields->index program)
+  )
+
+
+
+
+  )


CMR-2201: Removed unused test fixture

CMR-2201: Removed unused test fixture

--- metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/cleanup_test.clj
+++ metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/cleanup_test.clj
@@ -15,8 +15,7 @@
 (use-fixtures :each (join-fixtures
                       [(util/reset-database-fixture {:provider-id "REG_PROV" :small false}
                                                     {:provider-id "SMAL_PROV1" :small true}
-                                                    {:provider-id "SMAL_PROV2" :small true})
-                       tk/freeze-resume-time-fixture]))
+                                                    {:provider-id "SMAL_PROV2" :small true})]))

 (defn concept-revision-exists?
   "Returns true if the revision of the concept exists"


(PE-3659) Added Jetty server validation to service `init` exception test

This commit adds an assertion to a test that no Jetty server instance was
attached to the service context when a dependent service throws an
exception during its `init` function.

The commit also adjusts the test description to validate what it is
actually doing around the validation of the Jetty server instance.

--- test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
+++ test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
@@ -184,6 +184,13 @@
     [service jetty9-service]
     jetty-plaintext-config))

+(defn get-jetty-server-from-app-context
+  [app]
+  (-> (get-service app :WebserverService)
+      (tk-services/service-context)
+      (:jetty9-server)
+      (:server)))
+
 (deftest jetty-and-dependent-service-shutdown-after-service-error
   (testing (str "jetty and any dependent services are shutdown after a"
                 "service throws an error from its start function")
@@ -199,10 +206,7 @@
                                     context))
            app              (boot-service-and-jetty-with-default-config
                               test-service)
-           jetty-server     (-> (get-service app :WebserverService)
-                                (tk-services/service-context)
-                                (:jetty9-server)
-                                (:server))]
+           jetty-server     (get-jetty-server-from-app-context app)]
        (is (.isStarted jetty-server)
            "Jetty server was never started")
        (is (thrown-with-msg?
@@ -214,8 +218,9 @@
            "Service shutdown was not called.")
        (is (.isStopped jetty-server)
            "Jetty server was not stopped at shutdown."))))
-  (testing (str "jetty and any dependent services are shutdown after a"
-                "service throws an error from its init function")
+  (testing (str "jetty server instance never attached to the service context "
+                "and dependent services are shutdown after a service throws "
+                "an error from its init function")
     (with-test-logging
       (let [shutdown-called? (atom false)
             test-service     (tk-services/service
@@ -227,11 +232,15 @@
                                      (reset! shutdown-called? true)
                                      context))
             app              (boot-service-and-jetty-with-default-config
-                               test-service)]
+                               test-service)
+            jetty-server     (get-jetty-server-from-app-context app)]
         (is (thrown-with-msg?
               Throwable
               #"oops"
               (tk-core/run-app app))
             "tk run-app did not die with expected exception.")
+        (is (nil? jetty-server)
+            (str "Jetty server was unexpectedly attached to the service "
+                 "context."))
         (is (true? @shutdown-called?)
             "Service shutdown was not called.")))))


update page schema

update page schema

--- src/cljc/salava/page/schemas.cljc
+++ src/cljc/salava/page/schemas.cljc
@@ -49,6 +49,11 @@
                                                                         (<= (count %) 255))))
                        :format      (s/enum "short" "long")
                        :sort        (s/enum "name" "modified")})
+(s/defschema ShowcaseBlock {:type (s/eq "showcase")
+                            :title  (s/maybe s/Str)
+                            :badges [(s/maybe s/Int)]
+                            :format      (s/enum "short" "long")
+                             })

 (s/defschema ViewPage (assoc page :user_id s/Int
                                   :first_name s/Str
@@ -100,7 +105,8 @@
                                                                                s/Int)
                                                                     #(= (:type %) "file") (assoc FileBlock :id s/Int :block_order s/Int)
                                                                     #(= (:type %) "tag") (assoc TagBlock :id s/Int
-                                                                                :block_order s/Int))]}
+                                                                                :block_order s/Int)
+                                                                   #(= (:type %) "showcase") (assoc ShowcaseBlock :id s/Int :block_order s/Int))]}
                               :badges [{:id         s/Int
                                         :name       s/Str
                                         :image_file (s/maybe s/Str)
@@ -117,4 +123,5 @@
                                                            #(= (:type %) "html") (assoc HtmlBlock (s/optional-key :id) s/Int)
                                                            #(= (:type %) "file") (assoc FileBlock (s/optional-key :id) s/Int
                                                                                :files (s/maybe [s/Int]))
-                                                           #(= (:type %) "tag") (assoc TagBlock (s/optional-key :id) s/Int))]})
+                                                           #(= (:type %) "tag") (assoc TagBlock (s/optional-key :id) s/Int)
+                                                           #(= (:type %) "showcase") (assoc ShowcaseBlock (s/optional-key :id) s/Int))]})


Add re-frame requires

Add re-frame requires

--- src/cljs/five_three_one/core.cljs
+++ src/cljs/five_three_one/core.cljs
@@ -1,10 +1,17 @@
 (ns five-three-one.core
-    (:require [reagent.core :as reagent :refer [atom]]
-              [reagent.session :as session]
-              [secretary.core :as secretary :include-macros true]
-              [goog.events :as events]
-              [goog.history.EventType :as EventType])
+  (:require-macros [reagent.ratom :refer [reaction]])
+  (:require [reagent.core :as reagent :refer [atom]]
+            [reagent.session :as session]
             [cljsjs.web-animations :as animation]
+            [secretary.core :as secretary :include-macros true]
+            [goog.events :as events]
+            [goog.history.EventType :as EventType]
+            [re-frame.core :refer [register-handler
+                                   path
+                                   register-sub
+                                   dispatch
+                                   dispatch-sync
+                                   subscribe]])
     (:import goog.History))

 (defn signin-handler []


display last save time

display last save time

--- src/cljs/geo_collection/core.cljs
+++ src/cljs/geo_collection/core.cljs
@@ -21,6 +21,7 @@
                                                                  :speed (.-speed coords)}))))))

 (defn handler [response]
+  (session/put! :last-time-saved response)
   (.log js/console response))

 (defn error-handler [{:keys [status status-text]}]
@@ -51,6 +52,7 @@
      [:button {:class "btn btn-primary btn-block"
                :type :button
                :on-click save-position} "Save Position"]
+     [:h3 {:class "col-xs-12"} (session/get :last-time-saved)]
      ]]])

 (defn current-page []


Add implementation for create-partial-proc-fn with start-idx>0.

--- src/dsbdp/data_processing_dsl.clj
+++ src/dsbdp/data_processing_dsl.clj
@@ -132,6 +132,9 @@
   (if (= 0 start-idx)
     (create-proc-fn
       {:output-type (:output-type dsl-expression)
+       :rules (subvec (:rules dsl-expression) start-idx end-idx)})
+    (create-proc-fn
+      {:output-type (keyword (str (name (:output-type dsl-expression)) *incremental-indicator-suffix*))
        :rules (subvec (:rules dsl-expression) start-idx end-idx)})))

 (defn create-proc-fns-vec


Check the size of locality error reports

Instead of assuming Postgres gives us stable ordering of results,
without an `order by` clause, it makes more sense to check that an error
is included in the output.

--- test/vip/data_processor/validation/v5/locality_test.clj
+++ test/vip/data_processor/validation/v5/locality_test.clj
@@ -113,16 +113,17 @@
          report (-> (korma/exec-raw
                      [(str "select * from v5_dashboard.locality_error_report('" public-id "', 'loc3')")]
                      :results)
-                   first)]
-        (is (= {:results_id results-id
-                :path "VipObject.0.StreetSegment.31.Zip"
-                :severity "errors"
-                :scope "street-segment"
-                :identifier "ss33"
-                :error_type "missing"
-                :error_data ":missing-zip"}
-               report))))))
-
+                    set)]
+        (is (= 3 (count report)))
+        (is (contains?
+             report
+             {:results_id results-id
+              :path "VipObject.0.StreetSegment.31.Zip"
+              :severity "errors"
+              :scope "street-segment"
+              :identifier "ss33"
+              :error_type "missing"
+              :error_data ":missing-zip"}))))))

 (deftest ^:postgres locality-summary-test
   (let [errors-chan (a/chan 100)


fix typo

fix typo

--- src/graphql_clj/introspection.clj
+++ src/graphql_clj/introspection.clj
@@ -85,7 +85,7 @@
                         (case (:tag type)
                           :basic-type (:name type)
                           :list-type nil
-                          (throw (ex-info (format "Unhandled type in type-resolver:%s" type) {:type type}))))
+                          (throw (ex-info (format "Unhandled type in type-resolver:%s" type) {:type type})))))
         inner-type (:inner-type type)]
     (when (not (#{:LIST :NON_NULL} kind))
       (assert type-name (format "type-name is null for type: %s." type))


Add documentation, and adjust for io.aviso:pretty:1.0.4

--- src/io/aviso/twixt/exceptions.clj
+++ src/io/aviso/twixt/exceptions.clj
@@ -15,6 +15,9 @@
       (-> exception .getClass .getName)))

 (defprotocol MarkupGeneration
+  "Used to convert arbitrary values into markup strings.
+
+  Extended onto nil, String, APersistentMap, Sequential and Object."
   (to-markup
     [value]
     "Returns HTML markup representing the value."))
@@ -73,29 +76,27 @@
 (defn- element->clojure-name [element]
   (let [names (:names element)]
     (list
-      (s/join "/" (butlast names))
+      (s/join "/" (drop-last names))
       "/"
       [:strong (last names)])))

-(defn- element->java-name [element]
-  (let [class-name (:class element)
-        dotx (.lastIndexOf class-name ".")]
-    (list
-      (if (pos? dotx)
-        (list
-          ;; Take up to and including the "dot"
-          [:span.package-name (.substring class-name 0 (inc dotx))]
-          (.substring class-name (inc dotx)))
-        class-name)
-      " — "
-      (:method element))))
+(defn- element->java-name
+  [{:keys [package class simple-class method]}]
+  (list
+    (if package
+      (list
+        [:span.package-name package]
+        "."
+        simple-class)
+      class)
+    " — "
+    method))

 (defn- stack-trace-element->row-markup
-  [element]
-  (let [clojure? (-> element :names empty? not)
-        class-name (:class element)
-        java-name (element->java-name element)
-        ^String line (:line element)]
+  [{:keys [file line names]
+    :as   element}]
+  (let [clojure? (-> names empty? not)
+        java-name (element->java-name element)]
     [:tr
      [:td.function-name
       (if clojure?
@@ -104,24 +105,21 @@
           [:div.filtered java-name])
         java-name)
       ]
-     [:td.source-location (:file element)]
-     [:td (if (and (-> line s/blank? not)
-                   (-> line (Integer/parseInt) pos?))
-            line
-            "")]
+     [:td.source-location file]
+     [:td (or line "")]
      ]))

-(defn- exception->markup
+(defn- single-exception->markup
   "Given an analyzed exception, generate markup for it."
   [{^Throwable e :exception
-    :keys        [properties root]}]
+    :keys        [class-name message properties root]}]
   (html
     [:div.panel.panel-default
      [:div.panel-heading
-      [:h3.panel-title (-> e .getClass .getName)]
+      [:h3.panel-title class-name]
       ]
      [:div.panel-body
-      [:h4 (.getMessage e)]
+      [:h4 message]
       ;; TODO: sorting
       (when-not (empty? properties)
         [:dl
@@ -142,13 +140,14 @@
      ]))

-(defn write-exception-stack
-  "Writes the markup for a root exception and its stack of causes, including a stack trace for the deepest exception."
-  [^Throwable root-exception]
+(defn exception->markup
+  "Returns the markup (as a string) for a root exception and its stack of causes,
+  including a stack trace for the deepest exception."
+  [root-exception]
   (->>
     root-exception
     exception/analyze-exception
-    (map exception->markup)
+    (map single-exception->markup)
     (apply str)))

 (defn build-report
@@ -173,7 +172,7 @@
         [:h3 (h (exception-message exception))]
         ]
        ]
-      (write-exception-stack exception)
+      (exception->markup exception)

       [:h3 "Request"]


still not broken

still not broken

--- test/bluebell/fibers/ops_test.clj
+++ test/bluebell/fibers/ops_test.clj
@@ -33,7 +33,8 @@

 (defn static-if [cond true-branch false-branch]
   (core/node
-   (access/build core/-datatype :unspecified)))
+   (access/build core/-datatype :unspecified
+                 core/-args [cond true-branch false-branch])))

 (comment
   (core/make-map {}
@@ -41,5 +42,10 @@
                             (types/input 2)
                             (types/input 3)))

+  (core/make-code
+   (static-if (types/input 1)
+              (types/input 2)
+              (types/input 3)))
+
   )


Added license header

Added license header

--- test/branch_handler/core_test.clj
+++ test/branch_handler/core_test.clj
@@ -1,3 +1,15 @@
+;
+;  (C) Copyright 2016, 2020  Pavel Tisnovsky
+;
+;  All rights reserved. This program and the accompanying materials
+;  are made available under the terms of the Eclipse Public License v1.0
+;  which accompanies this distribution, and is available at
+;  http://www.eclipse.org/legal/epl-v10.html
+;
+;  Contributors:
+;      Pavel Tisnovsky
+;
+
 (ns branch-handler.core-test
   (:require [clojure.test :refer :all]
             [branch-handler.core :refer :all]))


Add comment to test, make sure test state doesn't go stale

--- test/useful/experimental_test.clj
+++ test/useful/experimental_test.clj
@@ -17,6 +17,7 @@
       (is (= odd  (odd?  a))))))

+;;; protocols defined for testing protocol-stub
 (defprotocol Sample
   (sample [this data]))

@@ -47,6 +48,7 @@
 (deftest stub-test
   (let [real-impl (Implementor.)
         stub-impl (StubImpl. real-impl)]
+    (reset! call-log []) ;; in case of stale test state
     (testing "default action works without exceptions"
       (is (= [] @call-log))
       (is (= 10 (sample real-impl 'whatever)))


SearchResults now checks "that" is a collection before calling .count on it

--- src/overtone/libs/freesound/search_results.clj
+++ src/overtone/libs/freesound/search_results.clj
@@ -17,7 +17,8 @@
   (empty [_]
     (.empty results-seq))
   (equiv [this that]
-    (and (= (.count this)
+    (and (coll? that)
+         (= (.count this)
             (.count that))
          (.equiv results-seq (.results that))))


remove old compiler hack

remove old compiler hack

caused incorrect source map columns and provided very tiny
performance gain overall. just kill it and stay with the default
compiler impl.

fixes #871

--- src/main/shadow/build/cljs_hacks.cljc
+++ src/main/shadow/build/cljs_hacks.cljc
@@ -571,41 +571,6 @@
 (defmethod comp/emit* :js-var [expr] (shadow-emit-var expr))
 (defmethod comp/emit* :local [expr] (shadow-emit-var expr))

-;; no perf impact, just easier to read
-(defn source-map-inc-col [{:keys [gen-col] :as m} n]
-  (assoc m :gen-col (+ gen-col n)))
-
-(defn source-map-inc-line [{:keys [gen-line] :as m}]
-  (assoc m
-    :gen-line (inc gen-line)
-    :gen-col 0))
-
-;; string? provides pretty decent boost
-(defn emit1 [x]
-  (cond
-    (nil? x) nil
-    (string? x)
-    (do (when-not (nil? comp/*source-map-data*)
-          (swap! comp/*source-map-data* source-map-inc-col (count x)))
-        (print x))
-    (map? x) (comp/emit x)
-    (seq? x) (run! emit1 x)
-    (fn? x) (x)
-    :else (let [s (print-str x)]
-            (when-not (nil? comp/*source-map-data*)
-              (swap! comp/*source-map-data* source-map-inc-col (count s)))
-            (print s))))
-
-(defn shadow-emits [& xs]
-  (run! emit1 xs))
-
-(defn shadow-emitln [& xs]
-  (run! emit1 xs)
-  (newline)
-  (when comp/*source-map-data*
-    (swap! comp/*source-map-data* source-map-inc-line))
-  nil)
-
 ;; noop
 (defn shadow-load-core [])

@@ -1051,9 +1016,6 @@
   (replace-fn! #'ana/parse-invoke* shadow-parse-invoke*)

   ;; cljs.compiler tweaks
-  (replace-fn! #'comp/emits shadow-emits)
-  (replace-fn! #'comp/emitln shadow-emitln)
-
   (replace-fn! #'comp/find-ns-starts-with shadow-find-ns-starts-with)

   (replace-fn! #'cljs.core/goog-define goog-define)


fix build report hook

fix build report hook

--- src/main/shadow/cljs/build_report.clj
+++ src/main/shadow/cljs/build_report.clj
@@ -205,7 +205,7 @@
     (html5
       {}
       [:head
-       [:title (format "[%s] Build Report - shadow-cljs" (name build-id))]
+       [:title (format "[%s] Build Report - shadow-cljs" (name (or build-id (:shadow.build/build-id build-state))))]
        [:meta {:charset "utf-8"}]]
       [:body
        [:div#root]


minor edit

minor edit

--- src/spekl_package_manager/package.clj
+++ src/spekl_package_manager/package.clj
@@ -406,7 +406,6 @@

 (defn environment-meets [package-description]
   (if-not (= nil (package-description :assumes))
-    (let [invalid-cmds (doall (filter (fn [cmd] (and (my-platform? cmd) (cmd-does-not-meet-requirements cmd)   )) (package-description :assumes)))])
-
-    (if (> (count invalid-cmds) 0)
-      (throw (EnvironmentException. (str "Your environment does not meet the requirements for this package: " ((first invalid-cmds) :message)))))))
+    (let [invalid-cmds (doall (filter (fn [cmd] (and (my-platform? cmd) (cmd-does-not-meet-requirements cmd)   )) (package-description :assumes)))]
+      (if (> (count invalid-cmds) 0)
+        (throw (EnvironmentException. (str "Your environment does not meet the requirements for this package: " ((first invalid-cmds) :message))))))))


better numbers-needed format in landscape

--- src/unspun/screens/number_needed.cljs
+++ src/unspun/screens/number_needed.cljs
@@ -314,6 +314,7 @@
         highlight (into #{} (map inc (ffloyd-sample (- nn 2)
                                                     (max 0 ((if (> rr 1) identity dec) (anyway rr br))))))
         {w :width h :height} (rum/react dimensions)
+        portrait (> h w)
         h (- h 168)                                         ; adjustment for existing header and footer
         isz 16
         row-n (js/Math.floor (/ w isz))
@@ -343,74 +344,75 @@

       (view {:style {:flex            1
-                     :flexDirection   "column"
+                     :flexDirection   (if portrait "column" "row")
                      :justifyContent  "flex-start"
                      :backgroundColor (:primary palette)
                      }}
             ;;
             ;; Title and text
             ;;
-            (view {:style {:flex            0.4
-                           :position        "relative"
-                           :justifyContent  "flex-start"
-                           :alignItems      "stretch"
-                           :backgroundColor (:dark-primary palette)
-                           }}
-                  (story-links palette)
-
-                  (view {:key   1
-                         :style {:position "absolute"
-                                 :backgroundColor "rgba(0,0,0,0)"
-                                 :top      (* 3 tffsz)
-                                 :bottom   0
-                                 :left     0
-                                 :right    0
-                                 :zIndex   1}}
-                        (scroll-view {:style {:flex 0.6}
-                                      :key   1
-                                      ;:backgroundColor (:dark-primary palette)
-                                      }
-                                     (scenario-title (:title scenar) text-field (:qoe scenar))
-                                     (text {:style {:padding    20
-                                                    :paddingTop 5
-                                                    :fontSize   tffsz}}
-                                           (text-field :light-primary "normal" nn-head)
-                                           (text-field (if (> rr 1) :text-icons :dark-primary)
-                                                       "bold" (trimr nn-one)
-                                                       (if (> rr 1) (:accent palette) (:text-icons palette)))
-                                           (text-field :light-primary "normal" (str " " nn-one-to-group))
-                                           (text-field :light-primary "bold" nn-group)
-                                           (text-field :light-primary "normal" nn-group-to-anyway)
-                                           (text-field :accent "bold" nn-anyway)
-                                           (text-field :light-primary "normal" nn-tail))))
-                  (view {:key   2
-                         :style {:position "absolute"
-                                 :height   (* 3 tffsz)
-                                 :bottom   (* 0.2 tffsz)
-                                 :left     0
-                                 :right    0
-                                 :zIndex   2}}
-                        (view {:style          {:flex 1}
-                               :flexDirection  "column"
-                               :justifyContent "flex-end"
-                               :alignItems     "center"
-                               }
-
-                              (ionicon {:name  "ios-arrow-down"
-                                        :size  50
-                                        :style {:width           50
-                                                :textAlign       "center"
-                                                :opacity         0.3
-                                                :color           (:text-icons palette)
-                                                :backgroundColor "rgba(0,0,0,0)"
-                                                }}))
-                        )
-
-                  )
+            (view {:style {:flex (if portrait 0.4 0.5)}}
+                  (view {:style {:flex            1
+                                 :position        "relative"
+                                 :justifyContent  "flex-start"
+                                 :alignItems      "stretch"
+                                 :backgroundColor (:dark-primary palette)
+                                 }}
+                        (story-links palette)
+
+                        (view {:key   1
+                               :style {:position        "absolute"
+                                       :backgroundColor "rgba(0,0,0,0)"
+                                       :top             (* 3 tffsz)
+                                       :bottom          0
+                                       :left            0
+                                       :right           0
+                                       :zIndex          1}}
+                              (scroll-view {:style {:flex 0.6}
+                                            :key   1
+                                            ;:backgroundColor (:dark-primary palette)
+                                            }
+                                           (scenario-title (:title scenar) text-field (:qoe scenar))
+                                           (text {:style {:padding    20
+                                                          :paddingTop 5
+                                                          :fontSize   tffsz}}
+                                                 (text-field :light-primary "normal" nn-head)
+                                                 (text-field (if (> rr 1) :text-icons :dark-primary)
+                                                             "bold" (trimr nn-one)
+                                                             (if (> rr 1) (:accent palette) (:text-icons palette)))
+                                                 (text-field :light-primary "normal" (str " " nn-one-to-group))
+                                                 (text-field :light-primary "bold" nn-group)
+                                                 (text-field :light-primary "normal" nn-group-to-anyway)
+                                                 (text-field :accent "bold" nn-anyway)
+                                                 (text-field :light-primary "normal" nn-tail))))
+                        (view {:key   2
+                               :style {:position "absolute"
+                                       :height   (* 3 tffsz)
+                                       :bottom   (* 0.2 tffsz)
+                                       :left     0
+                                       :right    0
+                                       :zIndex   2}}
+                              (view {:style          {:flex 1}
+                                     :flexDirection  "column"
+                                     :justifyContent "flex-end"
+                                     :alignItems     "center"
+                                     }
+
+                                    (ionicon {:name  "ios-arrow-down"
+                                              :size  50
+                                              :style {:width           50
+                                                      :textAlign       "center"
+                                                      :opacity         0.3
+                                                      :color           (:text-icons palette)
+                                                      :backgroundColor "rgba(0,0,0,0)"
+                                                      }}))
+                              )
+
+                        ))
             ;;
             ;; Graphics
             ;;
-            (view {:style {:flex          0.6
+            (view {:style {:flex          (if portrait 0.6 0.5)
                            :flexDirection "column"}}

                   (view {:key   1
@@ -428,7 +430,7 @@
                                                             :flexDirection "column"
                                                             :opacity       1}}

-                                     (nested-n-square** scenar palette rr w h nn highlight)))
+                                     (nested-n-square** scenar palette rr (if portrait w (* 2 w)) (if portrait h (+ h 168)) nn highlight)))

                   (view {:key   2
                          :style {:position "absolute"