[#947] Allow new columns when updating a dataset

Bug found by @janagombitova and @nadiagorchakova

--- backend/src/akvo/lumen/import.clj
+++ backend/src/akvo/lumen/import.clj
@@ -11,6 +11,7 @@
             [clj-http.client :as client]
             [clojure.data.csv :as csv]
             [clojure.java.jdbc :as jdbc]
+            [clojure.set :as set]
             [clojure.string :as str]
             [hugsql.core :as hugsql]))

@@ -47,18 +48,19 @@
     (update-successful-job-execution conn {:id job-execution-id})))

 (defn successful-update
-  "On a successful update we need to create a new dataset-version that is an exact copy
-   of the previous one, except with an updated :version and pointing to the new table-name
-   and imported-table-name. We also delete the previous table-name and imported-table-name
-   so we don't accumulate unused datasets on each update."
-  [conn job-execution-id dataset-id table-name imported-table-name dataset-version]
+  "On a successful update we need to create a new dataset-version that
+  is similar to the previous one, except with an updated :version and
+  pointing to the new table-name, imported-table-name and columns. We
+  also delete the previous table-name and imported-table-name so we
+  don't accumulate unused datasets on each update."
+  [conn job-execution-id dataset-id table-name imported-table-name dataset-version new-columns]
   (insert-dataset-version conn {:id (str (squuid))
                                 :dataset-id dataset-id
                                 :job-execution-id job-execution-id
                                 :table-name table-name
                                 :imported-table-name imported-table-name
                                 :version (inc (:version dataset-version))
-                                :columns (vec (:columns dataset-version))
+                                :columns new-columns
                                 :transformations (vec (:transformations dataset-version))})
   (drop-table (:imported-table-name dataset-version))
   (drop-table (:table-name dataset-version))
@@ -139,18 +141,13 @@
       columns)))

 (defn compatible-columns? [imported-columns columns]
-  (let [imported-columns (reduce (fn [m column]
-                                   (let [column-id (keyword (get column "columnName"))
-                                         column-type (keyword (get column "type"))
-                                         column-title (get column "title")]
-                                     (assoc m column-id {:id column-id
-                                                         :type column-type
-                                                         :title column-title})))
-                                 {}
-                                 imported-columns)]
-    (every? (fn [column]
-              (= column (get imported-columns (:id column))))
-            columns)))
+  (let [imported-columns (map (fn [column]
+                                {:id (keyword (get column "columnName"))
+                                 :type (keyword (get column "type"))
+                                 :title (get column "title")})
+                              imported-columns)]
+    (set/subset? (set imported-columns)
+                 (set columns))))

 (defn do-update [conn config dataset-id data-source-id job-execution-id data-source-spec]
   (try
@@ -173,13 +170,24 @@
                                    :to-table imported-table-name}
                                   {}
                                   {:transaction? false})
-                (apply-transformation-log conn table-name imported-columns transformations)
-                (successful-update conn
-                                   job-execution-id
-                                   dataset-id
-                                   table-name
-                                   imported-table-name
-                                   dataset-version))))))
+                (let [new-columns (apply-transformation-log conn
+                                                            table-name
+                                                            (mapv (fn [{:keys [title id type]}]
+                                                                    {"type" (name type)
+                                                                     "title" title
+                                                                     "columnName" (name id)
+                                                                     "sort" nil
+                                                                     "direction" nil
+                                                                     "hidden" false})
+                                                                  columns)
+                                                            transformations)]
+                  (successful-update conn
+                                     job-execution-id
+                                     dataset-id
+                                     table-name
+                                     imported-table-name
+                                     dataset-version
+                                     new-columns)))))))
     (catch clojure.lang.ExceptionInfo e
       (failed-update conn job-execution-id (.getMessage e))
       (throw e))


Fix typo in comment

Fix typo in comment

--- test/com/wsscode/pathom/playground.clj
+++ test/com/wsscode/pathom/playground.clj
@@ -52,7 +52,7 @@
                   p/trace-plugin]}))

 ;; A join on a lookup ref (Fulcro ident) supplies the starting state of :person/id 1.
-;; env can have anything you want in it (e.g. a Datommic/SQL connection, network service endpoint, etc.)
+;; env can have anything you want in it (e.g. a Datomic/SQL connection, network service endpoint, etc.)
 ;; the concurrency is handled though core.async, so you have to read the channel to get the output

 ; => {[:person/id 1] {:person/id 1 :person/name "Tom" :person/address {:address/city "Salem}}}


Added missing docs and namespace from node-pool.

--- src/shale/node-pool.clj
+++ src/shale/node-pool.clj
@@ -1,11 +1,17 @@
+(ns shale.node-pool)
+
 (defprotocol NodePool
   "Basic interface for choosing and managing Selenium nodes per session.
    Implementing this allows dynamic node domains- eg, by retrieving them from
    a cloud provider's API."

-  (get-node [this requirements] "")
-  (add-node [this requirements] "")
-  (remove-node [this url] ""))
+  (get-node [this requirements]
+    "Get a node from the pool. Takes the same requirement map as
+     get-or-create-session.")
+  (add-node [this requirements]
+    "Add a node to the pool that fulfills the requirement map.")
+  (remove-node [this url]
+    "Remove a node from the pool specific by url."))

 (deftype DefaultNodePool [nodes] NodePool
   "A simple node pool the chooses randomly from an initial list."
@@ -18,5 +24,4 @@

   (remove-node [this requirements]
     (throw (ex-info "Unable to remove nodes with the default node pool."
-                    {:user-visible true :status 500})))
-  )
+                    {:user-visible true :status 500}))))


(PDB-5022) meta-test/test-latest-version: disambiguate duplicate tests

--- test/puppetlabs/puppetdb/meta_test.clj
+++ test/puppetlabs/puppetdb/meta_test.clj
@@ -85,7 +85,7 @@
                 log-levels-emitted (set (map second @logz))]
             (is (nil? (log-levels-emitted :info)))))))))

-(deftest test-latest-version
+(deftest update-server-http-errors-not-logged-as-info
   (dotestseq [[version endpoint] endpoints]
     (testing "doesn't log update server HTTP errors at INFO"
       (with-test-db


Improve visibility of active buttons.

Improve visibility of active buttons.

Switching to RGB colors made it harder to see the difference between
active and ready state for some of the colors; this makes them move
distinct.

--- src/afterglow/controllers/ableton_push.clj
+++ src/afterglow/controllers/ableton_push.clj
@@ -698,7 +698,7 @@
                            (if ending
                              (if (> (rhythm/metro-beat-phase (:metronome (:show controller))) 0.4) 10 20)
                              50)
-                           (if (active-keys (:key cue)) 10 25))
+                           (if (active-keys (:key cue)) 10 20))
                          l-boost)))]
       (aset (:next-grid-pads controller) (+ x (* y 8)) (or color off-color)))))


put menu btn before canvas to kill selection bug

--- src-cljs/frontend/components/app.cljs
+++ src-cljs/frontend/components/app.cljs
@@ -48,10 +48,10 @@
     (render [_]
       (if (:navigation-point app)
         (dom/div #js {:id "app" :className "app"}
+          (om/build overlay/main-menu-button (select-in app [state/overlays-path state/main-menu-learned-path]))
           (when (overlay-visible? app)
             (om/build overlay/overlay app))
           (om/build app* app)
-          (dom/div #js {:className "app-main-outline"})
-          (om/build overlay/main-menu-button (select-in app [state/overlays-path state/main-menu-learned-path])))
+          (dom/div #js {:className "app-main-outline"}))

         (html [:div#app])))))


changed the logic for show-build-timing? and show-build-insights? to be less buggy and include trials and osx plans

--- src-cljs/frontend/models/project.cljs
+++ src-cljs/frontend/models/project.cljs
@@ -156,7 +156,9 @@
 (defn show-build-timing? [project plan]
   (or (config/enterprise?)
       (:oss project)
-      (> (:containers plan) 1)))
+      (plan-model/paid? plan)
+      (plan-model/trial? plan)
+      (plan-model/osx? plan)))

 (defn add-show-insights? [project plans]
   (let [org-name (-> project
@@ -169,6 +171,9 @@
                            (first)
                            (:plans)
                            (apply max-key :containers))]
+
     (assoc project :show-insights? (or (config/enterprise?)
                                        (:oss project)
-                                       (> (:containers org-best-plan) 1)))))
+                                       (plan-model/paid? org-best-plan)
+                                       (plan-model/trial? org-best-plan)
+                                       (plan-model/osx? org-best-plan)))))


changed impl of set-fields

changed impl of set-fields

--- src/karras/sugar.clj
+++ src/karras/sugar.clj
@@ -64,7 +64,7 @@
   (apply merge clauses))

 (defn incr       [field & [amount]] {:$inc {field (or amount 1)}})
-(defn set-fields [& pairs]          {:$set (apply hash-map pairs)})
+(defn set-fields [field-map]          {:$set field-map})
 (defn unset      [field]            {:$unset {field 1}})
 (defn push       [field value]      {:$push {field value}})
 (defn pop-last   [field]            {:$pop {field 1}})


fix reload

fix reload

--- recipes/boot-setup/build.boot
+++ recipes/boot-setup/build.boot
@@ -26,7 +26,7 @@
   (comp (serve :dir "target")
         (watch)
         (cljs-repl)
+        (reload :on-jsload 'boot-setup.core/main)
         (cljs :source-map true
               :optimizations :none
-              :unified-mode true)
-        (reload :on-jsload 'boot-setup.core/main)))
+              :unified-mode true)))


add zk-ledgers-root-path to env-config schema

--- src/onyx/schema.cljc
+++ src/onyx/schema.cljc
@@ -490,6 +490,7 @@
    (s/optional-key :onyx.bookkeeper/base-ledger-dir) s/Str
    (s/optional-key :onyx.bookkeeper/disk-usage-threshold) (s/pred float?)
    (s/optional-key :onyx.bookkeeper/disk-usage-warn-threshold) (s/pred float?)
+   (s/optional-key :onyx.bookkeeper/zk-ledgers-root-path) s/Str
    s/Keyword s/Any})

 (s/defschema AeronIdleStrategy


friend-list: added schema validation

friend-list: added schema validation

--- examples/friend-list/src-spec/friend_list/core.cljs
+++ examples/friend-list/src-spec/friend_list/core.cljs
@@ -1,12 +1,23 @@
 ; namespace is extracted into a separate src folder in order to be reused in elm-ish architecture examples
 (ns friend-list.core
   (:require [middleware.routing :as routing]
+            [middleware.schema :as schema]
+            [schema.core :as s]
             [reagent-mvsa.core :as mvsa]
             [reagent.core :as r]
             [goog.functions :refer [debounce]]
             [cljs.core.match :refer-macros [match]]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(def Schema
+  {:query   s/Str
+   :friends [{:id       s/Int
+              :name     s/Str
+              :username s/Str}]
+
+   ; allow any additional keys in order to support keys added by middlewares
+   s/Any    s/Any})
+
 (def -initial-model
   {:query   ""
    :friends nil})
@@ -93,4 +104,5 @@
   (-> {:initial-model -initial-model
        :control       (-new-control history api-search)
        :reconcile     -reconcile}
+      (schema/add Schema)
       (routing/add history)))


fixed render-page call

fixed render-page call

--- src/prais2/main.cljs
+++ src/prais2/main.cljs
@@ -289,7 +289,7 @@
 ;; Contains the app user interface
 ;;
 (rum/defc app-container < bs-popover bs-tooltip []
-          (render-page app)
+          (render-page)
           )

 ;;


Add a linebreak bretween board size and shuffle and update copyright

--- src/tile_game/grid.cljs
+++ src/tile_game/grid.cljs
@@ -31,16 +31,18 @@

 (defn board-size-slider [size command]
   [:div
-   [:button {:on-click #(async/put! command :reset)
-             :title "Generate a new solved board at selected size."}
-    "Reset"]
-   [:button {:on-click #(async/put! command :new-game)
-             :title "Generate a new shuffled board at the selected size."}
-    "Shuffle"]
-   [:label (str "Board size: " size)]
-   [:input {:type "range" :value size :min 2 :max 8
-            :on-change (fn [e] (swap! app-state assoc :size (.-target.value e)))
-            :style {:width "25%"}}]])
+   [:div
+    [:label (str "Board size: " size)]
+    [:input {:type "range" :value size :min 2 :max 8
+             :on-change (fn [e] (swap! app-state assoc :size (.-target.value e)))
+             :style {:width "25%"}}]]
+   [:div
+    [:button {:on-click #(async/put! command :reset)
+              :title "Generate a new solved board at selected size."}
+     "Reset"]
+    [:button {:on-click #(async/put! command :new-game)
+              :title "Generate a new shuffled board at the selected size."}
+     "Shuffle"]]])

 (defn render-tile [[x y] tile command]
   (if-not (zero? tile)
@@ -92,7 +94,7 @@
            [:div [:button {:on-click #(async/put! command :solve)} "Run solver!"]]]))]
      [:details [:summary "Help"] (help-screen)]
      [:p
-      "© 2017 Charles L.G. Comstock "
+      "© 2017-2018 Charles L.G. Comstock "
       [:a {:href "https://github.com/dgtized/tile-game"} "(github)"]]]))

 (defn playback-moves


Privatize a few functions in git-branch workflow.

--- src/incise/deploy/workflows/git_branch.clj
+++ src/incise/deploy/workflows/git_branch.clj
@@ -31,7 +31,7 @@
        (with-sh-dir *work-dir*
          ~@body))))

-(defn branch-exists?
+(defn- branch-exists?
   [branch]
   (contains? (git-branch-list *repo*) branch))

@@ -46,11 +46,11 @@
     checkout-orphaned-branch
     (partial git-checkout *repo*)) branch))

-(defn once-in-out-dir []
+(defn- once-in-out-dir []
   (.mkdirs *out-dir*)
   (once :out-dir (.getPath *out-dir*)))

-(defn head-info []
+(defn- head-info []
   (commit-info
     (find-rev-commit *repo*
                      (create-tree-walk *repo*)


More cleanup, rename writer functions

More cleanup, rename writer functions

--- src/main/clojure/clojure/data/json_new.clj
+++ src/main/clojure/clojure/data/json_new.clj
@@ -1,8 +1,3 @@
-;;; json.clj: JavaScript Object Notation (JSON) parser/writer
-
-;; by Stuart Sierra, http://stuartsierra.com/
-;; January 30, 2010
-
 ;; Copyright (c) Stuart Sierra, 2010. All rights reserved.  The use
 ;; and distribution terms for this software are covered by the Eclipse
 ;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
@@ -12,17 +7,12 @@
 ;; remove this notice, or any other, from this software.

 (ns ^{:author "Stuart Sierra"
-      :doc "JavaScript Object Notation (JSON) parser/writer.
-  See http://www.json.org/
-  To write JSON, use json-str, write-json, or print-json.
-  To read JSON, use read-json."}
+      :doc "JavaScript Object Notation (JSON) parser/generator.
+  See http://www.json.org/"}
   clojure.data.json-new
-  (:use [clojure.pprint :only (write formatter-out)])
+  (:require [clojure.pprint :as pprint])
   (:import (java.io PrintWriter PushbackReader StringWriter
                     StringReader Reader EOFException)))
-
-(def ^:dynamic ^:private *escape-unicode*)
-(def ^:dynamic ^:private *escape-solidus*)

 ;;; JSON READER

@@ -200,7 +190,8 @@
           ;; Read JSON arrays
           \[ (parse-array stream)

-          (throw (Exception. (str "JSON error (unexpected character): " (char c)))))))))
+          (throw (Exception.
+                  (str "JSON error (unexpected character): " (char c)))))))))

 (defn parse [rdr & options]
   (let [{:keys [keywordize eof-error? eof-value]
@@ -214,34 +205,36 @@
   ([string & options]
      (apply parse (PushbackReader. (StringReader. string)) options)))

-;;; JSON PRINTER
-
-(defprotocol Write-JSON
-  (write-json [object out escape-unicode?]
+;;; JSON WRITER
+
+(def ^:dynamic ^:private *escape-unicode*)
+(def ^:dynamic ^:private *escape-slash*)
+
+(defprotocol JSONWriter
+  (-write-json [object out]
     "Print object to PrintWriter out as JSON"))

-(defn- write-json-string [^CharSequence s ^PrintWriter out escape-unicode?]
+(defn- write-json-string [^CharSequence s ^PrintWriter out]
   (let [sb (StringBuilder. ^Integer (count s))]
     (.append sb \")
     (dotimes [i (count s)]
       (let [cp (int (.charAt s i))]
         (codepoint-case cp
-          ;; Handle printable JSON escapes before ASCII
+          ;; Printable JSON escapes
           \" (.append sb "\\\"")
           \\ (.append sb "\\\\")
-          \/ (.append sb "\\/")
-          ;; Print simple ASCII characters
+          \/ (.append sb (if *escape-slash* "\\/" "/"))
+          ;; Simple ASCII characters
           :simple-ascii (.append sb (.charAt s i))
-          ;; Handle JSON escapes
+          ;; JSON escapes
           \backspace (.append sb "\\b")
           \formfeed  (.append sb "\\f")
           \newline   (.append sb "\\n")
           \return    (.append sb "\\r")
           \tab       (.append sb "\\t")
           ;; Any other character is Unicode
-          (if escape-unicode?
-            ;; Hexadecimal-escaped
-            (.append sb (format "\\u%04x" cp))
+          (if *escape-unicode*
+            (.append sb (format "\\u%04x" cp)) ; Hexadecimal-escaped
             (.appendCodePoint sb cp)))))
     (.append sb \")
     (.print out (str sb))))
@@ -252,29 +245,29 @@
     (name x)
     (str x)))

-(defn- write-json-object [m ^PrintWriter out escape-unicode?]
+(defn- write-json-object [m ^PrintWriter out]
   (.print out \{)
   (loop [x m]
     (when (seq m)
       (let [[k v] (first x)]
         (when (nil? k)
           (throw (Exception. "JSON object keys cannot be nil/null")))
-	(write-json-string (as-str k) out escape-unicode?)
+	(write-json-string (as-str k) out)
         (.print out \:)
-        (write-json v out escape-unicode?))
+        (-write-json v out))
       (let [nxt (next x)]
         (when (seq nxt)
           (.print out \,)
           (recur nxt)))))
   (.print out \}))

-(defn- write-json-array [s ^PrintWriter out escape-unicode?]
+(defn- write-json-array [s ^PrintWriter out]
   (.print out \[)
   (loop [x s]
     (when (seq x)
       (let [fst (first x)
             nxt (next x)]
-        (write-json fst out escape-unicode?)
+        (-write-json fst out)
         (when (seq nxt)
           (.print out \,)
           (recur nxt)))))
@@ -283,81 +276,82 @@
 (defn- write-json-bignum [x ^PrintWriter out escape-unicode]
   (.print out (str x)))

-(defn- write-json-plain [x ^PrintWriter out escape-unicode?]
+(defn- write-json-plain [x ^PrintWriter out]
   (.print out x))

-(defn- write-json-null [x ^PrintWriter out escape-unicode?]
+(defn- write-json-null [x ^PrintWriter out]
   (.print out "null"))

-(defn- write-json-named [x ^PrintWriter out escape-unicode?]
-  (write-json-string (name x) out escape-unicode?))
-
-(defn- write-json-generic [x out escape-unicode?]
+(defn- write-json-named [x ^PrintWriter out]
+  (write-json-string (name x) out))
+
+(defn- write-json-generic [x out]
   (if (.isArray (class x))
-    (write-json (seq x) out escape-unicode?)
+    (-write-json (seq x) out)
     (throw (Exception. (str "Don't know how to write JSON of " (class x))))))

-(defn- write-json-ratio [x out escape-unicode?]
-  (write-json (double x) out escape-unicode?))
-
-(extend nil Write-JSON
-        {:write-json write-json-null})
-(extend clojure.lang.Named Write-JSON
-        {:write-json write-json-named})
-(extend java.lang.Boolean Write-JSON
-        {:write-json write-json-plain})
-(extend java.lang.Number Write-JSON
-        {:write-json write-json-plain})
-(extend java.math.BigInteger Write-JSON
-        {:write-json write-json-bignum})
-(extend java.math.BigDecimal Write-JSON
-        {:write-json write-json-bignum})
-(extend clojure.lang.Ratio Write-JSON
-        {:write-json write-json-ratio})
-(extend java.lang.CharSequence Write-JSON
-        {:write-json write-json-string})
-(extend java.util.Map Write-JSON
-        {:write-json write-json-object})
-(extend java.util.Collection Write-JSON
-        {:write-json write-json-array})
-(extend clojure.lang.ISeq Write-JSON
-        {:write-json write-json-array})
-(extend java.lang.Object Write-JSON
-        {:write-json write-json-generic})
+(defn- write-json-ratio [x out]
+  (-write-json (double x) out))
+
+(extend nil JSONWriter
+        {:-write-json write-json-null})
+(extend clojure.lang.Named JSONWriter
+        {:-write-json write-json-named})
+(extend java.lang.Boolean JSONWriter
+        {:-write-json write-json-plain})
+(extend java.lang.Number JSONWriter
+        {:-write-json write-json-plain})
+(extend java.math.BigInteger JSONWriter
+        {:-write-json write-json-bignum})
+(extend java.math.BigDecimal JSONWriter
+        {:-write-json write-json-bignum})
+(extend clojure.lang.Ratio JSONWriter
+        {:-write-json write-json-ratio})
+(extend java.lang.CharSequence JSONWriter
+        {:-write-json write-json-string})
+(extend java.util.Map JSONWriter
+        {:-write-json write-json-object})
+(extend java.util.Collection JSONWriter
+        {:-write-json write-json-array})
+(extend clojure.lang.ISeq JSONWriter
+        {:-write-json write-json-array})
+(extend java.lang.Object JSONWriter
+        {:-write-json write-json-generic})
+
+(defn write-json
+  "Write JSON-formatted output to a java.io.Writer.
+   Options are key-value pairs, valid options are:
+
+    :escape-unicode false
+        to turn off \\uXXXX escapes of Unicode characters
+
+    :escape-slash false
+        to turn of escaping / as \\/"
+  [x writer & options]
+  (let [{:keys [escape-unicode escape-slash]
+         :or {escape-unicode true
+              escape-slash true}} options]
+    (binding [*escape-unicode* escape-unicode
+              *escape-slash* escape-slash]
+      (-write-json x (PrintWriter. writer)))))

 (defn json-str
-  "Converts x to a JSON-formatted string.
-
-  Valid options are:
-    :escape-unicode false
-        to turn of \\uXXXX escapes of Unicode characters."
+  "Converts x to a JSON-formatted string. Options are the same as
+  write-json."
   [x & options]
-  (let [{:keys [escape-unicode] :or {escape-unicode true}} options
-	sw (StringWriter.)
-        out (PrintWriter. sw)]
-    (write-json x out escape-unicode)
+  (let [sw (StringWriter.)]
+    (apply write-json x sw options)
     (.toString sw)))

-(defn print-json
-  "Write JSON-formatted output to *out*.
-
-  Valid options are:
-    :escape-unicode false
-        to turn off \\uXXXX escapes of Unicode characters."
-  [x & options]
-  (let [{:keys [escape-unicode] :or {escape-unicode true}} options]
-    (write-json x (PrintWriter. *out*) escape-unicode)))
-
-
 ;;; JSON PRETTY-PRINTER

 ;; Based on code by Tom Faulhaber

 (defn- pprint-json-array [s escape-unicode]
-  ((formatter-out "~<[~;~@{~w~^, ~:_~}~;]~:>") s))
+  ((pprint/formatter-out "~<[~;~@{~w~^, ~:_~}~;]~:>") s))

 (defn- pprint-json-object [m escape-unicode]
-  ((formatter-out "~<{~;~@{~<~w:~_~w~:>~^, ~_~}~;}~:>")
+  ((pprint/formatter-out "~<{~;~@{~<~w:~_~w~:>~^, ~_~}~;}~:>")
    (for [[k v] m] [(as-str k) v])))

 (defn- pprint-json-generic [x escape-unicode]
@@ -380,7 +374,7 @@
         to turn off \\uXXXX escapes of Unicode characters."
   [x & options]
   (let [{:keys [escape-unicode] :or {escape-unicode true}} options]
-    (write x :dispatch #(pprint-json-dispatch % escape-unicode))))
+    (pprint/write x :dispatch #(pprint-json-dispatch % escape-unicode))))

 ;; Local Variables:
 ;; mode: clojure


indent

indent

--- src/webexample/core.clj
+++ src/webexample/core.clj
@@ -80,9 +80,9 @@
     (ANY "/" [] (io/resource "public/index.html"))
     (compojure.route/resources "/" :root "public")
     (ANY "*" []
-         (resource
-           :available-media-types ["*"]
-           :exists? false))))
+      (resource
+        :available-media-types ["*"]
+        :exists? false))))

 (defn make-db [db]
   (create-task-table! db))


BUGFIX: Was hooking up to the event handler every time

We only need to get the channel once.

--- src/tabler/core.cljs
+++ src/tabler/core.cljs
@@ -117,9 +117,11 @@
   "Dispatched msg when there's content received on the channel returned by
   function chan-f."
   [msg chan-f]
-  (go (while true
-        (let [content (<! (chan-f))]
-          (dispatch [msg content])))))
+  (let [channel (chan-f)]
+    (go (while true
+          (let [content (<! channel)]
+            (dispatch [msg content]))))
+    ))

 (defn mount-components []


preload main tabs after login

preload main tabs after login

--- src/status_im/ui/screens/routing/core.cljs
+++ src/status_im/ui/screens/routing/core.cljs
@@ -143,7 +143,7 @@
 (defn tab-navigator [routes config]
   (nav-reagent/tab-navigator
    routes
-   (prepare-config config)))
+   (assoc (prepare-config config) :lazy false)))

 (declare stack-screens)


Use thread macro to clarify code

Use thread macro to clarify code

--- src/whitman/core.clj
+++ src/whitman/core.clj
@@ -10,4 +10,7 @@
 (defn -main [& args]
   (if (< (count args) 1)
       (exit 1 "No configuration file specified")
-      (println (json/read-str (slurp (nth args 0))))))
+      (-> (nth args 0)
+          slurp
+          json/read-str
+          println)))


Shortens the 'Will not checkpoint' log (#1720)

* Shortens the 'Will not checkpoint' log

* Update scheduler/src/cook/kubernetes/api.clj

Co-authored-by: Nikolai Sinkov <096e2ca855e0d5a71823216f5078b4ae8955c1a2@gmail.com>

Co-authored-by: Nikolai Sinkov <096e2ca855e0d5a71823216f5078b4ae8955c1a2@gmail.com>

--- scheduler/src/cook/kubernetes/api.clj
+++ scheduler/src/cook/kubernetes/api.clj
@@ -704,7 +704,7 @@
 (defn calculate-effective-checkpointing-config
   "Given the job's checkpointing config, calculate the effective config. Making any adjustments such as defaults,
   overrides, or other behavior modifications."
-  [{:keys [job/checkpoint job/instance] :as job} task-id]
+  [{:keys [job/checkpoint job/instance job/uuid] :as job} task-id]
   (when checkpoint
     (let [{:keys [default-checkpoint-config]} (config/kubernetes)
           {:keys [max-checkpoint-attempts checkpoint-failure-reasons disable-checkpointing] :as checkpoint}
@@ -716,8 +716,11 @@
                                               (contains? checkpoint-failure-reasons (:reason/name reason)))
                                             instance)]
             (if (-> checkpoint-failures count (>= max-checkpoint-attempts))
-              (log/info "Will not checkpoint task-id" task-id ", there are at least" max-checkpoint-attempts "failed instances"
-                        {:job job})
+              (log/info "Will not checkpoint, there are at least" max-checkpoint-attempts "checkpoint failures"
+                        {:job-uuid uuid
+                         :max-checkpoint-attempts max-checkpoint-attempts
+                         :number-checkpoint-failures (count checkpoint-failures)
+                         :task-id task-id})
               checkpoint))
           checkpoint)))))


[#3026] Clean code

[#3026] Clean code

Relates https://github.com/akvo/akvo-lumen/pull/3078#discussion_r543135444

--- backend/test/akvo/lumen/visualisation/map_test.clj
+++ backend/test/akvo/lumen/visualisation/map_test.clj
@@ -1,4 +1,4 @@
-(ns akvo.lumen.visualisation.map_test
+(ns akvo.lumen.visualisation.map-test
   {:functional true}
   (:require
    [akvo.lumen.lib.dataset :as dataset]
@@ -39,38 +39,9 @@
 ;;; Fixture
 ;;;

-(def ^:dynamic *dataset-data*)
-(defn dataset-data-fixture [f]
-  (binding [*dataset-data* (i-c/flow-sample-imported-dataset groups-def 2)]
-    (f)))
-
-(def ^:dynamic *dataset-id*)
-(defn dataset-id-fixture [f]
-  (binding [*dataset-id* (tu/import-file *tenant-conn* *error-tracker*
-                                         {:dataset-name "Generated map"
-                                          :kind "clj-flow"
-                                          :data *dataset-data*})]
-    (f)
-    (let [{:keys [imported-table-name table-name]}
-          (db.transformation/latest-dataset-version-by-dataset-id
-           *tenant-conn* {:dataset-id *dataset-id*})
-          drop-table-seq
-          (format "DROP SEQUENCE IF EXISTS %s_rnum_seq CASCADE" table-name)
-          drop-table (jdbc/drop-table-ddl table-name)
-          drop-imported-table-seq
-          (format "DROP SEQUENCE IF EXISTS %s_rnum_seq CASCADE" imported-table-name)
-          drop-imported-table (jdbc/drop-table-ddl imported-table-name)]
-      (jdbc/db-do-commands *tenant-conn* [drop-table-seq
-                                          drop-table
-                                          drop-imported-table-seq
-                                          drop-imported-table])
-      (dataset/delete *tenant-conn* *dataset-id*))))
-
-
 (use-fixtures :once
   system-fixture data-groups-future-fixture tenant-conn-fixture
-  error-tracker-fixture tu/spec-instrument dataset-data-fixture
-  dataset-id-fixture)
+  error-tracker-fixture tu/spec-instrument)

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Utility fns, random data but we're using same form on the data and are
@@ -166,12 +137,16 @@
 ;;;

 (deftest ^:functional basic-map
-
   (testing "Map from Flow dataset using dataset_version"
-    (let [layers (layers *dataset-id* *dataset-data*)
+    (let [dataset-data (i-c/flow-sample-imported-dataset groups-def 2)
+          dataset-id (tu/import-file *tenant-conn* *error-tracker*
+                                         {:dataset-name "Generated map"
+                                          :kind "clj-flow"
+                                          :data dataset-data})
+          layers (layers dataset-id dataset-data)
           opts {:centre-of-the-world "greenwich"}
           metadata-array (v.maps/metadata-layers *tenant-conn* layers opts)
           map-config (v.map-config/build *tenant-conn* layers metadata-array)
           {:keys [sql]} (-> map-config :layers first :options)
           sql-result (jdbc/query *tenant-conn* sql)]
-      (check-data *dataset-data* sql-result))))
+      (check-data dataset-data sql-result))))


Update revision.

Update revision.

--- src/circle/backend/project/circle.clj
+++ src/circle/backend/project/circle.clj
@@ -27,7 +27,7 @@
          :type :deploy
          :vcs-type :git
          :vcs-url "git@github.com:arohner/CircleCI.git"
-         :vcs-revision "0542337e29f07835b01c81fb3a69301205fb4411"
+         :vcs-revision "7a7b587e65b4d490d75d62f6a6960cd20b46c6ad"
          :aws-credentials circle.aws-credentials/AWS-access-credentials
          :r53-zone-id "ZBVDNEPFXWZR2"
          :num-nodes 1


fix typo

fix typo

--- src/clj/org/openforis/ceo/handler.clj
+++ src/clj/org/openforis/ceo/handler.clj
@@ -25,7 +25,7 @@
             [org.openforis.ceo.views            :refer [not-found-page data-response]]
             [org.openforis.ceo.db.projects      :refer [can-collect? is-proj-admin?]]
             [org.openforis.ceo.db.institutions  :refer [is-inst-admin?]]
-            [org.openforis.ceo.type_conversions :as tc]))
+            [org.openforis.ceo.utils.type-conversion :as tc]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Routing Handler


refactor channel pool

refactor channel pool

--- src/cljs/wilkerdev/util/reactive.cljs
+++ src/cljs/wilkerdev/util/reactive.cljs
@@ -332,18 +332,9 @@
   ([n] (channel-pool n (chan 2048)))
   ([n queue]
    (dotimes [_ n]
-     (go
-       (loop []
-         (when-let [[input output] (<! queue)]
-           (<! (go
-                 (loop []
-                   (if-let [v (<! input)]
-                     (do
-                       (>! output v)
-                       (recur))
-                     (close! output)))
-                 nil))
-           (recur)))))
+     (dochan [[input output] queue]
+       (<! (dochan [v input] (>! output v)))
+       (close! output)))
    queue))

 (defn pool-enqueue [pool source]


escape dot, comma and quotation from chromosome names

--- src/clojure/cljam/util/chromosome.clj
+++ src/clojure/cljam/util/chromosome.clj
@@ -1,5 +1,13 @@
 (ns cljam.util.chromosome
   (:require [clojure.string :as str]))
+
+(defn normalize-name
+  [s]
+  (-> s
+      (str/replace #"\."  "_")
+      (str/replace #","  "_")
+      (str/replace #"\""  "")
+      (str/replace #"\'"  "")))

 (defn trim-chromosome-key
   [s]
@@ -26,5 +34,6 @@
 (defn normalize-chromosome-key
   [s]
   (-> s
+      normalize-name
       prepend-chromosome-prefix
       normalize-chromosome-prefix))


trimmed output

trimmed output

--- src/clojure_dmap/phrasal_patterns.clj
+++ src/clojure_dmap/phrasal_patterns.clj
@@ -8,7 +8,7 @@
 ;;;;;
 ; TODO;
 ; remove use of rule in favor of pattern
-; remove use of *tother* in favor of concept
+; remove use of *other* in favor of concept
 ; remove use of create-pattern or whatever
 ; fix up tabs
 ; fxi up comments by ; ;; ;;;, ;;;;; etc.
@@ -16,15 +16,16 @@
 ; fix up ears for dynamic variables (done)
 ; indent arg vectors and comment strings
 ; that annoying todo below about needing i computed before hand
-
+; testing
+; logging

 (def ^:dynamic *phrasal-patterns-map* {})
 (def ^:dynamic *completed-patterns* {})

 (defn reset []
-	(def *phrasal-patterns-map* {})
-	(def *completed-patterns* {})
+	(def ^:dynamic *phrasal-patterns-map* {})
+	(def ^:dynamic *completed-patterns* {})
 	(println ""))

 ; A phrasal pattern is used to define and run or advance pattern discovery.
@@ -120,7 +121,7 @@
 					(= literal (nth (:tokens pattern) (:token-index pattern)))))
 		(do
 			(def i (:token-index pattern))
-			(print "      advance-literal slots:" (:slot-values pattern) " frame:" (pattern :frame) " literal:" literal)
+			#_(print "      advance-literal slots:" (:slot-values pattern) " frame:" (pattern :frame) " literal:" literal)
 			(let [retval (create-phrasal-pattern
 				(:tokens pattern)
 				(:frame pattern)
@@ -128,10 +129,9 @@
 				(assoc (:slot-values pattern)
 					(pattern :frame)
 					(conj ((pattern :slot-values) (pattern :frame)) literal))) ]
-				(if (complete-pattern? retval)
-					(println " is complete.")
-					(println " is waiting for " (retval :token-index)
-							(nth (retval :tokens) (retval :token-index)) ))
+				;(if (complete-pattern? retval)
+				;	(println " is complete.")
+				;(println " is waiting for " (retval :token-index) (nth (retval :tokens) (retval :token-index)) ))
 				retval))
 		:t nil))
 		;:t (do (println "advance pattern returning ***nil***") nil)))
@@ -147,7 +147,7 @@
 				(= (first (keys slot)) (nth (:tokens pattern) (:token-index pattern))))
 			(do
 				(def i (:token-index pattern))
-				(print "      advance-concept slots:" (:slot-values pattern) " frame:" (pattern :frame) " slot:" slot)
+				#_(print "      advance-concept slots:" (:slot-values pattern) " frame:" (pattern :frame) " slot:" slot)
 				(let [pp
 					(create-phrasal-pattern
 						(:tokens pattern)
@@ -157,11 +157,11 @@
 						; TODO: why does i need save above?
 						;(assoc 	(:slot-vlaues pattern) (nth (:tokens pattern) (:token-index pattern)) value )
 				  )]
-					(if (complete-pattern? pp)
-						(println " " (pp :frame) " is complete.")
-						(println " " (pp :frame) " is waiting for "
-							(pp :token-index)
-							(nth (pp :tokens) (pp :token-index)) ))
+					;(if (complete-pattern? pp)
+						;(println " " (pp :frame) " is complete.")
+						;(println " " (pp :frame) " is waiting for "
+						;	(pp :token-index)
+						;	(nth (pp :tokens) (pp :token-index)) ))
 					;;(println "concept advanced pattern" pp)
 					pp  ))
 		:t  nil))
@@ -215,7 +215,7 @@
 		(doseq [tkn tokens]
 			(println "  token:" tkn)
 			(doseq [pattern (*phrasal-patterns-map* tkn)]
-				(println "    ptn:" (pattern :frame))
+				#_(println "    ptn:" (pattern :frame))
 				;(let [ x  (advance-pattern pattern (pattern :frame) tkn) ]
 				(let [ x  (advance-pattern-literal pattern tkn) ]
 					(add-pattern x)


~(deftest passato-prossimo-parsing-positive): fix test

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -180,9 +180,9 @@

 ;; this should succeed to parse...
 (deftest passato-prossimo-parsing-positive
-  (let [result (:parses (first (parse "lei è andata")))]
+  (let [result (-> "lei è andata" parse first :parses)]
     (is (not (empty? result)))
-    (is (= "lei è andata") (morph (first (:parses (first result)))))))
+    (is (= "lei è andata") (morph (first result)))))

 ;; ..whereas this should fail - that is, there
 ;; should be no parses found, i.e. (= 0 (count parses))


test field cache with doubles/longs/floats as well

--- test/bzzz/core_test.clj
+++ test/bzzz/core_test.clj
@@ -740,7 +740,10 @@
                    (store :index test-index-name
                           :documents [{:id (str "_aa_bb_" payload)
                                        :name_payload (str "zzzxxx|" payload)
-                                       :some_integer fc}]
+                                       :some_integer fc
+                                       :some_float 10.0
+                                       :some_double 20.0
+                                       :some_long 30}]
                           :facets {:name_payload {:use-analyzer "name_payload"}}
                           :analyzer {:name_payload {:type "custom"
                                                     :tokenizer "whitespace"
@@ -751,10 +754,13 @@
                               :explain true
                               :facets {:name_payload {}}
                               :query {:term-payload-clj-score {:field "name_payload", :value "zzzxxx"
-                                                               :field-cache ["some_integer"]
+                                                               :field-cache ["some_integer","some_float","some_double","some_long"]
                                                                :clj-eval "
 (fn [explanation payload ^java.util.Map local-state fc doc-id]
   (let [some_integer (.get ^org.apache.lucene.search.FieldCache$Ints (get fc \"some_integer\") doc-id)
+        some_float (.get ^org.apache.lucene.search.FieldCache$Floats (get fc \"some_float\") doc-id)
+        some_double (.get ^org.apache.lucene.search.FieldCache$Doubles (get fc \"some_double\") doc-id)
+        some_long (.get ^org.apache.lucene.search.FieldCache$Longs (get fc \"some_long\") doc-id)
         existed (.get local-state some_integer)]
     (float
       (+ 10
@@ -762,7 +768,7 @@
          (if (not existed)
            (do
              (.put local-state some_integer payload)
-             some_integer)
+             (+ some_integer some_float some_double some_long))
            0)))))
 "
                                                                }}}))]
@@ -774,8 +780,8 @@
                    (searcher)))
       (reset! query/allow-unsafe-queries* true)
       (let [r (searcher)]
-        (is (= 3034.0 (:_score (first (:hits r)))))
-        (is (= 1265.0 (:_score (second (:hits r)))))
+        (is (= 3094.0 (:_score (first (:hits r)))))
+        (is (= 1325.0 (:_score (second (:hits r)))))
         (is (= 1011.0 (:_score (last (:hits r))))))

       (let [clj-score {:term-payload-clj-score


Reduce end of pileup-seq from 1000000 to 100000


Update things

Update things

--- src/leiningen/new/cljskel/project.clj
+++ src/leiningen/new/cljskel/project.clj
@@ -5,12 +5,12 @@
   :dependencies [[ch.qos.logback/logback-classic "1.1.2"]
                  [cheshire "5.3.1"]
                  [clj-http "0.7.9"]
-                 [clj-time "0.6.0"]
+                 [clj-time "0.7.0"]
                  [com.ovi.common.logging/logback-appender "0.0.45"]
                  [com.ovi.common.metrics/metrics-graphite "2.1.23"]
                  [com.yammer.metrics/metrics-logback "2.2.0"]
                  [compojure "1.1.6" :exclusions [javax.servlet/servlet-api]]
-                 [environ "0.4.0"]
+                 [environ "0.5.0"]
                  [metrics-clojure "1.0.1"]
                  [metrics-clojure-ring "1.0.1"]
                  [nokia/instrumented-ring-jetty-adapter "0.1.8"]
@@ -20,22 +20,21 @@
                  [org.clojure/data.xml "0.0.7"]
                  [org.clojure/data.zip "0.1.1"]
                  [org.clojure/tools.logging "0.2.6"]
-                 [org.eclipse.jetty/jetty-server "8.1.14.v20131031"]
+                 [org.eclipse.jetty/jetty-server "8.1.15.v20140411"]
                  [org.slf4j/slf4j-api "1.7.7"]
-                 [org.slf4j/jcl-over-slf4j "1.7.6"]
-                 [org.slf4j/jul-to-slf4j "1.7.6"]
-                 [org.slf4j/log4j-over-slf4j "1.7.6"]
+                 [org.slf4j/jcl-over-slf4j "1.7.7"]
+                 [org.slf4j/jul-to-slf4j "1.7.7"]
+                 [org.slf4j/log4j-over-slf4j "1.7.7"]
                  [ring-middleware-format "0.3.2"]
                  [ring/ring-jetty-adapter "1.2.2" :exclusions [org.eclipse.jetty/jetty-server]]]

  :exclusions [commons-logging
               log4j]

-  :profiles {:dev {:dependencies [[com.github.rest-driver/rest-client-driver "1.1.36"
+  :profiles {:dev {:dependencies [[com.github.rest-driver/rest-client-driver "1.1.38"
                                    :exclusions [org.slf4j/slf4j-nop
                                                 javax.servlet/servlet-api
                                                 org.eclipse.jetty.orbit/javax.servlet]]
-                                  [clj-http-fake "0.4.1"]
                                   [junit "4.11"]
                                   [midje "1.6.3"]
                                   [rest-cljer "0.1.11"]]
@@ -43,8 +42,8 @@
                              [lein-midje "3.1.3"]
                              [jonase/kibit "0.0.8"]]}}

-  :plugins [[lein-ring "0.8.8"]
-            [lein-environ "0.4.0"]
+  :plugins [[lein-ring "0.8.10"]
+            [lein-environ "0.5.0"]
             [lein-release "1.0.73"]]

   ;; development token values


smart prioritization: sort the very slowest test first

drops runtime a bunch

--- src/bolth.clj
+++ src/bolth.clj
@@ -176,15 +176,24 @@
      (if (#{:error :fail} (:result-type previous-result)) (:runtime previous-result))
      (:runtime previous-result)]))

+(defn slowest-test [mapped-results tests]
+  (last
+    (sort-by
+      (fn [[test-var _ _]] (get-in mapped-results [(str test-var) :runtime]))
+      tests)))
+
 (defn smart-prioritize-tests [tests]
   (if-let [results @state/*previous-test-run*]
     (let [mapped-results (into {} (map (fn [[k v]] [(str k) v]) results))
           prioritized
-          (reverse
-            (sort-by
-              #(prioritize-test % mapped-results)
-              tests))]
-      prioritized)
+          (vec
+            (reverse
+              (sort-by
+                #(prioritize-test % mapped-results)
+                tests)))
+          slowest-test (slowest-test mapped-results prioritized)
+          with-slowest-first (into [slowest-test] (remove #(= % slowest-test) prioritized))]
+      with-slowest-first)
     tests))

 (defn pour-tests-to-queue [tests]


Check for Notification existance the right way

--- src-cljs/frontend/notifs.cljs
+++ src-cljs/frontend/notifs.cljs
@@ -3,7 +3,7 @@
             [frontend.state :as state]
             [frontend.localstorage :as lost]))

-(defn notifiable-browser [] (= (type (.-Notification js/window)) js/Function))
+(defn notifiable-browser [] (exists? (.-Notification js/window)))
 (defn notifications-permission [] (.-permission js/Notification))
 (defn notifications-granted  [] (=  notifications-permission "granted"))


Mention the existence of the pulse ugen in the square cgen docstring.

--- src/overtone/sc/cgens/oscillators.clj
+++ src/overtone/sc/cgens/oscillators.clj
@@ -17,5 +17,7 @@
    produces only odd harmonics resulting in a mellow, hollow sound. This
    makes it particularly suitable for emulating wind instruments, adding
    width to strings and pads, or for the creation of deep, wide bass
-   sounds."
+   sounds.
+
+   See the pulse ugen if you wish to modulate the width."
   (:ar (pulse:ar freq 0.5)))


Add no-doc metadata to more api functions.

--- src/onyx/api.clj
+++ src/onyx/api.clj
@@ -138,7 +138,7 @@
        entry))
    catalog))

-(defn compact-graph [tasks]
+(defn ^{:no-doc true} compact-graph [tasks]
   (->> tasks
        (map (juxt :id :egress-tasks))
        (into {})))
@@ -329,7 +329,7 @@
            coordinates
            (recur (first rst) (rest rst))))))))

-(defn with-conn [zookeeper-address f]
+(defn ^{:no-doc true} with-conn [zookeeper-address f]
   (s/validate s/Str zookeeper-address)
   (let [conn (zk/connect zookeeper-address)]
     (try


Updated functions in Child.clj to use let instead of def

--- src/research_clojure/eChild/Child.clj
+++ src/research_clojure/eChild/Child.clj
@@ -163,11 +163,12 @@
   "10th parameter"
   [sentence grammar]
   (if (and (inSentence? sentence "01") (inSentence? sentence "Verb"))
-    (do (def i (.indexOf sentence "01"))
-        (def j (.indexOf sentence "Verb"))
-        (if (and (> i 0) (not= (Math/abs (- i j)) 1))
-          (assoc grammar 9 1)
-          grammar))
+    (do (let [i (.indexOf sentence "01")
+              j (.indexOf sentence "Verb")]
+
+          (if (and (> i 0) (not= (Math/abs (- i j)) 1))
+            (assoc grammar 9 1)
+            grammar)))
     grammar))

@@ -250,14 +251,16 @@
   "Checks if either 'Never Verb 01' or
   '01 Verb Never' appear in sentence"
   [sentence checkForNV01]
-  (def n (.indexOf sentence "Never"))
-  (def v (.indexOf sentence "Verb"))
-  (def o (.indexOf sentence "01"))
-  (if (and (not= n -1) (not= v -1) (not= o -1))
-    (if checkForNV01
-      (< n v o)
-      (< o v n))
-    false))
+
+  (let [n (.indexOf sentence "Never")
+        v (.indexOf sentence "Verb")
+        o (.indexOf sentence "01")]
+
+        (if (and (not= n -1) (not= v -1) (not= o -1))
+          (if checkForNV01
+            (< n v o)
+            (< o v n))
+          false)))

 (defn affixHop_aux1
@@ -309,11 +312,11 @@
   and if they appear sequentially"
   [infoList initGrammar]
   (if (and (not= nil (inSentence? (get infoList 2) "03")) (not= nil (inSentence? (get infoList 2) "P")))
-    (do (def first (.indexOf (get infoList 2) "03"))
+    (do (let [first (.indexOf (get infoList 2) "03")]
         ;If 03 followed by P
         (if (and (> first 0) (= (.indexOf (get infoList 2) "P") (+ first 1)))
           (assoc initGrammar 1 1)
-          initGrammar))
+          initGrammar)))
     initGrammar))

@@ -429,13 +432,13 @@
   currentGrammar"
   [currentGrammar grammarID]

-  (def binType (str/split (Integer/toString (int (read-string (get grammarID 0))) 2) #""))
-
-  (if (< (count binType) 13)
-    (do (def tempVec (vec (repeat (- 13 (count binType)) 0)))
-      (def paddedBT (concat tempVec binType))
-      (= @currentGrammar paddedBT))
-    (= @currentGrammar binType)))
+  (let [binType (str/split (Integer/toString (int (read-string (get grammarID 0))) 2) #"")]
+    (if (< (count binType) 13)
+      (do (let [tempVec (vec (repeat (- 13 (count binType)) 0))
+                paddedBT (concat tempVec binType)]
+
+          (= @currentGrammar paddedBT)))
+      (= @currentGrammar binType))))

 (comment


Use _ in place on unused parameter

Use _ in place on unused parameter

--- ring-devel/src/ring/middleware/stacktrace.clj
+++ ring-devel/src/ring/middleware/stacktrace.clj
@@ -98,7 +98,7 @@
        (handler request)
        (catch Throwable ex
          (ex-response request ex))))
-    ([request respond raise]
+    ([request respond _]
      (try
        (handler request respond (fn [ex] (respond (ex-response request ex))))
        (catch Throwable ex


#21 - Added local recursive directory listing and diff partitioning.

--- src/biblecli/commands/bucketsync.cljs
+++ src/biblecli/commands/bucketsync.cljs
@@ -14,11 +14,75 @@

 (ns biblecli.commands.bucketsync
   (:require-macros [cljs.core.async.macros :refer [go]])
-  (:require [cljs.core.async :refer [to-chan chan put! tap mult <!]]))
+  (:require [cljs.core.async :refer [to-chan chan put! tap mult <!]]
+            [clojure.string :as s]))

 (def AWS (js/require "aws-sdk"))
+(def fs (js/require "fs"))
+(def path (js/require "path"))
+(def process js/process)

-(defn list-objects-1000 [s3 continuationToken]
+(defn readdir [dir]
+  (let [chan (chan)
+        cb (fn [err data]
+             (put! chan [err data]))]
+    (.readdir fs dir cb)
+    chan))
+
+(defn stat [path]
+  (let [chan (chan)
+        cb (fn [err data]
+             (put! chan [err data]))]
+    (.stat fs path cb)
+    chan))
+
+(defn stat-file [dir reldir filename]
+  (let [fspath (.join path dir filename)
+        relpath (if (empty? reldir) filename (str reldir "/" filename))
+        statchan (stat fspath)]
+    [relpath fspath statchan]))
+
+(defn wait-all [filestatsasync]
+  (go
+    (loop [stats filestatsasync
+           acc []]
+      (let [head (first stats)
+            rest (rest stats)]
+        (if head
+          (let [[relpath fspath statchan] head
+                [err data] (<! statchan)]
+            (if err
+              [err nil]
+              (recur rest (conj acc [relpath fspath data]))))
+          [nil acc])))))
+
+(defn isdir [stat]
+  (.isDirectory stat))
+
+(defn readdir-recursive
+  ([dir] (readdir-recursive dir "" {}))
+  ([dir reldir acc]
+   (go
+     (let [[err files] (<! (readdir dir))]
+       (if err
+         [err nil]
+         (let [filestatsasync (->> files (map #(stat-file dir reldir %)) (doall))
+               [err filestats] (<! (wait-all filestatsasync))]
+           (if err
+             [err nil]
+             (loop [lst filestats acc acc]
+               (let [[relpath fspath stat] (first lst)
+                     rest (rest lst)]
+                 (if relpath
+                   (if (isdir stat)
+                     (let [[err acc] (<! (readdir-recursive fspath relpath acc))]
+                       (if err
+                         [err nil]
+                         (recur rest acc)))
+                     (recur rest (conj acc [relpath fspath])))
+                   [nil acc]))))))))))
+
+(defn s3-list-objects-1000 [s3 continuationToken]
   (let [chan (chan)
         opts (cond-> {}
                continuationToken (assoc :ContinuationToken continuationToken))
@@ -27,20 +91,21 @@
     (.listObjectsV2 s3 (clj->js opts) cb)
     chan))

-(defn list-objects [s3]
+(defn s3-list-objects [s3]
   (go
     (loop [acc {}
            continuationToken nil]
-      (let [[err data] (<! (list-objects-1000 s3 continuationToken))]
-        (if err {:err err}
-                (let [{contents :Contents isTruncated :IsTruncated nextToken :NextContinuationToken} (js->clj data :keywordize-keys true)
-                      acc (->> contents
-                               (reduce (fn [coll {key :Key etag :ETag}] (assoc coll key etag)) acc))]
-                  (if isTruncated
-                    (recur acc nextToken)
-                    acc)))))))
+      (let [[err data] (<! (s3-list-objects-1000 s3 continuationToken))]
+        (if err
+          [err nil]
+          (let [{contents :Contents isTruncated :IsTruncated nextToken :NextContinuationToken} (js->clj data :keywordize-keys true)
+                acc (->> contents
+                         (reduce (fn [coll {key :Key etag :ETag}] (assoc coll key etag)) acc))]
+            (if isTruncated
+              (recur acc nextToken)
+              [nil acc])))))))

-(defn make-s3 [profile region bucket]
+(defn make-s3-client [profile region bucket]
   (let [cfg
           (cond-> {:region region
                    :sslEnabled true
@@ -49,8 +114,32 @@
               (assoc :credentials (AWS.SharedIniFileCredentials. (clj->js {:profile profile}))))]
     (AWS.S3. (clj->js cfg))))

+(defn partition-files [s3keys files]
+  [(->> s3keys (filter (fn [[key _]] (not (contains? files key)))) (vec))
+   (->> files (filter (fn [[key _]] (not (contains? s3keys key)))) (vec))
+   (->> files
+        (map (fn [[key path]] (let [etag (get s3keys key :notfound)] [key path etag])))
+        (filter (fn [[_ _ etag]] (not= etag :notfound)))
+        (vec))])
+
+(defn quit-on-error [err]
+  (println err)
+  (.exit process 1))
+
+(defn quit-on-success []
+  (.exit process 0))
+
 (defn sync! [dir profile region bucket]
-  (let [s3 (make-s3 profile region bucket)]
-    (go
-      (let [keys (<! (list-objects s3))]
-        (println (count keys))))))+  (go
+    (let [s3 (make-s3-client profile region bucket)
+          s3ObjectsTask (s3-list-objects s3)
+          filesTask (readdir-recursive dir)
+          [err1 s3keys] (<! s3ObjectsTask)
+          [err2 files] (<! filesTask)]
+      (if err1 (quit-on-error err1))
+      (if err2 (quit-on-error err2))
+      (let [[onlyremote onlylocal both] (partition-files s3keys files)]
+        (println "Remote: " (s/join onlyremote " | "))
+        (println "Local: " (s/join onlylocal " | "))
+        (println "Both: " (s/join both " | "))
+        (quit-on-success)))))


Add devcards showcasing the color schemes

--- src/cards/asciinema_player/cards.cljs
+++ src/cards/asciinema_player/cards.cljs
@@ -3,14 +3,62 @@
             [asciinema-player.view :as v])
   (:require-macros [devcards.core :as dc :refer [defcard]]))

+;; "emacs"
+
 (defonce state-1 (c/make-player-ratom 80 24 "/frames-10386.json" 148.297910690308 {}))
 (defonce dispatch-1 (c/start-event-loop! state-1))

-(defcard my-second-card
+(swap! state-1 assoc :theme "asciinema")
+
+(defcard emacs-card
   (dc/reagent [v/player state-1 dispatch-1]))

-(defonce state-2 (c/make-player-ratom 84 31 "/frames-color-test.json" 4.533024 {}))
+;; "fractals"
+
+(defonce state-2 (c/make-player-ratom 80 24 "/frames-20055.json" 38.91 {}))
 (defonce dispatch-2 (c/start-event-loop! state-2))

-(defcard my-third-card
+(defcard fractals-card
   (dc/reagent [v/player state-2 dispatch-2]))
+
+;; "catimg"
+
+(defonce state-3 (c/make-player-ratom 100 41 "/frames-26491.json" 12.318521 {}))
+(defonce dispatch-3 (c/start-event-loop! state-3))
+
+(defcard catimg-card
+  (dc/reagent [v/player state-3 dispatch-3]))
+
+;; "color table"
+
+(defonce state-4a (c/make-player-ratom 84 31 "/frames-color-test.json" 4.533024 {}))
+(defonce dispatch-4a (c/start-event-loop! state-4a))
+
+(defcard color-table-on-tango
+  (dc/reagent [v/player state-4a dispatch-4a]))
+
+(swap! state-4a assoc :theme "tango")
+
+(defonce state-4 (c/make-player-ratom 84 31 "/frames-color-test.json" 4.533024 {}))
+(defonce dispatch-4 (c/start-event-loop! state-4))
+
+(defcard color-table-on-asciinema
+  (dc/reagent [v/player state-4 dispatch-4]))
+
+(swap! state-4 assoc :theme "asciinema")
+
+(defonce state-5 (c/make-player-ratom 84 31 "/frames-color-test.json" 4.533024 {}))
+(defonce dispatch-5 (c/start-event-loop! state-5))
+
+(defcard color-table-on-seti
+  (dc/reagent [v/player state-5 dispatch-5]))
+
+(swap! state-5 assoc :theme "seti")
+
+(defonce state-6 (c/make-player-ratom 84 31 "/frames-color-test.json" 4.533024 {}))
+(defonce dispatch-6 (c/start-event-loop! state-6))
+
+(defcard color-table-on-monokai
+  (dc/reagent [v/player state-6 dispatch-6]))
+
+(swap! state-6 assoc :theme "monokai")


replace select component

replace select component

--- src/cljs/phonecat_re_frame/views.cljs
+++ src/cljs/phonecat_re_frame/views.cljs
@@ -3,7 +3,7 @@
             phonecat-re-frame.handlers
             [reagent.core :as reagent :refer [atom]]
             [re-frame.core :refer [subscribe, dispatch]]
-            [re-com.core :refer [button]])
+            [re-com.core :refer [button, h-box, v-box, single-dropdown]])
   (:require-macros [reagent.ratom :refer [reaction]]))

 ;; -------------------------
@@ -47,33 +47,28 @@
     [:div "Search"
      [:input {:on-change #(dispatch [:search-input-entered (-> % .-target .-value)])}]]))

-(defn mark-selected
-  "mark the given select element as selected if the order-prop matches the value of the element passed in"
-  [props order-prop current-prop-value]
-  (if (= order-prop current-prop-value)
-    (reagent/merge-props props {:selected "selected"})
-    props))
-
 (defn order-by-component
   "component to define how you want to order the phones list"
   []
   (let [order-prop (subscribe [:order-prop])]
     (fn []
-      [:div "Sort by: "
-       [:select {:on-change #(dispatch [:order-prop-changed (-> % .-target .-value)])}
-        [:option (mark-selected {:value "name"} @order-prop "name") "Alphabetical"]
-        [:option (mark-selected {:value "age"} @order-prop "age") "Newest"]]])))
+      [single-dropdown
+       :choices     [{:id "name" :label "Alphabetically"}
+                     {:id "age" :label "Newest"}]
+       :model       @order-prop
+       :placeholder "Sort order"
+       :width       "150px"
+       :on-change   #(dispatch [:order-prop-changed %])])))

 (defn home-page
-  "defines the ome page which will be the phone list component"
-  []
-  [:div {:class "container-fluid"}
-   [:div {:class "row"}
-    [:div {:class "col-md-2"}
-     [search-component]
-     [order-by-component]]
-    [:div {:class "col-md-10"}
-     [phones-component]]]])
+  "defines the home page which will be the phone list component"
+  []
+  [h-box
+   :children [[v-box
+               :children [[search-component]
+                          [order-by-component]]]
+              [v-box
+               :children [[phones-component]]]]])

 ;; -------------------------
 ;; Phone details views


Fix copyright year on sign.proto ns.

Fix copyright year on sign.proto ns.

--- src/clojure/buddy/core/sign/proto.clj
+++ src/clojure/buddy/core/sign/proto.clj
@@ -1,4 +1,4 @@
-;; Copyright 2014 Andrey Antukh <niwi@niwi.be>
+;; Copyright 2014-2015 Andrey Antukh <niwi@niwi.be>
 ;;
 ;; Licensed under the Apache License, Version 2.0 (the "License")
 ;; you may not use this file except in compliance with the License.


Take support ns nested in form

Take support ns nested in form

Fixes #36

--- ClojureScript/replete/src/replete/core.cljs
+++ ClojureScript/replete/src/replete/core.cljs
@@ -76,8 +76,7 @@
                               (set! *3 *2)
                               (set! *2 *1)
                               (set! *1 ret))
-                            (when (ns-form? form)
-                              (reset! current-ns (second form)))
+                            (reset! current-ns ana/*cljs-ns*)
                             ret))
                      (catch js/Error e
                        (set! *e e)


add special query behavior for set predicates

--- src/com/billpiel/mem_tracer/query.clj
+++ src/com/billpiel/mem_tracer/query.clj
@@ -24,8 +24,14 @@

 (defn get-some*
   [f v]
-  (if (fn? f)
+  (cond
+    (fn? f)
     (f v)
+
+    (set? f)
+    (f v)
+
+    :default
     (get v f)))

 (defn get-some
@@ -40,6 +46,9 @@

 (defn eq* [pred v]
   (cond (fn? pred)
+        (pred v)
+
+        (set? pred)
         (pred v)

         (instance? java.util.regex.Pattern pred)


fix adding and updating of triggers (#219)

--- server/src/spacon/components/trigger/core.clj
+++ server/src/spacon/components/trigger/core.clj
@@ -111,10 +111,10 @@
 (defn http-put-trigger [context]
   (let [t (:json-params context)]
     (if (s/valid? :spacon.specs.trigger/trigger-spec t)
-      (let [r (response/ok (triggermodel/modify
-                             (get-in context [:path-params :id]) t))]
-        (add-trigger t)
-        r)
+      (let [trigger (triggermodel/modify (get-in context [:path-params :id]) t)
+            res     (response/ok trigger)]
+        (add-trigger trigger)
+        res)
       (response/error
         (str "Failed to update trigger:\n"
              (s/explain-str :spacon.specs.trigger/trigger-spec t))))))
@@ -122,9 +122,10 @@
 (defn http-post-trigger [context]
   (let [t (:json-params context)]
     (if (s/valid? :spacon.specs.trigger/trigger-spec t)
-      (let [r (response/ok (triggermodel/create t))]
-        (add-trigger t)
-        r)
+      (let [trigger (triggermodel/create t)
+            res (response/ok trigger)]
+        (add-trigger trigger)
+        res)
       (response/error (str "Failed to create trigger:\n"
                            (s/explain-str :spacon.specs.trigger/trigger-spec t))))))


insights: allow timedout outcomes

insights: allow timedout outcomes

--- src-cljs/frontend/components/insights.cljs
+++ src-cljs/frontend/components/insights.cljs
@@ -1,6 +1,5 @@
 (ns frontend.components.insights
   (:require [cljs.core.async :as async :refer [>! <! alts! chan sliding-buffer close!]]
-            [cljs.core.match :refer-macros [match]]
             [clojure.string :as string]
             [frontend.async :refer [raise!]]
             [frontend.analytics :as analytics]
@@ -116,16 +115,26 @@
                            spacing)})
         (.text #(aget % "text")))))

-
-
 (defn add-queued-time [build]
   (let [queued-time (max (build/queued-time build) 0)]
     (assoc build :queued_time_millis queued-time)))

+(def insights-outcome-mapping
+  {"success" "success",
+   "failed" "failed",
+   "timedout" "failed",
+   "canceled" "canceled"})
+
+(def pass-fail-outcomes
+  (->> insights-outcome-mapping
+       (filter #(#{"success" "failed"} (second %)))
+       (into {})))
+
 (defn build-chartable? [{:keys [outcome build_time_millis]}]
-  (or (#{"success" "failed"} outcome)
-      (and (= "canceled" outcome)
-           build_time_millis)))
+  (boolean
+   (or (pass-fail-outcomes outcome)
+       (and (= "canceled" outcome)
+            build_time_millis))))

 (defn build-timing-url [build]
   (str (utils/uri-to-relative (unexterned-prop build "build_url"))
@@ -221,7 +230,9 @@
                                              :owner owner
                                              :properties {:build-url (unexterned-prop % "build_url")}})})
         (.select "rect.bar")
-        (.attr #js {"class" #(str "bar " (unexterned-prop % "outcome"))
+        (.attr #js {"class" #(str "bar " (-> %
+                                             (unexterned-prop "outcome")
+                                             insights-outcome-mapping))
                     "y" #(y-pos-scale (unexterned-prop % "build_time_millis"))
                     "x" #(x-scale (unexterned-prop % "build_num"))
                     "width" (.rangeBand x-scale)
@@ -466,12 +477,15 @@
   [{:keys [show-insights? chartable-builds] :as project}]
   (let [outcome (some->> chartable-builds
                          (map :outcome)
-                         (filter #{"success" "failed"})
-                         last)]
-    (match [show-insights? outcome]
-           [true "success"] :success
-           [true "failed"] :failed
-           :else :other)))
+                         reverse
+                         (filter pass-fail-outcomes)
+                         first)]
+    (if-let [result (and show-insights?
+                         (-> outcome
+                             pass-fail-outcomes
+                             keyword))]
+      result
+      :other)))

 (defn project-latest-build-time [project]
   (let [start-time (-> project


Editor cleanup

Editor cleanup

--- src-frontend/cljs/cljs_webrepl/editor.cljs
+++ src-frontend/cljs/cljs_webrepl/editor.cljs
@@ -8,92 +8,98 @@
    [taoensso.timbre :as timbre
     :refer-macros (tracef debugf infof warnf errorf)]))

-(defn codemirror-did-mount [node editor {:keys [focus? read-only? on-change on-key-down mode]} text]
+(defn cm-options [options]
+  (js-obj "readOnly" (:read-only? options false)
+          "height" (name (:height options :auto))
+          "autofocus" (:focus? options false)
+          "lineWrapping" (:line-wrap? options false)
+          "lineNumbers" (:line-numbers?  options false)
+          "mode" (name (:mode options :clojure))
+          "indentUnit" (:indent options 2)
+          "electricChars" (:electric-chars? options true)
+          "viewportMargin" (:viewport-margin options js/Infinity)
+          "extraKeys" (-> (:extra-keys options nil)
+                          (clj->js)
+                          (js/CodeMirror.normalizeKeyMap))))
+
+(defn cm-did-mount [node editor {:keys [on-change on-key-down] :as options} text]
   (let [element (-> node (r/dom-node))
-        opts    (js-obj "readOnly" read-only?
-                        "height" "auto"
-                        "autofocus" focus?
-                        "lineWrapping" true
-                        "lineNumbers" false
-                        "mode" (or mode "clojure")
-                        "value" text
-                        "indentUnit" 2
-                        "electricChars" true
-                        "viewportMargin" js/Infinity)
-        editor  (reset! editor (js/CodeMirror.fromTextArea element opts))]
+        cm-opts (cm-options options)
+        editor  (reset! editor (js/CodeMirror.fromTextArea element cm-opts))]
+    (.setValue editor text)
     (when on-change
       (.on editor "change" on-change))
     (when on-key-down
       (.on editor "keydown" on-key-down))))

-(defn codemirror-will-update [node editor [_ _ text]]
+(defn cm-will-update [node editor [_ _ text]]
+  (debugf "Update")
   (when-let [editor @editor]
-    (.setValue editor text)))
+    (.setValue editor text)
+    (.refresh editor)))

-(defn codemirror-will-unmount [node editor]
+(defn cm-will-unmount [node editor]
   (when-let [editor @editor]
     true)
   (reset! editor nil))

-(defn codemirror-render [_ text]
+(defn cm-render [_ text]
   [:textarea {:value text :read-only true}])

 (defn codemirror [props text]
   (let [editor (atom nil)]
     (r/create-class
      {:display-name           "codemirror"
-      :component-did-mount    #(codemirror-did-mount %1 editor props text)
-      :component-will-update  #(codemirror-will-update %1 editor %2)
-      :component-will-unmount #(codemirror-will-unmount %1 editor)
-      :reagent-render         codemirror-render})))
+      :component-did-mount    #(cm-did-mount %1 editor props text)
+      :component-will-update  #(cm-will-update %1 editor %2)
+      :component-will-unmount #(cm-will-unmount %1 editor)
+      :reagent-render         cm-render})))

 (defn editor-update [{:keys [state] :as props} editor change]
   (swap! state assoc :input (.getValue editor)))

-(defn editor-key-enter [{:keys [input submit] :as props} editor event]
-  (when (not (.-shiftKey event))
-    (when (or (.-ctrlKey event) (not (str/includes? @input "\n")))
-      (submit input)
-      (.preventDefault event))))
+(defn multi-line? [editor]
+  (-> (.getValue editor)
+      (str/includes? "\n")))

-(defn editor-key-up [{:keys [history-prev state] :as props} editor event]
-  (history-prev)
-  (.setValue editor (:input @state))
-  (.refresh editor)
-  (.preventDefault event))
+(defn make-submit [{:keys [submit] :as props}]
+  (fn [cm]
+    (submit (.getValue cm))))

-(defn editor-key-down [{:keys [history-next state] :as props} editor event]
-  (history-next)
-  (.setValue editor (:input @state))
-  (.refresh editor)
-  (.preventDefault event))
+(defn make-history-prev [{:keys [history-prev state] :as props}]
+  (fn [cm]
+    (history-prev)
+    (.setValue cm (:input (history-prev)))
+    (.refresh cm)))

-(def key-names {:enter 13
-                :up    38
-                :down  40})
+(defn make-history-next [{:keys [history-next state] :as props}]
+  (fn [cm]
+    (history-next)
+    (.setValue cm (:input (history-next)))
+    (.refresh cm)))

-(def key-code->name
-  (into {} (for [[k v] key-names] [v k])))
-
-(defn editor-key [props editor event]
-  (when-let [name (key-code->name (.-keyCode event))]
-    (case name
-      :enter (editor-key-enter props editor event)
-      :up    (editor-key-up props editor event)
-      :down  (editor-key-down props editor event)
-      nil)))
-
+(defn wrap-ignore-multi [f]
+  (fn [cm]
+    (if (multi-line? cm)
+      js/CodeMirror.Pass
+      (f cm))))

 (defn editor [props value]
-  (let [on-change (partial editor-update props)
-        on-key    (partial editor-key props)]
+  (let [history-next (make-history-next props)
+        history-prev (make-history-prev props)
+        submit       (make-submit props)
+        extra-keys   {:Up         (-> history-prev wrap-ignore-multi)
+                      :Down       (-> history-next wrap-ignore-multi)
+                      :Ctrl-Up    history-prev
+                      :Ctrl-Down  history-next
+                      :Enter      (-> submit wrap-ignore-multi)
+                      :Ctrl-Enter submit}]
     (fn []
       [codemirror
-       {:editable?   true
-        :numbers?    false
-        :focus?      true
-        :on-change   on-change
-        :on-key-down on-key}
+       {:editable?  true
+        :numbers?   false
+        :focus?     true
+        :extra-keys extra-keys}
        value])))

 (defn code [text]


printf mistake

printf mistake

--- src/cylon/oauth/client/web_client.clj
+++ src/cylon/oauth/client/web_client.clj
@@ -76,7 +76,7 @@

             (let [code (get params "code")

-                  _ (infof "Exchanging code (%s) for access token %s" access-token-uri)
+                  _ (infof "Exchanging code (%s) for access token via %s" code access-token-uri)

                   ;; Exchange the code for an access token
                   ;; This is a blocking operation. We elect to wait for


Add support for projects using lein-modules

Invokes all lein targets using modules if present in the :plugins.

--- src/leiningen/pallet_release/lein.clj
+++ src/leiningen/pallet_release/lein.clj
@@ -20,29 +20,41 @@
   (if (.exists f)
     (edn/read-string (slurp f))))

+(defn uses-lein-modules?
+  [project]
+  (some #(= 'lein-modules/lein-modules (first %)) (:plugins project)))
+
+(defn task
+  "Apply a task to project, using lein-modules if it is enabled."
+  [project & args]
+  (let [args (if (uses-lein-modules? project)
+               (concat ["modules"] args)
+               args)]
+    (apply-task (first args) project (rest args))))
+
 (defn clean
   [project]
   (debug "lein clean")
-  (apply-task "clean" project []))
+  (task project "clean"))

 (defn test
   [project]
   (debug "lein test")
-  (apply-task "with-profile" project ["+no-checkouts" "test"]))
+  (task project "with-profile" "+no-checkouts" "test"))

 (defn update-versions
   [project old-version new-version]
   (debug "lein set-version" new-version)
-  (apply-task "with-profile" project
-              ["+release" "set-version"
-               new-version ":previous-version" old-version]))
+  (task project "with-profile"
+        "+release" "set-version"
+        new-version ":previous-version" old-version))

 (defn set-next-version
   [project]
   (debug "lein set-version :point")
-  (apply-task "with-profile" project ["+release" "set-version" ":point"]))
+  (task project "with-profile" "+release" "set-version" ":point"))

 (defn deploy
   [project]
   (debug "lein deploy")
-  (apply-task "deploy" project ["clojars"]))
+  (task project "deploy" "clojars"))


Simplified

Simplified

--- src/layzee/core.clj
+++ src/layzee/core.clj
@@ -11,7 +11,7 @@
   (format "[%s] %s -- %s" (:created_at t) (-> t :text clean) (-> t :user :name)))

 (def no-retweets
-     #(= nil (:retweeted_status %1)))
+     #(nil? (:retweeted_status %1)))

 (defn -main [& args]
   (let [how-many 100]


put some logic in one line

put some logic in one line

--- src/braid/ui/views/pills.cljs
+++ src/braid/ui/views/pills.cljs
@@ -9,9 +9,7 @@
     (fn []
       (let [path (routes/tag-page-path {:group-id @open-group-id
                                         :tag-id (tag :id)})]
-        [:a.tag.pill {:class (if @user-subscribed-to-tag?
-                                " on"
-                                " off")
+        [:a.tag.pill {:class (if @user-subscribed-to-tag? "on" "off")
                       :tabIndex -1
                       :style {:background-color (id->color (tag :id))
                               :color (id->color (tag :id))
@@ -27,9 +25,7 @@
     (fn []
       (let [path (routes/user-page-path {:group-id @open-group-id
                                          :user-id (user :id)})]
-        [:a.user.pill {:class (case @user-status
-                                              :online " on"
-                                                      " off")
+        [:a.user.pill {:class (case @user-status :online "on" "off")
                        :tabIndex -1
                        :style {:background-color (id->color (user :id))
                                :color (id->color (user :id))


nil-guard edn-content-type?

nil-guard edn-content-type?

--- src/clj/clojuredocs/entry.clj
+++ src/clj/clojuredocs/entry.clj
@@ -122,9 +122,9 @@
         res))))

 (defn edn-content-type? [{:keys [headers]}]
-  (re-find #"application/edn"
-    (or (get headers "Content-Type")
-        (get headers "content-type"))))
+  (when-let [ct (or (get headers "Content-Type")
+                    (get headers "content-type"))]
+    (re-find #"application/edn" ct)))

 (defn decode-edn-body [h]
   (fn [r]


Fix the way I'm calling fetch-comic-list

--- src/clj/comic_reader/core.clj
+++ src/clj/comic_reader/core.clj
@@ -28,7 +28,7 @@
                    (when (= (:id s)
                             site)
                      s)))
-           (scrape/fetch-comic-list site)
+           scrape/fetch-comic-list
            edn-response))
     (c/GET "/comic/:name" [name]
       (str "Hello comic" name)))


Update main css

Update main css

--- src/clj/gtfve/styles/core.clj
+++ src/clj/gtfve/styles/core.clj
@@ -1,8 +1,13 @@
 (ns gtfve.styles.core
   (:require [garden.def :refer [defstylesheet defstyles]]
-            [garden.units :refer [px]]))
+            [garden.units :refer [px percent]]))

 (defstyles main
-  [[:.site-header {}]
-   [:.side-panel {}]
-   [:.maps-panel {}]])
+  [["@font-face" {:font-family "Roboto"
+                  :src "url(\"../font/Roboto/Roboto-Regular.ttf\")"}]
+   [:body {:padding-top (px 64)}]
+   [:.side-panel-container {:padding-left 0
+                            :padding-right 0}]
+   [:.main-panel-container {:padding-left 0
+                            :padding-right 0}]
+   [:.side-panel {}]])


refine report titles

refine report titles

--- src/clj_money/web/reports.clj
+++ src/clj_money/web/reports.clj
@@ -46,18 +46,24 @@

 (defmethod render-report :income-statement
   [{:keys [entity-id start-date end-date]}]
-  [:table.table.table-striped
+  (html
+    [:h1 (format "Income Statement: %s to %s"
+                 (format-date start-date)
+                 (format-date end-date))]
+    [:table.table.table-striped
      (map report-row (reports/income-statement (env :db)
                                                entity-id
                                                start-date
-                                               end-date))])
+                                               end-date))]))

 (defmethod render-report :balance-sheet
   [{:keys [entity-id as-of]}]
-  [:table.table.table-striped
-   (map report-row (reports/balance-sheet (env :db)
-                                          entity-id
-                                          as-of))])
+  (html
+    [:h1 (format "Balance Sheet as of %s" (format-date as-of))]
+    [:table.table.table-striped
+     (map report-row (reports/balance-sheet (env :db)
+                                            entity-id
+                                            as-of))]))

 (defn-  budget-report-row-class
   [record]
@@ -83,7 +89,7 @@
         as-of (or as-of
                   (budgets/end-date budget))]
     (html
-      [:h1 (format "%s as of %s" (:name budget) as-of)]
+      [:h1 (format "Budget %s as of %s" (:name budget) (format-date as-of))]
       [:table.table
        [:tr
         [:th "Account"]


mapquest data since google maps doesn't handle curves

--- src/cljs/ontheway/modern.cljs
+++ src/cljs/ontheway/modern.cljs
@@ -203,9 +203,7 @@
    (.parse js/JSON s)
    :keywordize-keys true))

-(defn direction-steps [m to from]
-  "Returns steps in the format
-  [{:start-lat :start-lng :end-lat :end-lng}, ...]"
+(defn fetch-google-lat-lngs [to from]
   (go
    (let [url (directions-uri to from)
          response (<! (http/get url))
@@ -221,10 +219,48 @@
                         :start-lng start-lng
                         :end-lat end-lat
                         :end-lng end-lng}))
-                   steps)
+                   steps)]
+     lat-lngs)))
+
+(defn mapquest-uri [to from]
+  (let [query-params {
+                      "key" "Fmjtd|luurnuurn0,bl=o5-9wr5lf"
+                      "to" to
+                      "from" from
+                      "routeType" "fastest"
+                      "narrativeType" "none"
+                      "shapeFormat" "raw"
+                      "generalize" "0"}
+        uri "http://www.mapquestapi.com/directions/v2/route"]
+    (mk-uri uri query-params)))
+
+(defn fetch-mapquest-lat-lngs [to from]
+  (go
+   (let [url (mapquest-uri to from)
+         response (<! (http/get url))
+         steps (-> response
+                   :body :route :shape :shapePoints)
+         lat-lngs (map
+                   (fn [[start-lat start-lng end-lat end-lng]]
+                     {:start-lat start-lat
+                      :start-lng start-lng
+                      :end-lat end-lat
+                      :end-lng end-lng})
+                   (partition 4 2 steps))]
+     (prn lat-lngs)
+     (prn steps)
+     ;;(prn response)
+     (.log js/console lat-lngs)
+     (.log js/console steps)
+     lat-lngs)))
+
+(defn direction-steps [m to from]
+  "Returns steps in the format
+  [{:start-lat :start-lng :end-lat :end-lng}, ...]"
+  (go
+   (let [lat-lngs (<! (fetch-mapquest-lat-lngs to from))
          start-point (-> lat-lngs first (select-keys [:start-lat :start-lng]) vals)
          end-point (-> lat-lngs last (select-keys [:end-lat :end-lng]) vals)
-         ;;end-point [45.5219757 -122.6822918]
          last-lat-lng (last lat-lngs)
          lines (concat
                 (map


filtered-edges into graph()

filtered-edges into graph()

--- src/clojure/defgraph/core.clj
+++ src/clojure/defgraph/core.clj
@@ -15,12 +15,10 @@
 (def edges    (into {} (filter val (zipmap vertices parents))))
 (def rootpath (memoize #(let [x (edges %)] (if x (conj {% x} (rootpath x)) {}))))

-(defn filtered-edges [re]
-  (filter #(re-matches re (first %)) edges))
-
 (defn graph [re]
-  {:V (set vertices)
-   :E (reduce conj {} (map #(rootpath %) (keys (filtered-edges re))))})
+  (let [filtered-edges (filter #(re-matches re (first %)) edges)]
+    {:V (set vertices)
+     :E (reduce conj {} (map #(rootpath %) (keys filtered-edges)))}))

 (defn -main [& args]
   (if (> (count args) 1)


Fix renaming mistakes

Fix renaming mistakes

--- src/clojure/neko/activity.clj
+++ src/clojure/neko/activity.clj
@@ -147,7 +147,7 @@
               ^android.os.Bundle ~'savedInstanceState]
              (.superOnCreate ~'this ~'savedInstanceState)
              (def ~(vary-meta def assoc :tag name) ~'this)
-             (~create ~'this ~'savedInstanceState)))
+             (~on-create ~'this ~'savedInstanceState)))
        ~@(map #(let [func (options %)
                      event-name (keyword->camelcase %)]
                  (when func
@@ -180,4 +180,4 @@
   "Runs the macro body on the UI thread.  If this macro is called on the UI
   thread, it will evaluate immediately."
   [activity & body]
-  `(run-on-ui-thread* ~activity (fn [] ~@body)))
+  `(on-ui* ~activity (fn [] ~@body)))


more vector functions

more vector functions


Removing test code.

Removing test code.

--- src/cmr/ingest/api/routes.clj
+++ src/cmr/ingest/api/routes.clj
@@ -22,8 +22,6 @@
     (if (empty? concept-id)
       concept
       (assoc concept :concept-id concept-id))))
-
-(codec/url-decode "Name%2FWith%2FSlashes")

 (defn- build-routes [system]
   (routes


cleanup capture-params-internally code

cleanup capture-params-internally code

--- src/com/rpl/specter/impl.cljc
+++ src/com/rpl/specter/impl.cljc
@@ -292,25 +292,24 @@
   (if-not (instance? CompiledPath path)
     path
     (let [params (:params path)
+          params-idx (:params-idx path)
           selector (-> path :transform-fns :selector)
           transformer (-> path :transform-fns :transformer)]
       (if (empty? params)
         path
-        (->CompiledPath
+        (no-params-compiled-path
           (->TransformFunctions
             RichPathExecutor
-            (fn [x-params params-idx vals structure next-fn]
-              (selector params 0 vals structure
+            (fn [x-params x-params-idx vals structure next-fn]
+              (selector params params-idx vals structure
                 (fn [_ _ vals-next structure-next]
-                  (next-fn x-params params-idx vals-next structure-next)
+                  (next-fn x-params x-params-idx vals-next structure-next)
                   )))
-            (fn [x-params params-idx vals structure next-fn]
-              (transformer params 0 vals structure
+            (fn [x-params x-params-idx vals structure next-fn]
+              (transformer params params-idx vals structure
                 (fn [_ _ vals-next structure-next]
-                  (next-fn x-params params-idx vals-next structure-next)
+                  (next-fn x-params x-params-idx vals-next structure-next)
                   ))))
-          params
-          0
           )))))

 (extend-protocol PathComposer
@@ -598,4 +597,3 @@
   (if (afn structure)
     (next-fn structure)
     structure))
-


use English language model defined by babel.directory

--- src/babel/english/writer.clj
+++ src/babel/english/writer.clj
@@ -2,10 +2,11 @@
   (:refer-clojure :exclude [get-in]))

 (require '[babel.config :refer [language-to-root-spec]])
-(require '[babel.generate :refer [generate]])
-(require '[babel.english.grammar :refer [small small-plus-vp-pronoun small-plus-plus-np]])
+(require '[babel.directory :refer [models]])
+(require '[babel.english.grammar :refer [small-plus-vp-pronoun small-plus-plus-np]])
 (require '[babel.english.lexicon :refer [lexicon]])
 (require '[babel.english.morphology :refer [fo]])
+(require '[babel.generate :refer [generate]])
 (require '[babel.reader :refer [read-all read-one]])
 (require '[babel.writer :as writer
            :refer [delete-from-expressions
@@ -40,6 +41,9 @@
         debug (log/debug (str "using spec:" (strip-refs spec)))

         use-map-fn pmap
+        model (-> ((-> models :en)) deref)
+        type-of-model (type model)
+        log-the-type (log/info (str "type of model is: " type-of-model))
         source-expressions (read-all spec
                                      source-language-short-name)]
     (count
@@ -71,7 +75,7 @@
                             (process [{:fill-one-language
                                        {:count 1
                                         :spec spec
-                                        :model (small)
+                                        :model model
                                         }}]
                                      source-language-short-name)]
                         ;; TODO: 'result' is currently
@@ -79,7 +83,7 @@
                         ;; of what the (process) command did.
                         (log/debug (str "process result:" result)))
                       (catch Exception e
-                        (let [catch-and-log-error true]
+                        (let [catch-and-log-error false]
                           (log/error (str "Could not translate source expression: "
                                           "'" (get source-expression :surface) "'"
                                           " from language: '" source-language-short-name
@@ -102,27 +106,28 @@

 (defn write-one [spec]
   (log/debug (str "generating from spec: " spec))
-  (try
-    (process [{:fill-one-language
-               {:count 1
-                :spec spec
-                :model small}}]
-             "en")
-    (catch Exception e
-      (cond
-
-        ;; TODO: make this conditional on
-        ;; there being a legitimate reason for the exception -
-        ;; e.g. the verb is "works (nonhuman)" (which takes a non-human
-        ;; subject), but we're trying to generate with
-        ;; {:agr {:person :1st or :2nd}}, for which the only lexemes
-        ;; are human.
-        true
-
-        (log/warn (str "ignoring exception: " e))
-        false
-        (throw e))))
-  )
+  (let [model (-> ((-> models :en)) deref)]
+    (log/debug (str "type of model is:" (type model)))
+    (try
+      (process [{:fill-one-language
+                 {:count 1
+                  :spec spec
+                  :model model}}]
+               "en")
+      (catch Exception e
+        (cond
+
+          ;; TODO: make this conditional on
+          ;; there being a legitimate reason for the exception -
+          ;; e.g. the verb is "works (nonhuman)" (which takes a non-human
+          ;; subject), but we're trying to generate with
+          ;; {:agr {:person :1st or :2nd}}, for which the only lexemes
+          ;; are human.
+          true
+
+          (log/warn (str "ignoring exception: " e))
+          false
+          (throw e))))))

 (defn all [ & [count]]
   (let [count (if count (Integer. count) 10)


+(defn root-verbs)

+(defn root-verbs)

--- src/babel/espanol/writer.clj
+++ src/babel/espanol/writer.clj
@@ -27,6 +27,25 @@

 (defn fo [expression]
   (morph/fo expression))
+
+;; for debugging: use map: in-order rather than interleaved by multiple workers.
+;; TODO: using pmap fails: cannot generate sentences; figure out why.
+(def use-map-fn map)
+
+(defn root-verbs [lexicon]
+  (let [lexemes (vals lexicon)]
+    (zipmap
+     (keys lexicon)
+     (use-map-fn (fn [lexeme-set]
+                   (filter (fn [lexeme]
+                             (and
+                              ;; how to only generate for a single infinitive (for testing/development):
+                              ;;                           (= (get-in lexeme [:espanol :espanol]) "abandonar")
+                                  (= (get-in lexeme [:synsem :cat]) :verb)
+                                  (= (get-in lexeme [:synsem :infl]) :top)
+                                  (not (= :top (get-in lexeme [:synsem :sem :pred] :top)))))
+                           lexeme-set))
+                 lexemes))))

 (defn todos [ & [count lexeme]]
   (let [count (if count (Integer. count) 10)


Corrected default Xbox platform strings

Corrected default Xbox platform strings

--- src/bltool/data/xboxlive.clj
+++ src/bltool/data/xboxlive.clj
@@ -7,8 +7,8 @@
   (:require [clojure.string :refer [trim, lower-case]]))

 (register-flags ["--xbox-name" "Xbox Live GamerTag"]
-  ["--xbox-360-platform" "Platform string to use for Xbox 360 games" :default "Xbox 360"]
-  ["--xbox-one-platform" "Platform string to use for Xbox One games" :default "Xbox One"])
+  ["--xbox-360-platform" "Platform string to use for Xbox 360 games (recommended: 360, Xbox, XBLA, XNA, XbxGoD)" :default "360"]
+  ["--xbox-one-platform" "Platform string to use for Xbox One games (recommended: XBO, Xbox, XbxGoD)" :default "XBO"])

 (def xboxapi-key "d22a2a5ed917343a163712dfdf15ef4839b9ea85")


nameit defaults to greek with fallback to english

--- src/clj/ephemeris/points.clj
+++ src/clj/ephemeris/points.clj
@@ -23,11 +23,16 @@
 (a :Neptune (. SweConst SE_NEPTUNE))
 (a :Pluto (. SweConst SE_PLUTO))

+(defn- datv [id v] (v (id (deref dat))))
+
 (defn lookup [what]
   (if (keyword? what)
-    (:id (get (deref dat) what))
+    (datv what :id)
     (get (deref rev) what)))

 (defn nameit
-  ([key-id] (name key-id :en))
-  ([key-id lang] (lang (get (deref dat) key-id))))
+  ([key-id] (nameit key-id :gr))
+  ([key-id lang] (let [res (datv key-id lang)]
+                   (if (nil? res)
+                     (datv key-id :en)
+                     res))))


playing around on playground.

playing around on playground.

--- src/clj/forma/playground.clj
+++ src/clj/forma/playground.clj
@@ -12,7 +12,29 @@
         forma.hadoop.io)
   (:require [incanter.core :as i]
             [cascalog.ops :as c]
-            [clojure.string :as s]))
+            [clojure.string :as s])
+  (:gen-class
+   :name  testing.dyn
+   :extends javax.swing.JFrame
+   :implements [clojure.lang.IMeta]
+   :prefix df-
+   :state state
+   :init  init
+   :constructors {[String] [String]}
+   :methods [[display [java.awt.Container] void]
+             ^{:static true} [version [] String]])
+  (:import (javax.swing JFrame JPanel)
+           (java.awt BorderLayout Container)))
+
+(defn df-meta [this] @(.state this))
+(defn version [] "1.0")
+(defn df-display [this pane]
+  (doto this
+    (-> .getContentPane .removeAll)
+    (.setContentPane (doto (JPanel.)
+                       (.add pane BorderLayout/CENTER)))
+    (.pack)
+    (.setVisible true)))

 (defn file-count
   "Prints the total count of files in a given directory to stdout."


Remove spiked wall trap when sequqnce finished

--- src/cljc/robinson/traps.cljc
+++ src/cljc/robinson/traps.cljc
@@ -9,7 +9,7 @@

 (defn conj-trap-in-current-place
   [state trap]
-  (rw/update-current-place state (fn [place] (update place :traps (fn [traps] (conj traps trap))))))
+  (rw/update-current-place state (fn [place] (update place :traps (fn [traps] (vec (conj traps trap)))))))

 (defn room-bound-xys
   [min-x min-y max-x max-y]
@@ -78,6 +78,7 @@
   [state x y cell]
   ;; determine trap advancement mechanics
   (log/info "x" x "y" y "cell" cell)
+  ;; TODO: only trigger once
   (let [{{min-x :min-x
           min-y :min-y
           max-x :max-x
@@ -103,14 +104,18 @@
       state)))

 (defn update-crushing-wall-trap
-  [state trap]
-  state)
+  [state idx]
+  (let [place-id (rw/current-place-id state)]
+    (update-in state
+               [:world :places place-id :traps idx :locations]
+               (comp rest vec))))

 (defn update-trap
-  [state trap]
+  [state [idx trap]]
+  (log/info "updating trap" [idx trap])
   (case (get trap :type)
     :crushing-wall
-      (update-crushing-wall-trap state trap)
+      (update-crushing-wall-trap state idx)
     state))

 (defn current-place-traps
@@ -120,5 +125,19 @@

 (defn update-traps
   [state]
-  (reduce update-trap state (current-place-traps state)))
+  (as-> state state
+    (reduce update-trap state (map-indexed vector (current-place-traps state)))
+    (if-let [place-id (rw/current-place-id state)]
+      (update-in state
+                 [:world :places place-id :traps]
+                 (fn [traps]
+                   (reduce (fn [traps trap]
+                             ;; remove expended crusing wall traps
+                             (if (and (= (get trap :type) :crushing-wall)
+                                      (empty? (get trap :locations)))
+                               traps
+                               (vec (conj traps trap))))
+                           []
+                           traps)))
+      state)))


Array items type also needs mangling.

Array items type also needs mangling.

--- src/clojure/abracad/avro.clj
+++ src/clojure/abracad/avro.clj
@@ -29,7 +29,8 @@
     form
     (-> (mangle-value form :name)
         (mangle-value ,,,, :namespace)
-        (mangle-value ,,,, :type))))
+        (mangle-value ,,,, :type)
+        (mangle-value ,,,, :items))))

 (defn ^:private clj->json
   "Parse Clojure data into a JSON schema."


remove possible reflection in tuple2

remove possible reflection in tuple2

--- src/clojure/flambo/tuple.clj
+++ src/clojure/flambo/tuple.clj
@@ -1,9 +1,10 @@
 (ns flambo.tuple
-  (:refer-clojure :exclude [first second seq vec])
   (:require [serializable.fn :as sfn])
   (:import [scala Tuple2]))

-(defn tuple [k v]
+(set! *warn-on-reflection* true)
+
+(defn ^Tuple2 tuple [k v]
   (Tuple2. k v))

 (defn key-val-fn [f]


Quick fix in the proxy

Quick fix in the proxy

--- src/clojure/picard/proxy.clj
+++ src/clojure/picard/proxy.clj
@@ -82,8 +82,10 @@
              (if (proxy-loop? req)
                (downstream :response bad-gateway)
                (initiate-request state opts req downstream)))
+           (done []) ;; We don't care about this
            ;; Handling all other events
            (:else [evt val]
              (if-let [upstream @state]
                (upstream evt val)
-               (throw (Exception. "Somehow, the upstream isn't set")))))))))
+               (throw (Exception. (str "Not expecting events:\n"
+                                       [evt val]))))))))))


Add with-default-empty-byte-string

Add with-default-empty-byte-string

--- src/clojure_fabric/proto.clj
+++ src/clojure_fabric/proto.clj
@@ -39,6 +39,13 @@
            ))

 ;;;
+;;; Macros
+(defmacro with-default-empty-byte-string [[arg] & body]
+  `(if (nil? ~arg)
+     ByteString/EMPTY
+     ~@body))
+
+;;;
 ;;;
 (defprotocol ICljToProto
   (clj->proto [this]))
@@ -125,11 +132,12 @@
   (clj->proto [this]
     (-> (ProposalPackage$ChaincodeHeaderExtension/newBuilder)
         (.setChaincodeId ^Chaincode$ChaincodeID (clj->proto chaincode-id))
-        (.setPayloadVisibility ByteString/EMPTY) ;; FIXME: payload-visibility
+        (.setPayloadVisibility (with-default-empty-byte-string [payload-visibility]
+                                 (throw (Exception. "Currently only supports default visibility 'all'"))))
         (.build))))

 (defn make-chaincode-header-extension
-  [& {:keys [payload-visibility chaincode-id] :or {payload-visibility "FIXME"}}]
+  [& {:keys [payload-visibility chaincode-id]}]
   (map->ChaincodeHeaderExtension {:payload-visibility payload-visibility
                                   :chaincode-id chaincode-id}))

@@ -166,14 +174,14 @@
         (.setChannelId channel-id)
         (.setTxId tx-id)
         (.setEpoch epoch)
-        (.setExtension (.toByteString ^ProposalPackage$ChaincodeHeaderExtension
-                                      (clj->proto extension)))
+        (.setExtension (with-default-empty-byte-string [extension]
+                         (.toByteString ^ProposalPackage$ChaincodeHeaderExtension
+                                        (clj->proto extension))))
         (.build))))

 (defn make-channel-header
   [& {:keys [type version timestamp channel-id tx-id epoch extension]
-      :or {type :endorser-transaction version 1 extension ByteString/EMPTY
-           timestamp (System/currentTimeMillis) epoch 0}}]
+      :or {type :endorser-transaction version 1 timestamp (System/currentTimeMillis) epoch 0}}]
   (map->ChannelHeader {:type type :version version :timestamp timestamp :epoch epoch
                        :channel-id channel-id :tx-id tx-id :extension extension}))

@@ -221,14 +229,13 @@
     (-> (ProposalPackage$Proposal/newBuilder)
         (.setHeader (.toByteString ^Common$Header (clj->proto header)))
         (.setPayload (.toByteString ^ProposalPackage$ChaincodeProposalPayload (clj->proto payload)))
-        (.setExtension (if (= extension ByteString/EMPTY)
-                         extension
+        (.setExtension (with-default-empty-byte-string [extension]
                          (.toByteString ^ProposalPackage$ChaincodeHeaderExtension
-                                        (clj->proto extension))))
+                                           (clj->proto extension))))
         (.build))))

 (defn make-proposal
-  [& {:keys [header payload extension] :or {extension ByteString/EMPTY}}]
+  [& {:keys [header payload extension]}]
   (map->Proposal {:header header :payload payload :extension extension}))

 ;; FIXME: input bytes
@@ -266,7 +273,8 @@
     (-> (Chaincode$ChaincodeDeploymentSpec/newBuilder)
         (.setChaincodeSpec ^Chaincode$ChaincodeSpec (clj->proto chaincode-spec))
         (.setEffectiveDate ^Timestamp (clj->proto (make-timestamp effective-date)))
-        (.setCodePackage (ByteString/copyFrom code-package))
+        (.setCodePackage (with-default-empty-byte-string [code-package]
+                           (ByteString/copyFrom code-package)))
         (.setExecEnv (exec-env-map exec-env))
         (.build))))