Lower crafting log levels

Lower crafting log levels

--- src/robinson/crafting.clj
+++ src/robinson/crafting.clj
@@ -549,7 +549,7 @@
            [?e :recipe/example-item-requirements ?v]]
           recipe-db
           rules
-          (fn [msg x] (log/info msg x) true)
+          (fn [msg x] (log/trace msg x) true)
           seq
           first
           rest
@@ -579,7 +579,7 @@
            [?e :recipe/example-item-properties ?v]]
           recipe-db
           rules
-          (fn info [x] (log/info x) true)
+          (fn info [x] (log/trace x) true)
           seq
           first
           rest
@@ -591,7 +591,7 @@

 (defn item-satisfies-requirement-clause?
   [item clause]
-  (log/info "item-satisfies-requirement-clause?" item clause)
+  (log/debug "item-satisfies-requirement-clause?" item clause)
   (cond
     (fn? clause)
       (clause item)
@@ -616,8 +616,8 @@

 (defn item-satisfies-any-clause?
   [item recipe]
-  (log/info "item-satisfies-any-clause?" item)
-  (log/info "item-satisfies-any-clause?" (get recipe :recipe/requirements))
+  (log/debug "item-satisfies-any-clause?" item)
+  (log/debug "item-satisfies-any-clause?" (get recipe :recipe/requirements))
   (some
     (partial item-satisfies-requirement-clause? item)
     (-> recipe :recipe/requirements rest)))
@@ -658,7 +658,7 @@
                                (remove empty?)
                                (mapcat combo/permutations))]
     (do
-    (log/info "testing" (count item-permutations) " item combos " (count recipes) " recipes")
+    (log/debug "testing" (count item-permutations) " item combos " (count recipes) " recipes")
     (or
       (set
         (for [recipe recipes
@@ -679,7 +679,7 @@
   [state hotkeys]
   (reduce (fn [state hotkey]
             (do
-              (log/info "removing" hotkey)
+              (log/trace "removing" hotkey)
               (ri/dec-item-count state hotkey)))
           state
           hotkeys))
@@ -696,16 +696,16 @@

 (defn- place-inventory
   [state id effects name]
-  (log/info "placing item with id" id "in inventory")
+  (log/debug "placing item with id" id "in inventory")
   (let [item (ig/id->item id)
-        _ (log/info item)
+        _ (log/trace item)
         updated-item (reduce (fn [item effect]
                                (if (satisfies? rcmp/ModItemOnCreate effect)
                                  (rcmp/item-on-create effect item)
                                  item))
                              (assoc item :name name)
                              (get item :effects))]
-    (log/info "add-to-inventory" updated-item)
+    (log/debug "add-to-inventory" updated-item)
     (ri/add-to-inventory state [updated-item])))

 (defn- add-by-ids
@@ -810,7 +810,7 @@
   ([recipe show-progress]
     {:post [string?]}
     (let [types (get recipe :recipe/types)]
-      (log/info "recipe-name" (count types) (get recipe :recipe/id) (get recipe :type) types (and show-progress (in-progress? recipe)))
+      (log/debug "recipe-name" (count types) (get recipe :recipe/id) (get recipe :type) types (and show-progress (in-progress? recipe)))
       (str
         (if (and show-progress (in-progress? recipe))
           "In progress "
@@ -842,8 +842,8 @@
     (craft-recipe state recipe true))
   ([state recipe exhaust]
     {:pre [(some? recipe)]}
-    (log/info "crafting recipe" (get recipe :recipe/id))
-    (log/info recipe)
+    (log/debug "crafting recipe" (get recipe :recipe/id))
+    (log/trace recipe)
     (let [exhaust-hotkeys (->> (get recipe :recipe/requirements)
                             ; remove 'each-of
                             rest
@@ -855,7 +855,7 @@
                             (map (fn [[slot _]] (get (slot->item state slot) :hotkey))))
           add          (get recipe :recipe/add)
           effects      (get recipe :effects [])
-          _ (log/info "add" add)
+          _ (log/trace "add" add)
           state (as-> state state
                     (add-by-ids state add effects (get recipe :place :inventory) (get recipe :recipe/name))
                     ; exhaust non-tool slot items
@@ -873,13 +873,13 @@
   "Returns a requirements where one of the clauses has been replaced with a specific item requirement based
    on the dominate item in the recipe."
   [item requirements]
-  (log/info "requirements-based-on-dominate-item" item requirements)
-  (log/info (->> requirements
+  (log/debug "requirements-based-on-dominate-item" item requirements)
+  (log/debug (->> requirements
               ; add index
               (map-indexed vector)
               vec))

-  (log/info (->> requirements
+  (log/debug (->> requirements
               ; add index
               (map-indexed vector)
               rest
@@ -900,7 +900,7 @@
                   rand-nth
                   ; extract index of clause to replace
                   first)]
-        (log/info "idx" idx)
+        (log/trace "idx" idx)
         ; replace clause with
         (assoc requirements idx [:item/id (get item :item/id)]))
       ; if not clauses - don't update requirements
@@ -909,13 +909,13 @@
 (defn save-recipe
   [state]
   {:post [(not (nil? %))]}
-  (log/info "Saving recipe")
-  (log/info (type (get-in state [:world :recipes])))
+  (log/debug "Saving recipe")
+  (log/debug (type (get-in state [:world :recipes])))
   #_(log/info (vec (get-in state [:world :recipes])))
   (let [recipe (current-recipe state)
         _ (assert (some? recipe))
         selected-recipe-hotkey (get-in state [:world :selected-recipe-hotkey])
-        _ (log/info "dominate-item" (get recipe :recipe/dominate-item))
+        _ (log/trace "dominate-item" (get recipe :recipe/dominate-item))
         #_ (log/info recipe)
         recipe-blueprint (-> recipe
                            :recipe/types
@@ -928,7 +928,7 @@
                         (update :recipe/requirements
                                 (partial requirements-based-on-dominate-item
                                          (get recipe :recipe/dominate-item))))]
-    (log/info (dissoc merged-recipe :recipe/events))
+    (log/debug (dissoc merged-recipe :recipe/events))
     (-> state
       (update-in [:world :recipes] assoc
         selected-recipe-hotkey merged-recipe)
@@ -937,14 +937,14 @@

 (defn fill-event
   [event recipe]
-  (letfn [(invoke-fn [f] (log/info "invoke-fn" f recipe) (f recipe))]
-    (log/info "fill-event" event)
-    (log/info "seq?" (sequential? (get event :description)))
+  (letfn [(invoke-fn [f] (log/trace "invoke-fn" f recipe) (f recipe))]
+    (log/debug "fill-event" event)
+    (log/trace "seq?" (sequential? (get event :description)))
     (-> event
       (cond-> (sequential? (get event :description))
         (update :description rand-nth))
       (update :event/choices (fn [choices]
-        (log/info "Updating choices" (count choices) choices)
+        (log/debug "Updating choices" (count choices) choices)
         (case (count choices)
           ; no choices, add (space - continue)
           0 [{:name "continue" :hotkey :space :source :fill-event1}]
@@ -964,7 +964,7 @@
   [recipe-ns val-in-result val-in-latter]
   (if-let [merge-sym (-> val-in-latter meta :merge)]
     (let [f (ns-resolve recipe-ns merge-sym)]
-      (log/info f)
+      (log/trace f)
       (f val-in-result val-in-latter))
     (into val-in-result val-in-latter)))

@@ -1005,9 +1005,9 @@

 (defn rand-event
   [state recipe-ns recipe]
-  (log/info "rand-event" (-> recipe :events))
-  (log/info "rand-event" (-> recipe :events last))
-  (log/info "rand-event" (keys recipe))
+  (log/debug "rand-event" (-> recipe :events))
+  (log/debug "rand-event" (-> recipe :events last))
+  (log/debug "rand-event" (keys recipe))
   (let [num-events (count (get recipe :events []))
         next-node-type (rand-nth
                          (cond
@@ -1064,8 +1064,8 @@
   (let [current-stage (get recipe :current-stage)]
     ; find selected choice

-    (log/info "choices" (vec (->> (get current-stage :event/choices))))
-    (log/info "choice" (->> (get current-stage :event/choices)
+    (log/debug "choices" (vec (->> (get current-stage :event/choices))))
+    (log/debug "choice" (->> (get current-stage :event/choices)
                       (filter #(= (get % :hotkey) keyin))
                       first))
     (if-let [choice (->> (get current-stage :event/choices)
@@ -1094,11 +1094,11 @@
                                                                 :done
                                                                 :choice/id])
                                            (select-keys current-stage [:gen]))))
-              _ (log/info "results" results)
+              _ (log/debug "results" results)
               choice-variables (->> choice
                                  (filter (fn [[k v]] (= "$" (namespace k))))
                                  (map (fn [[k v]] (let [f (eval-in-ns v recipe-ns)]
-                                                    (log/info "evaluating" v "into" f "arg" (get recipe k))
+                                                    (log/trace "evaluating" v "into" f "arg" (get recipe k))
                                                     [k (f (get recipe k))])))
                                  (into {}))
               ; merge results into current recipe
@@ -1115,7 +1115,7 @@
                                    (update-current-recipe
                                      update :events conj (get recipe :current-stage)))]
           (assert (not (nil? state-with-results)))
-          (log/info "next-state" (rw/current-state state-with-results))
+          (log/trace "next-state" (rw/current-state state-with-results))
           ; done with recipe?
           (cond
             (contains? choice :done)
@@ -1127,7 +1127,7 @@
               (if (not-empty (get choice :choice/events))
                 ; find next event
                 (let [next-event (rand-nth (get choice :choice/events))]
-                  (log/info "next-event" next-event)
+                  (log/trace "next-event" next-event)
                   (assoc-current-recipe
                     state-with-results
                     :current-stage
@@ -1135,7 +1135,7 @@
                     (fill-event
                       (if (keyword? next-event)
                         (let [event-fn (ns-resolve recipe-ns (-> next-event name symbol))]
-                          (log/info "resolved" recipe-ns next-event "to" event-fn)
+                          (log/trace "resolved" recipe-ns next-event "to" event-fn)
                           (event-fn state recipe))
                         next-event)
                       recipe)))
@@ -1162,8 +1162,8 @@
   {:pre [(not (nil? state))]
    :post [(not (nil? %))]}
   (let [gen-random (ns-resolve recipe-ns 'gen-random)]
-  (log/info "gen-random" gen-random)
-  (log/info "recipe init" recipe)
+  (log/trace "gen-random" gen-random)
+  (log/trace "recipe init" recipe)
   (assoc-current-recipe
       state
       :name (recipe-name recipe)


When browser loaded then save web session

Even if they are an anonymous user we store them as a session

--- src/webapp/framework/client/main.cljs
+++ src/webapp/framework/client/main.cljs
@@ -79,11 +79,15 @@
    (@init-fn)
    (detect-browser)

-   (let [session      (remote !create-session {
-                                               :init-state (with-out-str (prn @app-state))
-                                               :browser    (str (-> @app-state :system :platform) ","
-                                                                (-> @app-state :system :who-am-i))
-                                              })  ]
+    (let [cookie-session-id      (cookie/get "appshare.co")
+          session                (remote !create-session {
+                                                           :init-state (with-out-str (prn @app-state))
+
+                                                           :browser    (str (-> @app-state :system :platform) ","
+                                                                            (-> @app-state :system :who-am-i))
+
+                                                           :session-id-from-browser    cookie-session-id
+                                                           })  ]
      ;(log session)
         (reset! session-id      (:value session))
         (reset! data-session-id (:data-session-id session))


Default behaviour of turning column names into keyword args

--- src/semantic_csv/core.clj
+++ src/semantic_csv/core.clj
@@ -75,9 +75,13 @@
 (defn mappify
   "Comsumes the first item as a header, and returns a seq of the remaining items as a maps with the header
   values as keys (see mappify-row)."
-  [rows]
-  (let [header (first rows)]
-    (map (partial mappify-row header) (rest rows))))
+  ([rows]
+   (mappify {} rows))
+  ([{:keys [keyify] :or {keyify true} :as opts}
+    rows]
+   (let [header (first rows)
+         header (if keyify (mapv keyword header) header)]
+     (map (partial mappify-row header) (rest rows)))))

 ;; Here's an example to whet our whistle:
 ;;


(maint) Remove unused definitions from jruby-puppet-core

These defs moved over to jruby-puppet-internal in
23154f42f24351e55a329cf52663d291c4c5312f and are no longer used from
jruby-puppet-core.

--- src/clj/puppetlabs/services/jruby/jruby_puppet_core.clj
+++ src/clj/puppetlabs/services/jruby/jruby_puppet_core.clj
@@ -40,21 +40,6 @@

 (def default-master-var-dir
   "/opt/puppetlabs/server/data/puppetserver")
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Definitions
-
-(def jruby-puppet-env
-  "The environment variables that should be passed to the Puppet JRuby interpreters.
-  We don't want them to read any ruby environment variables, like $GEM_HOME or
-  $RUBY_LIB or anything like that, so pass it an empty environment map - except -
-  Puppet needs HOME and PATH for facter resolution, so leave those."
-  (select-keys (System/getenv) ["HOME" "PATH"]))
-
-(def ruby-code-dir
-  "The name of the directory containing the ruby code in this project.
-  This directory lives under src/ruby/"
-  "puppet-server-lib")

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Private


Corrected stupid mistake with the scheduler timer

--- src/shuppet/scheduler.clj
+++ src/shuppet/scheduler.clj
@@ -36,8 +36,8 @@
 (defn configure-apps
   [environment]
   (try
-    (time! (timer ["info" "application" (str "scheduler." environment ".configure_apps")]
-                  (dorun (core/configure-apps environment))))
+    (time! (timer ["info" "application" (str "scheduler." environment ".configure_apps")])
+           (dorun (core/configure-apps environment)))
     (catch Exception e
       (error (str-stacktrace e)))))


Use primary domain in link.

Use primary domain in link.

--- src/cljs/clj_templates/components/footer/component.cljs
+++ src/cljs/clj_templates/components/footer/component.cljs
@@ -3,4 +3,4 @@
 (defn footer []
   [:footer
    [:div.content
-    [:div [:span "By " [:a.dxtr-link {:href "http://www.dxtr.se/" :target "_blank"} "Dexter Gramfors"]]]]])
+    [:div [:span "By " [:a.dxtr-link {:href "https://dxtr.se/" :target "_blank"} "Dexter Gramfors"]]]]])


Wrap log text in scrollable

Wrap log text in scrollable

--- src/sqls/ui/worksheet.clj
+++ src/sqls/ui/worksheet.clj
@@ -28,7 +28,8 @@
                                                   :preferred-size [800 :by 400])
         log-text (seesaw.core/text :id :log :multi-line? true :editable? false)
         log-panel (seesaw.core/vertical-panel :id :log-panel
-                                              :items [log-text])
+                                              :items [(seesaw.core/scrollable log-text
+                                                                              :id :log-scrollable)])
         tabs-panel (seesaw.core/tabbed-panel :id :tabs
                                        :tabs [{:title "Results" :content results-panel}
                                               {:title "Log" :content log-panel}])


Cleaned up log references in core

Cleaned up log references in core

--- src/strange_coop/core.clj
+++ src/strange_coop/core.clj
@@ -1,9 +1,8 @@
 (ns strange-coop.core
   (:require [clojure.java.io :as io]
-            ;[clojure.tools.logging :as log]
             [com.stuartsierra.component :as component]
             [clojure.tools.trace :as tr]
-            [strange-coop.util :refer :all]
+            [strange-coop.util :refer [log log-tr]]
             [strange-coop.bbbpin :as bb :refer :all]
             [strange-coop.button :as button]
             [strange-coop.hbridge :as hb]))


Weekly query is limited (via hardcoded int)

--- src/swanson/models/db.clj
+++ src/swanson/models/db.clj
@@ -130,7 +130,7 @@
   WHERE t.date > now() - interval '1 year'
   AND t.amount < 0.00
   GROUP BY Week
-  ORDER BY Week")
+  ORDER BY Week DESC LIMIT 6")

 (defn get-transactions-by-week []
   (jdbc/query db-spec [week-grouping-query]))


restart services at boot (enable true)

restart services at boot (enable true)

--- src/terraboot/cluster.clj
+++ src/terraboot/cluster.clj
@@ -11,7 +11,7 @@
                     {:name "locksmithd.service" :command "stop" :mask true}
                     {:name "systemd-resolved.service" :command "stop"}
                     {:name "systemd-journald.service" :command "restart"}
-                    {:name "docker.service" :command "restart"}
+                    {:name "docker.service" :command "restart" :enable true}
                     {:name "dcos-link-env.service" :command "start" :content (snippet "systemd/dcos-link-env.service")}
                     {:name "dcos-download.service" :content (snippet "systemd/dcos-download.service")}
                     {:name "dcos-setup.service" :command "start" :content (clojure.string/trim-newline (snippet "systemd/dcos-setup.service")) :enable true}
@@ -19,7 +19,7 @@
                     {:name "docker-cleanup.service" :command "start" :content (snippet "systemd/docker-cleanup.service")}
                     {:name "docker-cleanup.timer" :command "start" :content (snippet "systemd/docker-cleanup.timer") :enable true}
                     {:name "install-confd.service" :command "start" :content (snippet "systemd/install-confd.service")}
-                    {:name "confd.service" :command "start" :enable true :content (snippet "systemd/confd.service")}]
+                    {:name "confd.service" :command "start" :content (snippet "systemd/confd.service") :enable true}]
             :update {:reboot-strategy "off"}}
    :write_files [{:path "/etc/mesosphere/setup-packages/dcos-provider-aws--setup/pkginfo.json"
                   :content "{}\n"}


fix for https://github.com/status-im/status-react/issues/867

--- src/status_im/profile/screen.cljs
+++ src/status_im/profile/screen.cljs
@@ -42,6 +42,7 @@
      [touchable-highlight {:style    st/back-btn-touchable
                            :on-press (fn []
                                        (dispatch [:set-in [:profile-edit :edit?] false])
+                                       (dispatch [:set-in [:profile-edit :name] nil])
                                        (dispatch [:navigate-back]))}
       [view st/back-btn-container
        [icon :back st/back-btn-icon]]]
@@ -132,10 +133,10 @@
       [icon :back st/back-btn-icon]]]
     ;; TODO not implemented
     #_[touchable-highlight {:style    st/actions-btn-touchable
-                          :on-press (fn []
-                                      (.log js/console "Dots pressed!"))}
-     [view st/actions-btn-container
-      [icon :dots st/edit-btn-icon]]]]
+                            :on-press (fn []
+                                        (.log js/console "Dots pressed!"))}
+       [view st/actions-btn-container
+        [icon :dots st/edit-btn-icon]]]]

    [status-image-view {:account    contact
                        :photo-path photo-path
@@ -191,7 +192,6 @@
    qr [:get-in [:profile-edit :qr-code]]
    current-account [:get-current-account]
    changed-account [:get :profile-edit]]
-  {:component-will-unmount #(dispatch [:set-in [:profile-edit :name] nil])}
   (let [{:keys [phone
                 address
                 public-key]


move data-source to status-im.utils.listview ns (fixes externs generatoin)

--- src/status_im/utils/listview.cljs
+++ src/status_im/utils/listview.cljs
@@ -4,6 +4,9 @@
 (defn clone-with-rows [ds rows]
   (.cloneWithRows ds (reduce (fn [ac el] (.push ac el) ac)
                              (clj->js []) rows)))
+
+(defmacro data-source [config]
+  (js/ReactNative.ListView.DataSource. (clj->js config)))

 (defn to-datasource [items]
   (clone-with-rows (data-source {:rowHasChanged not=}) items))


Classify review notes

Classify review notes

--- src/xray_charlie_charlie/core.clj
+++ src/xray_charlie_charlie/core.clj
@@ -39,16 +39,16 @@
   [options]
   (let [request (RequestOptions.)]
     (if (every? valid-request-options (keys options))
-      ;; I would prefer when-not/throw/... instead of if/do/.../throw
+      ;; TODO I would prefer when-not/throw/... instead of if/do/.../throw
       (do (when-let [ardm (:auto-retry-delay-millis options)]
             (.setAutoRetryDelayMillis request ardm))
           (when (or (true? (:cache-result options))
                     (false? (:cache-result options)))
             (.setCacheResult request (:cache-result options)))
-          ;; This does not deal with {:cache-result nil} in a sensible way.  Better check for key presence then true?/false?
+          ;; FIXME This does not deal with {:cache-result nil} in a sensible way.  Better check for key presence then true?/false?
           (when-let [dxv (:default-xquery-version options)]
             (.setDefaultXQueryVersion request dxv))
-          ;; A macro might be useful to replace the chain of when-lets with use-once variable names
+          ;; TODO A macro might be useful to replace the chain of when-lets with use-once variable names
           (when-let [epit (:effective-point-in-time options)]
             (.setEffectivePointInTime request (BigInteger. (str epit))))

@@ -136,7 +136,7 @@
   ([uri user pwd content-base options]
    (-> (create-session* uri user pwd content-base)
        (configure-session options))))
-;; I find the repetition of configure-session cluttering.  Probably not a big deal.
+;; TODO I find the repetition of configure-session cluttering.  Probably not a big deal.

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -173,7 +173,7 @@
       (do (when-not (.isClosed rs)
             (.close rs))
           data))))
-;; Maybe make the request result adhere to the sequence protocol?  Can with-open be used, as
+;; FIXME Maybe make the request result adhere to the sequence protocol?  Can with-open be used, as
 ;; rs seems to be closable?  The function is hard to understand as it is.

 (defn execute-xquery


Update test

Update test

--- test/clj_crud/admin_accounts_test.clj
+++ test/clj_crud/admin_accounts_test.clj
@@ -91,7 +91,7 @@
       (tc/at? "/admin")
       (visit "/admin/accounts")
       (within [:table#accounts :tbody :tr [:td.name (html/has [:a (html/text-pred #(= "User 1" %))])]]
-              (has (attr? [:a] :href "http://localhost/profile/user1")))
+              (has (attr? [:a] :href "http://localhost/todos/user1")))
       (visit "/profile/user1")
       (follow-redirect)
       (tc/at? "/login")


cleaning tests

cleaning tests

--- test/forma/classify/logistic_test.clj
+++ test/forma/classify/logistic_test.clj
@@ -10,8 +10,6 @@
             [forma.testing :as t]
             [forma.date-time :as date]
             [cascalog.ops :as c]))
-
-;; TODO: Write cascalog.midje tests

 (defn read-mys-csv
   "returns a properly adjusted list of the malaysia test data."
@@ -62,6 +60,8 @@
           (.put init-mat 3 to-insert))]
     (mult-fn mat) => out-mat))

+;; USEFUL FOR BENCHMARK
+
 (defn multiplier
   [n]
   ((partial * 1000) n))
@@ -81,3 +81,7 @@
         big-y (mk-y n)]
     (prn (.rows big-X) (.columns big-X))
     (logistic-beta-vector big-y big-X 1e-8 1e-10 iterations)))
+
+;; TIME required to calculate logistic betas for 1 million obs, 10 iterations
+;; (time (run-logistic-beta-vector 1000 10))
+;; "Elapsed time: 5014.590245 msecs"


added karma-slimer to doo

added karma-slimer to doo

--- library/src/doo/karma.clj
+++ library/src/doo/karma.clj
@@ -27,7 +27,9 @@
    :ie            {:plugin (karma-plugin-name "ie")
                    :name   "IE"}
    :karma-phantom {:plugin (karma-plugin-name "phantomjs")
-                   :name   "PhantomJS"}})
+                   :name   "PhantomJS"}
+   :karma-slimer  {:plugin (karma-plugin-name "slimerjs")
+                   :name   "SlimerJS"}})

 (def envs (set (keys karma-envs)))


revert changes

revert changes

--- test/jepsen/voltdb/multi_test.clj
+++ test/jepsen/voltdb/multi_test.clj
@@ -10,7 +10,7 @@
 (deftest a-test
   (loop []
     (when (run (multi-test {:tarball tarball
-                            :procedure-call-timeout 5000
+                            :procedure-call-timeout 1000
                             :time-limit 200}))
       (recur)
     )))


add test environment

add test environment

--- test/metabase/test/data/crate.clj
+++ test/metabase/test/data/crate.clj
@@ -1,18 +1,37 @@
 (ns metabase.test.data.crate
   "Code for creating / destroying a Crate database from a `DatabaseDefinition`."
-  (:require metabase.driver.crate
+  (:require [environ.core :refer [env]]
+            metabase.driver.crate
             (metabase.test.data [generic-sql :as generic]
                                 [interface :as i]))
   (:import metabase.driver.crate.CrateDriver))

-(defn- database->connection-details [_]
+(def ^:private ^:const field-base-type->sql-type
+  {:BigIntegerField "long"
+   :BooleanField    "boolean"
+   :CharField       "string"
+   :DateField       "timestamp"
+   :DateTimeField   "timestamp"
+   :DecimalField    "integer"
+   :FloatField      "float"
+   :IntegerField    "integer"
+   :TextField       "string"
+   :TimeField       "timestamp"})
+
+(defn- database->connection-details [_ _ {:keys [_ _]}]
   (merge {:host         "localhost"
           :port         4300}))

 (extend CrateDriver
   generic/IGenericSQLDatasetLoader
   (merge generic/DefaultsMixin
-         {})
+         {:execute-sql!              generic/sequentially-execute-sql!
+          :field-base-type->sql-type (fn [_ base-type]
+                                       (field-base-type->sql-type base-type))
+          :pk-sql-type               (constantly "integer primary key")
+          :create-db-sql             (constantly nil)
+          :add-fk-sql                (constantly nil)
+          :drop-db-if-exists-sql     (constantly nil)})
   i/IDatasetLoader
   (merge generic/IDatasetLoaderMixin
          {:database->connection-details database->connection-details


Use better example of rank-3 tensor

Use better example of rank-3 tensor


revert bb

revert bb


Add overlapping-bins test.

Add overlapping-bins test.

--- test/cavm/binner_test.clj
+++ test/cavm/binner_test.clj
@@ -1,6 +1,13 @@
 (ns cavm.binner-test
-  (:use clojure.test
-        cavm.binner))
+  (:require [cavm.binner :refer [calc-bin overlapping-bins]])
+  (:require [cavm.h2 :as h2])
+  (:require [clojure.test :refer [deftest testing is]])
+  (:require [clojure.test.check :as tc])
+  (:require [clojure.test.check.generators :as gen])
+  (:require [clojure.test.check.clojure-test :as tcct :refer [defspec]])
+  (:require [clojure.test.check.properties :as prop]))
+
+(def ^:dynamic *test-runs* 400)

 (deftest basic-test
   (testing "Some bins"
@@ -8,3 +15,25 @@
     (is (= 4684 (calc-bin 400000 500000)))
     (is (= 1061 (calc-bin 499900000 500000000)))
     (is (= 585 (calc-bin 100000 500000)))))
+
+(def gen-position (gen/resize (* 1024 1024) gen/s-pos-int))
+
+; Assert that, for a given interval, and a set of queries that
+; overlap the interval, overlapping-bins will always return a set
+; of bins that includes the bin of the interval.
+(defspec overlap-test
+  *test-runs*
+  (prop/for-all
+    [intvl (gen/tuple gen-position gen-position)
+     query-intvls (gen/such-that not-empty
+                                 (gen/resize 1000 (gen/vector
+                                                    (gen/tuple gen-position
+                                                               gen-position))))]
+    (let [[start end] intvl
+          bin (apply calc-bin (sort intvl))
+          query-intvls (map (comp vec sort) query-intvls)
+          overlapping (filter (fn [[s e]] (and (<= start e) (>= end s))) query-intvls)]
+      (every? (fn [q]
+                (let [bins (apply overlapping-bins q)]
+                  (some (fn [[s e]] (and (<= bin e) (>= bin s))) bins)))
+              overlapping))))


fix user-language

fix user-language

--- src/clj/salava/user/data.clj
+++ src/clj/salava/user/data.clj
@@ -89,7 +89,8 @@
   (let [data-dir (get-in ctx [:config :core :data-dir])
         site-url (get-in ctx [:config :core :site-url])
         user-data (conj () (all-user-data ctx user-id current-user-id))
-        ul (get-in (first user-data) [:user :language])
+        ul (let [lang (get-in (first user-data) [:user :language])]
+             (if (= "-" lang) "en" lang))
         font-path  (first (mapcat #(get-in ctx [:config % :font] []) (util/get-plugins ctx)))
         font  {:ttf-name (str site-url font-path)}
         stylesheet {:heading-name {:color [127 113 121]


refactor

refactor

--- src/leiningen/namespaces.clj
+++ src/leiningen/namespaces.clj
@@ -268,6 +268,13 @@
     #(u/run-command-on (->target-project-path %) lein-test %)
     projects)))

+(defn- log-test-hints [passed-projects]
+  (when (not (empty? passed-projects))
+    (m/info "* Tests are passed on projects:" passed-projects "\n")
+    (m/info "To see changes : lein sync" passed-projects "--diff")
+    (m/info "To commit      : lein sync" passed-projects "--commit")
+    (m/info "To push        : lein sync" passed-projects "--push")))
+
 ;;;;; Sync Commands ;;;;;

 (defn reset-all! [projects _]
@@ -306,12 +313,8 @@
     (if (not (empty? resources)) (update-resouces! resources source-project-desc))))

 (defn run-test [target-projects _]
-  (let [passed-projects (->> (test-all target-projects)
-                             (filter #(= (:result %) :passed))
-                             (map :project)
-                             (str/join ","))]
-    (when (not (empty? passed-projects))
-      (m/info "* Tests are passed on projects:" passed-projects "\n")
-      (m/info "To see changes : lein sync" passed-projects "--diff")
-      (m/info "To commit      : lein sync" passed-projects "--commit")
-      (m/info "To push        : lein sync" passed-projects "--push"))))+  (->> (test-all target-projects)
+       (filter #(= (:result %) :passed))
+       (map :project)
+       (str/join ",")
+       (log-test-hints)))


mark adding gid by default

mark adding gid by default

--- src/ophion/aggregate.clj
+++ src/ophion/aggregate.clj
@@ -125,23 +125,21 @@
        (assoc project value (dollar value)))
      {} values)}])

-(defn mark-field
+(def root-symbol "_")
+
+(defn mark
   [label]
   (if (map? label)
     (let [[key value] (first label)
           path (str "_history." key)]
-      {path (dollar value)})
+      (if (= value root-symbol)
+        [{:$addFields {path "$$ROOT"}}
+         {:$project
+          {(str path "._history") false
+           (str path "._id") false}}]
+        [{:$addFields {path (dollar value)}}]))
     (let [path (str "_history." label)]
-      {path "$$ROOT"})))
-
-(defn mark
-  [label]
-  (let [field (mark-field label)
-        path (first (keys field))]
-    [{:$addFields field}
-     {:$project
-      {(str path "._history") false
-       (str path "._id") false}}]))
+      [{:$addFields {path "$gid"}}])))

 (defn select
   [labels]


fixing endianess bug

fixing endianess bug

--- src/overtone/core/sc.clj
+++ src/overtone/core/sc.clj
@@ -9,6 +9,7 @@
     (java.util.regex Pattern)
     (java.util.concurrent TimeUnit TimeoutException)
     (java.io BufferedInputStream)
+    (java.nio ByteOrder)
     (java.util BitSet))
   (:use clj-scsynth.core)
   (:require [overtone.core.log :as log])
@@ -129,7 +130,7 @@
   [addr buf size]
   (println "internal-osc-callback...")
   (event ::recv-osc-message
-         :msg (osc-decode-packet (.getByteBuffer buf 0 size))))
+         :msg (osc-decode-packet (.order (.getByteBuffer buf 0 size) ByteOrder/BIG_ENDIAN))))

 (on ::send-osc-message (fn [event]
                          (let [buffer (java.nio.ByteBuffer/allocate 8129)]


Reformat docstrings

Reformat docstrings

--- src/pinpointer/core.cljc
+++ src/pinpointer/core.cljc
@@ -178,13 +178,20 @@
      (println "Success!!"))))

 (defn pinpoint
-  "Given a spec and a value that fails to conform, reports the spec error(s) in a human-friendly manner.
-
-  The opts map may have the following keys:
-    :width - Number of columns to try to wrap the report at. Defaults to 70.
-    :colorize - Can either be a keyword :ansi, :none or a fn that takes a color keyword and a string, and returns the colorized string. Defaults to :none.
-    :fallback-on-error - If set to true, falls back to s/explain-printer in case of an error during the analysis. Otherwise, throws the error. Defaults to true.
-    :eval - eval fn to be used to analyze spec errors. Defaults to clojure.core/eval in Clojure, nil in ClojureScript."
+  "Given a spec and a value that fails to conform, reports the spec
+error(s) in a human-friendly manner.
+
+The opts map may have the following keys:
+  :width - Number of columns to try to wrap the report at.
+    Defaults to 70.
+  :colorize - Can either be a keyword :ansi, :none or a fn that
+    takes a color keyword and a string, and returns the colorized
+    string. Defaults to :none.
+  :fallback-on-error - If set to true, falls back to
+    s/explain-printer in case of an error during the analysis.
+    Otherwise, rethrows the error. Defaults to true.
+  :eval - eval fn to be used to analyze spec errors. Defaults to
+    clojure.core/eval in Clojure, nil in ClojureScript."
   ([spec x] (pinpoint spec x {}))
   ([spec x opts]
    (pinpoint-out (s/explain-data spec x) opts)))


Recommenting performance testing settings in project.clj

--- es-spatial-plugin/project.clj
+++ es-spatial-plugin/project.clj
@@ -44,13 +44,13 @@

          ;; The ^replace is done to disable the tiered compilation for accurate benchmarks
          ;; See https://github.com/technomancy/leiningen/wiki/Faster
-         :jvm-opts ^:replace [;; important to allow logging to standard out
-                              "-Des.foreground=true"
-                              ;; Use the following to enable JMX profiling with visualvm
-                              "-Dcom.sun.management.jmxremote"
-                              "-Dcom.sun.management.jmxremote.ssl=false"
-                              "-Dcom.sun.management.jmxremote.authenticate=false"
-                              "-Dcom.sun.management.jmxremote.port=1098"]
+         ; :jvm-opts ^:replace [;; important to allow logging to standard out
+         ;                      "-Des.foreground=true"
+         ;                      ;; Use the following to enable JMX profiling with visualvm
+         ;                      "-Dcom.sun.management.jmxremote"
+         ;                      "-Dcom.sun.management.jmxremote.ssl=false"
+         ;                      "-Dcom.sun.management.jmxremote.authenticate=false"
+         ;                      "-Dcom.sun.management.jmxremote.port=1098"]
          :source-paths ["src" "dev"]}
    :uberjar {:aot :all}}


Set the Stage's viewport

Set the Stage's viewport

--- src/play_clj/core_render.clj
+++ src/play_clj/core_render.clj
@@ -13,7 +13,9 @@

 (defmethod render! Stage
   [{:keys [^Stage renderer ^Camera camera]}]
-  (when camera (.setCamera renderer camera))
+  (when camera
+    (.setCamera renderer camera)
+    (.setViewport renderer (. camera viewportWidth) (. camera viewportHeight)))
   (.draw renderer))

 (defn tiled-map-layers


Microscope load-conv now accepts env-overrides

--- src/polismath/microscope.clj
+++ src/polismath/microscope.clj
@@ -58,14 +58,15 @@

 (defn load-conv
-  [& {:keys [zid zinvite] :as args}]
+  [& {:keys [zid zinvite env-overrides] :or {env-overrides {}} :as args}]
   (assert (xor zid zinvite))
   (let [zid (or zid (get-zid-from-zinvite zinvite))]
-    (->
-      (db/load-conv zid)
-      (update-in
-        [:repness]
-        (partial pc/map-keys kw->int)))))
+    (env/with-env-overrides env-overrides
+      (->
+        (db/load-conv zid)
+        (update-in
+          [:repness]
+          (partial pc/map-keys kw->int))))))

 (def cli-options


Работа над меседжами оповещения а также индикатором загрузки

--- src-cljs/ixinfestor/core.cljs
+++ src-cljs/ixinfestor/core.cljs
@@ -144,9 +144,9 @@
     ))

 (defn display-message-on-time [time message]
-  (let [el [:div {:id "top-message" :class "alert alert-success" :style "position:absolute;top:10px;left:10px" :role "alert"}
+  (let [el [:div {:id "top-message" :class "alert alert-success" :style "position:absolute;bottom:10px;right:10px" :role "alert"}
             message]]
-    (->> el hipo/create (dommy/append! (by-id :main-navbar)))
+    (->> el hipo/create (dommy/append! (sel1 :body)))
     ;;(.appendChild (.-body js/document) (hipo/create el))
     (js/setTimeout (fn []
                      (when-let [e (by-id :top-message)]
@@ -608,6 +608,9 @@
 ;;*
 ;;**************************************************************************************************

+
+
+
 (def chan-ajax-post-json (chan))
 (def chan-ajax-post-json-white-end (chan))

@@ -615,6 +618,14 @@
   (while true
     (let [[url params handler-fn error-handler-fn] (<! chan-ajax-post-json)]
       (println "AJAX POST REQUEST: START ON " url " <- " params)
+
+
+      (let [el [:div {:id "top-download-message" :class "alert alert-warning" :style "position:absolute;top:40%;left:40%" :role "alert"}
+                [:img {:src "/images/preloader.gif"}]
+                "Подождите, идет загрузка данных..."]]
+        (->> el
+             hipo/create
+             (dommy/append! (sel1 :body))))

       ;; Данный вариант не работает в общей функции
       ;; #_(POST "/tag/path-and-chailds"
@@ -638,17 +649,19 @@
         :handler (fn [[ok response]]

                    (put! chan-ajax-post-json-white-end 1)
-
+
                    (if ok
                      (handler-fn response)
-                     (error-handler-fn response))
+                     (do (println "AJAX ERROR: " ok)
+                         (error-handler-fn response)))
+
                    ;;(println "AJAX POST RESPONSE ON " url " ->  " response)

                    (println "AJAX POST REQUEST: END ON " url))
         })

       (let [_ (<! chan-ajax-post-json-white-end)]
-        ))))
+        (when-let [e (by-id :top-download-message)] (dommy/remove! e))))))

 (defn ajax-post-json
   ([url params handler-fn]


Append newline to exception message when stacktrace is omitted

--- src/adzerk/boot_cljs/impl.clj
+++ src/adzerk/boot_cljs/impl.clj
@@ -60,12 +60,13 @@

     (util/serialize-exception
       (ex-info
-        message
+        ;; For now, when Boot shows the message with omit-stacktrace, no newline is automatically appended
+        (if cljs-error? (str message "\n") message)
         (-> data
             (assoc :from :boot-cljs)
             (cond->
               path (assoc :file path)
-              (and cljs-error?) (assoc :boot.util/omit-stacktrace? true)))
+              cljs-error? (assoc :boot.util/omit-stacktrace? true)))
         e))))

 (defn compile-cljs


Fixed click on project after project creation

--- frontend/src/uxbox/main/data/projects.cljs
+++ frontend/src/uxbox/main/data/projects.cljs
@@ -159,14 +159,18 @@
 (defrecord CreateProject [name width height layout]
   ptk/WatchEvent
   (watch [this state s]
-    (letfn [(on-success [{project :payload}]
-              (rx/of
-               (project-persisted project)
-               (udp/create-page {:width width
-                                 :height height
-                                 :layout layout
-                                 :project (:id project)
-                                 :name "Page 1" })))]
+    (letfn [(on-finish [{project :payload}]
+              (rx/of (fetch-projects)))
+            (on-success [{project :payload}]
+              (->> (rp/req :create/page
+                    {:name name
+                     :project (:id project)
+                     :data {}
+                     :metadata {:width width
+                                :height height
+                                :layout layout
+                                :order 0}})
+                   (rx/mapcat on-finish)))]
       (->> (rp/req :create/project {:name name})
            (rx/mapcat on-success)))))


clear editor on save

clear editor on save

--- MeinsApp/src/cljs/meins/ui/editor.cljs
+++ MeinsApp/src/cljs/meins/ui/editor.cljs
@@ -11,9 +11,9 @@

 (def local (r/atom {:md ""}))

-(defn header [save-fn cancel-fn label]
+(defn header [_save-fn _cancel-fn _label]
   (let [theme (subscribe [:active-theme])]
-    (fn [save-fn cancel-fn]
+    (fn [save-fn cancel-fn label]
       (let [button-bg (get-in c/colors [:button-bg @theme])
             btn-text (get-in c/colors [:btn-text @theme])
             header-color (get-in c/colors [:header-text @theme])]
@@ -52,7 +52,7 @@
 (defn editor [_]
   (let [theme (subscribe [:active-theme])]
     (fn [{:keys [screenProps navigation] :as props}]
-      (let [{:keys [navigate goBack]} (js->clj navigation :keywordize-keys true)
+      (let [{:keys [navigate]} (js->clj navigation :keywordize-keys true)
             cancel-fn (fn []
                         (.dismiss keyboard)
                         (navigate "Journal"))
@@ -63,9 +63,7 @@
                        (navigate "Journal"))
             bg (get-in c/colors [:list-bg @theme])
             text-bg (get-in c/colors [:text-bg @theme])
-            text-color (get-in c/colors [:text @theme])
-            header-color (get-in c/colors [:header-text @theme])]
-        ;(swap! local2 assoc :navigate navigate)
+            text-color (get-in c/colors [:text @theme])]
         [view {:style {:display        "flex"
                        :flex-direction "column"
                        :padding-top    50}}
@@ -89,49 +87,8 @@
                                             :color            text-color
                                             :width            "100%"}
                        :multiline          true
-                       ;:default-value      (:md @local)
+                       :default-value      (:md @local)
                        :keyboard-type      "twitter"
                        :keyboardAppearance (if (= @theme :dark) "dark" "light")
                        :on-change-text     (fn [text]
                                              (swap! local assoc-in [:md] text))}]]]))))
-
-#_(defn editor-tab [local put-fn theme]
-    (let [local2 (r/atom {})
-          #_#_save-fn #(let [new-entry (p/parse-entry (:md @local))]
-                         (h/new-entry-fn put-fn new-entry)
-                         (swap! local assoc-in [:md] "")
-                         (when-let [navigate (:navigate @local2)]
-                           (.dismiss keyboard)
-                           (navigate "journal")))
-          cancel-fn #(when-let [navigate (:navigate @local2)]
-                       (.dismiss keyboard)
-                       (navigate "journal"))
-          header-bg (get-in c/colors [:header-tab @theme])
-          text-color (get-in c/colors [:text @theme])
-          header-right (fn [_]
-                         [touchable-opacity {;:on-press save-fn
-                                             :style {:padding-top    8
-                                                     :padding-left   12
-                                                     :padding-right  12
-                                                     :padding-bottom 8}}
-                          [text {:style {:color      "#0078e7"
-                                         :text-align "center"
-                                         :font-size  18}}
-                           "save"]])
-          header-left (fn [_]
-                        [touchable-opacity {:on-press cancel-fn
-                                            :style    {:padding-top    8
-                                                       :padding-left   12
-                                                       :padding-right  12
-                                                       :padding-bottom 8}}
-                         [text {:style {:color      "#0078e7"
-                                        :text-align "center"
-                                        :font-size  18}}
-                          "cancel"]])
-          opts {:title            "Add Entry"
-                :headerRight      header-right
-                :headerLeft       header-left
-                :headerTitleStyle {:color text-color}
-                :headerStyle      {:backgroundColor header-bg}}]
-      (stack-navigator
-        {:editor {:screen (stack-screen (editor local local2 put-fn) opts)}})))


Make route helpers private.

Make route helpers private.

--- src/lunchlotto/routes.clj
+++ src/lunchlotto/routes.clj
@@ -8,7 +8,7 @@
             [cemerick.friend :as friend]
             (cemerick.friend [workflows :as workflows])))

-(def anonymous
+(def ^:private anonymous
   (routes
     (GET "/" [] common/home)
     (GET "/register" [] auth/show-registration-page)
@@ -18,7 +18,7 @@
     (POST "/confirm" {params :params} (auth/confirm-user params))
     (GET "/login" [] auth/show-login-page)))

-(def secure-user
+(def ^:private secure-user
   (friend/wrap-authorize
     (routes
       (GET "/lunches/upcoming" [] lunches/show-upcoming)


maybe made a mapcat-last function

maybe made a mapcat-last function

--- src/mediakeys/hotkeys.clj
+++ src/mediakeys/hotkeys.clj
@@ -41,7 +41,7 @@
                   (reset! provider new-provider)
                   result)))))

-(def new-provider
+(def new-provider!
     (let [provider (atom nil)]
         (fn [_]
             (when @provider
@@ -54,10 +54,33 @@

 (defn register-keys [^Provider provider keys]
     (let [return (chan)]
-        (doseq [[action hotkey] item
+        (doseq [[action hotkey] keys
                  keystroke [(make-keystroke hotkey)]]
                 (.register provider keystroke
                     (proxy [HotKeyListener] []
                         (onHotKey [event]
                             (put! return action)))))
+        return))
+
+; (defn mapcat< [f channel]
+;     (let [return (chan)]
+;         (go-loop []
+;             (let [value channel]
+;                 (if value)))))
+
+;  mapcat-last<
+;   somehow use an atom bound when return is made and reset it as part of the
+;   "macro" loop somehow
+;
+;
+(defn mapcat-last< [f channel]
+    (let [return (chan)
+          last-value (atom nil)]
+        (go-loop []
+            (reset! last-value (<! channel))
+            (go-loop []
+                ; this seems like it might leakk memory somehow
+                (>! return (<! @last-value))
+                (recur))
+            (recur))
         return))


Prepend logger names with underscores

Prepend logger names with underscores

--- src/devtools/debug.cljs
+++ src/devtools/debug.cljs
@@ -7,7 +7,8 @@
 ; hence we build a secondary console for our purposes

 (def indentation-spacer "  ")
-(def logger-name-padding 7)
+(def logger-name-stuffer "_")
+(def logger-name-padding 8)

 (def ^:dynamic *indent* 0)
 (def ^:dynamic *console* nil)
@@ -15,7 +16,7 @@
 (defn logger [name]
   (let [len (count name)
         lpad (- logger-name-padding len)
-        stuffing #(apply str (repeat % "."))
+        stuffing #(apply str (repeat % logger-name-stuffer))
         padded-name (str (stuffing lpad) name)]
     (logger/getLogger padded-name)))


Tune perf a little

Tune perf a little

--- src/atom_finder/find_atom.clj
+++ src/atom_finder/find_atom.clj
@@ -27,11 +27,12 @@
   (let [root-loc (.getFileLocation root)]
     (if (nil? root-loc)
       false
-      (let [root-offset (.getNodeOffset root-loc)
-            root-length (.getNodeLength root-loc)]
-
-        (and (<=    root-offset              offset)
-             (>= (+ root-offset root-length) offset))))))
+      (let [root-offset (.getNodeOffset root-loc)]
+        ; (According to VisualVM) The dispatch on these methods
+        ; is a CPU killer. Try to short-circuit if possible.
+        (if (> root-offset offset)
+          false
+          (>= (+ root-offset (.getNodeLength root-loc)) offset))))))

 (defn offset-parent
   "Find the AST node that contains the whole location offset


switch x,y to coords map

switch x,y to coords map

--- src/dodgeball/core.cljs
+++ src/dodgeball/core.cljs
@@ -40,14 +40,10 @@
       (vec (for [n (range 0 bench-size)]
        (dom/td nil))))))

-(defn coords [m]
-  (dissoc m :move))
-
-(defn unit? [kind x y]
-  (first (filter #(and
-           (= x (:x %))
-           (= y (:y %)))
-         (kind (:cells (om/root-cursor app-state))))))
+(defn unit? [kind coords]
+  (first (filter
+          #(= coords %)
+          (kind (:cells (om/root-cursor app-state))))))

 (defn highlight-tile [e]
  (set! (.. e -target -style -background) "gray"))
@@ -55,28 +51,28 @@
 (defn tile-view [cursor owner]
   (reify
     om/IRenderState
-    (render-state [this {:keys [x y move] :as position}]
+    (render-state [this {:keys [coords move] :as position}]
       (dom/td #js {:onClick #(put! move position)}
-        (if-let [ball (unit? :balls x y)]
+        (if-let [ball (unit? :balls coords)]
           (dom/div #js {:className "ball"}))
-        (if-let [red-player (unit? :red-team x y)]
+        (if-let [red-player (unit? :red-team coords)]
           (dom/div #js {:onClick #(highlight-tile %) :className "red-team"}))
-        (if-let [blue-player (unit? :blue-team x y)]
+        (if-let [blue-player (unit? :blue-team coords)]
           (dom/div #js {:className "blue-team"}))))))

 (defn board-view [app owner]
   (reify
     om/IInitState
-      (init-state [_]
-        {:move (chan)})
+    (init-state [_]
+      {:move (chan)})

     om/IWillMount
     (will-mount [_]
      (let [move (om/get-state owner :move)]
        (go (loop []
-          (let [selected (coords (<! move))
-                target (coords (<! move))]
-            (if (unit? :red-team apply target)
+          (let [selected (:coords (<! move))
+                target (:coords (<! move))]
+            (if (unit? :red-team target)
               (println "CAN'T MOVE THERE")
               (om/transact! app [:cells :red-team]
                 (fn [units]
@@ -94,7 +90,7 @@
             (apply dom/tr #js {:className (border-top y)}
               (vec (for [x board-size]
                 (om/build tile-view app
-                  {:state {:move move :x x :y y}})))))))
+                  {:state {:move move :coords {:x x :y y}}})))))))
         (bench)))))

 (om/root board-view app-state


clean up movement transaction

clean up movement transaction

--- src/dodgeball/core.cljs
+++ src/dodgeball/core.cljs
@@ -127,21 +127,17 @@
     (will-mount [_]
       (let [move (om/get-state owner :move)]
         (go (loop []
-          (let [selected-position (coords (<! move))]
-            (let [target-position (coords (<! move))]
-              (if (find-piece target-position)
+          (let [selected (coords (<! move))]
+            (let [target (coords (<! move))]
+              (if (find-piece target)
                 (println "CAN'T MOVE THERE")
                 (om/transact! app [:cells :red-team]
-                              (fn [xs]
-                                (println xs)
-                               (vec
-                                 (map
-                                    (fn [e]
-                                      (if (= selected-position e)
-                                        (assoc e :x target-position :y target-position)
-                                        e))
-                                  xs))))
-                (recur))))))))
+                  (fn [units]
+                    (vec
+                      (map
+                        #(if (= selected %) target %)
+                        units)))))
+              (recur)))))))

     om/IRenderState
     (render-state [this {:keys [move]}]


Use (keep ...) instead of (remove nil? (map ...))

--- src/catalog/layout/common.clj
+++ src/catalog/layout/common.clj
@@ -119,7 +119,6 @@
    (->>
     [[:kurzschrift false] [:vollschrift false] [:kurzschrift true] [:vollschrift true]
      [nil true] [nil false]]
-    (map (fn [k] (braille-signature (first (get items k)) t)))
-    (remove nil?)
+    (keep (fn [k] (braille-signature (first (get items k)) t)))
     (string/join " "))))


Only show next link when there are more entries.

If the next offset is smaller than the number of entries, we need a
next page. Otherwise this is the last page and we don't display a next
link.

--- src/statuses/routing.clj
+++ src/statuses/routing.clj
@@ -35,7 +35,9 @@
   (clojure.string/join "&" (map (fn [[key val]] (str (name key) "=" val)) m)))

 (defn next-uri [params request]
-  (str (base-uri request) (:uri request) "?" (build-query-string params)))
+  (if (< (:offset params) (core/get-count @db))
+  (str (base-uri request) (:uri request) "?" (build-query-string params))
+  nil))

 (defmacro with-etag
   "Ensures body is only evaluated if etag doesn't match. Try to do this in Java, suckers."


Log to info when resuming from checkpoint

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -63,10 +63,11 @@
 (defn checkpoint-name [group-id topic assigned-partition]
   (format "%s-%s-%s" group-id topic assigned-partition))

-(defn checkpoint-or-beginning [log consumer topic kpartition group-id task-map]
+(defn checkpoint-or-beginning [log-prefix log consumer topic kpartition group-id task-map]
   (let [k (checkpoint-name group-id topic kpartition)]
     (try
       (let [offset (inc (:offset (read-commit log k)))]
+        (info log-prefix "Seeking to checkpointed offset at:" offset)
         (seek-to-offset! consumer {:topic topic :partition kpartition} offset))
       (catch org.apache.zookeeper.KeeperException$NoNodeException nne
         (try
@@ -84,20 +85,24 @@
                (seek-to-offset! consumer {:topic topic :partition kpartition} offset))
              (cp/seek-to-beginning-offset! consumer [{:topic topic :partition kpartition}]))))))))

-(defn seek-offset! [log consumer group-id topic kpartition task-map]
+(defn seek-offset! [log-prefix log consumer group-id topic kpartition task-map]
   (if (and (:kafka/force-reset? task-map)
            (not (:kafka/start-offset task-map)))
     (let [policy (:kafka/offset-reset task-map)]
       (cond (= policy :smallest)
-            (cp/seek-to-beginning-offset! consumer [{:topic topic :partition kpartition}])
+            (do
+             (info log-prefix "Seeking to beginning offset on topic" {:topic topic :partition kpartition})
+             (cp/seek-to-beginning-offset! consumer [{:topic topic :partition kpartition}]))

             (= policy :largest)
-            (cp/seek-to-end-offset! consumer [{:topic topic :partition kpartition}])
+            (do
+             (info log-prefix "Seeking to end offset on topic" {:topic topic :partition kpartition})
+             (cp/seek-to-end-offset! consumer [{:topic topic :partition kpartition}]))

             :else
             (throw (ex-info "Tried to seek to unknown policy" {:recoverable? false
                                                                :policy policy}))))
-    (checkpoint-or-beginning log consumer topic kpartition group-id task-map)))
+    (checkpoint-or-beginning log-prefix log consumer topic kpartition group-id task-map)))

 (defn log-id [replica-val job-id peer-id task-id]
   (get-in replica-val [:task-slot-ids job-id task-id peer-id]))
@@ -168,7 +173,7 @@
         (throw e)))))

 (defn start-kafka-consumer
-  [{:keys [onyx.core/task-map onyx.core/pipeline onyx.core/log onyx.core/replica] :as event} lifecycle]
+  [{:keys [onyx.core/task-map onyx.core/pipeline onyx.core/log onyx.core/replica onyx.core/compiled] :as event} lifecycle]
   (let [{:keys [kafka/topic kafka/partition kafka/group-id kafka/consumer-opts]} task-map
         brokers (find-brokers (:kafka/zookeeper task-map))
         commit-interval (or (:kafka/commit-interval task-map) (:kafka/commit-interval defaults))
@@ -199,7 +204,7 @@
                                (not (:kafka/partition task-map)))
         _ (check-num-peers-equals-partitions task-map n-partitions)
         _ (assign-partitions! consumer [{:topic topic :partition kpartition}])
-        _ (seek-offset! log consumer group-id topic kpartition task-map)
+        _ (seek-offset! (:log-prefix compiled) log consumer group-id topic kpartition task-map)
         offset (cp/next-offset consumer {:topic topic :partition kpartition})
         commit-interval (or (:kafka/commit-interval task-map) (:kafka/commit-interval defaults))
         commit-fut (future (commit-loop log group-id topic kpartition commit-interval pending-commits))]


No longer recur when thread/interrupted This improves the chances of the future-cancel working

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -103,7 +103,8 @@
               data {:offset offset}]
           (extensions/force-write-chunk log :chunk data k)
           (swap! pending-commits (fn [coll] (remove (fn [k] (<= k offset)) coll)))))
-      (recur))
+      (when-not (Thread/interrupted)
+        (recur)))
     (catch InterruptedException e
       (throw e))
     (catch Throwable e


update run events to work with Replicating Perfection restriction

--- src/clj/game/cards-events.clj
+++ src/clj/game/cards-events.clj
@@ -43,7 +43,7 @@
                        (gain state :runner :memory (:memoryunits c))))))}

    "Blackmail"
-   {:req (req (> (:bad-publicity corp) 0)) :prompt "Choose a server" :choices (req servers)
+   {:req (req (> (:bad-publicity corp) 0)) :prompt "Choose a server" :choices (req runnable-servers)
     :msg "prevent ICE from being rezzed during this run"
     :effect (effect (register-run-flag!
                       card
@@ -57,7 +57,7 @@
    "Bribery"
    {:prompt "How many [Credits]?" :choices :credit
     :msg (msg "increase the rez cost of the 1st unrezzed ICE approached by " target " [Credits]")
-    :effect (effect (resolve-ability {:prompt "Choose a server" :choices (req servers)
+    :effect (effect (resolve-ability {:prompt "Choose a server" :choices (req runnable-servers)
                                       :effect (effect (run target nil card))} card nil))}

    "Calling in Favors"
@@ -82,7 +82,7 @@
                                            (runner-install target) (tag-runner 1) (shuffle! :deck))}} card))}

    "Cyber Threat"
-   {:prompt "Choose a server" :choices (req servers)
+   {:prompt "Choose a server" :choices (req runnable-servers)
     :effect (req (let [serv target
                        runtgt [(last (server->zone state serv))]
                        ices (get-in @state (concat [:corp :servers] runtgt [:ices]))]
@@ -137,7 +137,7 @@
    {:msg "draw 3 cards" :effect (effect (draw 3))}

    "Dirty Laundry"
-   {:prompt "Choose a server" :choices (req servers)
+   {:prompt "Choose a server" :choices (req runnable-servers)
     :effect (effect (run target {:end-run {:req (req (:successful run)) :msg " gain 5 [Credits]"
                                            :effect (effect (gain :runner :credit 5))}} card))}

@@ -152,7 +152,7 @@

    "Early Bird"
    {:prompt "Choose a server"
-    :choices (req servers)
+    :choices (req runnable-servers)
     :msg (msg "make a run on " target " and gain [Click]")
     :effect (effect (gain :click 1) (run target nil card))}

@@ -200,7 +200,7 @@
    {:msg (msg "reveal cards in HQ: " (join ", " (map :title (:hand corp))))}

    "Exploratory Romp"
-   {:prompt "Choose a server" :choices (req servers)
+   {:prompt "Choose a server" :choices (req runnable-servers)
     :effect (effect (run target
                        {:replace-access
                         {:prompt "Advancements to remove from a card in or protecting this server?"
@@ -253,7 +253,7 @@
                      card nil)))}

    "Forked"
-   {:prompt "Choose a server" :choices (req servers) :effect (effect (run target nil card))}
+   {:prompt "Choose a server" :choices (req runnable-servers) :effect (effect (run target nil card))}

    "Frame Job"
    {:prompt "Choose an agenda to forfeit"
@@ -282,7 +282,7 @@
    "High-Stakes Job"
    {:prompt "Choose a server"
     :choices (req (let [unrezzed-ice #(seq (filter (complement rezzed?) (:ices (second %))))
-                        ok-servs (filter unrezzed-ice (get-in @state [:corp :servers]))]
+                        ok-servs (filter unrezzed-ice runnable-servers)]
                     (map (comp zone->name first) ok-servs)))
     :effect (effect (run target {:end-run {:req (req (:successful run)) :msg " gain 12 [Credits]"
                                            :effect (effect (gain :runner :credit 12))}} card))}
@@ -361,7 +361,7 @@
                          (system-msg state side (str "adds " (:title c) " to Grip"))))))}

    "Inside Job"
-   {:prompt "Choose a server" :choices (req servers) :effect (effect (run target nil card))}
+   {:prompt "Choose a server" :choices (req runnable-servers) :effect (effect (run target nil card))}

    "Itinerant Protesters"
    {:msg "reduce the Corp's maximum hand size by 1 for each bad publicity"
@@ -378,7 +378,7 @@
                      (gain state :corp :hand-size-modification (:bad-publicity corp)))}

    "Knifed"
-   {:prompt "Choose a server" :choices (req servers) :effect (effect (run target nil card))}
+   {:prompt "Choose a server" :choices (req runnable-servers) :effect (effect (run target nil card))}

    "Kraken"
    {:req (req (:stole-agenda runner-reg)) :prompt "Choose a server" :choices (req servers)
@@ -502,7 +502,7 @@
     :events {:pre-steal-cost nil :runner-turn-ends nil}}

    "Prey"
-   {:prompt "Choose a server" :choices (req servers) :effect (effect (run target nil card))}
+   {:prompt "Choose a server" :choices (req runnable-servers) :effect (effect (run target nil card))}

    "Push Your Luck"
    {:player :corp :prompt "Guess the amount the Runner will spend on Push Your Luck"
@@ -540,7 +540,7 @@
     :effect (effect (handle-access targets))}

    "Recon"
-   {:prompt "Choose a server" :choices (req servers) :effect (effect (run target nil card))}
+   {:prompt "Choose a server" :choices (req runnable-servers) :effect (effect (run target nil card))}

    "Retrieval Run"
    {:effect (effect (run :archives
@@ -552,11 +552,11 @@
                         :effect (effect (runner-install target {:no-cost true}))}} card))}

    "Run Amok"
-   {:prompt "Choose a server" :choices (req servers)
+   {:prompt "Choose a server" :choices (req runnable-servers)
     :effect (effect (run target {:end-run {:msg " trash 1 piece of ICE that was rezzed during the run"}} card))}

    "Running Interference"
-   {:prompt "Choose a server" :choices (req servers)
+   {:prompt "Choose a server" :choices (req runnable-servers)
     :effect (effect (run target nil card)
                     (register-events {:pre-rez
                                       {:req (req (ice? target))
@@ -609,7 +609,7 @@
                                             (rseq (into [] (get-in @state [:corp :deck])))))}} card))}

    "Singularity"
-   {:prompt "Choose a server" :choices (req remotes)
+   {:prompt "Choose a server" :choices (req (filter #(can-run-server? state %) remotes))
     :effect (effect (run target
                       {:req (req (is-remote? target))
                        :replace-access
@@ -645,10 +645,10 @@
     :choices (req (cancellable (filter #(has-subtype? % "Icebreaker") (:deck runner)) :sorted))}

    "Spooned"
-   {:prompt "Choose a server" :choices (req servers) :effect (effect (run target nil card))}
+   {:prompt "Choose a server" :choices (req runnable-servers) :effect (effect (run target nil card))}

    "Stimhack"
-   {:prompt "Choose a server" :choices (req servers)
+   {:prompt "Choose a server" :choices (req runnable-servers)
     :effect (effect (gain-run-credits 9)
                     (run target {:end-run
                                  {:msg " take 1 brain damage"


correct log error rendering item detail form fields

--- src/clj_money/web/budgets.clj
+++ src/clj_money/web/budgets.clj
@@ -375,14 +375,15 @@
     [:div.row
      [:div.col-md-8
       (map #(period-input-group budget %)
-           (or (->> item
-                    :periods
-                    (partition 3))
-               (->> budget
-                    :period-count
-                    range
-                    (map #(hash-map :index % :amount 0M))
-                    (partition 3))))]]
+           (if (:periods item)
+             (->> item
+                  :periods
+                  (partition 3))
+             (->> budget
+                  :period-count
+                  range
+                  (map #(hash-map :index % :amount 0M))
+                  (partition 3))))]]
     [:input {:type :hidden :name :method :value :detail}]
     [:button.btn.btn-primary {:type :submit
                               :title "Click here to save this budget item."} "Save"]


Switches to using strings instead of keywords for PGN headers.

--- src/clojure/clj_chess/pgn.clj
+++ src/clojure/clj_chess/pgn.clj
@@ -70,7 +70,7 @@
    :symbol str
    :comment-content (comp #(str/replace % \newline \space) str)
    :header (fn [name value]
-             [(keyword (str/lower-case (second name))) (second value)])
+             [(second name) (second value)])
    :nag (fn [& rest]
           [:nag (case (first rest)
                   "!" 1


show prefix in window title

show prefix in window title

--- src/clojure/defgraph/core.clj
+++ src/clojure/defgraph/core.clj
@@ -22,7 +22,8 @@
 (defn -main [& args]
   (if (> (count args) 1)
     (println "Supply at most a single filtering prefix.")
-    (let [g (graph (re-pattern (str (first args) ".*")))
+    (let [prefix (first args)
+          g (graph (re-pattern (str prefix ".*")))
           mx (mxGraph.)
           model (.getModel mx)
           root (.getDefaultParent mx)
@@ -64,7 +65,7 @@
               actual-width (.getWidth bounds)
               scale-factor (* 0.9 (min (/ width actual-width) (/ height actual-height)))]
           (.setScale view scale-factor))
-        (doto (JFrame. "defgraph")
+        (doto (JFrame. (str "defgraph" (if prefix (str " - " prefix) "")))
           (.add gc)
           (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
           (.setSize width height)


Docstring fix.

Docstring fix.

--- src/clojure/inet/data/dns.clj
+++ src/clojure/inet/data/dns.clj
@@ -10,7 +10,7 @@
 This form has the following benefits: (a) it may accurately represent any
 binary data, just like the DNS wire form; (b) lexicographic byte order is also
 hierarchical order; and (c) for a given child domain and ancestor domain, one
-may easily find the next longer ancestor of the child.  The primary down-side
+may easily find the next longer child of the ancestor.  The primary down-side
 is that this form does make it more difficult to find the immediate parent of a
 given domain."
   (:require [clojure.string :as str])


One config-step per source node, coerced to a dseq.

--- src/clojure/parkour/graph.clj
+++ src/clojure/parkour/graph.clj
@@ -55,16 +55,6 @@
   "Update Hadoop `job` with configuration `step`, returning the mutated job."
   pgconf/configure!)

-(defn ^:private mux-step
-  [step] #(mux/add-subconf % (configure! (mr/job %) step)))
-
-(defn ^:private source-config
-  "Configure a job for a provided source vector."
-  [^Job job source]
-  (if (= 1 (count source))
-    (configure! job source)
-    (configure! job (mapv mux-step source))))
-
 (declare node-config)

 (defn ^:private subnode-config
@@ -82,7 +72,7 @@
   "Configure a job according to the state of a job graph node."
   [^Job job node]
   (doto job
-    (source-config (:source node))
+    (configure! (:source node))
     (subnodes-config node (:subnodes node))
     (pgt/mapper! node)
     (pgt/combiner! node)
@@ -102,9 +92,13 @@

 (defn source
   "Return a fresh `:source`-stage job graph node consuming from the
-provided `dseqs`."
-  [& dseqs]
-  {:stage :source, :source-id (gen-id), :source (vec dseqs), :config []})
+provided `dseq`."
+  [dseq]
+  {:stage :source,
+   :source-id (gen-id),
+   :source (dseq/dseq dseq),
+   :config [],
+   })

 (defn config
   "Add arbitrary configuration steps to current job graph `node`."
@@ -215,7 +209,7 @@

 (defmethod job-fn :source
   [node conf jname]
-  (fn [& args] (-> node :source first)))
+  (constantly (:source node)))

 (defmethod job-fn :default
   [node conf jname]


Added background color and draw a line in 'show-vector-field'

--- src/clojure2d/extra/utils.clj
+++ src/clojure2d/extra/utils.clj
@@ -70,11 +70,13 @@
   (let [c (canvas 800 800)]
     (with-canvas [c c]
       (set-color c :white 8)
+      (set-background c :black)
       (dotimes [_ 2500000]
         (let [x (r/drand (- m/PI) m/PI)
               y (r/drand (- m/PI) m/PI)
-              v (f (v/vec2 x y))]
-          (point c (norm-out (v 0)) (norm-out (v 1))))))
+              v1 (v/vec2 x y)
+              v2 (v/add v1 (f v1))]
+          (line c  (norm-out x) (norm-out y) (norm-out (v2 0)) (norm-out (v2 1))))))
     (show-window {:canvas c})))

 (defn show-image


hold repositories in a ref

hold repositories in a ref

--- src/otto/repositories.clj
+++ src/otto/repositories.clj
@@ -6,8 +6,9 @@
 (deftype RepositoryList
   [a]
   ARepositoryList
-  (items [this] a))
+  (items [this] @a))

 (defn make-repositories
   []
-  (->RepositoryList {}))
+  (let [repos (ref {})]
+    (->RepositoryList repos)))


need to use overtone.core.util

need to use overtone.core.util

--- src/overtone/app/main.clj
+++ src/overtone/app/main.clj
@@ -17,7 +17,7 @@
     (com.javadocking.model.codec DockModelPropertiesEncoder)
     (com.javadocking DockingManager))
   (:use (overtone.app editor tools browser)
-        (overtone.core setup sc ugen synth envelope event time-utils config)
+        (overtone.core setup util sc ugen synth envelope event time-utils config)
         (overtone.gui swing sg scope curve repl)
         clojure.stacktrace
         (clojure.contrib
@@ -89,8 +89,8 @@

 (defn app-quit []
   (save-workspace)
-  (try
-    (quit)
+  (try
+    (quit)
     (finally (System/exit 0))))

 (defn header []
@@ -213,7 +213,7 @@
       (.setLeftComponent main-split)
       (.setRightComponent tools-split))

-    (dosync (alter app* assoc
+    (dosync (alter app* assoc
                    :workspace-model dock-model
                    :right-div right-split))


cleaning some stuff up

cleaning some stuff up

--- src/frontier/cards.cljs
+++ src/frontier/cards.cljs
@@ -68,15 +68,16 @@
 (defmethod hist-trans :history.cancel [_ sys {:keys [history]}]
   (assoc sys :pointer (count history)))

+;; derivatives
+
 (defn under-control [system history]
   (assoc system :under-control
          (under-control? system history)))

 (defn render-state [system history comp*]
-  (if (under-control?  system history)
-    (assoc system :render-stater
-           (current-state* history (:pointer system) comp*))
-    (assoc system :render-stater
+  (assoc system :render-stater
+         (if (under-control?  system history)
+           (current-state* history (:pointer system) comp*)
            (current-state* history comp*))))

 (defn can-go-forward [state history]
@@ -138,10 +139,7 @@
        (html-edn derived-state)])))

 (defn managed-system [initial-state sys-comp render-callback initial-inputs]
-  (let [sys (devrunner-new
-             initial-state
-             sys-comp
-             (fn [{:keys [state event-chan]}]))
+  (let [sys (devrunner-new initial-state sys-comp)
         history-manager (HistoryManager. sys)
         history (run {}
                      history-manager
@@ -151,8 +149,7 @@
                                                    :event-chan event-chan }))))]
     (when initial-inputs
       (doseq [msg initial-inputs]
-        (swap! (:state-atom sys) conj msg))
-      (print @(:state-atom sys)))
+        (swap! (:state-atom sys) conj msg)))
     sys))

 (defn render-history-controls [{:keys [under-control can-go-back can-go-forward msg messages] :as sys} hist-chan]


All import data are presented

All import data are presented

--- src/tango/cljs/main.cljs
+++ src/tango/cljs/main.cljs
@@ -59,16 +59,48 @@

 (def app-state
   (atom
-   {:dancers [{:dancer/name "Bobo"} {:dancer/name "Rolf"}]}))
+   {:competition/date #inst "2014-11-22T00:00:00.000-00:00",
+    :competition/name "TurboMegatävling",
+    :dance-perfect/version "4.1",
+    :competition/location "THUNDERDOME",
+    :competition/classes
+    [{:class/name "Hiphop Singel Star B", :class/competitors
+      [{:competitor/name "Rulle Trulle", :competitor/number 1, :competitor/club "Rulles M&M"}
+       {:competitor/name "Katchyk Wrong", :competitor/number 2, :competitor/club "Sccchhh"}]}
+     {:class/name "Hiphop Singel Star J Fl", :class/competitors
+      [{:competitor/name "Ringo Stingo" :competitor/number 20, :competitor/club "Kapangg"}
+       {:competitor/name "Greve Turbo", :competitor/number 21, :competitor/club "OOoost"}]}]}))

-;; (defn dancers-component []
-;;   [:div
-;;    [:h2 "Dancers :"]
-;;    [:ul
-;;     (for [template (:dancers @app-state)]
-;;       ^{:key template} [:li "" (:dancer/name template)])]
-;;    [:input.btn.btn-default {:type "button" :value "Get Dancers"
-;;                             :on-click on-click-get-dancers}]])
+(defn competitor-component [competitors]
+  [:div ""
+   [:ul
+    (for [competitor competitors]
+      ^{:key competitor}
+      [:li
+       (str "Competitor number: "
+            (:competitor/number competitor)
+            " - "
+            (:competitor/name competitor)
+            " / "
+            (:competitor/club competitor))])]])
+
+(defn class-component [classes]
+  [:h3 "Classes"]
+  [:div
+   (for [cls classes]
+     ^{:key cls} [:div
+                  (:class/name cls)
+                  [competitor-component (:class/competitors cls)]
+                  ])])
+
+(defn competition-component []
+  [:div
+   [:h2 "Competition"]
+   [:h3 (str "Name :" (:competition/name @app-state)) ]
+   [:h3 (str "Date :" (:competition/date @app-state)) ]
+   [:h3 (str "Location :" (:competition/location @app-state))]
+   [:h3 (str "Classes :")]
+   [class-component (:competition/classes @app-state)]])

 (defn import-component []
   [:div
@@ -76,15 +108,16 @@
                             :onChange #(on-click-import-file %)}]
    ;; [:input.btn.btn-default {:type "button" :value "Ping"
    ;;                          :on-click #(chsk-send! [:client/ping {:content 1}])}]
-   [:div
-    [:h2 "Competition"]
-    [:h3 (str "Name :" (:competition/name @app-state)) ]]
+   ;; [:div
+   ;;  [:h2 "Competition"]
+   ;;  [:h3 (str "Name :" (:competition/name @app-state)) ]]
+   [competition-component]
    ])

 (defn ^:export run []
   (reagent/render-component [import-component] (.-body js/document)))

-
+;; {:competition/date #inst "2014-11-22T00:00:00.000-00:00", :competition/name "TurboMegatävling", :dance-perfect/version "4.1", :competition/location "THUNDERDOME", :competition/classes [{:class/name "Hiphop Singel Star B", :class/competitors [{:competitor/name "Rulle Trulle", :competitor/number 1, :competitor/club "Rulles M&M"} {:competitor/name "Katchyk Wrong", :competitor/number 2, :competitor/club "Sccchhh"}]} {:class/name "Hiphop Singel Star J Fl", :class/competitors [{:competitor/name "Ringo Stingo", :competitor/number 20, :competitor/club "Kapangg"} {:competitor/name "Greve Turbo", :competitor/number 21, :competitor/club "OOoost"}]}]}}

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Socket handling


Misc hk

Misc hk

--- src/taoensso/carmine.clj
+++ src/taoensso/carmine.clj
@@ -1,7 +1,7 @@
 (ns taoensso.carmine "Clojure Redis client & message queue."
   {:author "Peter Taoussanis"}
   (:refer-clojure :exclude [time get set key keys type sync sort eval])
-  (:require [clojure.string :as str]
+  (:require [clojure.string       :as str]
             [taoensso.encore      :as encore]
             [taoensso.timbre      :as timbre]
             [taoensso.nippy.tools :as nippy-tools]
@@ -623,10 +623,11 @@
     (->> (hgetall key)
          (parse (parser-comp outer-parser inner-parser)))))

-(comment (wcar {} (hmset* "hkey" {:a "aval" :b "bval" :c "cval"}))
-         (wcar {} (hmset* "hkey" {})) ; ex
-         (wcar {} (hmget* "hkey" :a :b))
-         (wcar {} (parse str/upper-case (hmget* "hkey" :a :b)))
-         (wcar {} (hmget* "hkey" "a" "b"))
-         (wcar {} (hgetall* "hkey"))
-         (wcar {} (parse str/upper-case (hgetall* "hkey"))))
+(comment
+  (wcar {} (hmset* "hkey" {:a "aval" :b "bval" :c "cval"}))
+  (wcar {} (hmset* "hkey" {})) ; ex
+  (wcar {} (hmget* "hkey" :a :b))
+  (wcar {} (parse str/upper-case (hmget* "hkey" :a :b)))
+  (wcar {} (hmget* "hkey" "a" "b"))
+  (wcar {} (hgetall* "hkey"))
+  (wcar {} (parse str/upper-case (hgetall* "hkey"))))


Housekeeping: high-level code organization

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -61,7 +61,7 @@
 ;; * Docs.
 ;; * Bench.

-;;;; DynamoDB API objects
+;;;; API - core objects

 (defn- db-client*
   "Returns a new AmazonDynamoDBClient instance for the supplied IAM credentials."
@@ -95,14 +95,17 @@
     (.setReadCapacityUnits  (long read-units))
     (.setWriteCapacityUnits (long write-units))))

-;;;; Coercions
+;;;; Coercion - values
+
+;; TODO Nippy support (will require special marker bin-wrapping), incl.
+;; Serialized (boxed) type (should allow empty strings & ANY type of set)
+;; Maybe require special wrapper types for writing bins/serialized

 (defn- str->num [^String s] (if (.contains s ".") (Double. s) (Long. s)))
 (defn- bb->ba   [^ByteBuffer bb] (.array bb))

 (defn- db-val->clj-val
   "Returns the Clojure value of given AttributeValue object."
-  ;; TODO Nippy support
   [^AttributeValue x]
   (or (.getS x)
       (some->> (.getN  x) str->num)
@@ -122,9 +125,6 @@

 (defn- clj-val->db-val
   "Returns an AttributeValue object for given Clojure value."
-  ;; TODO Nippy support (will require special marker bin-wrapping), incl.
-  ;; Serialized (boxed) type (should allow empty strings & ANY type of set)
-  ;; Maybe require special wrapper types for writing bins/serialized
   [x]
   (cond
    (string? x)          (if (.isEmpty ^String x)
@@ -139,9 +139,85 @@
    :else    (throw (Exception. (str "Unknown value type: " (type x))))))

 (comment (map clj-val->db-val ["foo" 10 3.14 (.getBytes "foo")
-                                #{"a" "b" "c"} #{1 2 3.14} #{(.getBytes "foo")}]))
-
-;;;; TODO Dev
+                               #{"a" "b" "c"} #{1 2 3.14} #{(.getBytes "foo")}]))
+
+;;;; Coercion - objects
+
+(defn- db-map->clj-map [x] (when x (utils/fmap db-val->clj-val (into {} x))))
+
+(defprotocol AsMap (as-map [x]))
+
+(extend-protocol AsMap
+  KeySchemaElement
+  (as-map [element]
+    {:name (.getAttributeName element)
+     :type (-> (.getAttributeType element)
+               (str/lower-case)
+               (keyword))})
+
+  KeySchema
+  (as-map [schema]
+    (merge
+     (when-let [e (.getHashKeyElement schema)]  {:hash-key  (as-map e)})
+     (when-let [e (.getRangeKeyElement schema)] {:range-key (as-map e)})))
+
+  ProvisionedThroughputDescription
+  (as-map [throughput]
+    {:read  (.getReadCapacityUnits throughput)
+     :write (.getWriteCapacityUnits throughput)
+     :last-decrease (.getLastDecreaseDateTime throughput)
+     :last-increase (.getLastIncreaseDateTime throughput)})
+
+  DescribeTableResult
+  (as-map [result]
+    (let [table (.getTable result)]
+      {:name          (.getTableName table)
+       :creation-date (.getCreationDateTime table)
+       :item-count    (.getItemCount table)
+       :key-schema    (as-map (.getKeySchema table))
+       :throughput    (as-map (.getProvisionedThroughput table))
+       :status        (-> (.getTableStatus table)
+                          (str/lower-case)
+                          (keyword))}))
+
+  BatchWriteResponse
+  (as-map [result]
+    {:consumed-capacity-units (.getConsumedCapacityUnits result)})
+
+  BatchWriteItemResult
+  (as-map [result]
+    {:responses         (utils/fmap as-map (into {} (.getResponses result)))
+     :unprocessed-items (.getUnprocessedItems result)})
+
+  BatchResponse
+  (as-map [result]
+    {:consumed-capacity-units (.getConsumedCapacityUnits result)
+     :items (some->> (.getItems result)
+                     (into [])
+                     (utils/fmap #(utils/fmap db-val->clj-val (into {} %))))})
+
+  KeysAndAttributes
+  (as-map [result]
+    (merge
+     (when-let [a (.getAttributesToGet result)] {:attrs (into [] a)})
+     (when-let [c (.getConsistentRead result)]  {:consistent c})
+     (when-let [k (.getKeys result)]            {:keys (utils/fmap as-map (into [] k))})))
+
+  BatchGetItemResult
+  (as-map [result]
+    {:responses        (utils/fmap as-map (into {} (.getResponses result)))
+     :unprocessed-keys (utils/fmap as-map (into {} (.getUnprocessedKeys result)))})
+
+  GetItemResult (as-map [result] (db-map->clj-map (.getItem result)))
+
+  Key
+  (as-map [k]
+    {:hash-key  (db-val->clj-val (.getHashKeyElement k))
+     :range-key (db-val->clj-val (.getRangeKeyElement k))})
+
+  nil (as-map [_] nil))
+
+;;;; API - tables

 (defn create-table
   "Create a table in DynamoDB with the given map of properties. The properties
@@ -181,61 +257,6 @@
      (.setTableName (str name))
      (.setProvisionedThroughput (provisioned-throughput throughput)))))

-(defprotocol AsMap (as-map [x]))
-
-(extend-protocol AsMap
-  KeySchemaElement
-  (as-map [element]
-    {:name (.getAttributeName element)
-     :type (-> (.getAttributeType element)
-               (str/lower-case)
-               (keyword))})
-  KeySchema
-  (as-map [schema]
-    (merge
-     (when-let [e (.getHashKeyElement schema)]  {:hash-key  (as-map e)})
-     (when-let [e (.getRangeKeyElement schema)] {:range-key (as-map e)})))
-  ProvisionedThroughputDescription
-  (as-map [throughput]
-    {:read  (.getReadCapacityUnits throughput)
-     :write (.getWriteCapacityUnits throughput)
-     :last-decrease (.getLastDecreaseDateTime throughput)
-     :last-increase (.getLastIncreaseDateTime throughput)})
-  DescribeTableResult
-  (as-map [result]
-    (let [table (.getTable result)]
-      {:name          (.getTableName table)
-       :creation-date (.getCreationDateTime table)
-       :item-count    (.getItemCount table)
-       :key-schema    (as-map (.getKeySchema table))
-       :throughput    (as-map (.getProvisionedThroughput table))
-       :status        (-> (.getTableStatus table)
-                          (str/lower-case)
-                          (keyword))}))
-  BatchWriteResponse
-  (as-map [result]
-    {:consumed-capacity-units (.getConsumedCapacityUnits result)})
-  BatchWriteItemResult
-  (as-map [result]
-    {:responses         (utils/fmap as-map (into {} (.getResponses result)))
-     :unprocessed-items (.getUnprocessedItems result)})
-  BatchResponse
-  (as-map [result]
-    {:consumed-capacity-units (.getConsumedCapacityUnits result)
-     :items (some->> (.getItems result)
-                     (into [])
-                     (utils/fmap #(utils/fmap db-val->clj-val (into {} %))))})
-  KeysAndAttributes
-  (as-map [result]
-    (merge
-     (when-let [a (.getAttributesToGet result)] {:attrs (into [] a)})
-     (when-let [c (.getConsistentRead result)]  {:consistent c})
-     (when-let [k (.getKeys result)]            {:keys (utils/fmap as-map (into [] k))})))
-  BatchGetItemResult
-  (as-map [result]
-    {:responses        (utils/fmap as-map (into {} (.getResponses result)))
-     :unprocessed-keys (utils/fmap as-map (into {} (.getUnprocessedKeys result)))}))
-
 (defn describe-table
   "Returns a map describing the table in DynamoDB with the given name, or nil
   if the table doesn't exist."
@@ -268,16 +289,7 @@
       .getTableNames
       seq))

-(defn- item-map
-  "Turn a item in DynamoDB into a Clojure map."
-  [item]
-  (if item
-    (utils/fmap db-val->clj-val (into {} item))))
-
-(extend-protocol AsMap
-  GetItemResult
-  (as-map [result]
-    (item-map (.getItem result))))
+;;;; API - items

 (defn- set-expected-value! ; TODO PR
   "Makes a Put request conditional by setting its expected value"
@@ -338,13 +350,7 @@
    (db-client creds)
    (DeleteItemRequest. table (item-key {:hash-key hash-key}))))

-(extend-protocol AsMap
-  Key
-  (as-map [k]
-    {:hash-key  (db-val->clj-val (.getHashKeyElement k))
-     :range-key (db-val->clj-val (.getRangeKeyElement k))})
-  nil
-  (as-map [_] nil))
+;;;; API - batch ops

 (defn- batch-item-keys [request-or-keys]
   (for [key (:keys request-or-keys request-or-keys)]
@@ -427,8 +433,10 @@
              (partition 3 (flatten reqs))))
           (group-by #(name (second %)) requests)))))))

+;;;; API - queries & scans
+
 (defn- result-map [results]
-  {:items    (map item-map (.getItems results))
+  {:items    (map db-map->clj-map (.getItems results))
    :count    (.getCount results)
    :last-key (as-map (.getLastEvaluatedKey results))})

@@ -520,4 +528,4 @@
     (result-map
      (.query
       (db-client creds)
-      (query-request table hash-key range options)))))
+      (query-request table hash-key range options)))))


(TK-369) Whitespace from previous commit

--- src/puppetlabs/trapperkeeper/services/webserver/normalized_uri_helpers.clj
+++ src/puppetlabs/trapperkeeper/services/webserver/normalized_uri_helpers.clj
@@ -60,24 +60,24 @@
     (handle [^String target ^Request base-request
              ^HttpServletRequest request ^HttpServletResponse response]
       (when-let [handler (proxy-super getHandler)]
-          (if-let [normalized-uri
-                   (try
-                     (normalize-uri-path request)
-                     (catch IllegalArgumentException ex
-                       (do
-                         (servlet/update-servlet-response
-                          response
-                          {:status 400
-                           :body (.getMessage ex)})
-                         (.setHandled base-request true))
-                       nil))]
-            (.handle
-             handler
-             target
-             base-request
-             (HttpServletRequestWithAlternateRequestUri.
-              request
-              normalized-uri)
+        (if-let [normalized-uri
+                 (try
+                   (normalize-uri-path request)
+                   (catch IllegalArgumentException ex
+                     (do
+                       (servlet/update-servlet-response
+                        response
+                        {:status 400
+                         :body (.getMessage ex)})
+                       (.setHandled base-request true))
+                     nil))]
+          (.handle
+           handler
+           target
+           base-request
+           (HttpServletRequestWithAlternateRequestUri.
+            request
+            normalized-uri)
            response))))))

 (schema/defn ^:always-validate normalized-uri-filter :- Filter


CMR-5199: Added note about stackoverflow case.

--- src/cmr/http/kit/response.clj
+++ src/cmr/http/kit/response.clj
@@ -30,6 +30,11 @@
     (catch Exception _
       maybe-ref)))

+;; XXX This is currently broken ... with a stackoverflow error. The issue is
+;;     that soft-reference->json! calls json/generate-string, but that in
+;;     turn calls soft-reference->json!, when attempting to encode a soft-
+;;     reference. One fix for this would be to use a low-level string-
+;;     generating function instead of the API-level one.
 (defn soft-reference->json!
   "Given a soft reference object and a Cheshire JSON generator, write the
   data stored in the soft reference to the generator as a JSON string.


Adding test connection to oracle startup.

--- src/cmr/oracle/connection.clj
+++ src/cmr/oracle/connection.clj
@@ -25,12 +25,21 @@
     :password password}))

+(defn test-db-connection!
+  "Tests the database connection. Throws an exception if unable to execute some sql."
+  [oracle-store]
+  (when-not (= [{:a 1M}]
+               (j/query oracle-store "select 1 a from dual"))
+    (throw (Exception. "Could not select data from database."))))
+
+
 (defrecord OracleStore [db]

   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   lifecycle/Lifecycle

   (start [this system]
+         (test-db-connection! this)
          this)

   (stop [this system]
@@ -56,10 +65,3 @@
   "Creates and returns the database connection pool."
   [db-spec]
   (map->OracleStore (pool db-spec)))
-
-(defn test-db-connection!
-  "Tests the database connection. Throws an exception if unable to execute some sql."
-  [oracle-store]
-  (when-not (= [{:a 1M}]
-               (j/query oracle-store "select 1 a from dual"))
-    (throw (Exception. "Could not select data from database."))))


CMR-680: Refactored.

CMR-680: Refactored.

--- src/cmr/search/api/routes.clj
+++ src/cmr/search/api/routes.clj
@@ -106,16 +106,7 @@
   [path-w-extension]
   (second (re-matches #"([^\.]+)(?:\..+)?" path-w-extension)))

-(defn- mime-type-from-headers
-  "Try to get a supported mime-type from the 'accept' header."
-  [headers supported-mime-types]
-  (let [mime-type-str (when-let [mstr (get headers "accept")]
-                        ;; Strip out any semicolon clauses
-                        (str/replace mstr #";.*?(,|$)" "$1"))
-        ;; Split mime-type string on commas
-        mime-types (when mime-type-str (str/split (str/lower-case mime-type-str), #"[,]"))
-        first-supported-mime-type (some (set mime-types) supported-mime-types)]
-    (or first-supported-mime-type mime-type-str)))
+

 (defn- get-search-results-format
   "Returns the requested search results format parsed from headers or from the URL extension"
@@ -124,7 +115,7 @@
   ([path-w-extension headers valid-mime-types default-mime-type]
    (let [ext-mime-type (path-w-extension->mime-type path-w-extension)
          mime-type (or ext-mime-type
-                       (mime-type-from-headers headers valid-mime-types)
+                       (mt/mime-type-from-headers headers valid-mime-types)
                        default-mime-type)]
      (mt/validate-request-mime-type mime-type valid-mime-types)
      ;; set the default format to xml


Press space to generate a new pixel-ship

--- pixel-ship-quil/src/pixel_ship_quil/core.clj
+++ pixel-ship-quil/src/pixel_ship_quil/core.clj
@@ -25,7 +25,6 @@
         cockpit-pixels ((comp :cockpit :pixels) (:pixel-ship state))]
     (q/with-translation [200
                          (- (q/height) 200)]
-
       (doseq [pixel hull-pixels]
         (draw-rect pixel))
       (doseq [pixel solid-pixels]
@@ -33,6 +32,11 @@
       (doseq [pixel cockpit-pixels]
         (draw-rect pixel))
     )))
+
+(defn key-press [state event]
+  (if (= (q/raw-key ) \space )
+    (assoc state :pixel-ship (create-pixel-ship-quil))
+    state))

 (defn -main
   []
@@ -42,13 +46,14 @@
     :setup setup
     ;:update update-state
     :draw draw-state
+    :key-typed key-press
     :features [:keep-on-top]
     :middleware [m/fun-mode] ))

 ;(-main)

 (defn create-pixel-ship-quil []
-  (psc/color-pixel-ship (psc/create-pixel-ship (assoc bollinger/model :seed Integer/MAX_VALUE))));(rand-int Integer/MAX_VALUE)))))
+  (psc/color-pixel-ship (psc/create-pixel-ship (assoc bollinger/model :seed (rand-int Integer/MAX_VALUE)))))

 (def p-per-c 20)


delaney.clj: worked on modifier functions for type DSymbol

--- clojure/org/gavrog/clojure/delaney.clj
+++ clojure/org/gavrog/clojure/delaney.clj
@@ -9,6 +9,12 @@
   (indices [_])
   (s [_ i D])
   (v [_ i j D]))
+
+(defprotocol IPersistentDSymbol
+  (dsconj [_ new])
+  (dsdisj [_ old])
+  (dsglue [_ i D E])
+  (dsunglue [_ i D]))

 (extend-type DelaneySymbol
   IDSymbol
@@ -25,14 +31,35 @@
   (elements [_] (seq elms))
   (index? [_ i] (idcs i))
   (indices [_] (seq idcs))
-  (s [_ i D] ((s# i) D))
+  (s [_ i D] ((or (s# i) {}) D))
   (v [ds i j D]
      (when (and (element? ds D) (index? ds i) (index? ds j))
-       (cond (= j (inc i)) ((v# i) D)
-             (= j (dec i)) ((v# j) D)
+       (cond (= j (inc i)) ((or (v# i) {}) D)
+             (= j (dec i)) ((or (v# j) {}) D)
              (= j i) 1
              (= (s ds i D) (s ds j D)) 2
-             :else 1))))
+             :else 1)))
+  IPersistentDSymbol
+  (dsconj [_ new] (DSymbol. idcs (into elms new) s# v#))
+  (dsdisj [_ old]
+          (let [s-remove (fn [[i a]]
+                           [i (reduce dissoc a (concat old (map (s# i) old)))])
+                v-remove (fn [[i a]] [i (reduce dissoc a old)])
+                new-elms (persistent! (reduce disj! (transient elms) old))
+                new-s# (into {} (map s-remove s#))
+                new-v# (into {} (map v-remove v#))]
+            (DSymbol. idcs new-elms new-s# new-v#)))
+  (dsglue [ds i D E]
+          (DSymbol. (conj idcs i)
+                    (conj elms D E)
+                    (assoc s# i (assoc (s# i) D E, E D))
+                    v#)
+          ds)
+  (dsunglue [ds i D]
+            (DSymbol. idcs
+                      elms
+                      (assoc s# i (dissoc (s# i) D ((s# i) D)))
+                      v#)))

 ;; General D-symbol functions


Fix: For genuinely lazy derive-column and add-columns functions.

--- src/grafter/tabular.clj
+++ src/grafter/tabular.clj
@@ -5,6 +5,7 @@
             [grafter.tabular.common :as tabc]
             [grafter.tabular.csv]
             [grafter.tabular.excel]
+            [clojure.tools.logging :refer [spy]]
             [incanter.core :as inc]
             [potemkin.namespaces :refer [import-vars]]))

@@ -207,6 +208,22 @@
 (defn lift->vector [x]
   (if (sequential? x) x [x]))

+(defn- resolve-keys [headers hash]
+  (map-keys #(resolve-col-id % headers nil) hash))
+
+(defn- select-row-values [src-col-ids row]
+  (map #(get row %) src-col-ids))
+
+(defn- apply-f-to-row-hash [src-col-ids new-header f row]
+  (let [args-from-cols (select-row-values src-col-ids row)
+        new-col-val (apply f args-from-cols)
+        new-column-hash (resolve-keys new-header new-col-val)]
+    (println new-column-hash)
+    (merge row new-column-hash)))
+
+(defn- resolve-all-col-ids [dataset source-cols]
+  (map (partial resolve-column-id dataset) source-cols))
+
 (defn derive-column
   "Adds a new column to the end of the row which is derived from
 column with position col-n.  f should just return the cells value.
@@ -215,24 +232,25 @@
 the specified column being cloned."

   ([dataset new-column-name from-cols]
-   (derive-column dataset new-column-name from-cols identity))
+     (derive-column dataset new-column-name from-cols identity))
   ;; todo support multiple columns/arguments to f.
   ([dataset new-column-name from-cols f]
-     (inc/add-derived-column new-column-name (lift->vector from-cols) f dataset)))
-
-(defn- resolve-keys [headers hash]
-  (map-keys #(resolve-col-id % headers nil) hash))
-
-(defn- select-row-values [src-col-ids row]
-  (map #(get row %) src-col-ids))
-
-(defn- apply-f-to-row-hash [src-col-ids new-header f row]
-  (let [args-from-cols (select-row-values src-col-ids row)
-        new-cols-and-values (resolve-keys new-header (apply f args-from-cols))]
-    (merge row new-cols-and-values)))
-
-(defn- resolve-all-col-ids [dataset source-cols]
-  (map (partial resolve-column-id dataset) source-cols))
+     (let [resolved-from-cols (resolve-all-col-ids dataset from-cols)]
+       (make-dataset (->> dataset
+                          :rows
+                          (map (fn [row]
+                                 (let [args-from-cols (select-row-values resolved-from-cols row)
+                                       new-col-val (apply f args-from-cols)]
+                                   (merge row {new-column-name new-col-val })))))
+                     (concat (column-names dataset) [new-column-name])))))
+
+(defn add-column
+  "Add a new column to a dataset with the supplied value lazily copied
+  into every row within it."
+
+  [dataset new-column value]
+
+  (derive-column dataset new-column nil (constantly value)))

 (defn- infer-new-columns-from-first-row [dataset source-cols f]
   (let [source-cols (resolve-all-col-ids dataset source-cols)
@@ -246,10 +264,49 @@
     new-col-ids))

 (defn add-columns
+  "Add several new columns to a dataset at once.  There are a number of different parameterisations:
+
+  (add-columns ds {:foo 10 :bar 20})
+
+  Calling with two arguments where the second argument is a hash map
+  creates new columns in the dataset for each of the hashmaps keys and
+  copies the hashes values lazily down all the rows.  This
+  parameterisation is designed to work well build-lookup-table.
+
+  When given either a single column id or many along with a function
+  which returns a hashmap, add-columns will pass each cell from the
+  specified columns into the given function, and then associate its
+  returned map back into the dataset.  e.g.
+
+  (add-columns ds \"a\" (fn [a] {:b (inc a) :c (inc a)} ))
+
+  ; =>
+
+  | a | :b | :c |
+  |---+----+----|
+  | 0 |  1 |  1 |
+  | 1 |  2 |  2 |
+
+  As a dataset needs to know its columns in this case it will infer
+  them from the return value of the first row.  If you don't want to
+  infer them from the first row then you can also supply them like so:
+
+  (add-columns ds [:b :c] \"a\" (fn [a] {:b (inc a) :c (inc a)} ))
+
+  ; =>
+
+  | a | :b | :c |
+  |---+----+----|
+  | 0 |  1 |  1 |
+  | 1 |  2 |  2 |
+
+"
   ([dataset hash]
      (let [merge-cols (fn [ds k]
-                        (inc/add-column k (repeat (hash k)) ds))
+                        (add-column ds k (hash k)))
            keys (-> hash keys sort)]
+       ;; Yes, this is actually lazy with respect to rows, as we're
+       ;; just reducing new lazy columns onto our dataset.
        (reduce merge-cols dataset keys)))

   ([dataset source-cols f]


Fix declaration order error

Fix declaration order error

--- src/grafter/tabular.clj
+++ src/grafter/tabular.clj
@@ -398,21 +398,21 @@
        (swap dataset first-col second-col))
      (throw (Exception. "Number of columns should be even")))))

+(defn- remaining-keys [dataset key-cols]
+  (let [remaining-keys (->> key-cols
+                            (set/difference (set (:column-names dataset))))]
+
+    remaining-keys))
+
+(defn- order-values [key-cols hash]
+  (map #(get hash %) key-cols))
+
 (defn resolve-key-cols [dataset key-cols]
   (->> (set (if (sequential? key-cols)
               key-cols
               [key-cols]))
        (order-values key-cols)
        (resolve-all-col-ids dataset)))
-
-(defn- remaining-keys [dataset key-cols]
-  (let [remaining-keys (->> key-cols
-                            (set/difference (set (:column-names dataset))))]
-
-    remaining-keys))
-
-(defn- order-values [key-cols hash]
-  (map #(get hash %) key-cols))

 (defn build-lookup-table
   "Takes a dataset, a vector of any number of column names corresponding