getting dummy latest result list

getting dummy latest result list

--- src/ontrail/exercise.clj
+++ src/ontrail/exercise.clj
@@ -1,22 +1,50 @@
 (ns ontrail.exercise
-  (:use ontrail.mongodb ontrail.formats))
-
-(require '[monger.conversion]
-         '[clj-time.core :as time]
-         '[monger.joda-time]
-         '[monger.collection :as mc])
-
-(import [org.bson.types ObjectId])
+  (:use ontrail.mongodb ontrail.formats
+        monger.operators)
+  (:require [monger.collection :as mc]
+            [clj-time.core :as time]
+            [monger.query :as mq]
+            [monger.joda-time]
+            [net.cgrand.enlive-html :as html])
+  (:import [org.bson.types ObjectId]))

 (defn get-heart-rate-reserve [exercise user-profile]
   (let [resthr (get user-profile :resthr)
         maxhr (get user-profile :maxhr)
         avghr (get exercise :avghr)]
-    (println (format "hr res: %d %d %d" resthr maxhr avghr))
     (if (and (not-nil? user-profile) (positive-numbers? (list resthr maxhr avghr)))
       (str (int (+ 0.5 (* 100.0 (/ (- avghr resthr) (- maxhr resthr))))) "%")
       "")))
-
+
+(defn as-ex-result [result]
+  (let [pace (get-pace {:duration (get result :duration)
+                        :distance (get result :distance)
+                        :sport (get result :sport)})
+        duration (to-human-time (get result :duration))
+        distance (to-human-distance (get result :distance))
+        truncated-body (get result :body)
+        id (get result :_id)
+        sport (get result :sport)
+        comment-count (count (get result :comments))]
+    {:pace pace
+     :duration duration
+     :distance distance
+     :body truncated-body
+     :sport sport
+     :id id
+     :comment-count comment-count}))
+
+(defn as-ex-result-list [results]
+  (map as-ex-result results))
+
+(defn get-latest-ex-list [stream-name page]
+  (let [results (mq/with-collection EXERCISE
+               (mq/find {})
+               (mq/fields [ :_id :heading :body :duration :distance :sport :date :comments ])
+               (mq/limit 30)
+               (mq/sort {:date 1}))]
+    (as-ex-result-list results)))
+
 (defn get-ex [id]
   (let [exercise (mc/find-one-as-map EXERCISE {:_id (ObjectId. id)})
         user-profile (get (mc/find-one-as-map ONUSER {:username (get exercise :user)}) :profile)


forgot to add :start to list of possible values

--- sidecar/src/figwheel_sidecar/schemas/config.clj
+++ sidecar/src/figwheel_sidecar/schemas/config.clj
@@ -212,7 +212,7 @@

   :validate-config false")

-(def-key ::validate-interactive (some-fn boolean? #{:fix :quit})
+(def-key ::validate-interactive (some-fn boolean? #{:fix :quit :start})
   "Because build startup time is significant Figwheel offers the
 opportunity for you to fix you configuration problems interactively.
 In some develeopment environments this is not desirable. In this case


Ignore deployment files ending in ‘.template’. This allows deployment descriptor template files to be (e.g. git commit) in the deployment directory, without the deployer activating these.

--- src/containium/deployer.clj
+++ src/containium/deployer.clj
@@ -33,7 +33,7 @@
 ;;; File system implementation.

 ;;---TODO Replace regexes with simpler/faster .endsWith calls?
-(def ^:private descriptor-files-re #"[^\.]((?!\.(activate|status|deactivated)$).)+")
+(def ^:private descriptor-files-re #"[^\.]((?!\.(activate|status|deactivated|template)$).)+")
 (def ^:private activate-files-re   #"[^\.].*\.activate")


buffers/view-buffer: use smaller width and height for generated view (400px x 320px)

--- src/overtime/buffers.clj
+++ src/overtime/buffers.clj
@@ -43,7 +43,7 @@
     (-> (ot/num-frames buf)
         range
         (incanter.charts/xy-plot buf-vals :title (str (name category) " buffer: " (name key)) :x-label "range" :y-label "buffer vals")
-        incanter.core/view)))
+        (incanter.core/view :width 400 :height 320))))

 (defn view-category-buffers
   "View buffer as X/Y plot using Incanter view"


only skip the cursor forward for semicolon (close #18)

--- src/parinfer/editor.cljs
+++ src/parinfer/editor.cljs
@@ -62,7 +62,8 @@
           from-x (.. change -from -ch)
           line-no (.. change -from -line)
           line (.getLine cm line-no)
-          insert-x (.indexOf line text from-x)]
+          insert-x (.indexOf line text from-x)
+          after-x (+ insert-x (count text))]
       (cond
         ;; something is selected, don't touch the cursor
         selection?
@@ -76,9 +77,13 @@
         (= -1 insert-x)
         (.setCursor cm line-no from-x)

-        ;; move cursor to after the typed characters were found.
-        :else
-        (.setCursor cm line-no (+ insert-x (count text)))))))
+        ;; only move the semicolon ahead since it can be pushed forward by
+        ;; commenting out inferred parens meaning they are immediately
+        ;; reinserted behind it.
+        (= text ";")
+        (.setCursor cm line-no after-x)
+
+        :else nil))))

 ;;----------------------------------------------------------------------
 ;; Life Cycle events


fix :pomegranate key

fix :pomegranate key

--- src/tailrecursion/boot.clj
+++ src/tailrecursion/boot.clj
@@ -22,7 +22,7 @@
   (atom {:boot {:dependencies #{}
                 :directories #{}
                 :repositories #{}
-                {:pomegranate {:installed #{}}}}}))
+                :pomegranate {:installed #{}}}}))

 (def ^:dynamic *default-repositories*
   #{"http://repo1.maven.org/maven2/"
@@ -37,7 +37,7 @@
     (swap! env (partial merge-with into)
            {:boot {:dependencies deps
                    :repositories repos
-                   {:pomegranate {:installed installed}}}})))
+                   :pomegranate {:installed installed}}})))

 (defn add [dirs]
   (when (seq dirs)


Update example

Update example

--- src/datasplash/examples.clj
+++ src/datasplash/examples.clj
@@ -282,9 +282,9 @@
                       :description "Google Cloud Storage to stage local files."}})

 (defn stream-interactions-from-pubsub
- [pipeline read-subscription write-transformed-topic]
+ [pipeline read-topic write-transformed-topic]
  (->> pipeline
-      (ps/read-from-pubsub read-subscription {:name "read-interactions-from-pubsub"})
+      (ps/read-from-pubsub read-topic {:name "read-interactions-from-pubsub"})
       (ds/map (fn [message]
                 (do
                   (log/info (str "Got message:\n" message))
@@ -309,10 +309,10 @@
                   {:runner "DataflowPipelineRunner"
                    :streaming true})
         {:keys [project]} (ds/get-pipeline-configuration pipeline)
-        read-subscription (format "projects/%s/subscriptions/my-subscription" project)
+        read-topic (format "projects/%s/topics/my-topic" project)
         write-transformed-topic (format "projects/%s/topics/my-transformed-topic" project)
         read-transformed-subscription (format "projects/%s/subscriptions/my-transformed-subscription" project)]
-    (stream-interactions-from-pubsub pipeline read-subscription write-transformed-topic)
+    (stream-interactions-from-pubsub pipeline read-topic write-transformed-topic)
     (stream-forwarded-interactions-from-pubsub pipeline read-transformed-subscription)))

 ;;;;;;;;;;


seperating flavors

seperating flavors

--- src/proxmox/provider.clj
+++ src/proxmox/provider.clj
@@ -91,21 +91,32 @@
       (and (not ip_address) (not netif)) [(gen-ip ct "proxmox") network]
       )))

+(defn- redhat-network
+  "updates redhat bridged networking"
+  [node ip_address {:keys [gateway] :as network} vmid]
+  (let [ifcfg (<< "~(.getPath temp)/ifcfg-eth0") (<< "~(.getPath temp)/network")]
+    (spit ifcfg (redhat-ifcfg-eth0 (merge {:ip ip_address} network)))
+    (copy ifcfg (<< "/var/lib/vz/private/~{vmid}/etc/sysconfig/network-scripts/") (get-node node))))
+
+(defn- debian-network
+  "debian bridged networking update"
+  [node ip_address network vmid]
+  (let [temp (temp-dir "update-interfaces") output (<< "~(.getPath temp)/interfaces")]
+    (try
+      (spit output (debian-interfaces (merge {:ip ip_address} network)))
+      (copy output (<< "/var/lib/vz/private/~{vmid}/etc/network/") (get-node node))
+      (finally (delete-dir temp))))
+  )
+
 (defn update-interfaces
   "uploads interfaces file for a ct if bridge is used"
   [node flavor ip_address network vmid]
-  (let [temp (temp-dir "update-interfaces") output (<< "~(.getPath temp)/interfaces")]
-    (try
-      (when (= flavor :redhat)
-        (let [ifcfg (<< "~(.getPath temp)/ifcfg-eth0")]
-          (spit ifcfg (redhat-ifcfg-eth0 (merge {:ip ip_address} network))))
-          (copy ifcfg (<< "/var/lib/vz/private/~{vmid}/etc/sysconfig/network-scripts/") (get-node node))
-        )
-      (when (= flavor :debian)
-        (spit output (debian-interfaces (merge {:ip ip_address} network)))
-        (copy output (<< "/var/lib/vz/private/~{vmid}/etc/network/") (get-node node))
-        )
-      (finally (delete-dir temp)))))
+  (case flavor
+    :redhat (redhat-network node ip_address network vmid)
+    :debian (debian-network node ip_address network vmid)
+    (throw+ {:type ::missing-flavor :flavor flavor :message "No matching proxmox template flavor found"})
+    )
+  )

 (defconstrainedrecord Container [node ct extended network]
   "ct should match proxmox expected input (see http://pve.proxmox.com/pve2-api-doc/)"


renaming fn to what it is- all channel videos

--- src/thehex/notube/core.clj
+++ src/thehex/notube/core.clj
@@ -101,7 +101,7 @@
    (some #(str-in? text %) (:bullying blacklist))
    (some #(str-in? text %) (:hate-speech blacklist))))

-(defn handle-all-videos
+(defn handle-all-channel-videos
   "Call youtube api for videos, then continually call parse-videos on the set of results,
   by using the nextPageToken if its available on response body
   'UC-lHJZR3Gqxm24_Vd_AJ5Yw'"
@@ -109,9 +109,9 @@
    (let [[videos next-page-token] (yt/search-videos channel-id page-token)]
      (future (parse-videos videos))
      (when next-page-token
-       (handle-all-videos channel-id next-page-token))))
+       (handle-all-channel-videos channel-id next-page-token))))
   ([channel-id]
-   (handle-all-videos channel-id nil)))
+   (handle-all-channel-videos channel-id nil)))

 (defn handle-all-comments
   "Call yt api for videos, and use in handle-video to continually query for all comments,


reduce a lot of complexity by treating robots as indivisual atoms...

... instead of keeping a mutable list of robots (like you would in
Ruby).

--- clojure/robot-name/robot.clj
+++ clojure/robot-name/robot.clj
@@ -1,9 +1,6 @@
 (ns robot)

-(def id-seq (ref 0))
 (def name-seq (ref ["A" "A" 0]))
-(def robots (ref {}))
-
 (defn- inc-name-seq [curr-seq]
   (update-in curr-seq [2] inc))

@@ -13,37 +10,16 @@
 (defn- generate-name []
   (format-name @name-seq))

-(defn- generate-name-and-inc-seq []
+(defn- next-name []
   (let [name (generate-name)]
     (dosync (alter name-seq inc-name-seq))
     name))

-(defn- build []
-  {:name (generate-name)
-   :id @id-seq})
-
-(defn- manufacture []
-  (let [new-robot (build)]
-    (dosync
-     (alter robots assoc @id-seq new-robot)
-     (alter name-seq inc-name-seq)
-     (alter id-seq inc))
-    new-robot))
-
-(defn- change-name [robot new-name]
-  (let [id (robot :id)]
-    (dosync
-     (alter robots assoc-in [id :name] new-name))
-    (@robots id)))
-
 (defn robot []
-  (manufacture))
+  (atom (next-name)))

 (defn robot-name [robot]
-  (or (:name ( @robots (robot :id)))
-      (:name (change-name robot (generate-name-and-inc-seq)))))
+  @robot)

 (defn reset-name [robot]
-  (let [original-name (robot :name)]
-    (change-name robot nil)
-    original-name))
+  (reset! robot (next-name)))


Added missing word to description

Added missing word to description

--- src/ui/relevance/display.cljs
+++ src/ui/relevance/display.cljs
@@ -400,7 +400,7 @@
        [:div {:class "page-header"} [:h2 "Import data"]]
        [:div {:class "alert alert-warning"}
         [:h4 "Warning!"]
-        [:p "Your reading statistics be replaced with the information you enter below."]]
+        [:p "Your reading statistics will be replaced with the information you enter below."]]
        [:div {:class "row"}
         [:textarea {:class     "form-control"
                     :rows      30


Improve error reporting for validation errors.

--- src/uxbox/frontend/errors.clj
+++ src/uxbox/frontend/errors.clj
@@ -24,7 +24,11 @@

 (defmethod handle-exception :validation
   [err]
-  (let [response (select-keys (ex-data err) [:type :payload])]
+  (let [message (.getMessage err)
+        {:keys [type payload]} (ex-data err)
+        response {:message message
+                  :type type
+                  :payload payload}]
     (http/bad-request (rsp response))))

 (defmethod handle-exception :auth/wrong-credentials


fix bad names

fix bad names

--- src/structural_typing/type.clj
+++ src/structural_typing/type.clj
@@ -107,16 +107,16 @@
    If this function is used, custom error-handlers need to handle both individual candidate
    failures and group-of-candidate failures.
 "
-  ([type-repo type-shorthand candidate]
+  ([type-repo type-shorthand candidates]
      (let [compiled-type (produce-type type-repo type-shorthand)
-           oopsies (mapcat #(all-oopsies compiled-type %) candidate)]
-       (respond-to-results type-repo candidate oopsies)))
-  ([type-shorthand candidate]
-     (all-built-like @global-type/repo type-shorthand candidate)))
+           oopsies (mapcat #(all-oopsies compiled-type %) candidates)]
+       (respond-to-results type-repo candidates oopsies)))
+  ([type-shorthand candidates]
+     (all-built-like @global-type/repo type-shorthand candidates)))

 (defn <>all-built-like
   "The same as [[all-built-like]] but intended to be used in `->`
-   pipelines. Consequently, the `candidate` argument comes first.
+   pipelines. Consequently, the `candidates` argument comes first.

          (-> emr-patients
              augment           (<>all-built-like [:Decidable Patient])
@@ -126,10 +126,10 @@

    (The `<>` is intended to remind you of
    [swiss arrows](https://github.com/rplevy/swiss-arrows).)"
-  ([candidate type-repo type-shorthand]
-     (all-built-like type-repo type-shorthand candidate))
-  ([candidate type-shorthand]
-     (<>all-built-like candidate @global-type/repo type-shorthand)))
+  ([candidates type-repo type-shorthand]
+     (all-built-like type-repo type-shorthand candidates))
+  ([candidates type-shorthand]
+     (<>all-built-like candidates @global-type/repo type-shorthand)))

 (depr/defn checked
   "Use [[built-like]] instead."


Make spline

Make spline

--- src-cljs/frontend/components/insights/project.cljs
+++ src-cljs/frontend/components/insights/project.cljs
@@ -64,6 +64,7 @@
                              (group-by #(-> % :start_time time-format/parse time/at-midnight) builds))]
         (js/c3.generate (clj->js {:bindto el
                                   :data {:x "date"
+                                         :type "spline"
                                          :columns [(concat ["date"] (map first build-times))
                                                    (concat ["Build Times"] (map last build-times))]}
                                   :legend {:hide true}


Revert "CIRCLE-2347 - Allow building forks without env vars"

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -651,17 +651,12 @@
                                     "builds to use them and let others see your builds, both through the "
                                     "web UI and the API."]})
             (describe-flag {:flag :build-fork-prs
-                            :title "Build forked pull requests"
+                            :title "Permissive building of fork pull requests"
                             :blurb (list
                                     [:p
-                                     "Run builds for pull requests from forks. "
+                                     "Run builds of fork pull request changes with this project's configuration. "
                                      "CircleCI will automatically update the commit status shown on GitHub's "
-                                     "pull request page."])})
-            (describe-flag {:flag :forks-receive-secret-env-vars
-                            :title "Pass secrets to builds from forked pull requests"
-                            :blurb (list
-                                    [:p
-                                     "Run builds for fork pull request changes with this project's configuration, environment variables, and secrets. "]
+                                     "pull request page."]
                                     [:p
                                      "There are serious security concerns with this setting (see "
                                      [:a (open-ext {:href "https://circleci.com/docs/fork-pr-builds/"}) "the documentation"] " for details.) "


temporarily using regex in test

temporarily using regex in test

--- test/bad_movie_back_end/core/bad_movie_back_end_tests.clj
+++ test/bad_movie_back_end/core/bad_movie_back_end_tests.clj
@@ -9,4 +9,4 @@
   (fact "Test GET request to / route returns expected string"
     (let [response (app (mock/request :get "/"))]
       (:status response) => 200
-      (:body response) => (contains "HELLO FROM NASHORN"))))
+      (:body response) => (contains #"Hello, .+"))))


indentation

indentation

--- data/core.clj
+++ data/core.clj
@@ -16,155 +16,155 @@

 (def
   ^{:arglists '([& items])
-  :doc "Creates a new list containing the items."
-  :added "1.0"}
+    :doc "Creates a new list containing the items."
+    :added "1.0"}
   list list**)

 (def
   ^{:arglists '([x seq])
-  :doc "Returns a new seq where x is the first element and seq is
-      the rest."
-      :added "1.0"}
-      cons cons*)
+    :doc "Returns a new seq where x is the first element and seq is
+         the rest."
+         :added "1.0"}
+  cons cons*)

 (def
   ^{:arglists '([coll])
-  :doc "Returns the first item in the collection. Calls seq on its
-      argument. If coll is nil, returns nil."
-      :added "1.0"}
-      first first*)
+    :doc "Returns the first item in the collection. Calls seq on its
+         argument. If coll is nil, returns nil."
+         :added "1.0"}
+  first first*)

 (def
   ^{:arglists '([coll])
-  :doc "Returns a seq of the items after the first. Calls seq on its
-      argument.  If there are no more items, returns nil."
-      :added "1.0"}
-      next next*)
+    :doc "Returns a seq of the items after the first. Calls seq on its
+         argument.  If there are no more items, returns nil."
+         :added "1.0"}
+  next next*)

 (def
   ^{:arglists '([coll])
-  :doc "Returns a possibly empty seq of the items after the first. Calls seq on its
-      argument."
-      :added "1.0"}
-      rest rest*)
+    :doc "Returns a possibly empty seq of the items after the first. Calls seq on its
+         argument."
+         :added "1.0"}
+  rest rest*)

 (def
   ^{:arglists '([coll x] [coll x & xs])
-  :doc "conj[oin]. Returns a new collection with the xs
-      'added'. (conj nil item) returns (item).  The 'addition' may
-      happen at different 'places' depending on the concrete type."
-      :added "1.0"}
-      conj (fn conj
-             ([coll x] (conj* coll x))
-             ([coll x & xs]
-              (if xs
-                (recur (conj* coll x) (first xs) (next xs))
-                (conj* coll x)))))
+    :doc "conj[oin]. Returns a new collection with the xs
+         'added'. (conj nil item) returns (item).  The 'addition' may
+         happen at different 'places' depending on the concrete type."
+         :added "1.0"}
+  conj (fn conj
+         ([coll x] (conj* coll x))
+         ([coll x & xs]
+          (if xs
+            (recur (conj* coll x) (first xs) (next xs))
+            (conj* coll x)))))

 (def
   ^{:doc "Same as (first (next x))"
-  :arglists '([x])
-  :added "1.0"}
+    :arglists '([x])
+    :added "1.0"}
   second (fn second [x] (first (next x))))

 (def
   ^{:doc "Same as (first (first x))"
-  :arglists '([x])
-  :added "1.0"}
+    :arglists '([x])
+    :added "1.0"}
   ffirst (fn ffirst [x] (first (first x))))

 (def
   ^{:doc "Same as (next (first x))"
-  :arglists '([x])
-  :added "1.0"}
+    :arglists '([x])
+    :added "1.0"}
   nfirst (fn nfirst [x] (next (first x))))

 (def
   ^{:doc "Same as (first (next x))"
-  :arglists '([x])
-  :added "1.0"}
+    :arglists '([x])
+    :added "1.0"}
   fnext (fn fnext [x] (first (next x))))

 (def
   ^{:doc "Same as (next (next x))"
-  :arglists '([x])
-  :added "1.0"}
+    :arglists '([x])
+    :added "1.0"}
   nnext (fn nnext [x] (next (next x))))

 (def
   ^{:arglists '([coll])
-  :doc "Returns a seq on the collection. If the collection is
-      empty, returns nil.  (seq nil) returns nil."
-      :added "1.0"}
-      seq seq*)
+    :doc "Returns a seq on the collection. If the collection is
+         empty, returns nil.  (seq nil) returns nil."
+         :added "1.0"}
+  seq seq*)

 (def
   ^{:arglists '([c x])
-  :doc "Evaluates x and tests if it is an instance of type
-      c. Returns true or false"
-      :added "1.0"}
-      instance? instance?*)
+    :doc "Evaluates x and tests if it is an instance of type
+         c. Returns true or false"
+         :added "1.0"}
+  instance? instance?*)

 (def
   ^{:arglists '([x])
-  :doc "Returns true if x is a sequence"
-  :added "1.0"}
+    :doc "Returns true if x is a sequence"
+    :added "1.0"}
   seq? (fn seq? [x] (instance? Seq x)))

 (def
   ^{:arglists '([x])
-  :doc "Returns true if x is a Char"
-  :added "1.0"}
+    :doc "Returns true if x is a Char"
+    :added "1.0"}
   char? (fn char? [x] (instance? Char x)))

 (def
   ^{:arglists '([x])
-  :doc "Returns true if x is a String"
-  :added "1.0"}
+    :doc "Returns true if x is a String"
+    :added "1.0"}
   string? (fn string? [x] (instance? String x)))

 (def
   ^{:arglists '([x])
-  :doc "Returns true if x is a map"
-  :added "1.0"}
+    :doc "Returns true if x is a map"
+    :added "1.0"}
   map? (fn map? [x] (instance? ArrayMap x)))

 (def
   ^{:arglists '([x])
-  :doc "Returns true if x is a vector"
-  :added "1.0"}
+    :doc "Returns true if x is a vector"
+    :added "1.0"}
   vector? (fn vector? [x] (instance? Vector x)))

 (def
   ^{:arglists '([map key val] [map key val & kvs])
-  :doc "`assoc[iate]. When applied to a map, returns a new map of the
-      same (hashed/sorted) type, that contains the mapping of key(s) to
-      val(s). When applied to a vector, returns a new vector that
-      contains val at index. Note - index must be <= (count vector)."
-      :added "1.0"}
-      assoc
-      (fn assoc
-        ([map key val] (assoc* map key val))
-        ([map key val & kvs]
-         (let [ret (assoc* map key val)]
-           (if kvs
-             (if (next kvs)
-               (recur ret (first kvs) (second kvs) (nnext kvs))
-               (throw (ex-info "assoc expects even number of arguments after map/vector, found odd number" {})))
-             ret)))))
+    :doc "`assoc[iate]. When applied to a map, returns a new map of the
+         same (hashed/sorted) type, that contains the mapping of key(s) to
+         val(s). When applied to a vector, returns a new vector that
+         contains val at index. Note - index must be <= (count vector)."
+         :added "1.0"}
+  assoc
+  (fn assoc
+    ([map key val] (assoc* map key val))
+    ([map key val & kvs]
+     (let [ret (assoc* map key val)]
+       (if kvs
+         (if (next kvs)
+           (recur ret (first kvs) (second kvs) (nnext kvs))
+           (throw (ex-info "assoc expects even number of arguments after map/vector, found odd number" {})))
+         ret)))))

 (def
   ^{:arglists '([obj])
-  :doc "Returns the metadata of obj, returns nil if there is no metadata."
-  :added "1.0"}
+    :doc "Returns the metadata of obj, returns nil if there is no metadata."
+    :added "1.0"}
   meta meta*)

 (def
   ^{:arglists '([obj m])
-  :doc "Returns an object of the same type and value as obj, with
-      map m as its metadata."
-      :added "1.0"}
-      with-meta with-meta*)
+    :doc "Returns an object of the same type and value as obj, with
+         map m as its metadata."
+         :added "1.0"}
+  with-meta with-meta*)

 (def ^{:private true :dynamic true}
   assert-valid-fdecl (fn [fdecl]))
@@ -196,8 +196,8 @@

 (def
   ^{:arglists '([coll])
-  :doc "Return the last item in coll, in linear time."
-  :added "1.0"}
+    :doc "Return the last item in coll, in linear time."
+    :added "1.0"}
   last (fn last [s]
          (if (next s)
            (recur (next s))
@@ -205,8 +205,8 @@

 (def
   ^{:arglists '([coll])
-  :doc "Return a seq of all but the last item in coll, in linear time."
-  :added "1.0"}
+    :doc "Return a seq of all but the last item in coll, in linear time."
+    :added "1.0"}
   butlast (fn butlast [s]
             (loop [ret [] s s]
               (if (next s)
@@ -216,42 +216,42 @@
 (def

   ^{:doc "Same as (def name (fn [params* ] exprs*)) or (def
-        name (fn ([params* ] exprs*)+)) with any doc-string or attrs added
-        to the var metadata. prepost-map defines a map with optional keys
-        :pre and :post that contain collections of pre or post conditions."
-        :arglists '([name doc-string? attr-map? [params*] prepost-map? body]
-                    [name doc-string? attr-map? ([params*] prepost-map? body)+ attr-map?])
-        :added "1.0"}
-        defn (fn defn [&form &env name & fdecl]
-               ;; Note: Cannot delegate this check to def because of the call to (with-meta name ..)
-               (if (instance? Symbol name)
-                 nil
-                 (throw (ex-info "First argument to defn must be a symbol" {:form name})))
-               (let [m (if (string? (first fdecl))
-                         {:doc (first fdecl)}
-                         {})
-                     fdecl (if (string? (first fdecl))
-                             (next fdecl)
-                             fdecl)
-                     m (if (map? (first fdecl))
-                         (conj m (first fdecl))
-                         m)
-                     fdecl (if (map? (first fdecl))
-                             (next fdecl)
-                             fdecl)
-                     fdecl (if (vector? (first fdecl))
-                             (list fdecl)
-                             fdecl)
-                     m (if (map? (last fdecl))
-                         (conj m (last fdecl))
-                         m)
-                     fdecl (if (map? (last fdecl))
-                             (butlast fdecl)
-                             fdecl)
-                     m (conj {:arglists (list 'quote (sigs fdecl))} m)
-                     m (conj (if (meta name) (meta name) {}) m)]
-                 (list 'def (with-meta name m)
-                       (cons `fn fdecl) ))))
+         name (fn ([params* ] exprs*)+)) with any doc-string or attrs added
+         to the var metadata. prepost-map defines a map with optional keys
+         :pre and :post that contain collections of pre or post conditions."
+         :arglists '([name doc-string? attr-map? [params*] prepost-map? body]
+                     [name doc-string? attr-map? ([params*] prepost-map? body)+ attr-map?])
+         :added "1.0"}
+  defn (fn defn [&form &env name & fdecl]
+         ;; Note: Cannot delegate this check to def because of the call to (with-meta name ..)
+         (if (instance? Symbol name)
+           nil
+           (throw (ex-info "First argument to defn must be a symbol" {:form name})))
+         (let [m (if (string? (first fdecl))
+                   {:doc (first fdecl)}
+                   {})
+               fdecl (if (string? (first fdecl))
+                       (next fdecl)
+                       fdecl)
+               m (if (map? (first fdecl))
+                   (conj m (first fdecl))
+                   m)
+               fdecl (if (map? (first fdecl))
+                       (next fdecl)
+                       fdecl)
+               fdecl (if (vector? (first fdecl))
+                       (list fdecl)
+                       fdecl)
+               m (if (map? (last fdecl))
+                   (conj m (last fdecl))
+                   m)
+               fdecl (if (map? (last fdecl))
+                       (butlast fdecl)
+                       fdecl)
+               m (conj {:arglists (list 'quote (sigs fdecl))} m)
+               m (conj (if (meta name) (meta name) {}) m)]
+           (list 'def (with-meta name m)
+                 (cons `fn fdecl)))))

 (set-macro* #'defn)

@@ -263,8 +263,8 @@

 (def
   ^{:arglists '([coll])
-  :doc "Creates a new vector containing the contents of coll."
-  :added "1.0"}
+    :doc "Creates a new vector containing the contents of coll."
+    :added "1.0"}
   vec vec*)

 (defn vector
@@ -275,18 +275,18 @@

 (def
   ^{:arglists '([& keyvals])
-  :doc "keyval => key val
-      Returns a new hash map with supplied mappings.  If any keys are
-      equal, they are handled as if by repeated uses of assoc."
-      :added "1.0"}
-      hash-map hash-map*)
+    :doc "keyval => key val
+         Returns a new hash map with supplied mappings.  If any keys are
+         equal, they are handled as if by repeated uses of assoc."
+         :added "1.0"}
+  hash-map hash-map*)

 (def
   ^{:arglists '([& keys])
-  :doc "Returns a new hash set with supplied keys.  Any equal keys are
-      handled as if by repeated uses of conj."
-      :added "1.0"}
-      hash-set hash-set*)
+    :doc "Returns a new hash set with supplied keys.  Any equal keys are
+         handled as if by repeated uses of conj."
+         :added "1.0"}
+  hash-set hash-set*)

 (defn nil?
   "Returns true if x is nil, false otherwise."
@@ -297,48 +297,48 @@
 (def

   ^{:doc "Like defn, but the resulting function name is declared as a
-        macro and will be used as a macro by the compiler when it is
-        called."
-        :arglists '([name doc-string? attr-map? [params*] body]
-                    [name doc-string? attr-map? ([params*] body)+ attr-map?])
-        :added "1.0"}
-        defmacro (fn [&form &env
-                      name & args]
-                   (let [prefix (loop [p (list name) args args]
-                                  (let [f (first args)]
-                                    (if (string? f)
-                                      (recur (cons f p) (next args))
-                                      (if (map? f)
-                                        (recur (cons f p) (next args))
-                                        p))))
-                         fdecl (loop [fd args]
-                                 (if (string? (first fd))
-                                   (recur (next fd))
-                                   (if (map? (first fd))
-                                     (recur (next fd))
-                                     fd)))
-                         fdecl (if (vector? (first fdecl))
-                                 (list fdecl)
-                                 fdecl)
-                         add-implicit-args (fn [fd]
-                                             (let [args (first fd)]
-                                               (cons (vec (cons '&form (cons '&env args))) (next fd))))
-                         add-args (fn [acc ds]
-                                    (if (nil? ds)
-                                      acc
-                                      (let [d (first ds)]
-                                        (if (map? d)
-                                          (conj acc d)
-                                          (recur (conj acc (add-implicit-args d)) (next ds))))))
-                         fdecl (seq (add-args [] fdecl))
-                         decl (loop [p prefix d fdecl]
-                                (if p
-                                  (recur (next p) (cons (first p) d))
-                                  d))]
-                     (list 'do
-                           (cons `defn decl)
-                           (list 'set-macro* (list 'var name))
-                           (list 'var name)))))
+         macro and will be used as a macro by the compiler when it is
+         called."
+         :arglists '([name doc-string? attr-map? [params*] body]
+                     [name doc-string? attr-map? ([params*] body)+ attr-map?])
+         :added "1.0"}
+  defmacro (fn [&form &env
+                name & args]
+             (let [prefix (loop [p (list name) args args]
+                            (let [f (first args)]
+                              (if (string? f)
+                                (recur (cons f p) (next args))
+                                (if (map? f)
+                                  (recur (cons f p) (next args))
+                                  p))))
+                   fdecl (loop [fd args]
+                           (if (string? (first fd))
+                             (recur (next fd))
+                             (if (map? (first fd))
+                               (recur (next fd))
+                               fd)))
+                   fdecl (if (vector? (first fdecl))
+                           (list fdecl)
+                           fdecl)
+                   add-implicit-args (fn [fd]
+                                       (let [args (first fd)]
+                                         (cons (vec (cons '&form (cons '&env args))) (next fd))))
+                   add-args (fn [acc ds]
+                              (if (nil? ds)
+                                acc
+                                (let [d (first ds)]
+                                  (if (map? d)
+                                    (conj acc d)
+                                    (recur (conj acc (add-implicit-args d)) (next ds))))))
+                   fdecl (seq (add-args [] fdecl))
+                   decl (loop [p prefix d fdecl]
+                          (if p
+                            (recur (next p) (cons (first p) d))
+                            d))]
+               (list 'do
+                     (cons `defn decl)
+                     (list 'set-macro* (list 'var name))
+                     (list 'var name)))))

 (set-macro* #'defmacro)

@@ -380,12 +380,12 @@

 (def
   ^{:arglists '([& xs])
-  :doc "With no args, returns the empty string. With one arg x, returns
-      string representation of x. (str nil) returns the empty string. With more than
-      one arg, returns the concatenation of the str values of the args."
-      :added "1.0"
-      :tag String}
-      str str*)
+    :doc "With no args, returns the empty string. With one arg x, returns
+         string representation of x. (str nil) returns the empty string. With more than
+         one arg, returns the concatenation of the str values of the args."
+         :added "1.0"
+         :tag String}
+  str str*)

 (defn symbol?
   "Return true if x is a Symbol"


Bit of cleanup in parser.

Bit of cleanup in parser.

--- src/wealthpulse/parser.clj
+++ src/wealthpulse/parser.clj
@@ -42,12 +42,13 @@
   NOTE: The possibility of different commodities is completely ignored right now. (TODO)"
   [entry-type entries]
   (let [b-entries (filter #(= (:entry-type %) entry-type) entries)
-        commodity (:commodity (first (filter #(not (nil? (:commodity %))) b-entries)))
+        commodity (some #(if (not (nil? (:commodity %))) (:commodity %)) b-entries)
         sum (reduce (fn [sum entry]
                       (if (nil? (:amount entry))
                           sum
                           (+ sum (:amount entry))))
-                    0 b-entries)
+                    0
+                    b-entries)
         num-nil (count (filter #(nil? (:amount %)) b-entries))]
     {:sum sum :commodity commodity :num-nil num-nil}))

@@ -115,11 +116,11 @@
   "Transform a parse-tree amount into a map containing :amount and :commodity."
   [first-val second-val]
   (let [quantity (if (= (first first-val) :quantity)
-                   (bigdec (string/replace (first (drop 1 first-val)) "," ""))
-                   (bigdec (string/replace (first (drop 1 second-val)) "," "")))
+                   (bigdec (string/replace (nth first-val 1) "," ""))
+                   (bigdec (string/replace (nth second-val 1) "," "")))
         commodity (cond
-                     (= (first first-val) :commodity) (string/trim (first (drop 1 first-val)))
-                     (not (nil? second-val)) (string/trim (first (drop 1 second-val)))
+                     (= (first first-val) :commodity) (string/trim (nth first-val 1))
+                     (not (nil? second-val)) (string/trim (nth second-val 1))
                      :else nil)]
     {:amount quantity :commodity commodity}))


fix service view limit calc

fix service view limit calc

--- src/cljs/swarmpit/component/service/info/settings.cljs
+++ src/cljs/swarmpit/component/service/info/settings.cljs
@@ -93,20 +93,31 @@
   [agent]
   (when agent (label/base "agent" "primary")))

+(defn calculate-limit
+  "Calculate limit from task nodes if not specified"
+  [type running-tasks stats]
+  (let [nodes (->> (group-by :nodeId running-tasks)
+                   (map #(keyword (first %)))
+                   (into []))
+        nodes-resources (select-keys (:resources stats) nodes)]
+    (->> (map second nodes-resources)
+         (map type)
+         (reduce +))))
+
 (defn calculate-cpu-limit
   [running-tasks stats limit]
   (if (zero? (:cpu limit))
-    (reduce + (map #(:cores (get (:resources stats)
-                                 (keyword (:nodeId %)))) running-tasks))
-    (:cpu limit)))
+    (calculate-limit :cores running-tasks stats)
+    (* (:cpu limit)
+       (count running-tasks))))

 (defn calculate-memory-limit
   [running-tasks stats limit]
   (if (zero? (:memory limit))
-    (reduce + (map #(:memory (get (:resources stats)
-                                  (keyword (:nodeId %)))) running-tasks))
+    (calculate-limit :memory running-tasks stats)
     (* (:memory limit)
-       (* 1024 1024))))
+       (* 1024 1024)
+       (count running-tasks))))

 (rum/defc form-stats [running-tasks desired-tasks stats limit]
   (let [cpu (reduce + (map #(get-in % [:stats :cpu]) running-tasks))


added saving to file and loading from file of program editor contents

--- src/clojure/org/turtle/geometry/TurtleGraphics.clj
+++ src/clojure/org/turtle/geometry/TurtleGraphics.clj
@@ -13,14 +13,16 @@
                                 onResume superOnResume
                                 onPause superOnPause
                                 onDestroy superOnDestroy
-                                onBackPressed superOnBackPressed}
+                                onBackPressed superOnBackPressed
+                                onActivityResult superOnActivityResult}
               :state ^{:tag ActivityState} state
               :init init
               :constructors {[] []})
   (:import [android.app Activity]
-           [android.content Context]
+           [android.content Context Intent]
            [android.graphics Bitmap Bitmap$Config BitmapFactory Canvas
             Color Matrix Paint Paint$Cap Paint$Style Rect]
+           [android.net Uri]
            [android.text SpannableStringBuilder]
            [android.view
             GestureDetector GestureDetector$SimpleOnGestureListener
@@ -35,7 +37,8 @@
            [android.util AttributeSet]
            [android.util.Log]

-           [java.io BufferedWriter StringWriter]
+           [java.io BufferedWriter BufferedReader
+            File FileReader FileWriter StringWriter]
            [java.util.concurrent
             ConcurrentLinkedQueue
             LinkedBlockingQueue
@@ -181,6 +184,9 @@
                             nil))])

+
+(def ^{:const true} intent-save-file 0)
+(def ^{:const true} intent-load-file 1)

 (defn text-input->int [^EditText input-field]
   (Integer/valueOf ^String
@@ -398,6 +404,10 @@
                                             (resource :button_clear))
         button-reindent ^Button (.findViewById editor-layout
                                                (resource :button_reindent))
+        button-save ^Button (.findViewById editor-layout
+                                           (resource :button_save))
+        button-load ^Button (.findViewById editor-layout
+                                           (resource :button_load))

         rotated-turtle-bitmap (rotate-right-90
                                (BitmapFactory/decodeResource
@@ -465,8 +475,7 @@
              (.setCurrentTabByTag tab-host
                                   (.getString activity
                                               (resource :string
-                                                        :graphics_tab_label)))))
-         (log "Clicked run button"))))
+                                                        :graphics_tab_label))))))))

     (.setOnClickListener
      button-stop
@@ -504,12 +513,42 @@
                  (.setText editor (str *out*))))
              (catch Exception e
                (.setText editor orig-contents)
-               (report-error activity (str "error while indenting:\n" e)))))))))
+               (report-error activity (str "error while indenting:\n" e))))))))
+
+    (.setOnClickListener
+     button-save
+     (reify android.view.View$OnClickListener
+       (onClick [this unused-button]
+         (let [get-file-intent (Intent. Intent/ACTION_GET_CONTENT)]
+           (.setType get-file-intent "file/*")
+           ;; (.setType get-file-intent "text/*")
+           (let [choose-file-intent
+                 (Intent/createChooser get-file-intent
+                                       "Choose file to save to")]
+             (.startActivityForResult activity
+                                      choose-file-intent
+                                      intent-save-file))))))
+
+    (.setOnClickListener
+     button-load
+     (reify android.view.View$OnClickListener
+       (onClick [this unused-button]
+         (let [get-file-intent (Intent. Intent/ACTION_GET_CONTENT)]
+           (.setType get-file-intent "file/*")
+           ;; (.setType get-file-intent "*/*")
+           (let [choose-file-intent
+                 (Intent/createChooser get-file-intent
+                                       "Choose file to load from")]
+             (.startActivityForResult activity
+                                      choose-file-intent
+                                      intent-load-file)))))))

   (.setText (program-source-editor @this)
-            "(doseq [r [1 1.5 2 2.5 3]]\n  (dotimes [_ 360]\n    (forward r)\n    (left 1)))"
-            ;; "(forward 100)\n(left 90)\n(forward 100)\n"
-            )
+            ;; "(doseq [r [1 1.5 2 2.5 3]]\n  (dotimes [_ 360]\n    (forward r)\n    (left 1)))"
+            "(forward 100)\n(left 90)\n(forward 100)\n")
+
+  (log "program editor contents = \n%s"
+       (str (.getText (program-source-editor @this))))
   ;; (.setOnTouchListener (program-source-editor @this)
   ;;
   ;;                      (make-double-tap-handler
@@ -581,6 +620,29 @@
       (.superOnBackPressed this)
       (.setCurrentTabByTag tab-host source-tab-tag))))

+(defn -onActivityResult
+  [^org.turtle.geometry.TurtleGraphics this
+   request-code
+   result-code
+   ^Intent data]
+  (when (= result-code Activity/RESULT_OK)
+    (cond
+     (= request-code intent-save-file)
+     (let [uri (.getData data)
+           filename (.getPath uri)]
+       (spit filename (.getText (program-source-editor @this)))
+       ;; (with-open [writer (BufferedWriter. (FileWriter. filename))]
+       ;;   (.write writer (.getText (program-source-editor @this))))
+       )
+     (= request-code intent-load-file)
+     (let [uri (.getData data)
+           file (.getPath uri)]
+       (.setText (program-source-editor @this)
+                 ^String (slurp file)))
+     :else
+     ;; ignore it
+     nil)))
+
 ;; (defn -onSaveInstanceState [^org.turtle.geometry.TurtleGraphics this
 ;;                             ^android.os.Bundle bundle]
 ;;   )
@@ -591,7 +653,8 @@

 (defn clear-intermed-bitmap [^org.turtle.geometry.TurtleGraphics this]
-  (.drawColor ^Canvas (get-in @this [:draw-state :draw-canvas]) Color/WHITE))
+  (when-let [intermed-bitmap (get-in @this [:draw-state :draw-canvas])]
+    (.drawColor ^Canvas intermed-bitmap Color/WHITE)))

 (defn -surfaceChanged [^org.turtle.geometry.TurtleGraphics this
                        ^SurfaceHolder holder
@@ -910,7 +973,7 @@
                  (.runOnUiThread
                   activity
                   (fn []
-                    (report-error activity "Interrupted"))))
+                    (report-error activity "Interrupted" false))))
                (catch Exception e
                  (.runOnUiThread
                   activity


temporarily deleting the html escaping (b/c of problems with blockquoting in MD)

--- src/NoteHub/views/pages.clj
+++ src/NoteHub/views/pages.clj
@@ -137,8 +137,6 @@
              ; if not, append "-n", where "n" is the next free number
              (let [[year month day] (map #(+ (second %) (.get (Calendar/getInstance) (first %)))
                                          {Calendar/YEAR 0, Calendar/MONTH 1, Calendar/DAY_OF_MONTH 0})
-                   ; This is the _only_ point where user's content enters the web app, so we escape the content.
-                   draft (escape-html draft)
                    untrimmed-line (filter #(or (= \- %) (Character/isLetterOrDigit %))
                                           (-> draft ccs/split-lines first (sreplace " " "-") lower-case))
                    trim (fn [s] (apply str (drop-while #(= \- %) s)))


fix(html): use file to concat path and filename

--- src/asset_minifier/core.clj
+++ src/asset_minifier/core.clj
@@ -158,11 +158,11 @@
         (spit target (.toSource compiler))
         (merge result (compression-details assets (file target)))))))

-(defn minify-html-asset [asset target opts]
+(defn- minify-html-asset [asset target opts]
   (let [result (html-comressor/compress (slurp asset))
-        target-filename (str target (.getName asset))]
-    (make-parents target-filename)
-    (spit target-filename result)))
+        target-file (file target (.getName asset))]
+    (make-parents (.getPath target-file))
+    (spit target-file result)))

 (defn minify-html [path target opts]
   (delete-target target)


cleanup

cleanup

--- src/babel/italiano/pos.cljc
+++ src/babel/italiano/pos.cljc
@@ -9,44 +9,3 @@
 (def drinkable-noun pos/drinkable-noun)
 (def noun pos/noun)
 (def pronoun-acc pos/pronoun-acc)
-
-(def noun-agreement
-  (let [agr (atom :top)
-        cat (atom :top)]
-    {:italiano {:agr agr
-                :cat cat}
-     :synsem {:cat cat
-              :agr agr}}))
-
-;; A generalization of intransitive and transitive:
-;; they both have a subject, thus "subjective".
-(def verb-subjective
-  (unifyc pos/verb-subjective
-          (let [infl (atom :top)
-                agr (atom :top)
-                essere-type (atom :top)]
-            {:italiano {:agr agr
-                        :essere essere-type
-                        :infl infl}
-             :synsem {:infl infl
-                      :essere essere-type
-                      :subcat {:1 {:agr agr}}}})))
-
-;; TODO: move place/city to if/then rules.
-(def pronoun-reflexive
-  {:synsem {:cat :noun
-            :sem {:place false
-                  :city false}
-            :pronoun true
-            :case :acc
-            :reflexive true}})
-
-(def essere-aux-subject-agreement
-  (let [subject-agreement (atom :top)]
-    {:synsem {:subcat {:1 {:agr subject-agreement}
-                       :2 {:subcat {:1 {:agr subject-agreement}}}}}}))
-
-(def subj-obj-humanness
-  (let [human (atom :top)]
-    {:synsem {:sem {:subj {:human human}
-                    :obj {:human human}}}}))


Add more magic-sparkles-tests

Add more magic-sparkles-tests

--- test/caesium/binding_test.clj
+++ test/caesium/binding_test.clj
@@ -146,6 +146,11 @@
     [buf-tag nil buf-tag nil buf-tag nil]

     'caesium.crypto.scalarmult
+    '(caesium.binding/✨ scalarmult q n p)
+    `(.crypto_scalarmult b/sodium ~'q ~'n ~'p)
+    [buf-tag buf-tag buf-tag]
+
+    'caesium.crypto.scalarmult
     '(caesium.binding/✨ scalarmult-base q n)
     `(.crypto_scalarmult_base b/sodium ~'q ~'n)
     [buf-tag buf-tag]))


Adding failing test to test ci.

Adding failing test to test ci.


Slight change to the way that speed test states are handled

--- test/infsocsol/speed_test.clj
+++ test/infsocsol/speed_test.clj
@@ -78,16 +78,17 @@

 (defn profile-example-a
   "Profiling of example A"
-  [samples]
+  [samples max-cpus]
   (dataset
    [:platform :version :cpus :states :iterations :time]
    (doall
     (apply concat
-           (for [states (concat (range 51 501 (/ (- 501 51) (- samples 1))) [501])]
+           (for [i (range samples)
+                 :let [states (+ 51 (* 150 i))]]

              (conj
               (for [platform [:matlab :octave]
-                    cpus (range 1 5)]
+                    cpus (range 1 (inc max-cpus))]

                 (run-profile platform
                              {:version :current
@@ -105,7 +106,7 @@

 (defn profile-fisheries-det-basic
   "Profiling of basic deterministic fisheries model"
-  [samples]
+  [samples max-cpus]
   (dataset
    [:platform :version :cpus :states :iterations :time]
    (doall
@@ -115,7 +116,7 @@
                        time-step (/ 1 (Math/pow 2 i))]]
              (conj
               (for [platform [:matlab :octave]
-                    cpus (range 1 5)]
+                    cpus (range 1 (inc max-cpus))]

                 (run-profile platform
                              {:version :current


Move start-env inside test to avoid startup when reloading

--- test/onyx/validation_test.clj
+++ test/onyx/validation_test.clj
@@ -5,164 +5,155 @@
             [clojure.test :refer [deftest is testing]]
             [onyx.api]))

-(def id (java.util.UUID/randomUUID))
-
-(def config (load-config))
-
-(def env-config
-  (assoc (:env-config config)
-         :onyx/id id
-         :onyx.log/config {:appenders {:standard-out {:enabled? false}
-                                       :spit {:enabled? false}}}))
-
-(def peer-config
-  (assoc (:peer-config config)
-         :onyx/id id
-         :onyx.peer/job-scheduler :onyx.job-scheduler/balanced))
-
-(def env (onyx.api/start-env env-config))
-
-(def workflow
-  [[:in-bootstrapped :inc]
-   [:inc :out]])
-
-(def illegal-catalog ["not" "a" "catalog"])
-
-(def illegal-input-catalog
-  [{:onyx/name :in-bootstrapped
-    :onyx/type :input
-    :onyx/bootstrap? true
-    :onyx/batch-size 2}])
-
-(def illegal-output-catalog
-  [{:onyx/name :in-bootstrapped
-    :onyx/type :output
-    :onyx/bootstrap? true
-    :onyx/batch-size 2}])
-
-(def illegal-function-catalog
-  [{:onyx/name :inc
-    :onyx/type :function
-    :onyx/batch-size 5}])
-
-(def illegal-dispatch-catalog
-  [{:onyx/name :input
-    :onyx/type :input
-    :onyx/medium :core.async
-    :onyx/batch-size 5}])
-
-(def incomplete-catalog
-  [{:onyx/name :in-bootstrapped
-    :onyx/type :input
-    :onyx/medium :onyx-memory-test-plugin
-    :onyx/bootstrap? true
-    :onyx/batch-size 2}])
-
-(deftest bad-jobs-1
-  (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog illegal-catalog :workflow workflow
-                                                           :task-scheduler :onyx.task-scheduler/balanced})))
-
-  (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog illegal-input-catalog :workflow workflow
-                                                           :task-scheduler :onyx.task-scheduler/balanced})))
-
-  (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog illegal-output-catalog :workflow workflow
-                                                           :task-scheduler :onyx.task-scheduler/balanced})))
-
-  (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog illegal-function-catalog :workflow workflow
-                                                           :task-scheduler :onyx.task-scheduler/balanced})))
-
-  (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog illegal-dispatch-catalog :workflow workflow
-                                                           :task-scheduler :onyx.task-scheduler/balanced})))
-
-  (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog incomplete-catalog :workflow workflow
-                                                           :task-scheduler :onyx.task-scheduler/balanced}))))
-
-(def workflow-tests-catalog
-  [{:onyx/name :in
-    :onyx/type :input
-    :onyx/medium :core.async
-    :onyx/batch-size 5}
-   {:onyx/name :intermediate
-    :onyx/fn :test-fn
-    :onyx/type :function
-    :onyx/batch-size 5}
-   {:onyx/name :out
-    :onyx/type :output
-    :onyx/medium :core.async
-    :onyx/batch-size 5}])
-
-(def dupes-workflow
-  [[:in :intermediate]
-   [:in :intermediate]
-   [:intermediate :out]])
-
-(def illegal-incoming-inputs-workflow
-  [[:intermediate :in]])
-
-(def illegal-outgoing-outputs-workflow
-  [[:out :intermediate]])
-
-(def illegal-edge-nodes-count-workflow
-  [[:in :intermediate]
-   [:intermediate]])
-
-(def illegal-intermediate-nodes-workflow
-  [[:in :intermediate]
-   [:in :out]])
-
-(deftest bad-jobs-2
-  (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog workflow-tests-catalog
-                                                           :workflow illegal-incoming-inputs-workflow
-                                                           :task-scheduler :onyx.task-scheduler/balanced})))
-
-  (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog workflow-tests-catalog
-                                                           :workflow illegal-outgoing-outputs-workflow
-                                                           :task-scheduler :onyx.task-scheduler/balanced})))
-
-  (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog workflow-tests-catalog
-                                                           :workflow illegal-edge-nodes-count-workflow
-                                                           :task-scheduler :onyx.task-scheduler/balanced})))
-
-  (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog workflow-tests-catalog
-                                                           :workflow illegal-intermediate-nodes-workflow
-                                                           :task-scheduler :onyx.task-scheduler/balanced})))
-
-  (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog workflow-tests-catalog
-                                                           :workflow dupes-workflow
-                                                           :task-scheduler :onyx.task-scheduler/balanced}))))
-
-(def invalid-lifecycles
-  [{:lifecycle/task :in
-    :lifecycle/calls :non-namespaced-calls}])
-
-(def correct-catalog
-  [{:onyx/name :in
-    :onyx/plugin :a/b
-    :onyx/medium :some-medium
-    :onyx/type :input
-    :onyx/bootstrap? true
-    :onyx/batch-size 2}
-   {:onyx/name :intermediate
-    :onyx/fn :a/fn-path
-    :onyx/type :function
-    :onyx/batch-size 2}
-   {:onyx/name :out
-    :onyx/plugin :a/b
-    :onyx/medium :some-medium
-    :onyx/type :output
-    :onyx/batch-size 2}])
-
-(def correct-workflow
-  [[:in :intermediate]
-   [:intermediate :out]])
-
-(deftest bad-jobs-3
-  (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog correct-catalog
-                                                           :workflow correct-workflow
-                                                           :lifecycles invalid-lifecycles
-                                                           :task-scheduler :onyx.task-scheduler/balanced}))))
-
-(onyx.api/shutdown-env env)
+(deftest validation-errors
+  (let [id (java.util.UUID/randomUUID)
+        config (load-config)
+        env-config
+        (assoc (:env-config config)
+               :onyx/id id
+               :onyx.log/config {:appenders {:standard-out {:enabled? false}
+                                             :spit {:enabled? false}}})
+        peer-config
+        (assoc (:peer-config config)
+               :onyx/id id
+               :onyx.peer/job-scheduler :onyx.job-scheduler/balanced)
+        env (onyx.api/start-env env-config)
+        workflow
+        [[:in-bootstrapped :inc]
+         [:inc :out]]
+        illegal-catalog ["not" "a" "catalog"]
+        illegal-input-catalog
+        [{:onyx/name :in-bootstrapped
+          :onyx/type :input
+          :onyx/bootstrap? true
+          :onyx/batch-size 2}]
+        illegal-output-catalog
+        [{:onyx/name :in-bootstrapped
+          :onyx/type :output
+          :onyx/bootstrap? true
+          :onyx/batch-size 2}]
+
+        illegal-function-catalog
+        [{:onyx/name :inc
+          :onyx/type :function
+          :onyx/batch-size 5}]
+
+        illegal-dispatch-catalog
+        [{:onyx/name :input
+          :onyx/type :input
+          :onyx/medium :core.async
+          :onyx/batch-size 5}]
+
+        incomplete-catalog
+        [{:onyx/name :in-bootstrapped
+          :onyx/type :input
+          :onyx/medium :onyx-memory-test-plugin
+          :onyx/bootstrap? true
+          :onyx/batch-size 2}]
+
+        workflow-tests-catalog
+        [{:onyx/name :in
+          :onyx/type :input
+          :onyx/medium :core.async
+          :onyx/batch-size 5}
+         {:onyx/name :intermediate
+          :onyx/fn :test-fn
+          :onyx/type :function
+          :onyx/batch-size 5}
+         {:onyx/name :out
+          :onyx/type :output
+          :onyx/medium :core.async
+          :onyx/batch-size 5}]
+
+        dupes-workflow
+        [[:in :intermediate]
+         [:in :intermediate]
+         [:intermediate :out]]
+
+        illegal-incoming-inputs-workflow
+        [[:intermediate :in]]
+
+        illegal-outgoing-outputs-workflow
+        [[:out :intermediate]]
+
+        illegal-edge-nodes-count-workflow
+        [[:in :intermediate]
+         [:intermediate]]
+
+        illegal-intermediate-nodes-workflow
+        [[:in :intermediate]
+         [:in :out]]
+
+        invalid-lifecycles
+        [{:lifecycle/task :in
+          :lifecycle/calls :non-namespaced-calls}]
+
+        correct-catalog
+        [{:onyx/name :in
+          :onyx/plugin :a/b
+          :onyx/medium :some-medium
+          :onyx/type :input
+          :onyx/bootstrap? true
+          :onyx/batch-size 2}
+         {:onyx/name :intermediate
+          :onyx/fn :a/fn-path
+          :onyx/type :function
+          :onyx/batch-size 2}
+         {:onyx/name :out
+          :onyx/plugin :a/b
+          :onyx/medium :some-medium
+          :onyx/type :output
+          :onyx/batch-size 2}]
+
+        correct-workflow [[:in :intermediate] [:intermediate :out]]]
+    (testing "bad-jobs-1"
+      (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog illegal-catalog :workflow workflow
+                                                               :task-scheduler :onyx.task-scheduler/balanced})))
+
+      (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog illegal-input-catalog :workflow workflow
+                                                               :task-scheduler :onyx.task-scheduler/balanced})))
+
+      (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog illegal-output-catalog :workflow workflow
+                                                               :task-scheduler :onyx.task-scheduler/balanced})))
+
+      (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog illegal-function-catalog :workflow workflow
+                                                               :task-scheduler :onyx.task-scheduler/balanced})))
+
+      (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog illegal-dispatch-catalog :workflow workflow
+                                                               :task-scheduler :onyx.task-scheduler/balanced})))
+
+      (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog incomplete-catalog :workflow workflow
+                                                               :task-scheduler :onyx.task-scheduler/balanced}))))
+
+    (testing "bad-jobs-2"
+      (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog workflow-tests-catalog
+                                                               :workflow illegal-incoming-inputs-workflow
+                                                               :task-scheduler :onyx.task-scheduler/balanced})))
+
+      (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog workflow-tests-catalog
+                                                               :workflow illegal-outgoing-outputs-workflow
+                                                               :task-scheduler :onyx.task-scheduler/balanced})))
+
+      (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog workflow-tests-catalog
+                                                               :workflow illegal-edge-nodes-count-workflow
+                                                               :task-scheduler :onyx.task-scheduler/balanced})))
+
+      (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog workflow-tests-catalog
+                                                               :workflow illegal-intermediate-nodes-workflow
+                                                               :task-scheduler :onyx.task-scheduler/balanced})))
+
+      (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog workflow-tests-catalog
+                                                               :workflow dupes-workflow
+                                                               :task-scheduler :onyx.task-scheduler/balanced}))))
+
+    (testing "bad-jobs-3"
+      (is (thrown? Exception (onyx.api/submit-job peer-config {:catalog correct-catalog
+                                                               :workflow correct-workflow
+                                                               :lifecycles invalid-lifecycles
+                                                               :task-scheduler :onyx.task-scheduler/balanced}))))
+
+    (onyx.api/shutdown-env env)))
+

 (deftest map-set-workflow
   (is (= (sort [[:a :b]


Add tests to verify that statement position is correctly ascribed to the first character in the statement.

--- test/sql_file/script_test.clj
+++ test/sql_file/script_test.clj
@@ -42,6 +42,8 @@
   (testing "Statement delimiter processing"
     (is (= [{:line 1, :column 1, :statement "1"}]
            (script/sql-statements "1;")))
+    (is (= [{:line 1, :column 3, :statement "1"}]
+           (script/sql-statements "  1;")))
     (is (= [{:line 1, :column 1, :statement "1"} {:line 1, :column 3, :statement "2"}]
            (script/sql-statements "1;2")))
     (is (= [{:line 1, :column 1, :statement "1"} {:line 1, :column 3, :statement "2"}]
@@ -52,6 +54,10 @@
            (script/sql-statements "1;2';'3;"))))

   (testing "newline processing"
+    (is (= [{:line 3, :column 1, :statement "1"}]
+           (script/sql-statements "\n\n1;")))
+    (is (= [{:line 3, :column 1, :statement "1"}]
+           (script/sql-statements "-- comment \n -- comment \n1;")))
     (is (= [{:line 1, :column 1, :statement "1"}]
            (script/sql-statements "1;\n;")))
     (is (= [{:line 1, :column 1, :statement "1 2"}]


Remove console print.

Remove console print.

--- src/cljs/hatnik/web/client/form/add_action.cljs
+++ src/cljs/hatnik/web/client/form/add_action.cljs
@@ -223,7 +223,6 @@
         (.modal modal-window)))))

 (defn show [& data-pack]
-  (.log js/console "!")
   (om/root add-action-component
            (assoc
                (into {} (map vec (partition-all 2 data-pack)))


Avoid nested div in p

Avoid nested div in p

--- src/name_bazaar/ui/pages/how_it_works_page.cljs
+++ src/name_bazaar/ui/pages/how_it_works_page.cljs
@@ -24,14 +24,14 @@
       [youtube
        {:src "https://www.youtube.com/embed/pmtVMaqk_eg"}]]
      [:p "There’s a persistent search bar at the top of the website, no matter what page you’re on. Simply type in a name you’re looking for and you’re off to the races! By clicking the “Offerings” button at the top of the left-hand menu, a more " [:a {:href (path-for :route.offerings/search)} "detailed offering search page"] " is available, where you can filter by a number of intuitive parameters like price, buy now vs. auction, and so on. "]
-     [:p.centered [:div.flow-image.buy]]
+     [:p.centered [:span.flow-image.buy]]
      [:p "Once you’ve found a name you’d like to buy or bid on, click on it for more information. If the offering is a “buy now” type, you can immediately pay the listed price to acquire the name. If it’s an “auction” type, you can enter a winning bid, and watch the name to be notified if you get out bid, or if the auction closes."]
      [:h1.ui.header "Selling Names"]
      [:p.centered
       [youtube
        {:src "https://www.youtube.com/embed/xyB4q1i51xI"}]]
      [:p "Any names already registered and owned by a MetaMask or Parity address can be listed for sale on the site through a simple " [:a {:href (path-for :route.offerings/create)} "Create Offering"] " page. When creating an auction, type the name you’d like to sell, the starting price, the “Minimum Bid Increase”, and the time you’d like the auction to end. You can also adjust the “Time Extension” slider, to allow the auction to continue in case any new bids roll in at the last minute."]
-     [:p.centered [:div.flow-image.sell]]
+     [:p.centered [:span.flow-image.sell]]
      [:p "In addition to the auction feature, sellers can also utilize the “Buy Now” listing type, which is a firm set price to immediately buy the name."]
      [:h1.ui.header "Watching and Requesting Names"]
      [:p.centered


chore: rename test

chore: rename test

--- src/test/clojure/clojure/tools/common_tests.clj
+++ src/test/clojure/clojure/tools/common_tests.clj
@@ -249,6 +249,6 @@
   (is (= {:tag "foo"} (meta (read-string "^\"foo\" 'bar"))))
   (is (= {:tag 'String} (meta (read-string "^String 'x")))))

-(deftest read-namespaced-map
+(deftest read-namespaced-map'
   (is (= {:foo/bar 1 :baz 2} (read-string "#:foo{:bar 1 :_/baz 2}")))
   (is (= '{foo/bar 1 :baz 2} (read-string "#:foo{bar 1 :_/baz 2}"))))


move reset-cpu to the last

move reset-cpu to the last

Signed-off-by: Yen-Chin Lee <082d453d72dce940e12089a4ad48b97cfe1f3ec4@gmail.com>

--- src/emulator_chip8/cpu.cljc
+++ src/emulator_chip8/cpu.cljc
@@ -53,13 +53,6 @@

    (State. memory stack SP PC V I DT ST)))

-
-(defn reset-cpu
-  "Reset the full cpu state."
-  []
-  (-> (make-cpu)
-      load-fontset))
-
 ;; Default fontsets, it will be add to memory
 (def fontset
   [0xF0 0x90 0x90 0x90 0xF0 ; 0
@@ -85,4 +78,10 @@
   [state]
   (let [memory (:memory state)
         c (count memory)]
-    (merge state {:memory (vec (take c (into fontset memory)))})))+    (merge state {:memory (vec (take c (into fontset memory)))})))
+
+(defn reset-cpu
+  "Reset the full cpu state."
+  []
+  (-> (make-cpu)
+      load-fontset))


Request handler and response function

Request handler and response function

--- src/branch_handler/core.clj
+++ src/branch_handler/core.clj
@@ -11,6 +11,38 @@

 (def verbose true)
 (def port 4000)
+
+(defn slurp-
+    [filename]
+    (try
+        (slurp filename)
+        (catch Exception e
+            (log/error e)
+            nil)))
+
+(defn read-request-body
+    "Read all informations from the request body."
+    [request]
+    (slurp- (:body request)))
+
+(defn log-request
+    [request]
+    (log/info "Handling request: " (:uri request) (:remote-addr request))
+    (if verbose
+        (clojure.pprint/pprint request)))
+
+(defn send-response
+    [response-text]
+    (-> (http-response/response response-text)
+        (http-response/content-type "text/html")))
+
+(defn http-request-handler
+    "Handler that is called by Ring for all requests received from user(s)."
+    [request]
+    (log-request request)
+    (if (= [:post "/"] [(:request-method request) (:uri request)])
+        (api-call-handler request))
+    (send-response ""))

 (def ring-app
     "Definition of a Ring-based application behaviour."


Rewrite model.flash. Add now!.

Rewrite model.flash. Add now!.

--- src/cadence/model/flash.clj
+++ src/cadence/model/flash.clj
@@ -2,7 +2,32 @@
   (:refer-clojure :exclude [get])
   (:require [noir.session :as sess]))

-(defn put! [t & m]
-  (sess/flash-put! {:type t :message m}))
+(defn- flash-now!
+  "Store a flash value that will persist for this request only."
+  [k v]
+  (swap! sess/*noir-flash* assoc-in [:incoming k] v))

-(def get sess/flash-get)
+(defn- base-put!
+  "Most basic flash put the can either do an immediate or slow push using a
+  custom format on the :alert key."
+  [flasher t m] (flasher :alert {:type t :message (apply str m)}))
+
+(defn- put-partial
+  "A wrapper around base-put! that allows it to be used with a variable number
+  of arguments. The second argument is treated specially if it is a keyword."
+  [flasher]
+  (fn [flash-type & message]
+    (if (keyword? flash-type)
+      (base-put! flasher flash-type message)
+      (base-put! flasher :info (cons flash-type message)))))
+
+(def now!
+  "Does an immediate flash."
+  (put-partial flash-now!))
+
+(def put!
+  "Does a slow flash."
+  (put-partial sess/flash-put!))
+
+;; Alias this namespace's get to noir's flash-get.
+(def get (partial sess/flash-get :alert))


placeholder data in config

placeholder data in config

--- resources/conf/jsk-conf.clj
+++ resources/conf/jsk-conf.clj
@@ -7,10 +7,10 @@

  :email-conf {:host "smtp.gmail.com"
               :port 587
-              :user "user@gmail.com"
-              :pass "user-pass"}
+              :user "you@gmail.com"
+              :pass "your-pass"}

-:error-email-to "xfthhxk@gmail.com"
+:error-email-to "you@domain.com"

  ; These are the logs generated by the jobs being run
  ; Each execution has its own log file.


adjusting model and fixing routes

adjusting model and fixing routes

--- src/celestial/api/users.clj
+++ src/celestial/api/users.clj
@@ -58,9 +58,13 @@

 (defmodel quota :username :string :quotas {:type :Quotas})

-(defmodel quotas :proxmox {:type :Limit})
+(defmodel quotas :env {:type :Env})

-(defmodel limit :limit :int)
+(defmodel env :hypervisor {:type :Limits})
+
+(defmodel limits :limits {:type :Counts} :used {:type :Counts})
+
+(defmodel counts :count :int)

 (defroutes- quotas {:path "/quota" :description "User quota managment"}

@@ -70,12 +74,12 @@
   (GET- "/quotas/:name" [^:string name] {:nickname "getQuota" :summary "Get users quota"}
     (success (q/get-quota name)))

-  (POST- "/quotas/" [& ^:quota quota] {:nickname "addQuota" :summary "Adds a user quota"}
+  (POST- "/quotas" [& ^:quota quota] {:nickname "addQuota" :summary "Adds a user quota"}
     (wrap-errors
        (q/add-quota quota)
        (success {:message "added quota"})))

-  (PUT- "/quotas/" [& ^:quota quota] {:nickname "updateQuota" :summary "Updates an existing quota"}
+  (PUT- "/quotas" [& ^:quota quota] {:nickname "updateQuota" :summary "Updates an existing quota"}
     (wrap-errors
       (q/update-quota quota)
       (success {:message "quota updated"})))


CMR-1922: Addressed a review comment

CMR-1922: Addressed a review comment

--- metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/delete_test.clj
+++ metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/delete_test.clj
@@ -60,6 +60,7 @@
       (is (= 201 status))
       (is (= 4 revision-id))

+      ;; Make sure that the saved tombstone is what it is expected to be
       (is (= (dissoc (assoc saved-coll1
                             :deleted true
                             :metadata ""


Ignore binding names and their order when comparing SELECT query results

--- src/clj/sparqlab/sparql.clj
+++ src/clj/sparqlab/sparql.clj
@@ -39,7 +39,7 @@
 (defmethod normalize-query-results ::select
   [_ query-results]
   (let [data (parse-string query-results keyword)]
-    (cond-> (get-in data [:results :bindings])
+    (cond-> (map (partial map val) (get-in data [:results :bindings]))
       (not (get-in data [:results :ordered])) set ; Unordered bindings are compared as sets
       )))


Utilized new repairable-friend-in-range-of-selected? track for tile masking

--- src/cljs/zetawar/views.cljs
+++ src/cljs/zetawar/views.cljs
@@ -84,8 +84,7 @@
               (and @(subs/unit-selected? conn)
                    (not @(subs/selected? conn q r))
                    (not @(subs/enemy-in-range-of-selected? conn q r))
-                   (not (and @(subs/friend-in-range-of-selected? conn q r)
-                             @(subs/can-be-repaired? conn q r)
+                   (not (and @(subs/repairable-friend-in-range-of-selected? conn q r)
                              @(subs/selected-can-repair-other? conn)))
                    (not @(subs/valid-destination-for-selected? conn q r))))]
     [:image {:visibility (if show "visible" "hidden")


remove unused code

remove unused code

--- src/clojure_fabric/user.clj
+++ src/clojure_fabric/user.clj
@@ -300,29 +300,6 @@
    (get-enrollment-certificate core/*user*))
   ([user]
    (:certificate user)))
-
-#_
-(defn create-or-update-channel
-  ;; evelope - read from <channel-name>.tx file
-  [user channel-name orderer {:keys [^bytes envelope config signatures]}]
-  (cond envelope
-        ;; envelope is byte array of Envelope, which is ready to be parsed in
-        ;; - *.tx file
-        (proto/send-update-channel-using-envelope (Common$Envelope/parseFrom envelope))
-
-        ;; config is byte array
-        ;; signature is a list of byte array
-        (and config signatures)
-        (let [channel-header (proto/make-channel-header :type :config-update
-                                                        :chainnel-id channel-name
-                                                        :tx-id :FIXME)
-
-              config-update-envelope (proto/make-config-update-envelope :config-update config
-                                                                        :signatures signatures)
-              ]
-          ;; config-update-envelope is a payload data, i.e.
-          ;; Payload = Header + Payload(config-update-envelope)
-          (proto/send-update-channel-using-envelope envelope))))

 (defn create-or-update-channel
   ([orderer envelope]


fix the dockerised unit tests so that they can be run on MacOS

--- test/duratom/core_test.clj
+++ test/duratom/core_test.clj
@@ -3,9 +3,24 @@
             [duratom.core :refer :all]
             [duratom.utils :as ut]
             [taoensso.nippy :as nippy]
-            [clojure.java.io :as io])
-  (:import (duratom.core Duratom)
-           (clojure.lang Agent)))
+            [clojure.java
+             [shell :as shell]
+             [io :as io]]
+            [clojure.string :as str])
+  (:import (clojure.lang Agent)))
+
+(defonce docker-default-machine-ip
+  ;; `localhost` which works on Ubuntu simply won't work on MacOS.
+  ;; we need the public IP of the docker-machine - `default` in this case.
+  ;; this tends to be 192.168.99.100, but we can easily check via `docker-machine ip default`
+  (delay
+    (or (try
+          (some-> (shell/sh "docker-machine" "ip" "default")
+                  :out
+                  str/trim-newline)
+          (catch Throwable _))
+        ;; per https://devilbox.readthedocs.io/en/latest/howto/docker-toolbox/find-docker-toolbox-ip-address.html
+        "192.168.99.100")))

 (defn- common*
   [dura exists? async?]
@@ -134,9 +149,10 @@

 (defn- postgres-backed-tests*
   [async?]
-  (let [db-spec {:classname   "org.postgresql.Driver"
+  (let [ip @docker-default-machine-ip
+        db-spec {:classname   "org.postgresql.Driver"
                  :subprotocol "postgresql"
-                 :subname     "//localhost:5432/atomDB"
+                 :subname     (str "//"  ip ":5432/atomDB") ;; localhost won't work on the mac
                  :user        "dimitris"
                  :password    "secret"}
         table-name "atom_state"
@@ -196,7 +212,9 @@

 (defn- redis-backed-tests*
   [async?]
-  (let [db-config  {:pool {} :spec {:uri "redis://localhost:6379/"}}
+  (let [ip @docker-default-machine-ip
+        db-config  {:pool {}
+                    :spec {:uri (str "redis://" ip ":6379/")}} ;; localhost won't work on the mac
         key-name "atom:state"
         init {:x 1 :y 2}
         key-exists? #(ut/redis-key-exists? db-config key-name)


Move sample dataset generation code off of korma :honey_pot:

--- sample_dataset/metabase/sample_dataset/generate.clj
+++ sample_dataset/metabase/sample_dataset/generate.clj
@@ -1,5 +1,6 @@
 (ns metabase.sample-dataset.generate
-  (:require [clojure.java.io :as io]
+  (:require (clojure.java [io :as io]
+                          [jdbc :as jdbc])
             [clojure.math.numeric-tower :as math]
             [clojure.string :as s]
             (faker [address :as address]
@@ -8,8 +9,7 @@
                    [internet :as internet]
                    [name :as name])
             [incanter.distributions :as dist]
-            (korma [core :as k]
-                   [db :as kdb])
+            [metabase.db.spec :as dbspec]
             [metabase.util :as u])
   (:import java.util.Date))

@@ -369,52 +369,48 @@
    (io/delete-file (str filename ".mv.db") :silently)
    (io/delete-file (str filename ".trace.db") :silently)
    (println "Creating db...")
-   (let [db (kdb/h2 {:db         (format "file:%s;UNDO_LOG=0;CACHE_SIZE=131072;QUERY_CACHE_SIZE=128;COMPRESS=TRUE;MULTI_THREADED=TRUE;MVCC=TRUE;DEFRAG_ALWAYS=TRUE;MAX_COMPACT_TIME=5000;ANALYZE_AUTO=100"
-                                         filename)
-                     :make-pool? false})]
+   (let [db (dbspec/h2 {:db         (format "file:%s;UNDO_LOG=0;CACHE_SIZE=131072;QUERY_CACHE_SIZE=128;COMPRESS=TRUE;MULTI_THREADED=TRUE;MVCC=TRUE;DEFRAG_ALWAYS=TRUE;MAX_COMPACT_TIME=5000;ANALYZE_AUTO=100"
+                                            filename)
+                        :make-pool? false})]
      (doseq [[table-name field->type] (seq tables)]
-       (k/exec-raw db (create-table-sql table-name field->type)))
+       (jdbc/execute! db [(create-table-sql table-name field->type)]))

      ;; Add FK constraints
      (println "Adding FKs...")
      (doseq [{:keys [source-table field dest-table]} fks]
-       (k/exec-raw db (format "ALTER TABLE \"%s\" ADD CONSTRAINT \"FK_%s_%s_%s\" FOREIGN KEY (\"%s\") REFERENCES \"%s\" (\"ID\");"
-                              source-table
-                              source-table field dest-table
-                              field
-                              dest-table)))
+       (jdbc/execute! db [(format "ALTER TABLE \"%s\" ADD CONSTRAINT \"FK_%s_%s_%s\" FOREIGN KEY (\"%s\") REFERENCES \"%s\" (\"ID\");"
+                                  source-table
+                                  source-table field dest-table
+                                  field
+                                  dest-table)]))

      ;; Insert the data
      (println "Inserting data...")
      (doseq [[table rows] (seq data)]
        (assert (keyword? table))
        (assert (sequential? rows))
-       (let [entity (-> (k/create-entity (s/upper-case (name table)))
-                        (k/database db))]
-         (k/insert entity (k/values (for [row rows]
-                                      (->> (for [[k v] (seq row)]
-                                             [(s/upper-case (name k)) v])
-                                           (into {})))))))
+       (let [table-name (s/upper-case (name table))]
+         (apply jdbc/insert! db table-name (for [row rows]
+                                             (into {} (for [[k v] (seq row)]
+                                                        {(s/upper-case (name k)) v}))))))

      ;; Insert the _metabase_metadata table
      (println "Inserting _metabase_metadata...")
-     (k/exec-raw db (format "CREATE TABLE \"_METABASE_METADATA\" (\"keypath\" VARCHAR(255),  \"value\" VARCHAR(255), PRIMARY KEY (\"keypath\"));"))
-     (-> (k/create-entity "_METABASE_METADATA")
-         (k/database db)
-         (k/insert (k/values (reduce concat (for [[table-name {table-description :description, columns :columns}] annotations]
-                                              (let [table-name (s/upper-case (name table-name))]
-                                                (conj (for [[column-name kvs] columns
-                                                            [k v]             kvs]
-                                                        {:keypath (format "%s.%s.%s" table-name (s/upper-case (name column-name)) (name k))
-                                                         :value   (name v)})
-                                                      {:keypath (format "%s.description" table-name)
-                                                       :value table-description})))))))
+     (jdbc/execute! db ["CREATE TABLE \"_METABASE_METADATA\" (\"KEYPATH\" VARCHAR(255), \"VALUE\" VARCHAR(255), PRIMARY KEY (\"KEYPATH\"));"])
+     (apply jdbc/insert! db "_METABASE_METADATA" (reduce concat (for [[table-name {table-description :description, columns :columns}] annotations]
+                                                                  (let [table-name (s/upper-case (name table-name))]
+                                                                    (conj (for [[column-name kvs] columns
+                                                                                [k v]             kvs]
+                                                                            {:keypath (format "%s.%s.%s" table-name (s/upper-case (name column-name)) (name k))
+                                                                             :value   (name v)})
+                                                                          {:keypath (format "%s.description" table-name)
+                                                                           :value table-description})))))

      ;; Create the 'GUEST' user
      (println "Preparing database for export...")
-     (k/exec-raw db "CREATE USER GUEST PASSWORD 'guest';")
+     (jdbc/execute! db ["CREATE USER GUEST PASSWORD 'guest';"])
      (doseq [table (conj (keys data) "_METABASE_METADATA")]
-       (k/exec-raw db (format "GRANT SELECT ON %s TO GUEST;" (s/upper-case (name table)))))
+       (jdbc/execute! db [(format "GRANT SELECT ON %s TO GUEST;" (s/upper-case (name table)))]))

      (println "Done."))))


first working version of leaf-neighbours lookup, i.e. lookup-range implementation

--- sample/src/sample/btree.clj
+++ sample/src/sample/btree.clj
@@ -214,8 +214,7 @@
                     vs2             (concat vs2a vs2b)]
                 [(->B+TreeInternalNode b (dec partition-size) ks1 vs1)
                  nk
-                 (->B+TreeInternalNode b (- partition-size (rem size 2)) ks2 vs2)
-                 leaf-neighbours]))
+                 (->B+TreeInternalNode b (- partition-size (rem size 2)) ks2 vs2)]))

             (ins [{:keys [b ks vs size] :as n} k v]
               (if-not (= k ::inf)
@@ -238,7 +237,7 @@
                                (-> (ins this nk n1)
                                    (ins childk n2)))]
         (if (>= (-> nn :size) b)
-          (split nn)
+          (concat (split nn) [nlnbs])
           [nn nil nil nlnbs]))))

   B+TreeLookupable
@@ -265,25 +264,27 @@
   B+TreeModifyable

   (insert [this k v leaf-neighbours]
-    (letfn [(insert-leaf-neighbours [n n1]
-              (let [{pleaf :prev nleaf :next} (get leaf-neighbours n)
+    (letfn [(insert-leaf-neighbours [n1]
+              (let [{pleaf :prev nleaf :next} (get leaf-neighbours this)
                     {ppleaf :prev}            (when-not (nil? pleaf)
                                                 (get leaf-neighbours pleaf))
                     {nnleaf :next}            (when-not (nil? nleaf)
                                                 (get leaf-neighbours nleaf))]
                 (-> leaf-neighbours
                     (assoc-if-not-nil pleaf {:prev ppleaf :next n1})
+                    (dissoc this)
                     (assoc-if-not-nil n1    {:prev pleaf  :next nleaf})
                     (assoc-if-not-nil nleaf {:prev n1     :next nnleaf}))))

-            (update-leaf-neighbours [n n1 n2]
-              (let [{pleaf :prev nleaf :next} (get leaf-neighbours n)
+            (update-leaf-neighbours [n1 n2]
+              (let [{pleaf :prev nleaf :next} (get leaf-neighbours this)
                     {ppleaf :prev}            (when-not (nil? pleaf)
                                                 (get leaf-neighbours pleaf))
                     {nnleaf :next}            (when-not (nil? nleaf)
                                                 (get leaf-neighbours nleaf))]
                 (-> leaf-neighbours
                     (assoc-if-not-nil pleaf {:prev ppleaf :next n1})
+                    (dissoc this)
                     (assoc-if-not-nil n1    {:prev pleaf  :next n2})
                     (assoc-if-not-nil n2    {:prev n1     :next nleaf})
                     (assoc-if-not-nil nleaf {:prev n2     :next nnleaf}))))
@@ -295,21 +296,20 @@
                     m2 (apply dissoc m ks1)
                     n1size partition-size
                     n2size (- partition-size (rem size 2))
+                    n1 (->B+TreeLeafNode b n1size m1)
                     n2 (->B+TreeLeafNode b n2size m2)
-                    n1 (->B+TreeLeafNode b n1size m1)
-                    nleafnbs (update-leaf-neighbours n n1 n2)]
-                (println "NLEAFNBS" nleafnbs)
+                    nleafnbs (update-leaf-neighbours n1 n2)]
                 [n1 (last ks1) n2 nleafnbs]))

-            (ins [{:keys [b m size] :as n} k v]
+            (ins [k v]
               (let [nsize (if (contains? m k) size (inc size))
                     nm (assoc m k v)]
                 (->B+TreeLeafNode b nsize nm)))]

-      (let [nn (ins this k v)]
+      (let [nn (ins k v)]
         (if (>= (-> nn :size) b)
           (split nn)
-          [nn nil nil (insert-leaf-neighbours this nn)]))))
+          [nn nil nil (insert-leaf-neighbours nn)]))))

   B+TreeLookupable

@@ -317,16 +317,19 @@
     [k (get m k)])

   (lookup-range [this k klen leaf-neighbours]
-    (println "RANGE LOOKUP" k klen (keys m))
-    (when (<= (cmp-keys (-> m keys first) k) 0)
+    (when (>= (cmp-keys k (-> m keys first)) 0)
       (let [matching-keys (->> (keys m)
                                (filter #(= (cmp-keys % k) 0)))]
-        (println "  MK" (keys m) matching-keys)
-        [k (concat (-> (select-keys m matching-keys)
-                       vals
-                       vec)
-                   (when-let [next (get leaf-neighbours this)]
-                     (second (lookup-range next k klen leaf-neighbours))))])))
+        ;;; TODO: we don't really need k in this case, as it is only needed for when we get
+        ;;;   invoked by insert. as this never happens for lookup-range, we could get rid of
+        ;;;   k (i.e. result in 2-tuple vector form). however, currently lookup* (below) relies
+        ;;;   on the format to be a 2-tuple, so we leave it like that for the moment:
+        [k (lazy-seq
+            (concat (-> (select-keys m matching-keys)
+                        vals
+                        vec)
+                    (when-let [next (-> (get leaf-neighbours this) :next)]
+                      (second (lookup-range next k klen leaf-neighbours)))))])))

   B+TreeLeafNodeIterable

@@ -345,23 +348,11 @@
   t/TreeModifyable

   (insert [this k v]
-    (letfn [#_(neighbour-map [root]
-                (let [nodes (iterate-leafnodes root)
-                      prevs (concat [nil] nodes)
-                      nexts (-> (rest nodes) (concat [nil]))]
-                  (->> (map (fn [node prev next]
-                              [node prev next])
-                            nodes prevs nexts)
-                       (reduce (fn [s [node prev next]]
-                                 (assoc s node {:prev prev
-                                                :next next}))
-                               {}))))]
-
-      (let [[n1 k n2 nlnbs] (insert root k v leaf-neighbours)
-            nroot (if (nil? n2)
-                    n1
-                    (->B+TreeInternalNode b 1 [k] [n1 n2]))]
-        (->B+Tree b nroot nlnbs))))
+    (let [[n1 k n2 nlnbs] (insert root k v leaf-neighbours)
+          nroot (if (nil? n2)
+                  n1
+                  (->B+TreeInternalNode b 1 [k] [n1 n2]))]
+      (->B+Tree b nroot nlnbs)))

   t/TreeLookupable

@@ -382,13 +373,13 @@

 #_(-> (b+tree 3)
-    (t/insert 5 55)
-    (t/insert 9 99)
-    (t/insert 3 33)
-    (t/insert 4 44)
-    (t/insert 2 22)
-    (t/insert 1 11)
-    #_(t/lookup 3))
+    (t/insert [:a 5] 55)
+    (t/insert [:a 9] 99)
+    (t/insert [:a 3] 33)
+    (t/insert [:a 4] 44)
+    (t/insert [:a 2] 22)
+    (t/insert [:a 1] 11)
+    (t/lookup-range [:a 3]))

 #_(let [kvs (take 100000 (repeatedly #(let [k (-> (rand-int 9000000)
                                                 (+ 1000000))]
@@ -407,15 +398,16 @@
   [kv1 (count @ts) (time (t/lookup t k1))])

 #_(let [kvs (for [k1 [:a :b :c]
-                k2 [1 3 5 7 9]]
-            [[k1 k2] (str (name k1) k2)])
+                k2 ["x" "y" "z"]
+                k3 [1 3 5 7 9]]
+            [[k1 k2 k3] (str (name k1) k2 k3)])
       t (time (reduce (fn [t [k v]]
                         (let [nt (t/insert t k v)]
                           nt))
                       (b+tree 3)
                       kvs))]
-  (clojure.pprint/pprint t)
-  (t/lookup t [:a]))
+  #_(clojure.pprint/pprint t)
+  (t/lookup-range t [:b]))


update conversion ID

update conversion ID

--- frontend/analytics/facebook.cljs
+++ frontend/analytics/facebook.cljs
@@ -3,7 +3,7 @@
             [goog.net.jsloader]))

 (defn track-conversion []
-  (.push js/window._fbq #js ["track" "6017231164176" {:value "0.01" :currency "USD"}]))
+  (.push js/window._fbq #js ["track" "6017370234581" {:value "0.01" :currency "USD"}]))

 (defn track-signup []
   (utils/swallow-errors


Introducing abbreviations for context-{object,attribute}-closure

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

--- src/conexp/fca/contexts.clj
+++ src/conexp/fca/contexts.clj
@@ -417,6 +417,8 @@
   [ctx set-of-objects]
   (attribute-derivation ctx (object-derivation ctx set-of-objects)))

+(defalias odprime context-object-closure)
+
 (defn extents
   "Computes a sequence of all extents of ctx, in a lectic order."
   [ctx]
@@ -426,6 +428,8 @@
   "Computes double prime in context ctx for the given set-of-attributes."
   [ctx set-of-attributes]
   (object-derivation ctx (attribute-derivation ctx set-of-attributes)))
+
+(defalias adprime context-attribute-closure)

 (defn intents
   "Computes a sequence of all intents of ctx, in a lectic order."


add charts for tag type counts and type counts

Also fixed sorting issue in count-and-group for tag-type-counts

--- pedestal-app/app/src/semtag_web/rendering.cljs
+++ pedestal-app/app/src/semtag_web/rendering.cljs
@@ -86,8 +86,8 @@
             screen (route/url->screen rel-uri params)]
         (swap! route/dynamic-screens assoc screen params)
         (set-focus-messages :screen screen
-                                :params params
-                                :paths (dynamic-paths route screen)))
+                            :params params
+                            :paths (dynamic-paths route screen)))
       ;; just for static pages
       (if-let [screen (route/url->screen rel-uri)]
         (set-focus-messages :screen screen)
@@ -112,8 +112,8 @@
 (def templates (html-templates/semtag-web-templates))

 (defn render-home-page [_ _ input-queue]
-    (set-page-title "Welcome to semtag!")
-    (history/navigated input-queue :home))
+  (set-page-title "Welcome to semtag!")
+  (history/navigated input-queue :home))

 ;;; Search-form
 ;;;
@@ -156,24 +156,40 @@
 (defn set-search-title [renderer [_ path _ new-value] _]
   (set-page-title new-value))

-(defn- add-stats-charts [things]
-  (let [tag-counts (->> (flatten (map :tags things))
-                        frequencies
-                        (sort-by #(second %1) (fn [a b] (> a b)))
-                        (group-by second)
-                        (mapv (fn [[k v]] [k (->> v
-                                                  (map first)
-                                                  sort
-                                                  (string/join ", "))])))]
+(defn- count-and-group
+  "Given a list of words, returns a vector of sorted count and grouped word pairs."
+  [words]
+  (->> words
+       frequencies
+       (group-by second)
+       (mapv (fn [[k v]] [k (->> v
+                                 (map first)
+                                 sort
+                                 (string/join ", "))]))
+       (sort-by first)
+       reverse))
+
+(defn- add-stats-charts [tags things]
+  (let [tag-type-counts (count-and-group (map first tags))
+        tag-counts (count-and-group (flatten (map :tags things)))
+        type-counts (count-and-group (map :type things))]
+    (bar-chart/render "#type_counts_chart"
+                      (mapv first type-counts)
+                      (mapv second type-counts))
     (bar-chart/render "#tag_counts_chart"
                       (mapv first tag-counts)
-                      (mapv second tag-counts))))
+                      (mapv second tag-counts))
+    (bar-chart/render "#tag_type_counts_chart"
+                      (mapv first tag-type-counts)
+                      (mapv second tag-type-counts))))

 (defn render-search-results [_ [_ _ _ new-value] input-queue]
   (let [{:keys [things tags]} new-value]
     (dom/set-html!
       (dom/by-id "search_results")
-      (html "

"
+      (html "

Type Counts

"
+            "

Tag Counts

"
+            "

Tag Type Counts

"
             "

"
             (p/table-stats (frequency-stat "Tag Type Counts" (map first tags))
                            (frequency-stat "Tag Counts" (flatten (map :tags things)))
@@ -182,7 +198,7 @@
                               :fields [:type :name :url :desc :tags]
                               :row-partial p/tag-search-row
                               :caption (format "Total: %s" (count (map :url things))))))
-    (add-stats-charts things)
+    (add-stats-charts tags things)
     (enable-clickable-links-on "#search_table td:not([data-field=url])" input-queue)))

 ;; we'd like to destroy/hide these but that requires changing render-search-results


Not ready to doc this just yet

Not ready to doc this just yet

--- modules/cache/src/main/clojure/immutant/cache/config.clj
+++ modules/cache/src/main/clojure/immutant/cache/config.clj
@@ -15,7 +15,7 @@
 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 ;; 02110-1301 USA, or see the FSF site: http://www.fsf.org.

-(ns immutant.cache.config
+(ns ^{:no-doc true} immutant.cache.config
   (:import [org.infinispan.configuration.cache VersioningScheme CacheMode]
            [org.infinispan.transaction TransactionMode LockingMode]
            org.infinispan.transaction.lookup.GenericTransactionManagerLookup


fix removal of jsloader.load

fix removal of jsloader.load

--- support/src/figwheel/client/file_reloading.cljs
+++ support/src/figwheel/client/file_reloading.cljs
@@ -5,6 +5,7 @@
    [goog.string]
    [goog.object :as gobj]
    [goog.net.jsloader :as loader]
+   [goog.html.legacyconversions :as conv]
    [goog.string :as gstring]
    [clojure.string :as string]
    [clojure.set :refer [difference]]
@@ -205,8 +206,10 @@
 (defn reload-file-in-html-env
   [request-url callback]
   (dev-assert (string? request-url) (not (nil? callback)))
-  (let [deferred (loader/load (add-cache-buster request-url)
-                              #js {:cleanupWhenDone true})]
+  (let [deferred (loader/safeLoad
+                  (conv/trustedResourceUrlFromString
+                   (str (add-cache-buster request-url)))
+                  #js {:cleanupWhenDone true})]
     (.addCallback deferred #(apply callback [true]))
     (.addErrback deferred #(apply callback [false]))))


One more stress test wiped out

One more stress test wiped out

--- test/clojurewerkz/cassaforte/multi/stress_test.clj
+++ test/clojurewerkz/cassaforte/multi/stress_test.clj
@@ -1,21 +0,0 @@
-(ns clojurewerkz.cassaforte.multi.stress-test
-  (:require [clojurewerkz.cassaforte.test-helper :as th]
-            [clojurewerkz.cassaforte.client :as client]
-            [clojurewerkz.cassaforte.multi.cql :refer :all]
-            [clojure.test :refer :all]
-            [clojurewerkz.cassaforte.query :refer :all]))
-
-(use-fixtures :each th/initialize!)
-
-(deftest insert-test
-  (doseq [n [10 1000 10000]]
-    (let [table  :users
-          docs   (map (fn [i]
-                        {:name (str "user_" i) :city (str "city_" i) :age (int i)})
-                      (take n (iterate inc 1)))]
-      (truncate th/session table)
-      (println "Inserting " n " documents...")
-      (time (insert-batch th/session table docs))
-      (println "Inserting " n " documents with prepared statement...")
-      (time (client/prepared (insert-batch th/session table docs)))
-      (is (= n (perform-count th/session table))))))


Remove the upper limit for the option 'cassandra-batch-rate'

--- src/cyanite_remover/cli.clj
+++ src/cyanite_remover/cli.clj
@@ -225,7 +225,7 @@
     :validate [#(< 0 %) "Must be a number > 0"]]
    [nil "--cassandra-batch-rate RATE" "Cassandra batch rate (batches per second)"
     :parse-fn #(Integer/parseInt %)
-    :validate [#(< 0 % 101) "Must be a number between 1-100"]]
+    :validate [#(< 0 %) "Must be a number > 0"]]
    [nil "--elasticsearch-index INDEX"
     (str "Elasticsearch index. Default: " pstore/default-es-index)]
    [nil "--elasticsearch-scroll-batch-size SIZE"


Write errors to standard error.

Write errors to standard error.

--- src/enoki_lang_clj/core.clj
+++ src/enoki_lang_clj/core.clj
@@ -141,5 +141,6 @@
   [& args]
   (let [ast (parser (slurp *in*))]
     (if (map? ast)
-      (println ast)
+      (binding [*out* *err*]
+        (println ast))
       (println (code-gen ast)))))