Disable requesting names shorter than 7

Disable requesting names shorter than 7

--- src/name_bazaar/ui/components/ens_name_details.cljs
+++ src/name_bazaar/ui/components/ens_name_details.cljs
@@ -2,7 +2,7 @@
   (:require
     [clojure.string :as string]
     [district0x.ui.components.transaction-button :refer [transaction-button]]
-    [name-bazaar.shared.utils :refer [top-level-name?]]
+    [name-bazaar.shared.utils :refer [top-level-name? name-label]]
     [name-bazaar.ui.components.add-to-watched-names-button :refer [add-to-watched-names-button]]
     [name-bazaar.ui.components.ens-record.etherscan-link :refer [ens-record-etherscan-link]]
     [name-bazaar.ui.components.ens-record.general-info :refer [ens-record-general-info]]
@@ -19,7 +19,9 @@
      {:primary true
       :pending? tx-pending?
       :pending-text "Requesting..."
-      :disabled has-requested?
+      :disabled (or has-requested?
+                    (and (top-level-name? name)
+                         (< (count (name-label name)) 7)))
       :on-click #(dispatch [:offering-requests/add-request {:ens.record/name name}])}
      (if has-requested? "Requested" "Request")]))


Fixing problem when testing with external db.

--- transmit-lib/src/cmr/transmit/metadata_db.clj
+++ transmit-lib/src/cmr/transmit/metadata_db.clj
@@ -226,7 +226,8 @@
   "Delete the provider with the matching provider-id from the CMR metadata repo."
   [context provider-id]
   (let [{:keys [status body]} (delete-provider-raw context provider-id)]
-    (when-not (or (= status 200) (= status 404))
+    (when-not (or (> 300 status 199) (= status 404))
+      (cmr.common.dev.capture-reveal/capture status)
       (errors/internal-error!
         (format "Failed to delete provider status: %s body: %s"
                 status body)))))


Update nimbus.clj

Update nimbus.clj

Corrected formatting

--- storm-core/src/clj/backtype/storm/daemon/nimbus.clj
+++ storm-core/src/clj/backtype/storm/daemon/nimbus.clj
@@ -856,7 +856,8 @@
   (if (some #(.contains name %) DISALLOWED-TOPOLOGY-NAME-STRS)
     (throw (InvalidTopologyException.
             (str "Topology name cannot contain any of the following: " (pr-str DISALLOWED-TOPOLOGY-NAME-STRS))))
-              (if (clojure.string/blank? name) (throw (InvalidTopologyException. (str "Topology name cannot be blank"))))))
+  (if (clojure.string/blank? name)
+    (throw (InvalidTopologyException. (str "Topology name cannot be blank"))))))

 (defn- try-read-storm-conf [conf storm-id]
   (try-cause


update pom description and URL

update pom description and URL

--- build.boot
+++ build.boot
@@ -39,9 +39,9 @@

   pom     {:project 'alda/client-java
            :version +version+
-           :description "A music programming language for musicians"
-           :url "https://github.com/alda-lang/alda"
-           :scm {:url "https://github.com/alda-lang/alda"}
+           :description "A Java command-line client for Alda"
+           :url "https://github.com/alda-lang/alda-client-java"
+           :scm {:url "https://github.com/alda-lang/alda-client-java"}
            :license {"name" "Eclipse Public License"
                      "url" "http://www.eclipse.org/legal/epl-v10.html"}}


upgrade dependencies, including mantra (-> 0.2.0)

--- build.boot
+++ build.boot
@@ -1,16 +1,20 @@
 (set-env!
   :source-paths   #{"src"}
   :resource-paths #{"test-page"}
-  :dependencies   '[[org.clojure/clojure       "1.7.0"]
-                    [org.clojure/clojurescript "1.7.228"]
-                    [adzerk/bootlaces          "0.1.11"    :scope "test"]
-                    [adzerk/boot-cljs          "1.7.228-1" :scope "test"]
-                    [adzerk/boot-cljs-repl     "0.3.0"     :scope "test"]
-                    [com.cemerick/piggieback   "0.2.1"     :scope "test"]
-                    [weasel                    "0.7.0"     :scope "test"]
-                    [org.clojure/tools.nrepl   "0.2.12"    :scope "test"]
-                    [chronoid                  "0.1.1"]
-                    [music-theory              "0.1.0"]])
+  :dependencies   '[[org.clojure/clojure       "1.10.1"       :scope "provided"]
+                    [org.clojure/clojurescript "1.10.520"     :scope "provided"]
+                    [io.djy/chronoid           "0.2.0"]
+                    [music-theory              "0.1.0"]
+                    [adzerk/bootlaces          "0.2.0"        :scope "test"]
+                    [adzerk/boot-cljs          "2.1.5"        :scope "test"]
+                    [adzerk/boot-cljs-repl     "0.4.0"        :scope "test"]
+                    [cider/piggieback          "0.4.1"        :scope "test"]
+                    [weasel                    "0.7.0"        :scope "test"]
+                    [nrepl                     "0.7.0-alpha1" :scope "test"]
+                    ;; Workaround for boot-cljs-repl using something that was
+                    ;; removed in JDK 11. This also seems to fail when I use JDK
+                    ;; 8, which I don't understand, but anyway, this fixes it.
+                    [javax.xml.bind/jaxb-api "2.4.0-b180830.0359" :scope "test"]])

 (require '[adzerk.bootlaces      :refer :all]
          '[adzerk.boot-cljs      :refer (cljs)]


update db build processes to be more composable

--- build.boot
+++ build.boot
@@ -168,17 +168,33 @@
                  (update :simulator-template/arena-template lookup-arena-ref conn)))
        (d/transact conn)))

-(defn- refresh-db!
-  [uri]
-  (d/delete-database uri)
-  (d/create-database uri)
+(defn- seed-db!
+  [uri]
   (let [conn (d/connect uri)]
     @(db-fns/seed-database-functions conn)
     (transact-all conn "resources/datomic/schema.dtm")
     (transact-all conn "resources/datomic/roles.dtm")
     (transact-all conn "resources/datomic/users.dtm")
     (transact-all conn "resources/datomic/arena-templates.dtm")
-    @(seed-simulator-templates conn)))
+    @(seed-simulator-templates conn))
+  uri)
+
+(defn- create-db!
+  [uri]
+  (d/create-database uri)
+  uri)
+
+(defn- delete-db!
+  [uri]
+  (d/delete-database uri)
+  uri)
+
+(defn- refresh-db!
+  [uri]
+  (-> uri
+      delete-db!
+      create-db!
+      seed-db!))

 (deftask refresh-db-functions
   "resets the transactors in the db"
@@ -211,6 +227,15 @@

   (-> (build-connection-string)
       refresh-db!))
+
+#_(deftask seed-prod
+  "Seeds the prod dynamo db"
+  []
+  (System/setProperty "APP_ENV" "prod-ddb")
+
+  (-> (build-connection-string)
+      create-db!
+      seed-db!))

 (deftask build
   "Creates a new build"


bump hoplon

bump hoplon

--- build.boot
+++ build.boot
@@ -4,7 +4,7 @@

 (set-env!
  :dependencies '[[tailrecursion/boot.task "2.1.0"]
-                 [tailrecursion/hoplon "5.4.1"]
+                 [tailrecursion/hoplon "5.5.0"]
                  [tailrecursion/boot.notify "2.0.0-SNAPSHOT"]
                  [tailrecursion/boot.ring   "0.1.0-SNAPSHOT"]
                  [org.clojure/clojurescript "0.0-2138"]]


adds dependency to adzerk.boot-test and exposes it's test task into build.boot

--- build.boot
+++ build.boot
@@ -4,7 +4,7 @@
   :dependencies '[[org.clojure/clojure "1.7.0"     :scope "provided"]
                   [boot/core           "2.5.5"     :scope "provided"]
                   [http-kit            "2.1.19"    :scope "test"]
-                  [adzerk/boot-test    "1.0.7"     :scope "test"]])
+                  [adzerk/boot-test    "1.1.0"     :scope "test"]])

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


upping dev/test deps

upping dev/test deps

--- build.boot
+++ build.boot
@@ -5,10 +5,10 @@
   :dependencies '[;; mount brings _no dependencies_, everything here is for
                   ;; mount dev, examples apps and tests

-                  [org.clojure/clojure "1.7.0"              :scope "provided"]
-                  [org.clojure/clojurescript "1.7.189"      :scope "provided" :classifier "aot"]
-                  [datascript "0.13.3"                      :scope "provided"]
-                  [compojure "1.4.0"                        :scope "provided"]
+                  [org.clojure/clojure "1.8.0"              :scope "provided"]
+                  [org.clojure/clojurescript "1.7.228"      :scope "provided" :classifier "aot"]
+                  [datascript "0.15.0"                      :scope "provided"]
+                  [compojure "1.5.0"                        :scope "provided"]
                   [ring/ring-jetty-adapter "1.1.0"          :scope "provided"]
                   [cheshire "5.5.0"                         :scope "provided"]
                   [hiccups "0.3.0"                          :scope "provided" :exclusions [org.clojure/clojurescript]]
@@ -18,24 +18,24 @@
                   [robert/hooke "1.3.0"                     :scope "provided"]
                   [org.clojure/tools.namespace "0.2.11"     :scope "provided"]
                   [org.clojure/tools.nrepl "0.2.12"         :scope "provided"]
-                  [com.datomic/datomic-free "0.9.5327"      :scope "provided" :exclusions [joda-time]]
+                  [com.datomic/datomic-free "0.9.5359"      :scope "provided" :exclusions [joda-time]]

                   ;; boot clj
-                  [boot/core              "2.5.1"           :scope "provided"]
+                  [boot/core              "2.6.0"           :scope "provided"]
                   [adzerk/bootlaces       "0.1.13"          :scope "test"]
                   [adzerk/boot-logservice "1.0.1"           :scope "test"]
-                  [adzerk/boot-test       "1.0.6"           :scope "test"]
+                  [adzerk/boot-test       "1.1.1"           :scope "test"]
                   [tolitius/boot-check    "0.1.1"           :scope "test"]

                   ;; boot cljs
-                  [adzerk/boot-cljs            "1.7.170-3"       :scope "test"]
+                  [adzerk/boot-cljs            "1.7.228-1"       :scope "test"]
                   [adzerk/boot-cljs-repl       "0.3.0"           :scope "test"]
                   [pandeiro/boot-http          "0.7.1-SNAPSHOT"  :scope "test"]
                   [tolitius/boot-stripper      "0.1.0-SNAPSHOT"  :scope "test"]
                   [com.cemerick/piggieback     "0.2.1"           :scope "test" :exclusions [org.clojure/clojurescript]]
                   [weasel                      "0.7.0"           :scope "test" :exclusions [org.clojure/clojurescript]]
                   [adzerk/boot-reload          "0.4.8"           :scope "test"]
-                  [crisptrutski/boot-cljs-test "0.2.1-SNAPSHOT"  :scope "test"]])
+                  [crisptrutski/boot-cljs-test "0.2.2-SNAPSHOT"  :scope "test"]])

 (require '[adzerk.bootlaces :refer :all]
          '[adzerk.boot-test :as bt]


updated bq

updated bq

--- src/datasplash/bq.clj
+++ src/datasplash/bq.clj
@@ -14,13 +14,17 @@
            [com.google.cloud.dataflow.sdk.coders TableRowJsonCoder]))

 (defn read-bq-table-raw
-  ([from options p]
-   (let [opts (assoc options :label :read-bq-table-raw)]
-     (-> p
-         (cond-> (instance? Pipeline p) (PBegin/in))
-         (.apply (with-opts base-schema opts
-                   (BigQueryIO$Read/from from))))))
-  ([from p] (read-bq-table-raw from {} p)))
+  [{:keys [query table] :as options} p]
+  (let [opts (assoc options :label :read-bq-table-raw)
+        ptrans (cond
+                 query (BigQueryIO$Read/fromQuery query)
+                 table (BigQueryIO$Read/from table)
+                 :else (throw (ex-info
+                               "Error with options of read-bq-table, should specify one of :table or :query"
+                               {:options options})))]
+    (-> p
+        (cond-> (instance? Pipeline p) (PBegin/in))
+        (apply-transform ptrans named-schema opts))))

 (defn table-row->clj
   [^TableRow row]
@@ -57,19 +61,16 @@
   [from options]
   (let [safe-opts (dissoc options :name)]
     (ptransform
-     (:name options)
+     :read-bq-table-to-clj
      [p]
      (->> p
-          (read-bq-table-raw from options)
-          (dmap table-row->clj options)))))
+          (read-bq-table-raw safe-opts)
+          (dmap table-row->clj safe-opts)))))

 (defn read-bq-table
-  ([from options ^Pipeline p]
-   (let [opts (assoc options :label :read-bq-table)]
-     (-> p
-         (.apply (with-opts base-schema opts
-                   (read-bq-table-clj-transform from opts))))))
-  ([from p] (read-bq-table from {} p)))
+  [options ^Pipeline p]
+  (let [opts (assoc options :label :read-bq-table)]
+    (apply-transform p (read-bq-table-clj-transform opts) :base-schema opts)))

 (defn ->schema
   ^TableSchema
@@ -126,16 +127,14 @@
 (defn write-bq-table-raw
   ([to options ^PCollection pcoll]
    (let [opts (assoc options :label :write-bq-table-raw)]
-     (-> pcoll
-         (.apply (with-opts write-bq-table-schema opts
-                   (BigQueryIO$Write/to to))))))
+     (apply-transform pcoll (BigQueryIO$Write/to to) write-bq-table-schema opts)))
   ([to pcoll] (write-bq-table-raw to {} pcoll)))

 (defn- write-bq-table-clj-transform
   [to options]
   (let [safe-opts (dissoc options :name)]
     (ptransform
-     (:name options)
+     :write-bq-table-from-clj
      [^PCollection pcoll]
      (let [schema (:schema options)
            base-coll (if schema
@@ -148,7 +147,5 @@
 (defn write-bq-table
   ([to options ^PCollection pcoll]
    (let [opts (assoc options :label :write-bq-table)]
-     (-> pcoll
-         (.apply (with-opts base-schema opts
-                   (write-bq-table-clj-transform to opts))))))
+     (apply-transform pcoll (write-bq-table-clj-transform to opts) write-bq-table-schema opts)))
   ([to pcoll] (write-bq-table to {} pcoll)))


Allow for pretty much anything as a spec predicate

--- src/detritus/spec.clj
+++ src/detritus/spec.clj
@@ -13,7 +13,7 @@
 (s/def ::field-spec
   (s/cat :field symbol?
          :turnstyle #{:- :?}
-         :spec (some-fn qualified-ident? ifn?)))
+         :spec (complement #{:- :?})))

 (s/def ::fields
   (s/and vector?


CMR-3551: Fixed the ingest job that refreshes the humanizer alias cache

--- ingest-app/src/cmr/ingest/services/jobs.clj
+++ ingest-app/src/cmr/ingest/services/jobs.clj
@@ -113,12 +113,10 @@
   (let [context {:system system}]
     (cleanup-expired-collections context)))

-
-(defn RefreshHumanizerAliasCache
-  "Refresh the humanizer-alias-cache in a configurable time interval"
-  [context]
-  (humanizer-alias-cache/refresh-cache context))
-
+(def-stateful-job RefreshHumanizerAliasCache
+  [_ system]
+  (let [context {:system system}]
+    (humanizer-alias-cache/refresh-cache context)))
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Jobs for refreshing the collection granule aggregation cache in the indexer. This is a singleton job
 ;; and the indexer does not have a database so it's triggered from Ingest and sent via message.


Add style arg to h-box, v-box, gap, line (box, scroller and border already had it)

--- src/re_com/box.cljs
+++ src/re_com/box.cljs
@@ -128,135 +128,137 @@

 ;; ------------------------------------------------------------------------------------
-;;  gap (debug colour: chocolate)
+;;  Private Component: box-base (debug colour: lightblue)
+;; ------------------------------------------------------------------------------------
+
+(defn- box-base
+  [& {:keys [class f-child f-container size scroll h-scroll v-scroll width height min-width min-height justify align align-self
+             margin padding border l-border r-border t-border b-border radius bk-color child style]}]
+  "This should generally NOT be used as it is the basis for the box, scroller and border components."
+  (let [s (merge
+            (when f-child     (flex-child-style size))
+            (when f-container {:display "flex" :flex-flow "inherit"})
+            (when scroll      (scroll-style :overflow scroll))
+            (when h-scroll    (scroll-style :overflow-x h-scroll))
+            (when v-scroll    (scroll-style :overflow-y v-scroll))
+            (when width       {:width width})
+            (when height      {:height height})
+            (when min-width   {:min-width min-width})
+            (when min-height  {:min-height min-height})
+            (when (and f-container justify) (justify-style justify))
+            (when (and f-container align) (align-style :align-items align))
+            (when align-self  (align-style :align-self align-self))
+            (when margin      {:margin margin})       ;; margin and padding: "all" OR "top&bottom right&left" OR "top right bottom left"
+            (when padding     {:padding padding})
+            (when border      {:border        border})
+            (when l-border    {:border-left   l-border})
+            (when r-border    {:border-right  r-border})
+            (when t-border    {:border-top    t-border})
+            (when b-border    {:border-bottom b-border})
+            (when radius      {:border-radius   radius})
+            (if bk-color
+              {:background-color bk-color}
+              (if debug {:background-color "lightblue"} {}))
+            style)]
+    [:div {:class class :style s}
+     child]))
+
+
+;; ------------------------------------------------------------------------------------
+;;  Component: gap (debug colour: chocolate)
 ;; ------------------------------------------------------------------------------------

 (defn gap
-  [& {:keys [size width height]}]
+  [& {:keys [size width height style]}]
   "Returns markup which produces a gap between children in a v-box/h-box along the main axis.
    Specify size in any sizing amount, usually px or % or perhaps em. Defaults to 20px."
-  (let [g-style (when size {:flex (str "0 0 " size)})
-        w-style (when width {:width width})
-        h-style (when height {:height height})
-        d-style (when debug {:background-color "chocolate"})
-        s       (merge g-style w-style h-style d-style)]
+  (let [s (merge
+            (when size {:flex (str "0 0 " size)})
+            (when width {:width width})
+            (when height {:height height})
+            (when debug {:background-color "chocolate"})
+            style)]
     [:div {:class "rc-gap" :style s}]))

 ;; ------------------------------------------------------------------------------------
-;;  line
+;;  Component: line
 ;; ------------------------------------------------------------------------------------

 (defn line
-  [& {:keys [size color]
+  [& {:keys [size color style]
       :or {size "1px" color "lightgray"}}]
   "Returns markup which produces a line between children in a v-box/h-box along the main axis.
    Specify size in pixels and a stancard CSS colour. Defaults to a 1px red line."
-  (let [flex-child {:flex (str "0 0 " size)}
-        c-style    {:background-color color}
-        s          (merge flex-child c-style)]
+  (let [s (merge
+            {:flex (str "0 0 " size)}
+            {:background-color color}
+            style)]
     [:div {:class "rc-line" :style s}]))

 ;; ------------------------------------------------------------------------------------
-;;  h-box (debug colour: gold)
+;;  Component: h-box (debug colour: gold)
 ;; ------------------------------------------------------------------------------------

 (defn h-box
-  [& {:keys [f-child size width height min-width min-height justify align margin padding gap children]
+  [& {:keys [f-child size width height min-width min-height justify align margin padding gap children style]
       :or   {f-child true size "none" justify :start align :stretch}}]
   "Returns markup which produces a horizontal box.
    It's primary role is to act as a container for child components and lays it's children from left to right.
    By default, it also acts as a child under it's parent."
-  (let [flex-container {:display "flex" :flex-flow "row nowrap"}
-        flex-child     (when f-child (flex-child-style size))
-        w-style        (if width {:width width})
-        h-style        (when height {:height height})
-        mw-style       (when min-width {:min-width min-width})
-        mh-style       (when min-height {:min-height min-height})
-        j-style        (justify-style justify)
-        a-style        (align-style :align-items align)
-        m-style        (when margin {:margin margin})       ;; margin and padding: "all" OR "top&bottom right&left" OR "top right bottom left"
-        p-style        (when padding {:padding padding})
-        d-style        (when debug {:background-color "gold"})
-        s              (merge flex-container flex-child w-style h-style mw-style mh-style j-style a-style m-style p-style d-style)
-        gap-form       (when gap [re-com.box/gap :size gap :width gap])
-        children       (if gap
-                         (interpose gap-form (filter identity children)) ;; filter is to remove possible nils so we don't add unwanted gaps
-                         children)]
+  (let [s        (merge
+                   {:display "flex" :flex-flow "row nowrap"}
+                   (when f-child (flex-child-style size))
+                   (if width {:width width})
+                   (when height {:height height})
+                   (when min-width {:min-width min-width})
+                   (when min-height {:min-height min-height})
+                   (justify-style justify)
+                   (align-style :align-items align)
+                   (when margin {:margin margin})       ;; margin and padding: "all" OR "top&bottom right&left" OR "top right bottom left"
+                   (when padding {:padding padding})
+                   (when debug {:background-color "gold"})
+                   style)
+        gap-form (when gap [re-com.box/gap :size gap :width gap])
+        children (if gap
+                   (interpose gap-form (filter identity children)) ;; filter is to remove possible nils so we don't add unwanted gaps
+                   children)]
     (into [:div {:class "rc-h-box" :style s}] children)))

 ;; ------------------------------------------------------------------------------------
-;;  v-box (debug colour: antiquewhite)
+;;  Component: v-box (debug colour: antiquewhite)
 ;; ------------------------------------------------------------------------------------

 (defn v-box
-  [& {:keys [f-child size width height min-width min-height justify align margin padding gap children]
+  [& {:keys [f-child size width height min-width min-height justify align margin padding gap children style]
       :or   {f-child true size "none" justify :start align :stretch}}]
   "Returns markup which produces a vertical box.
    It's primary role is to act as a container for child components and lays it's children from top to bottom.
    By default, it also acts as a child under it's parent."
-  (let [flex-container {:display "flex" :flex-flow "column nowrap"}
-        flex-child     (when f-child    (flex-child-style size))
-        w-style        (when width      {:width width})
-        h-style        (if height
-                         {:height height}
-                         {:height "inherit"})
-        mw-style       (when min-width  {:min-width min-width})
-        mh-style       (when min-height {:min-height min-height})
-        j-style        (justify-style justify)
-        a-style        (align-style :align-items align)
-        m-style        (when margin     {:margin margin})       ;; margin and padding: "all" OR "top&bottom right&left" OR "top right bottom left"
-        p-style        (when padding    {:padding padding})
-        d-style        (when debug      {:background-color "antiquewhite"})
-        s              (merge flex-container flex-child w-style h-style mw-style mh-style j-style a-style m-style p-style d-style)
-        gap-form       (when gap [re-com.box/gap :size gap :height gap])
-        children       (if gap
-                         (interpose gap-form (filter identity children)) ;; filter is to remove possible nils so we don't add unwanted gaps
-                         children)]
+  (let [s        (merge
+                   {:display "flex" :flex-flow "column nowrap"}
+                   (when f-child    (flex-child-style size))
+                   (when width      {:width width})
+                   {:height (if height height "inherit")}
+                   (when min-width  {:min-width min-width})
+                   (when min-height {:min-height min-height})
+                   (justify-style justify)
+                   (align-style :align-items align)
+                   (when margin     {:margin margin})       ;; margin and padding: "all" OR "top&bottom right&left" OR "top right bottom left"
+                   (when padding    {:padding padding})
+                   (when debug      {:background-color "antiquewhite"})
+                   style)
+        gap-form (when gap [re-com.box/gap :size gap :height gap])
+        children (if gap
+                   (interpose gap-form (filter identity children)) ;; filter is to remove possible nils so we don't add unwanted gaps
+                   children)]
     (into [:div {:class "rc-v-box" :style s}] children)))

 ;; ------------------------------------------------------------------------------------
-;;  box-base (debug colour: lightblue)
-;; ------------------------------------------------------------------------------------
-
-(defn box-base
-  [& {:keys [class f-child f-container size scroll h-scroll v-scroll width height min-width min-height justify align align-self
-             margin padding border l-border r-border t-border b-border radius bk-color child style]}]
-  "This should generally NOT be used as it is the basis for the box, scroller and border components."
-  (let [flex-child     (when f-child     (flex-child-style size))
-        flex-container (when f-container {:display "flex" :flex-flow "inherit"})
-        s-style        (when scroll      (scroll-style :overflow scroll))
-        sh-style       (when h-scroll    (scroll-style :overflow-x h-scroll))
-        sv-style       (when v-scroll    (scroll-style :overflow-y v-scroll))
-        w-style        (when width       {:width width})
-        h-style        (when height      {:height height})
-        mw-style       (when min-width   {:min-width min-width})
-        mh-style       (when min-height  {:min-height min-height})
-        j-style        (when (and f-container justify) (justify-style justify))
-        a-style        (when (and f-container align) (align-style :align-items align))
-        as-style       (when align-self  (align-style :align-self align-self))
-        m-style        (when margin      {:margin margin})       ;; margin and padding: "all" OR "top&bottom right&left" OR "top right bottom left"
-        p-style        (when padding     {:padding padding})
-        b-style        (when border      {:border        border})
-        bl-style       (when l-border    {:border-left   l-border})
-        br-style       (when r-border    {:border-right  r-border})
-        bt-style       (when t-border    {:border-top    t-border})
-        bb-style       (when b-border    {:border-bottom b-border})
-        r-style        (when radius      {:border-radius   radius})
-        c-style        (if bk-color
-                         {:background-color bk-color}
-                         (if debug {:background-color "lightblue"} {}))
-        s              (merge flex-child flex-container s-style sh-style sv-style w-style h-style mw-style mh-style j-style a-style as-style
-                              m-style p-style b-style bl-style br-style bt-style bb-style r-style c-style style)]
-    [:div {:class class :style s}
-     child]))
-
-
-;; ------------------------------------------------------------------------------------
-;;  box
+;;  Component: box
 ;; ------------------------------------------------------------------------------------

 (defn box
@@ -292,7 +294,7 @@

 ;; ------------------------------------------------------------------------------------
-;;  scroller
+;;  Component: scroller
 ;; ------------------------------------------------------------------------------------

 (defn scroller
@@ -338,7 +340,7 @@

 ;; ------------------------------------------------------------------------------------
-;;  border
+;;  Component: border
 ;; ------------------------------------------------------------------------------------

 (defn border
@@ -350,7 +352,7 @@
     - border-width: thin, medium, thick or standard CSS size (e.g. 2px, 0.5em)
     - border-style: none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset
     - color:        standard CSS color (e.g. grey #88ffee)"
-  (let [no-border (every? nil? [border l-border r-border t-border b-border])
+  (let [no-border      (every? nil? [border l-border r-border t-border b-border])
         default-border "1px solid lightgrey"]
     (box-base :class "rc-border"
               :f-child     true


use _lambda_result_ as identifier

use _lambda_result_ as identifier

--- src/evalback/core.clj
+++ src/evalback/core.clj
@@ -17,7 +17,9 @@
            de.tla2b.exceptions.TLA2BException
            de.prob.Main
            de.prob.scripting.Api
-           de.be4.classicalb.core.parser.node.AImplicationPredicate))
+           (de.be4.classicalb.core.parser.node TIdentifierLiteral AImplicationPredicate)))
+
+(def varname [(TIdentifierLiteral. "_lambda_result_")])

 (def instances 2)
 (def prob-timeout 3000)
@@ -49,7 +51,12 @@
 (defn mk-formula [formalism input]
   (let [cbf (instantiate formalism input)
         pred? (= "#PREDICATE" (.getKind cbf))]
-    (if pred? [cbf nil] (let [gs (str (gensym "ProB_Var_"))] [(instantiate formalism (str gs  " = " input)) gs]))))
+    (if pred?
+      [cbf nil]
+      (let [
+            cbf (instantiate formalism (str  "lambda_result_ = " input))
+            ast (.. cbf getAst getPParseUnit getPredicate getLeft (setIdentifier varname))]
+        [cbf "_lambda_result_"]))))

 (defn top-level-implication? [cbf]
@@ -202,10 +209,11 @@
             (serve (get-handler)
                    {:port port
                     :init init
-                    :auto-reload? true
+                    :open-browser? false
+                    :stacktraces? false
+                    :auto-reload? false
                     :destroy destroy
-                    :join? false}))
-    (println (str "You can view the site at http://localhost:" port))))
+                    :join? true}))))

 (defn stop-server []
   (.stop @server)


:admin-email is not used anymore

:admin-email is not used anymore

--- src/freecoin/core.clj
+++ src/freecoin/core.clj
@@ -187,8 +187,7 @@
                                  (select-keys stores-m [:account-store :password-recovery-store])
                                  account-activator password-recoverer
                                  {:hash-fn buddy.hashers/derive :hash-check-fn buddy.hashers/check})
-            server             (-> (create-app (assoc config-m
-                                                      :admin-email "aspra@dyne.org") stores-m blockchain email-authenticator)
+            server             (-> (create-app config-m stores-m blockchain email-authenticator)
                                    (server/run-server {:port (config/port config-m)
                                                        :host (config/host config-m)}))]
         (assoc app-state


Remove subscribe-once function, it now useless.

--- src/futura/stream.clj
+++ src/futura/stream.clj
@@ -122,31 +122,6 @@
           (rf subscriber)
           (.onComplete subscriber))))))

-(defn- subscribe-once
-  "Create a subscription instance that only
-  subscribes for one value."
-  [^Publisher p callback]
-  (let [subscription (atomic/ref nil)
-        completed (atomic/boolean false)
-        subscriber (reify Subscriber
-                     (onSubscribe [_ s]
-                       (atomic/set! subscription s)
-                       (.request s 1))
-                     (onNext [_ v]
-                       (when-not @completed
-                         (callback v)
-                         (.cancel @subscription)
-                         (atomic/compare-and-set! completed false true)))
-                     (onError [_ e]
-                       (when-not @completed
-                         (callback nil)
-                         (atomic/compare-and-set! completed false true)))
-                     (onComplete [_]
-                       (when-not @completed
-                         (callback nil)
-                         (atomic/compare-and-set! completed false true))))]
-    (.subscribe p subscriber)))
-
 (defn- promise->publisher
   "Create a publisher with promise as source."
   [source]
@@ -373,4 +348,3 @@
       asyncp/ReadPort
       (take! [_ handler]
         (asyncp/take! sr handler)))))
-


CMR-4850: Added CORS support for health checks. (#511)

* CMR-4850: Added CORS support for health checks.

* CMR-4850: Removed the OPTIONS "/" case. Will be supported when requested.

--- common-app-lib/src/cmr/common_app/api/health.clj
+++ common-app-lib/src/cmr/common_app/api/health.clj
@@ -2,13 +2,14 @@
   "Defines the health routes for applications."
   (:require
    [cheshire.core :as json]
+   [cmr.common-app.api.routes :as common-routes]
    [cmr.common.cache :as cache]
    [cmr.common.cache.in-memory-cache :as mem-cache]
    [cmr.common.cache.single-thread-lookup-cache :as stl-cache]
    [cmr.common.config :refer [defconfig]]
    [cmr.common.log :refer [warn]]
    [cmr.common.mime-types :as mt]
-   [compojure.core :refer [GET]]))
+   [compojure.core :refer :all]))

 (def health-cache-key
   "The key used to store the health cache in the system cache map."
@@ -34,7 +35,8 @@
   (when-not ok?
     (warn "Health check failed" (pr-str dependencies)))
   {:status (if ok? 200 503)
-   :headers {"Content-Type" (mt/with-utf-8 mt/json)}
+   :headers {common-routes/CONTENT_TYPE_HEADER (mt/with-utf-8 mt/json)
+             common-routes/CORS_ORIGIN_HEADER "*"}
    :body (json/generate-string dependencies)})

 (defn- get-app-health
@@ -53,5 +55,6 @@
   takes a request-context as a parameter to determine if the application and its dependencies are
   working as expected."
   [health-fn]
+  (OPTIONS "/health" req common-routes/options-response)
   (GET "/health" {:keys [request-context]}
     (get-app-health request-context health-fn)))


No colons in backup filenames

No colons in backup filenames

--- src/tango/export2.clj
+++ src/tango/export2.clj
@@ -148,17 +148,13 @@
 (defn activity-result [] ()first )

-(defn make-file-name-with-timestamp [file-name]
-
-  )
-
 (defn make-file-name-with-timestamp
   ;; Adds the current time at the end
   ;; of the filename
   [file-name]
   (let [time-now (t/now)
         time-formatter (tf/formatters :hour-minute-second)
-        time-now-formatted (tf/unparse time-formatter time-now)
+        time-now-formatted (cstr/replace (tf/unparse time-formatter time-now) \: \_)
         new-file-name (str file-name "." time-now-formatted)]
     new-file-name
     ))


scheduler: Document why we return true on handle-resource-offers! error

--- scheduler/src/cook/mesos/scheduler.clj
+++ scheduler/src/cook/mesos/scheduler.clj
@@ -615,7 +615,7 @@
         (log/error t "Error in match:" (ex-data t))
         (async/go
           (async/>! offers-chan @offer-stash))
-        true
+        true  ; if an error happened, it doesn't mean we need to penalize Fenzo
         )))))

 (defn view-incubating-offers


Bring tests in line with Ruby tests.

Bring tests in line with Ruby tests.

The Ruby spec for Bob includes a number of tests that clarify certain
points of Bob's behavior.  This commit brings them to the Clojure spec
for Bob.

--- assignments/clojure/bob/bob_test.clj
+++ assignments/clojure/bob/bob_test.clj
@@ -1,14 +1,35 @@
 (ns bob.test (:use clojure.test))
 (load-file "bob.clj")

+(deftest responds-to-something
+  (is (= "Whatever." (bob/response-for "Tom-ay-to, tom-aaaah-to."))))
+
 (deftest responds-to-shouts
-  (is (= "Woah, chill out!" (bob/response-for "SHOUTING"))))
+  (is (= "Woah, chill out!" (bob/response-for "WATCH OUT!"))))

 (deftest responds-to-questions
-  (is (= "Sure." (bob/response-for "A question?"))))
+  (is (= "Sure." (bob/response-for "Does this cryogenic chamber make me look fat?"))))

-(deftest responds-to-statements
-  (is (= "Whatever." (bob/response-for "A statement."))))
+(deftest responds-to-forceful-talking
+  (is (= "Whatever." (bob/response-for "Let's go make out behind the gym!"))))
+
+(deftest responds-to-acronyms
+  (is (= "Whatever." (bob/response-for "It's OK if you don't want to go to the DMV."))))
+
+(deftest responds-to-forceful-questions
+  (is (= "Woah, chill out!" (bob/response-for "WHAT THE HELL WERE YOU THINKING?"))))
+
+(deftest responds-to-shouting-with-special-characters
+  (is (= "Woah, chill out!" (bob/response-for "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"))))
+
+(deftest responds-to-shouting-numbers
+  (is (= "Woah, chill out!" (bob/response-for "1, 2, 3 GO!"))))
+
+(deftest responds-to-shouting-with-no-exclamation-mark
+  (is (= "Woah, chill out!" (bob/response-for "I HATE YOU"))))
+
+(deftest responds-to-statement-containing-question-mark
+  (is (= "Whatever." (bob/response-for "Ending with ? means a question."))))

 (deftest responds-to-silence
   (is (= "Fine, be that way." (bob/response-for ""))))


Expand all filter sections by default

Expand all filter sections by default

--- frontend/src/faceboard/state.cljs
+++ frontend/src/faceboard/state.cljs
@@ -10,9 +10,9 @@
              :editor-path    nil
              :loading?       0
              :extended-set   #{}
-             :filters        {:expanded-set #{:countries}
+             :filters        {:expanded-set #{:countries :socials :tags}
                               :active       {:countries #{}
-                                             :tags      #{}
-                                             :socials   #{}}}}
+                                             :socials   #{}
+                                             :tags      #{}}}}
      :anims {}
      :cache {:tabs {}}}))


Report correct file name

Report correct file name

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -281,7 +281,7 @@
           (perun/report-info task-name "rendered %s new or changed files" (count render-inputs)))
         (case (count copy-files)
           0 nil
-          1 (perun/report-info task-name "copied changed file %s" (first (keys render-inputs)))
+          1 (perun/report-info task-name "copied changed file %s" (first (keys copy-files)))
           (perun/report-info task-name "copied %s unchanged file(s)" (count copy-files)))
         (boot/empty-dir! tmp)
         output-fs))))


[#84] Refactor clojure.instant functions

--- priv/clojure/instant.clj
+++ priv/clojure/instant.clj
@@ -41,7 +41,9 @@
                   (recur (erlang.io.IWriter/write.e b \0))
                   (str b)))))

-(def parse-timestamp
+(def timestamp-regex #"(\d\d\d\d)(?:-(\d\d)(?:-(\d\d)(?:[T](\d\d)(?::(\d\d)(?::(\d\d)(?:[.](\d+))?)?)?)?)?)?(?:[Z]|([-+])(\d\d):(\d\d))?")
+
+(defn parse-timestamp
      "Parse a string containing an RFC3339-like like timestamp.

 The function new-instant is called with the following arguments.
@@ -92,26 +94,25 @@
 will be treated as if the time-offset zero (+00:00) had been
 specified.
 "
-     (let [timestamp #"(\d\d\d\d)(?:-(\d\d)(?:-(\d\d)(?:[T](\d\d)(?::(\d\d)(?::(\d\d)(?:[.](\d+))?)?)?)?)?)?(?:[Z]|([-+])(\d\d):(\d\d))?"]
-
-       (fn [new-instant cs]
-         (if-let [[_ years months days hours minutes seconds fraction
-                   offset-sign offset-hours offset-minutes]
-                  (re-matches timestamp cs)]
-           (new-instant
-            (parse-int years)
-            (if-not months   1 (parse-int months))
-            (if-not days     1 (parse-int days))
-            (if-not hours    0 (parse-int hours))
-            (if-not minutes  0 (parse-int minutes))
-            (if-not seconds  0 (parse-int seconds))
-            (if-not fraction 0 (parse-int (zero-fill-right fraction 9)))
-            (cond (= "-" offset-sign) -1
-                  (= "+" offset-sign)  1
-                  :else                0)
-            (if-not offset-hours   0 (parse-int offset-hours))
-            (if-not offset-minutes 0 (parse-int offset-minutes)))
-           (fail (str "Unrecognized date/time syntax: " cs))))))
+
+  [new-instant cs]
+  (if-let [[_ years months days hours minutes seconds fraction
+            offset-sign offset-hours offset-minutes]
+           (re-matches timestamp-regex cs)]
+    (new-instant
+     (parse-int years)
+     (if-not months   1 (parse-int months))
+     (if-not days     1 (parse-int days))
+     (if-not hours    0 (parse-int hours))
+     (if-not minutes  0 (parse-int minutes))
+     (if-not seconds  0 (parse-int seconds))
+     (if-not fraction 0 (parse-int (zero-fill-right fraction 9)))
+     (cond (= "-" offset-sign) -1
+           (= "+" offset-sign)  1
+           :else                0)
+     (if-not offset-hours   0 (parse-int offset-hours))
+     (if-not offset-minutes 0 (parse-int offset-minutes)))
+    (fail (str "Unrecognized date/time syntax: " cs))))

 ;;; ------------------------------------------------------------------------
@@ -236,8 +237,9 @@
   #[#[years months days]
     #[hours minutes seconds]])

-(def read-instant-date
+(defn read-instant-date
   "To read an instant as a java.util.Date, bind *data-readers* to a map with
 this var as the value for the 'inst key. The timezone offset will be used
-to convert into UTC."
-  (partial parse-timestamp (validated construct-date)))
+  to convert into UTC."
+  [date]
+  (parse-timestamp (validated construct-date) date))


discover every 30 seconds; dont do the random sleep

--- src/bzzz/core.clj
+++ src/bzzz/core.clj
@@ -149,7 +149,6 @@
   (locking peers*
     (swap! peers*
            assoc-in [@index/identifier* (join ":" ["http://localhost" (as-str @port*)]) ] @timer*))
-  (Thread/sleep (* (int (rand 20)) 1000))
   (let [c (async/chan)
         hosts @discover-hosts*
         str-state (json/write-str {:discover-hosts @discover-hosts*})]
@@ -203,7 +202,7 @@
   (log/info "starting bzzz --identifier" (as-str @index/identifier*) "--port" @port* "--directory" @index/root* "--hosts" @discover-hosts* "--acceptable-discover-time-diff" @acceptable-discover-time-diff*)
   (every 5000 #(index/refresh-search-managers) (mk-pool) :desc "search refresher")
   (every 1000 #(swap! timer* inc) (mk-pool) :desc "timer")
-  (every 120000 #(discover) (mk-pool) :desc "periodic discover")
+  (every 30000 #(discover) (mk-pool) :desc "periodic discover")
   (every 10000 #(log/trace "up:" @timer* @index/identifier* @discover-hosts* @peers*) (mk-pool) :desc "dump")
   (repeatedly
    (try


ensure that when behaviors are reloaded the tabs get drawn again

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

--- src/lt/objs/tabs.cljs
+++ src/lt/objs/tabs.cljs
@@ -406,7 +406,7 @@
                       ))

 (behavior ::repaint-tab-updated
-          :triggers #{:tab.updated}
+          :triggers #{:tab.updated, :object.refresh}
           :reaction (fn [this]
                       (object/update! this [:count] inc)
                       (object/merge! this {:no-redraw false})))


prevent the inspector from exploding if you give a sourcemap url that doesn't lead to a file

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

--- src/lt/util/load.cljs
+++ src/lt/util/load.cljs
@@ -19,7 +19,7 @@
   (js/require (str pwd "/core/node_modules/" path)))

 (defn- abs-source-mapping-url [code file]
-  (if-let [path-to-source-map (second (re-find #"\n//# sourceMappingURL=(.*)" code))]
+  (if-let [path-to-source-map (second (re-find #"\n//# sourceMappingURL=(.*\.map)" code))]
     (if-not (absolute? path-to-source-map)
       (let [abs-path-to-source-map (string/replace (.join fpath (.dirname fpath file) path-to-source-map) "\\" "/")
             abs-path-to-source-map (if (= separator "\\")


No, seriously.  Leave the case of user input alone when working with regular expressions.

--- src/marcgrep/core.clj
+++ src/marcgrep/core.clj
@@ -53,8 +53,10 @@
                  "not_equals" predicates/not-equals?
                  "exists" predicates/exists?
                  "does_not_exist" predicates/not-exists?
-                 "matches_regexp" predicates/matches?
-                 "does_not_match_regexp" predicates/not-matches?
+                 "matches_regexp" [predicates/matches?
+                                   {:case-sensitive true}]
+                 "does_not_match_regexp" [predicates/not-matches?
+                                          {:case-sensitive true}]
                  "repeats_field" predicates/has-repeating-fields?
                  "does_not_repeat_field" predicates/does-not-repeat-field?
                  })
@@ -88,11 +90,15 @@
         (fn [record] (or (left-fn record) (right-fn record)))
         (fn [record] (and (left-fn record) (right-fn record)))))

-    (let [value (when (:value query)
+    (let [[predicate options] (if (vector? (predicates (:operator query)))
+                                (predicates (:operator query))
+                                [(predicates (:operator query))])
+          value (if (:case-sensitive options)
+                  (:value query)
                   (.toLowerCase (:value query)))
           fieldspec (parse-marc-field (:field query))]
       (fn [record]
-        ((predicates (:operator query))
+        (predicate
          record
          fieldspec
          value)))))


Remove unused parameter in save-library

Remove unused parameter in save-library

--- src/naughtmq/core.clj
+++ src/naughtmq/core.clj
@@ -37,7 +37,7 @@
           (recur))))))

 (defn save-library
-  [s v]
+  [s]
   (let [lib-name (os-specific-path s)
         lib-path (str "/native/" lib-name)
         tmp-path (System/getProperty "java.io.tmpdir")]
@@ -54,8 +54,8 @@

 (defn load-library
   "Loads the given path (string) as a native library."
-  [s v]
-  (let [file_path (save-library s v)]
+  [s]
+  (let [file_path (save-library s)]
     (try (System/load file_path)
       (catch java.io.IOException e
         (log/error (str "Could not load native file: " s))


Add additional block comment.

Add additional block comment.


Add TODO.

Add TODO.

--- src/pepa/printing.clj
+++ src/pepa/printing.clj
@@ -30,6 +30,7 @@
                           :data (util/slurp-bytes pdf)}
               file (model/store-file! db file-props)
               origin "printer"]
+          ;; TODO: Allow printing to inbox
           (when-not false ; (model/inbox-origin? (:config lpd) origin)
             (log/info lpd "Creating Document for file" (:id file))
             (let [document (model/create-document! db {:title (:name file-props)


Fix discount

Fix discount

--- src/bot/brain.clj
+++ src/bot/brain.clj
@@ -109,7 +109,7 @@
                                  (assoc item :distance (manhattan-distance my-pos [(:x item-pos) (:y item-pos)])))) items)]
     (->> items-with-dist
          (sort-by :distance)
-         (remove #(< money (* (:price %) (:discountPercent %) 0.01)))
+         (remove #(< money (* (:price %) (- 100 (:discountPercent %) 0.01))))
          first
          get-coordinates)))


Add docstrings to implemented functions.

--- src/promesa/core.cljs
+++ src/promesa/core.cljs
@@ -72,42 +72,73 @@
     :else (.resolve js/Promise v)))

 (defn promise?
+  "Returns true if `p` is a primise
+  instance."
   [p]
   (instance? js/Promise p))

 (defn fulfilled?
+  "Returns true if promise `p` is
+  already fulfilled."
   [p]
   {:pre [(promise? p)]}
   (.isFulFilled p))

 (defn rejected?
+  "Returns true if promise `p` is
+  already rejected."
   [p]
   {:pre [(promise? p)]}
   (.isRejected p))

 (defn pending?
+  "Returns true if promise `p` is
+  stil pending."
   [p]
   {:pre [(promise? p)]}
   (.isPending p))

 (defn all
+  "Given an array of promises, return a promise
+  that is fulfilled  when all the items in the
+  array are fulfilled."
   [& promises]
   (.all js/Promise promises))

 (defn any
+  "Given an array of promises, return a promise
+  that is fulfilled when first one item in the
+  array is fulfilled."
   [& promises]
   (.any js/Promise promises))

 (defn delay
+  "Given a timeout in miliseconds and optional
+  value, returns a promise that will fulfilled
+  with provided value (or nil) after the
+  time is reached."
   ([t] (delay t nil))
   ([t v]
    (.delay js/Promise v t)))

 (defn then
+  "A chain helper for promises."
   [p callback]
   (.then p callback))

 (defn catch
+  "Catch all promise chain helper."
+  ([p callback]
+   (.catch p callback))
+  ([p type callback]
+   (let [type (condp = type
+                :timeout (.-TimeoutError js/Promise)
+                :cancel (.-CancellationError js/Promise)
+                type)]
+     (.catch p type callback))))
+
+(defn error
+  "Catch operational errors promise chain helper."
   [p callback]
-  (.catch p callback))
+  (.error p callback))


Extra actx-line div not needed.

Extra actx-line div not needed.

--- src/cbfg/vis.cljs
+++ src/cbfg/vis.cljs
@@ -170,13 +170,11 @@
         actx-info (get-in vis [:actxs actx])
         children (:children actx-info)]
     ["
"
-     "
"
      " <button class='toggle' id='toggle-" actx-id "'>"
      (if (:closed actx-info) "▶" "▼")
      " </button>"
      " " actx-id " "
      "
" (vis-html-loop-state vis (:loop-state actx-info)) "
"
-     "
"
      "

"
      (mapv (fn [ch-info]
              (let [ch-id (:id ch-info)]
@@ -187,8 +185,7 @@
      (when (not (:closed actx-info))
        ["
"
         (mapv (fn [child-actx]
-                ["
" (vis-html-actx vis child-actx actx-ch-ch-infos)
-                 "
"])
+                ["
" (vis-html-actx vis child-actx actx-ch-ch-infos) "
"])
               (sort #(compare (last %1) (last %2)) (keys children)))
         "
"])
      "
"]))


ignore nil metrics

ignore nil metrics

--- src/riemann/folds.clj
+++ src/riemann/folds.clj
@@ -175,7 +175,7 @@
   [events]
   (when-let [e (some identity events)]
     (let [
-      samples (map :metric events)
+      samples (non-nil-metrics events)
       n (count samples)
       mean (/ (reduce + samples) n)
       intermediate (map #(Math/pow (- %1 mean) 2) samples)]


fix octave param handling

fix octave param handling

--- src/semitone/core.clj
+++ src/semitone/core.clj
@@ -89,7 +89,7 @@
                 accidental-map {"#" 1 "##" 2 "b" -1 "bb" -2 "n" 0 "" nil}
                 key-pressure (= "&" (get m 1))
                 key (get note-map (get m 2))
-                octave (if (= "" (get m 4)) (:octave state) (Integer. (get m 4)))
+                note-octave (if (= "" (get m 4)) nil (Integer. (get m 4)))
                 accidental (or (get accidental-map (get m 3))
                                (get (:key-signature state) (clojure.string/lower-case (get m 2)))
                                0)]
@@ -98,7 +98,8 @@
                                  (= "-" (get m 1)) :end
                                  (= "-" (get m 5)) :begin
                                  :else nil)
-                          :key (mod (+ (* (+ 1 octave) 12) key accidental) 128)
+                          :key (+ key accidental)
+                          :note-octave note-octave
                           :param (if key-pressure :key-pressure :octave)
                           :notes (vec-rest notes)}))
           ;; cc
@@ -227,6 +228,7 @@
                       :time-signature [4 4]
                       :transpose 0
                       :octave 4
+                      :note-octave nil
                       :param :octave
                       :cc-value 0
                       :tempo 120
@@ -243,22 +245,35 @@
                              {:notes (vec-rest notes)})
                       (map? (first notes))
                       (parse-state notes state)
-                      (keyword? (first notes))
+                      (and (keyword? (first notes))
+                           (not (empty? (vec-rest notes))))
                       (parse-state (cons {(first notes) (first (vec-rest notes))} (vec-rest (vec-rest notes))) state)
                       :else
                       (let [notes (:notes state)
-                            state (parse-param (:notes state) state)
                             state (parse-length (:notes state) state)
                             state (if (nil? (:repeat-length state)) (parse-note (:notes state) state) state)
+                            state (parse-param (:notes state) state)
+                            key (cond
+                                  (or (= (:key-type state) ShortMessage/NOTE_ON)
+                                      (= (:key-type state) ShortMessage/POLY_PRESSURE))
+                                  (mod (+ (:key state)
+                                          (:transpose state)
+                                          (* (+ 1 (or (:note-octave state) (:octave state))) 12)) 128)
+                                  (= (:key-type state) ShortMessage/PITCH_BEND)
+                                  (bit-and (:pitch-bend state) 2r1111111)
+                                  :else (:key state))
                             value (get {ShortMessage/NOTE_ON (:attack state)
                                         ShortMessage/CHANNEL_PRESSURE (:channel-pressure state)
                                         ShortMessage/CONTROL_CHANGE (:cc-change state)
-                                        ShortMessage/PITCH_BEND (:pitch-bend state)
+                                        ShortMessage/PITCH_BEND (min 128 (bit-shift-right (:pitch-bend state) 7))
                                         ShortMessage/POLY_PRESSURE (:key-pressure state)}
                                        (:key-type state) 0)
                             track (aget (.getTracks (.getSequence (:sequencer state))) (:track state))]
                         (when (= (count notes) (count (:notes state)))
-                          (throw (Exception. (format "Could not parse note: %s" (str (first notes))))))
+                          (throw (Exception. (format "Could not parse note: %s"
+                                                     (if (symbol? (first notes))
+                                                       (name (first notes))
+                                                       (str (first notes)))))))
                         (cond
                           (and (not (nil? (:key state))) (= (type (:key state)) MidiMessage))
                           (.add track (MidiEvent. (:key state) (:position state)))
@@ -269,10 +284,7 @@
                                     (MidiEvent. (ShortMessage.
                                                  (:key-type state)
                                                  (:channel state)
-                                                 (+ (:key state)
-                                                    (if (or (= (:key-type state) ShortMessage/NOTE_ON)
-                                                            (= (:key-type state) ShortMessage/POLY_PRESSURE))
-                                                      (:transpose state) 0))
+                                                 key
                                                  value)
                                                 (:position state))))
                             (when (and (= (:key-type state) ShortMessage/NOTE_ON) (not (= (:tie state) :begin)))
@@ -291,7 +303,8 @@
                                         (:position state)
                                         (+ (:position state) (or (:repeat-length state) (:length state))))})))
               notes (:notes state)]
-          (recur notes (merge state {:repeat-length nil})))
+          (recur notes (merge state {:repeat-length nil
+                                     :note-octave nil})))
         state))))

 (defn play [& [notes sequencer state]]


cleanup to prepare for parsing overhaul

cleanup to prepare for parsing overhaul

--- src/snergly/core.cljs
+++ src/snergly/core.cljs
@@ -13,9 +13,9 @@

 (declare reconciler)

-(defn set-maze-params! [& kvpairs]
+(defn set-maze-params! [r-or-c & kvpairs]
   (assert (= 0 (mod (count kvpairs) 2)) "Arguments must be pairs of keys and values")
-  (om/transact! reconciler
+  (om/transact! r-or-c
                 (mapv (fn [[k v]] `(snergly.core/set-maze {:maze-key ~k :value ~v}))
                       (partition 2 kvpairs))))

@@ -23,8 +23,9 @@
   (reify protocols/UI
     (report-status [_ msg]
       (println (str "STATUS CHANGE: " msg))
-      (set-maze-params! :active msg))
-    (report-update [_ msg grid] (set-maze-params! :active msg :grid grid))))
+      (set-maze-params! reconciler :active msg))
+    (report-update [_ msg grid]
+      (set-maze-params! reconciler :active msg :grid grid))))

 ;; I shouldn't have to do this; the "right way", apparently, is to set the
 ;; ref as a property on the component.  And that works great in figwheel
@@ -132,7 +133,7 @@
                   analysis start-row start-col end-row end-col
                   active]} maze
           modify (fn [maze-key e]
-                   (om/transact! this `[(snergly.core/set-maze {:maze-key ~maze-key :value ~(aget e "target" "value")})]))
+                   (set-maze-params! this maze-key (aget e "target" "value")))
           go-async (fn [maze e]
                      (println (str "maze: " maze))
                      (protocols/start-animation (:animator maze) maze ui))


CMR-3008: Refactor code

CMR-3008: Refactor code

--- indexer-app/src/cmr/indexer/data/index_set.clj
+++ indexer-app/src/cmr/indexer/data/index_set.clj
@@ -690,21 +690,18 @@
          concept (when (= :granule concept-type) (meta-db/get-concept context concept-id revision-id))]
      (get-concept-index-names context concept-id revision-id options concept)))
   ([context concept-id revision-id {:keys [target-index-key all-revisions-index?]} concept]
-   ;; Setting all-revisions-index? to true is short hand for saying we should target the all collections
-   ;; revision index.
-   (let [target-index-key (or target-index-key (when all-revisions-index? :all-collection-revisions))
-         concept-type (cs/concept-id->type concept-id)
+   (let [concept-type (cs/concept-id->type concept-id)
          indexes (get-in (get-concept-type-index-names context) [:index-names concept-type])]
      (case concept-type
        :collection
-       ;; If a target index is specified index to just that index. Otherwise index to all collection
-       ;; indexes except for the all-collection-revisions index.
-       (if target-index-key
-          [(get indexes target-index-key)]
-          (keep (fn [[k v]]
-                  (when-not (= :all-collection-revisions (keyword k))
-                    v))
-                indexes))
+       (cond
+         target-index-key [(get indexes target-index-key)]
+         all-revisions-index? [:all-collection-revisions]
+         ;; Else index to all collection indexes except for the all-collection-revisions index.
+         :else (keep (fn [[k v]]
+                      (when-not (= :all-collection-revisions (keyword k))
+                        v))
+                     indexes))

        :tag
        [(get indexes (or target-index-key :tags))]


More robust input focus

More robust input focus

--- src/stratus/core.cljs
+++ src/stratus/core.cljs
@@ -56,3 +56,4 @@
 (om/root input {} {:target (. js/document (getElementById "input"))})

 (set-input-focus)
+(.. js/document (addEventListener "click" (fn [event] (js/setTimeout set-input-focus 10))))


Remove typo

Remove typo

--- src/swanson/utils.clj
+++ src/swanson/utils.clj
@@ -80,5 +80,3 @@
 (html/deftemplate index "swanson/views/template.html"
   [ctx]
   [:p#message] (html/content (get ctx :message "Nothing")))
-
-(index {:message "foo"})


made reading a file be resiliant to failure

--- src/duffel/fs.clj
+++ src/duffel/fs.clj
@@ -185,6 +185,11 @@
     [file-struct filename]
     (and (not (seq? file-struct)) (= (file-struct :base-name) filename)))

+(defn dump-file
+    [filename]
+    (try (slurp filename)
+    (catch java.lang.Exception e nil)))
+
 (defn merge-meta
     "Given a file-struct and some metadata merges the file-struct's meta field
     with the given metadata"
@@ -211,5 +216,5 @@
     [dir-tree local-prefix]
     (if-let [meta-file (some #(when (basename-is? % "_meta.json") %) dir-tree)]
         [ (filter #(not (basename-is? % "_meta.json")) dir-tree)
-          (slurp (str local-prefix (meta-file :full-name))) ]
+          (dump-file (str local-prefix (meta-file :full-name))) ]
         [ dir-tree "" ]))


add unpack optimization

add unpack optimization

--- src/transit/core.cljs
+++ src/transit/core.cljs
@@ -145,6 +145,11 @@
                  (forEach
                    ([coll f]
                       (doseq [[k v] coll]
-                        (f v k)))))}
+                        (f v k)))))
+               :unpack
+               (fn [x]
+                 (if (instance? cljs.core/PersistentArrayMap x)
+                   (.-arr x)
+                   false))}
           (clj->js (dissoc opts :handlers)))))))


adding an upload POST route, which should currently mock the previous api implementation

--- src/bitfondue/handler.clj
+++ src/bitfondue/handler.clj
@@ -17,6 +17,7 @@
             [buddy.auth.middleware :refer [wrap-authentication wrap-authorization]]
             (bouncer [core :as b]
                      [validators :as v])
+            [taoensso.timbre :as log]
             [bitfondue.config :as config]
             (bitfondue.models [users :as users]
                               [chunks :as chunks]))
@@ -54,11 +55,20 @@
         (ok {:token token}))
       (bad-request {:message "wrong auth data"}))))

+(defn upload
+  [request]
+  ;; make sure the body.img, body.html and body.tab_info attributes are present
+  (log/debug "received a request")
+  (spit "validated_request.edn" (b/validate (:params request)
+                                            :username v/required
+                                            :email v/required))
+
 (defroutes app-routes
   (GET "/" [] "Success!")
   (GET "/dashboard" [] home)
   (GET "/chunks" [] chunks)
   (POST "/login" [] login)
+  (POST "/upload" [] upload)
   (route/resources "/")
   (route/not-found "Not Found"))


fixed some formatting

fixed some formatting

--- src/boost_bin/handler.clj
+++ src/boost_bin/handler.clj
@@ -22,6 +22,4 @@
 (defn -main
   [& args]
   (let [port (Integer/parseInt (or (first args) "8080"))]
-    (run-jetty
-      app
-      {:port port})))
+    (run-jetty app {:port port})))


Order and group items before generating large print

--- src/catalog/web/views.clj
+++ src/catalog/web/views.clj
@@ -75,6 +75,7 @@
         editorial (db/read-editorial year issue :grossdruck)
         recommendation (db/read-recommendation year issue :grossdruck)]
     (-> (db/read-catalog year issue)
+        vubis/order-and-group
         (layout.fop/document :grossdruck editorial recommendation)
         (layout.fop/generate-pdf! temp-file))
     (-> temp-file


Cleaned up resources.clj

Cleaned up resources.clj

--- src/cfpb/qu/resources.clj
+++ src/cfpb/qu/resources.clj
@@ -43,7 +43,7 @@
 (defresource
   ^{:doc "Resource for an individual dataset."}
   dataset
-  :available-media-types ["text/html" "application/json" "application/xml"]
+  :available-media-types ["text/html" "application/json" "application/xml"]
   :method-allowed? (request-method-in :get)
   :exists? (fn [{:keys [request]}]
              (let [dataset (get-in request [:params :dataset])
@@ -70,6 +70,39 @@
                      resource (reduce #(hal/add-resource %1 "slice" %2) resource embedded)]
                  (views/dataset (:media-type representation) resource))))

+(defn- templated-url
+  "Build the templated URL for slice queries."
+  [base-href clauses]
+  (str base-href "?"
+       (str/join "&"
+                 (map
+                  (comp #(str "$" % "={?" % "}") name)
+                  clauses))))
+
+(defn- slice-resource
+  "Build a HAL resource for a slice."
+  [slice request query]
+  (let [base-href (:uri request)
+        href (url-like (if-let [query-string (:query-string request)]
+                         (str base-href "?" query-string)
+                         base-href))
+        result (:result query)
+        clauses (map (comp keyword :key) views/clauses)
+        page (:page query)]
+    (-> (hal/new-resource href)
+        (hal/add-link :rel "up" :href (urls/dataset-path dataset))
+        (hal/add-link :rel "query"
+                      :href (templated-url base-href clauses)
+                      :templated true)
+        (hal/add-properties {:dataset dataset
+                             :slice (name slice)
+                             :size (:size result)
+                             :total (:total result)
+                             :page page
+                             :query (select-keys query clauses)
+                             :dimensions (:dimensions query)
+                             :results (:data result)}))))
+
 (defresource
   ^{:doc "Resource for an individual slice."}
   slice
@@ -95,30 +128,8 @@
                      slicedef (get-in metadata [:slices slice])
                      query (params->Query (:params request) slicedef)
                      query (query/execute dataset (:table slicedef) query)
-                     base-href (:uri request)
-                     href (url-like (if-let [query-string (:query-string request)]
-                                      (str base-href "?" query-string)
-                                      base-href))
-                     result (:result query)
-                     clauses (map (comp keyword :key) views/clauses)
-                     page (:page query)
-                     resource (-> (hal/new-resource href)
-                                  (hal/add-link :rel "up" :href (urls/dataset-path dataset))
-                                  (hal/add-link :rel "query"
-                                                :href
-                                                (str base-href "?"
-                                                     (str/join "&"
-                                                      (map
-                                                       (comp #(str "$" % "={?" % "}") name)
-                                                       clauses)))
-                                                :templated true)
-                                  (hal/add-properties {:dataset dataset :slice (name slice)})
-                                  (hal/add-properties {:size (:size result) :total (:total result)})
-                                  (hal/add-property :page page)
-                                  (hal/add-property :query (select-keys query clauses))
-                                  (hal/add-property :dimensions (:dimensions query))
-                                  (hal/add-property :results (:data result)))
-                     view-map {:base-href base-href
+                     resource (slice-resource slice request query)
+                     view-map {:base-href (:uri request)
                                :metadata metadata
                                :slicedef slicedef
                                :headers headers


GitHub Issue #33 - persist theme changes from paused state

--- src/client/game/core.cljs
+++ src/client/game/core.cljs
@@ -519,16 +519,17 @@
 (defn resume-game!
   "Restores the state of the board pre-pausing, and resumes gravity"
   []
-  (reset! state @paused-board)
-
-  ;; NOTE: this is just a quick hack to make the modal disappear after the
-  ;;   scramble board is gone
-  ;; it was jarring visually otherwise
-  (js/setTimeout hide-paused-modal! 20)
-
-  (go-go-gravity!)
-  (reset! paused? false)
-  (reset! music-playing? @paused-music))
+  (let [merge-paused-theme #(merge @paused-board {:theme (:theme %)})]
+    (swap! state merge-paused-theme)
+
+    ;; NOTE: this is just a quick hack to make the modal disappear after the
+    ;;   scramble board is gone
+    ;; it was jarring visually otherwise
+    (js/setTimeout hide-paused-modal! 20)
+
+    (go-go-gravity!)
+    (reset! paused? false)
+    (reset! music-playing? @paused-music)))

 (defn pause-game!
   "Saves the current state of the board, loads the game-over animation and pauses gravity"


CLJS-978: Analysis caching doesn't account for constants table

`cljs.analyzer/register-constant!` now takes an optional analysis
`env`. If supplied will use the current ns to add this to the
`:cljs.analyzer/constants` set for the namespace.

when reading analysis cache off disk in `cljs.analyzer/analyze-file`
add all constants in `:cljs.analyzer/constants` back to the
compilation environment via `cljs.analyzer/register-constant!`

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -204,12 +204,20 @@
                    (Exception. (str "constant type " (type value) " not supported"))))]
     (symbol (str prefix (swap! constant-counter inc)))))

-(defn- register-constant! [val]
-  (swap! env/*compiler* update-in [::constant-table]
-    (fn [table]
-      (if (get table val)
-        table
-        (assoc table val (gen-constant-id val))))))
+(defn- register-constant!
+  ([val] (register-constant! nil val))
+  ([env val]
+   (swap! env/*compiler*
+     (fn [cenv]
+       (cond->
+         (-> cenv
+           (update-in [::constant-table]
+             (fn [table]
+               (if (get table val)
+                 table
+                 (assoc table val (gen-constant-id val))))))
+         env (update-in [::namespaces (-> env :ns :name) ::constants]
+               (fnil conj #{}) val))))))

 (def default-namespaces '{cljs.core {:name cljs.core}
                           cljs.user {:name cljs.user}})
@@ -469,7 +477,7 @@
 ;; TODO: move this logic out - David
 (defn analyze-keyword
   [env sym]
-  (register-constant! sym)
+  (register-constant! env sym)
   {:op :constant :env env :form sym :tag 'cljs.core/Keyword})

 (defn get-tag [e]
@@ -1994,7 +2002,11 @@
                           :load-macros true}))]
                  (when (or *verbose* (:verbose opts))
                    (util/debug-prn "Reading analysis cache for " res))
-                 (swap! env/*compiler* assoc-in [::analyzed-cljs path] true)
-                 (swap! env/*compiler* assoc-in [::namespaces ns]
-                   (edn/read-string (slurp cache))))))))))))
-
+                 (swap! env/*compiler*
+                   (fn [cenv]
+                     (let [cached-ns (edn/read-string (slurp cache))]
+                       (doseq [x (::constants cached-ns)]
+                         (register-constant! x))
+                       (-> cenv
+                         (assoc-in [::analyzed-cljs path] true)
+                         (assoc-in [::namespaces ns] cached-ns))))))))))))))


oops!

oops!

--- src/clj/tictag/server.clj
+++ src/clj/tictag/server.clj
@@ -65,7 +65,7 @@
          (format
           "<Response><Message>Updated ping with timestamp %s, old pings: %s, new pings: %s</Message></Response>"
           (:timestamp last-ping)
-          (pr-str (:tags last-pings))
+          (pr-str (:tags last-ping))
           (pr-str (set args))))))))

 (def sms


uff, remove todos that were never supposed to be committed

--- src/cljs/fatlip/core.cljs
+++ src/cljs/fatlip/core.cljs
@@ -1,13 +1,3 @@
-;; Account for danglers
-;; Check out alternative ordering heuristics, ie Junger and Mutzel. Look for more recent research.
-;; switch to new cljs.test
-;; pre/post conditions
-;; herbert
-;; support multi-section character paths
-;; separate core into logical subsections; ie, order, plot, draw
-;; figure out public api protocols
-;; short circuiting can't rely on initial layer... has to do whole graph
-
 (ns fatlip.core
   (:require [fatlip.sparse :refer [input->SparseGraph]]
             [fatlip.order :refer [SparseGraph->FlatGraph]]


FIX: mesh (+ reformat)

FIX: mesh (+ reformat)

--- src/clojure/yaw/scene.clj
+++ src/clojure/yaw/scene.clj
@@ -13,14 +13,14 @@
   "Returns a rgb tuple from a keyword color"
   [color]
   (case color
-      :black [0 0 0]
-      :red [1 0 0]
-      :blue [0 0 1]
-      :green [0 1 0]
-      :yellow [1 1 0]
-      :cyan [0 1 1]
-      :magenta [1 0 1]
-      :white [1 1 1]))
+    :black [0 0 0]
+    :red [1 0 0]
+    :blue [0 0 1]
+    :green [0 1 0]
+    :yellow [1 1 0]
+    :cyan [0 1 1]
+    :magenta [1 0 1]
+    :white [1 1 1]))

 (defn color
   "Returns a rgb tuple from any sort of color"
@@ -56,16 +56,18 @@
                      :scale (:scale skybox)
                      :color (color (:color skybox))))
     (let [items (reduce item-map empty-item-map items)]
-      (println items)
       (run! (fn [[k v]]
-              (let [m (apply w/create-simple-mesh! world (mesh/mesh (:mesh v)) )
-                    i (w/create-item! world :id (str k)
-                                      :position (get v :pos [0 0 0])
-                                      :scale (get v :scale 1))]
+              (let [m (mesh/mesh (:mesh v))
+                    m (w/create-simple-mesh!
+                       world
+                       :geometry m
+                       :rgb (color (second (get v :mat [0 0 0]))))
+                    i (w/create-item!
+                       world
+                       :id (str k)
+                       :position (get v :pos [0 0 0])
+                       :scale (get v :scale 1)
+                       :mesh m)]
                 (apply w/rotate! i (explode (get v :rot [0 0 0])))))
             (:items items)))))

-
-(display [:scene {:skybox {:color :red :scale [30 30 30]}}
-          [:item :test/box {:mesh :mesh/box :color :white :pos [0 0 -5] :rot [0 45 0]}]])
-


Make translate-coords parametrizable with operation.

--- src/uxbox/shapes.cljs
+++ src/uxbox/shapes.cljs
@@ -144,10 +144,12 @@
 (defn translate-coords
   "Given a shape and initial coords, transform
   it mapping its coords to new provided initial coords."
-  [shape x y]
-  (let [x' (:x shape)
-        y' (:y shape)]
-    (assoc shape :x (- x' x) :y (- y' y))))
+  ([shape x y]
+   (translate-coords shape x y -))
+  ([shape x y op]
+   (let [x' (:x shape)
+         y' (:y shape)]
+     (assoc shape :x (op x' x) :y (op y' y)))))

 (defn resolve-position
   "Recursively resolve the real shape position in


Require manifold.stream before using Manifold's IEventSource (#272)

The manifold.stream.core namespace needs to be required before
referencing the interface.

Fixes #271

--- src/yada/resource.clj
+++ src/yada/resource.clj
@@ -5,6 +5,7 @@
    [hiccup.core :refer [html]]
    [schema.core :as s]
    [schema.utils :as su]
+   [manifold.stream]
    [yada.charset :as charset]
    [yada.context :refer [content-type]]
    [yada.schema :as ys]


minor fix

minor fix

--- src/ysmiraak/lang.clj
+++ src/ysmiraak/lang.clj
@@ -1,10 +1,6 @@
 (ns ysmiraak.lang)

-;; goals
-;; 1. unify exprs and types (basic constructors shared by types and data)
-;; 2. unify composition and application (????)
-;; 3. compositional lambda calculus (variables and their evaluation rules)
-;; 4. asap beta reduction (partial evaluation)
+;; https://ncatlab.org/nlab/show/pure+type+system

 (defrecord V [name])            (defn v? [x] (instance? V x))
 (defrecord A [vars form])       (defn a? [x] (instance? A x))
@@ -53,7 +49,7 @@
                   (ev expr dict)
                   (subvec args size))
             (throw (ex-info "arity error" {:args args :vals body}))))
-        (let [vars (reduce disj vars (keys dict))]
+        (let [vars (apply clojure.set/union (map fv form))]
           (if (seq vars) ; defer application
             (A. vars form)
             (apply head body))))))
@@ -127,6 +123,8 @@
   (= 4 (? (% (? apply ? chi [2]) a) 2))

   ;; swap var
+  (= (% (? psi b c) b c)
+     (% (? + b c) b c))
   (= (?% (? + a b) a b)
      (? + b b))

@@ -144,55 +142,3 @@
   ;; todo test recursion

   )
-
-(comment ; todo goal 1
-
-  ;; let
-  ;; - A B C be types
-  ;; - a b c be variables
-  ;; - x y z be values
-
-  ;; types all the way down
-  ($ Type A x nil)
-
-  ;; A -> B
-  ($ Type
-     (%'   A       B)
-     (% ($ A a) ($ B (... a ...)))
-     nil)
-
-  ;; forall (a : A) . C(a)
-  ($ Type
-     (%'   A       Type)
-     (% ($ A a)    (C a))
-     (% ($ A a) ($ (C a) (... a ...)))
-     nil)
-
-  ;; forall (a : A , b : B) . C(a)
-  ($ Type
-     (%'   A       Type    Type)
-     (% ($ A a)    B       (C a))
-     (% ($ A a) ($ B b) ($ (C a) (... a ... b ...)))
-     nil)
-
-  ;; exists (a : A , b : B) . C(a)
-  ($ Type
-     (&'   A       Type    Type)
-     (& ($ A a)    B       (C a))
-     (& ($ A x) ($ B y) ($ (C x) (... x ... y ...)))
-     nil)
-
-  ;; exists (a : A) . C(a)
-  ($ Type
-     (&'   A       Type)
-     (& ($ A a)    (C a))
-     (& ($ A x) ($ (C x) (... x ...)))
-     nil)
-
-  ;; (A, B)
-  ($ Type
-     (&    A       B)
-     (& ($ A x) ($ B y))
-     nil)
-
-  )


Moar async.

Moar async.

--- src/datascript/query.cljs
+++ src/datascript/query.cljs
@@ -18,6 +18,15 @@

 ;; Utilities
+(defn async-reduce [reducer-function initial-value collection callback]
+  (let [accumulator (atom initial-value)
+        items-processed (atom 0)]
+    (doseq [item collection]
+      (reducer-function accumulator item (fn [result]
+                                            (swap! accumulator (fn [] result)) ; cheating a bit in the update function
+                                            (swap! items-processed inc)
+                                            (if (= @items-processed (count collection))
+                                              (callback @accumulator)))))))

 (defn intersect-keys [attrs1 attrs2]
   (set/intersection (set (keys attrs1))
@@ -436,18 +445,20 @@
       (let [relation (lookup-pattern context clause)]
         (update-in context [:rels] collapse-rels relation))))

-(defn resolve-clause [context clause]
-  (if (rule? context clause)
-    (let [[source rule] (if (source? (first clause))
-                          [(first clause) (next clause)]
-                          ['$ clause])
-          source (get-in context [:sources source])
-          rel    (solve-rule (assoc context :sources {'$ source}) rule)]
-      (update-in context [:rels] collapse-rels rel))
-    (-resolve-clause context clause)))
+;TODO not really sure it is valid to replace all these context's with @context's, but it seems to work
+(defn resolve-clause [context clause callback]
+  (callback
+    (if (rule? @context clause)
+      (let [[source rule] (if (source? (first clause))
+                            [(first clause) (next clause)]
+                            ['$ clause])
+            source (get-in @context [:sources source])
+            rel    (solve-rule (assoc @context :sources {'$ source}) rule)]
+        (update-in @context [:rels] collapse-rels rel))
+      (-resolve-clause @context clause))))

 (defn -q [context clauses callback]
-  (callback (reduce resolve-clause context clauses)))
+  (async-reduce resolve-clause context clauses callback))

 (defn -collect
   ([context symbols]


WIP add comment to REPL about how to start the API server

--- ssclj/jar/project.clj
+++ ssclj/jar/project.clj
@@ -46,6 +46,23 @@
                  [jonase/eastwood                           "0.2.1"]
                  [lein-cloverage                            "1.0.3"]]

+  :repl-options {;; What to print when the repl session starts.
+                :welcome
+                (println (str
+                  ;; These first lines are the default ones:
+                  "\n"
+                  "      Docs: (doc function-name-here)\n"
+                  "            (find-doc \"part-of-name-here\")\n"
+                  "    Source: (source function-name-here)\n"
+                  "   Javadoc: (javadoc java-object-or-class-here)\n"
+                  "      Exit: Control+D or (exit) or (quit)\n"
+                  "   Results: Stored in vars *1, *2, *3, an exception in *e\n"
+                  "\n"
+                  ;; This line is related to the SlipStream project:
+                  "API Server: (require '[com.sixsq.slipstream.ssclj.app.server :as server])\n"
+                  "            (def state (server/start 8201))\n"))
+                }
+
   :profiles {
     :provided
       { :dependencies [[reply/reply "0.3.4"]]}


let it sleep for a while

let it sleep for a while

--- src/epicea/typed/core.clj
+++ src/epicea/typed/core.clj
@@ -203,11 +203,18 @@
 (assert (= 4 (vec-size v0)))
 (assert (= 3 (vec-size v1)))

-
 ;(defmultiple export-typed-value first
 ;  (:primitive [x] (export-primitive x)))
-(defn export-typed-value [x]
-  [:export x])
+;; (defn export-typed-value [x]
+;;   (let [h (get-type-head x)
+;;         b (get-type-body x)]
+;;     (cond
+;;       (contains? primitive-values h) (get-primitive-value b)
+;;       (= h :record) (export-record b)
+;;       (= h :vec) (export-vec b)
+;;       :default x)))
+
+

 ;; How to specify one:


Uniformly change taxi-infinite to make upper-right a goal

--- src/exp/taxi_infinite.clj
+++ src/exp/taxi_infinite.clj
@@ -70,7 +70,8 @@
  env/FactoredEnv
   (goal-map []
     (into {}
-      (apply concat
+      (apply concat
+        [[['atx] width] [['aty] height]]
         (for [[pass _ [dx dy]] passengers]
           [[['passx pass] dx] [['passy pass] dy]])))))

@@ -167,7 +168,7 @@
                                      [(str "(passx " n " x" sx ")")
                                       (str "(passy " n " y" sy ")")])))
          "  )
-           (:goal (and "
+           (:goal (and "  (str "(at " width "-" height ")")
               (util/str-join " " (apply concat
                                    (for [[n _ [dx dy]] passengers]
                                      [(str "(passx " n " x" dx ")")
@@ -258,7 +259,7 @@
               (util/str-join " " (for [[n [sx sy]] passengers]
                                    (str "(passat " n " " sx "-" sy ")")))
               ")
-           (:goal (and (at 1-1)"
+           (:goal (and " (str "(at " width "-" height ")")
               (util/str-join " " (for [[n _ [dx dy]] passengers]
                                    (str "(passat " n " " dx "-" dy ")")))
               ")))"]))))


Implemented basic (sub-) process execution functions.

--- src/fm/simrunner/exec.clj
+++ src/fm/simrunner/exec.clj
@@ -3,9 +3,30 @@

   "Utilities for the Execution of Processes."

-    :author "Frank Mosebach"})
+    :author "Frank Mosebach"}
+  (:require
+    [clojure.java.io :as jio])
+  (:import
+    (java.io InputStream PrintWriter)))

-(defn exec
-  "TODO: spawn a process, drain its ouput, wait for termination..."
-  [])
+(defn write-lines [^InputStream source ^PrintWriter target]
+  (with-open [reader (jio/reader source)]
+    (doseq [line (line-seq reader)]
+      (.println target line))))

+(defn out>-system-out [out]
+  (write-lines out *out*))
+
+(defn err>-system-err [err]
+  (write-lines err *err*))
+
+(defn exec [path & args]
+  (.start (ProcessBuilder. (into-array (cons path args)))))
+
+(defn drain-outputs
+  [process & {:keys [out> err>]
+              :or {out> out>-system-out err> err>-system-err}}]
+  (future (out> (.getInputStream process)))
+  (future (err> (.getErrorStream process)))
+  nil)
+


Display as an example the function exposed in the 'fnx.meta.example.clj namespace.

--- src/fnx/views/welcome.clj
+++ src/fnx/views/welcome.clj
@@ -31,3 +31,15 @@
    [:h2 (str "Display range from " start " to " end)]
    [:p#wrapper (map #(str % "
")
                     (range (read-string start) (read-string end)))]))
+
+;; A page to expose some functions from a fixed namespace fnx.meta.example
+(defpage "/expose" {:keys [ns] :as user}
+  (let [n (if (empty? ns) 'fnx.meta.example (symbol ns))
+        title (str "Exposed functions in " n)]
+    (common/site-layout
+     title
+     [:h1 title]
+     [:p#wrapper (let [f (fnx.meta.expose/ns-public-fn n)]
+                   (if f
+                     (map #(str "" % "
") f)
+                     (str "No function exposed in " n)))])))


Generate full namespace for real.

Generate full namespace for real.

Improve the `generate-ns` function to actually go over all the
methods. Issue #3

--- src/gogolica/generate.clj
+++ src/gogolica/generate.clj
@@ -13,7 +13,7 @@
             [cheshire.core :refer [generate-string parse-string]]
             [camel-snake-kebab.core :refer :all]))

-(defn generate-ns-sexp
+(defn generate-ns-declaration
   "Generates the ns declaration for an API.
   Takes name, version, description and docs link, all strings."
   [name version desc docs-link]
@@ -130,22 +130,27 @@
      (~'println ~(generate-request httpMethod path parameters))
     (~'http/request ~(generate-request httpMethod path parameters))))

-(defn generate-ns-file
+(defn pprint-symbols
+  [symbols]
+  (-> symbols
+      (f/pprint {:width 100}) ;; Fipp pretty prints clojure code nicely
+      with-out-str))
+
+(defn generate-ns
   "Given a service model, generates a clojure namespace with the implementation
-  of all the API methods as functions, and writes it to file."
+   of all the API methods as functions and returns it as a pretty string."
   [{:keys [name version description documentationLink rootUrl servicePath]
     :as model}]
-  (let [symbols->str #(-> %
-                          (f/pprint {:width 100}) ;; Fipp pretty prints clojure code nicely
-                          with-out-str)]
-    (->> [[(generate-ns-sexp name version description documentationLink)]
-          (generate-global-vars rootUrl servicePath)
-          [(generate-function-from-method
-            (-> model/storage-model :resources :buckets :methods :insert))
-           (generate-function-from-method
-            (-> model/storage-model :resources :buckets :methods :list))
-           (generate-function-from-method model/storage-object-get)]]
-          ;;(mapv generate-function-from-method ;; TODO get all the methods)])))
-         (apply concat) ;; <- this is for flattening the methods
-         (mapv symbols->str)
+  (let [ns-declaration (generate-ns-declaration name version description documentationLink)
+        global-vars (generate-global-vars rootUrl servicePath)
+        functions (->> (:resources model)
+                       (mapcat
+                        (fn [[resource-id resource]]
+                          (for [[method-id method] (:methods resource)]
+                            (generate-function-from-method method)))))]
+    (->> (concat
+          [ns-declaration]
+          global-vars
+          functions)
+         (map pprint-symbols)
          (str/join "\n\n"))))


master: Maybe 1 is 0

master: Maybe 1 is 0

--- functions/test/wort/core_test.clj
+++ functions/test/wort/core_test.clj
@@ -4,7 +4,7 @@

 (deftest a-test
   (testing "FIXME, I fail."
-    (is (= 1 1))))
+    (is (= 1 0))))

 (deftest splits_on_whitespace
   (is (= ["a" "test"] (get_words_from_key {"key" "a test"} "key")))


branchings2d.clj: better bounds and faster tests.

--- clojure/org/gavrog/clojure/branchings2d.clj
+++ clojure/org/gavrog/clojure/branchings2d.clj
@@ -3,21 +3,33 @@
           [generators :only [make-backtracker results]]
           [delaney])))

-(defn branchings [d-set min-face-degree min-vert-degree min-curvature]
+(defn branchings
+  [d-set & {:keys [face-sizes-at-least
+                   vertex-degrees-at-least
+                   curvature-at-least
+                   try-spins]
+            :or {face-sizes-at-least 3
+                 vertex-degrees-at-least 3
+                 curvature-at-least 0
+                 try-spins [1 2 3 4 6]}}]
   (let [ds (canonical d-set)
-        good-degree (fn [i D v]
-                      (cond (= 0 i) (<= min-face-degree (* v (r ds 0 1 D)))
-                            (= 1 i) (<= min-vert-degree (* v (r ds 1 2 D)))))]
+        new-curvature (fn [c s v] (+ c (* (if s 2 1) (- (/ v) 1))))
+        still-good (fn [c i D r s v]
+                     (and (<= curvature-at-least (new-curvature c s v))
+                          (cond (= 0 i) (<= face-sizes-at-least (* r v))
+                                (= 1 i) (<= vertex-degrees-at-least (* r v)))))]
     (make-backtracker
-      {:root (let [orbs (for [i [0 1], D (orbit-reps ds [i (inc i)])] [i D])]
-               [ds (into #{} orbs)])
-       :extract (fn [[ds unused]]
-                  (when (and (empty? unused)
-                             (canonical? ds)
-                             (<= min-curvature (curvature ds)))
+      {:root (let [orbs (for [i [0 1] :let [j (inc i)]
+                              D (orbit-reps ds [i j])]
+                          [i D (r ds i j D) (orbit-loopless? ds [i j] D)])]
+               [ds (curvature ds 1) (into #{} orbs)])
+       :extract (fn [[ds c unused]]
+                  (when (and (empty? unused) (canonical? ds))
                     ds))
-       :children (fn [[ds unused]]
-                   (when-let [[i D] (first unused)]
-                     (for [v [1 2 3 4 6]
-                           :when (good-degree i D v)]
-                       [(spin ds i (inc i) D v) (disj unused [i D])])))})))
+       :children (fn [[ds c unused]]
+                   (when-let [[i D r s] (first unused)]
+                     (for [v try-spins
+                           :when (still-good c i D r s v)]
+                       [(spin ds i (inc i) D v)
+                        (new-curvature c s v)
+                        (disj unused [i D r s])])))})))


(TK-3) Rename WebserverServiceContext schema

Rename WebserverServiceContext schema to ServerContext, as this
will now represent the context for a single server within the list
of servers.

--- src/puppetlabs/trapperkeeper/services/webserver/jetty9_core.clj
+++ src/puppetlabs/trapperkeeper/services/webserver/jetty9_core.clj
@@ -62,7 +62,7 @@
                                        config/WebserverSslPemConfig)
    (schema/optional-key :callback-fn) (schema/pred ifn?)})

-(def WebserverServiceContext
+(def ServerContext
   {:state     Atom
    :handlers  ContextHandlerCollection
    :server    (schema/maybe Server)})
@@ -107,14 +107,14 @@
 (schema/defn ^:always-validate started? :- Boolean
   "A predicate that indicates whether or not the webserver-context contains a Jetty
   Server object."
-  [webserver-context :- WebserverServiceContext]
+  [webserver-context :- ServerContext]
   (instance? Server (:server webserver-context)))

 (schema/defn ^:always-validate
   merge-webserver-overrides-with-options :- config/WebserverServiceRawConfig
   "Merge any overrides made to the webserver config settings with the supplied
    options."
-  [webserver-context :- WebserverServiceContext
+  [webserver-context :- ServerContext
    options :- config/WebserverServiceRawConfig]
   (let [overrides (:overrides (swap! (:state webserver-context)
                                      assoc
@@ -189,7 +189,7 @@
 (schema/defn ^:always-validate
   create-server :- Server
   "Construct a Jetty Server instance."
-  [webserver-context :- WebserverServiceContext
+  [webserver-context :- ServerContext
    config :- config/WebserverServiceConfig]
   (let [server (Server. (QueuedThreadPool. (:max-threads config)))]
     (when (:http config)
@@ -243,7 +243,7 @@

 (schema/defn ^:always-validate
   add-handler :- ContextHandler
-  [webserver-context :- WebserverServiceContext
+  [webserver-context :- ServerContext
    handler :- ContextHandler]
   (.addHandler (:handlers webserver-context) handler)
   handler)
@@ -263,7 +263,7 @@
   proxy-servlet :- ProxyServlet
   "Create an instance of Jetty's `ProxyServlet` that will proxy requests at
   a given context to another host."
-  [webserver-context :- WebserverServiceContext
+  [webserver-context :- ServerContext
    target :- ProxyTarget
    options :- ProxyOptions]
   (let [custom-ssl-ctxt-factory (when (map? (:ssl-config options))
@@ -307,7 +307,7 @@
 ;;; Public

 (schema/defn ^:always-validate
-  initialize-context :- WebserverServiceContext
+  initialize-context :- ServerContext
   "Create a webserver-context which contains a HandlerCollection and a
   ContextHandlerCollection which can accept the addition of new handlers
   before the webserver is started."
@@ -322,7 +322,7 @@
   merge-webserver-overrides-with-options :- config/WebserverServiceRawConfig
   "Merge any overrides made to the webserver config settings with the supplied
    options."
-  [webserver-context :- WebserverServiceContext
+  [webserver-context :- ServerContext
    options :- config/WebserverServiceRawConfig]
   {:post [(map? %)]}
   (let [overrides (:overrides (swap! (:state webserver-context)
@@ -334,13 +334,13 @@
     (merge options overrides)))

 (schema/defn ^:always-validate shutdown
-  [webserver-context :- WebserverServiceContext]
+  [webserver-context :- ServerContext]
   (when (started? webserver-context)
     (log/info "Shutting down web server.")
     (.stop (:server webserver-context))))

 (schema/defn ^:always-validate
-  create-webserver :- WebserverServiceContext
+  create-webserver :- ServerContext
     "Create a Jetty webserver according to the supplied options:

     :host         - the hostname to listen on
@@ -369,7 +369,7 @@
                      :want or :none (defaults to :need)
     :cipher-suites - list of cryptographic ciphers to allow for incoming SSL connections
     :ssl-protocols - list of protocols to allow for incoming SSL connections"
-  [webserver-context :- WebserverServiceContext
+  [webserver-context :- ServerContext
    options :- config/WebserverServiceRawConfig]
   {:pre  [(map? options)]
    :post [(started? %)]}
@@ -383,10 +383,10 @@
     (.setHandler s (gzip-handler hc))
     (assoc webserver-context :server s)))

-(schema/defn ^:always-validate start-webserver! :- WebserverServiceContext
+(schema/defn ^:always-validate start-webserver! :- ServerContext
   "Creates and starts a webserver.  Returns an updated context map containing
   the Server object."
-  [webserver-context :- WebserverServiceContext
+  [webserver-context :- ServerContext
    config :- config/WebserverServiceRawConfig]
   (let [webserver-context (create-webserver webserver-context config)]
     (log/info "Starting web server.")
@@ -405,7 +405,7 @@
   "Add a static content context handler (allow for customization of the context handler through javax.servlet.ServletContextListener implementations)"
   ([webserver-context base-path context-path]
    (add-context-handler webserver-context base-path context-path nil))
-  ([webserver-context :- WebserverServiceContext
+  ([webserver-context :- ServerContext
     base-path :- schema/Str
     context-path :- schema/Str
     context-listeners :- (schema/maybe [ServletContextListener])]
@@ -419,7 +419,7 @@

 (schema/defn ^:always-validate
   add-ring-handler :- ContextHandler
-  [webserver-context :- WebserverServiceContext
+  [webserver-context :- ServerContext
    handler :- (schema/pred ifn? 'ifn?)
    path :- schema/Str]
   (let [ctxt-handler (doto (ContextHandler. path)
@@ -430,7 +430,7 @@
   add-servlet-handler :- ContextHandler
   ([webserver-context servlet path]
    (add-servlet-handler webserver-context servlet path {}))
-  ([webserver-context :- WebserverServiceContext
+  ([webserver-context :- ServerContext
     servlet :- Servlet
     path :- schema/Str
     servlet-init-params :- {schema/Any schema/Any}]
@@ -446,7 +446,7 @@
   "Registers a WAR to Jetty. It takes two arguments: `[war path]`.
   - `war` is the file path or the URL to a WAR file
   - `path` is the URL prefix at which the WAR will be registered"
-  [webserver-context :- WebserverServiceContext
+  [webserver-context :- ServerContext
    war :- schema/Str
    path :- schema/Str]
   (let [handler (doto (WebAppContext.)
@@ -467,7 +467,7 @@
   two arguments, `[proxy-req req]`. For more information see
   README.md/#callback-fn.)
   "
-  [webserver-context :- WebserverServiceContext
+  [webserver-context :- ServerContext
    target :- ProxyTarget
    path :- schema/Str
    options :- ProxyOptions]
@@ -499,7 +499,7 @@

     When the value of :type is :proxy, the endpoint information will be
     an instance of ProxyEndpoint."
-   [webserver-context :- WebserverServiceContext]
+   [webserver-context :- ServerContext]
    (:endpoints @(:state webserver-context)))

 (schema/defn ^:always-validate
@@ -547,7 +547,7 @@
    If a call is made to this function after webserver startup or after another
    call has already been made to this function (e.g., from other service),
    a java.lang.IllegalStateException will be thrown."
-  [webserver-context :- WebserverServiceContext
+  [webserver-context :- ServerContext
    overrides :- config/WebserverServiceRawConfig]
   ; Might be worth considering an implementation that only fails if the caller
   ; is trying to override a specific option that has been overridden already
@@ -580,7 +580,7 @@
                         "already been set")))))))

 (schema/defn ^:always-validate join
-  [webserver-context :- WebserverServiceContext]
+  [webserver-context :- ServerContext]
   {:pre [(started? webserver-context)]}
   (.join (:server webserver-context)))


minor

minor

--- jar-prslib/src/clj/sixsq/slipstream/prs/core.clj
+++ jar-prslib/src/clj/sixsq/slipstream/prs/core.clj
@@ -10,8 +10,6 @@

 (defn- call-prs
   [body endpoint & [http-params]]
-  (println "call PRS: " http-params)
-  (println "body: "  body)
   (:body (http/put endpoint (merge {:body body} http-params))))