Add copy to clipboard

Add copy to clipboard

--- src/datafrisk/core.cljs
+++ src/datafrisk/core.cljs
@@ -2,6 +2,17 @@
   (:require [reagent.core :as r]))

 (declare DataFrisk)
+
+(def styles
+  {:shell {:backgroundColor "#FAFAFA"
+           :fontFamily "Consolas,Monaco,Courier New,monospace"
+           :fontSize "12px"
+           :z-index 9999}
+   :strings {:color "#4Ebb4E"}
+   :keywords {:color "purple"}
+   :numbers {:color "blue"}
+   :nil {:color "red"}
+   :shell-visible-button {:backgroundColor "#4EE24E"}})

 (defn ExpandButton [{:keys [expanded? path emit-fn]}]
   [:button {:style {:border 0
@@ -17,17 +28,6 @@
                   :transform (when expanded? "rotate(90deg)")}}
     [:polygon {:points "0,0 0,100 100,50" :stroke "black"}]]])

-(def styles
-  {:shell {:backgroundColor "#FAFAFA"
-           :fontFamily "Consolas,Monaco,Courier New,monospace"
-           :fontSize "12px"
-           :z-index 9999}
-   :strings {:color "#4Ebb4E"}
-   :keywords {:color "purple"}
-   :numbers {:color "blue"}
-   :nil {:color "red"}
-   :shell-visible-button {:backgroundColor "#4EE24E"}})
-
 (defn ExpandAllButton [emit-fn data]
   [:button {:onClick #(emit-fn :expand-all data)
             :style {:padding "3px"
@@ -50,6 +50,19 @@
                     :borderLeft "0"
                     :backgroundColor "white"}}
    "Collapse all"])
+
+(defn CopyButton [emit-fn data]
+  [:button {:onClick #(emit-fn :copy data)
+            :style {:padding "3px"
+                    :cursor "pointer"
+                    :borderTopRightRadius "2px"
+                    :borderBottomRightRadius "2px"
+                    :borderTop "1px solid darkgray"
+                    :borderBottom "1px solid darkgray"
+                    :borderRight "1px solid darkgray"
+                    :borderLeft "0"
+                    :backgroundColor "white"}}
+   "Copy"])

 (defn NilText []
   [:span {:style (:nil styles)} (pr-str nil)])
@@ -261,6 +274,31 @@
                   expanded-paths))))
       expanded-paths)))

+(defn copy-to-clipboard [data]
+  (let [pretty (with-out-str (cljs.pprint/pprint data))
+        textArea (.createElement js/document "textarea")]
+    (doto textArea
+      ;; Put in top left corner of screen
+      (aset "style" "position" "fixed")
+      (aset "style" "top" 0)
+      (aset "style" "left" 0)
+      ;; Make it small
+      (aset "style" "width" "2em")
+      (aset "style" "height" "2em")
+      (aset "style" "padding" 0)
+      (aset "style" "border" "none")
+      (aset "style" "outline" "none")
+      (aset "style" "boxShadow" "none")
+      ;; Avoid flash of white box
+      (aset "style" "background" "transparent")
+      (aset "value" pretty))
+
+    (.appendChild (.-body js/document) textArea)
+    (.select textArea)
+
+    (.execCommand js/document "copy")
+    (.removeChild (.-body js/document) textArea)))
+
 (defn emit-fn-factory [state-atom id swappable]
   (fn [event & args]
     (case event
@@ -268,6 +306,7 @@
       :expand-all (swap! state-atom assoc-in [:data-frisk id :expanded-paths] (expand-all-paths (first args)))
       :contract (swap! state-atom update-in [:data-frisk id :expanded-paths] disj (first args))
       :collapse-all (swap! state-atom assoc-in [:data-frisk id :expanded-paths] #{})
+      :copy (copy-to-clipboard (first args))
       :changed (let [[path value] args]
                  (if (seq path)
                    (swap! swappable assoc-in path value)
@@ -282,7 +321,8 @@
     [:div
      [:div {:style {:padding "4px 2px"}}
       [ExpandAllButton emit-fn data]
-      [CollapseAllButton emit-fn]]
+      [CollapseAllButton emit-fn]
+      [CopyButton emit-fn data]]
      [:div {:style {:flex "0 1 auto"}}
       [DataFrisk {:data data
                   :swappable swappable


Continue playing with layouts

Continue playing with layouts

--- src/ecregister/core.clj
+++ src/ecregister/core.clj
@@ -1,11 +1,20 @@
 (ns ecregister.core
   (:gen-class)
-  (:use [seesaw.core])
+  (:use [seesaw.core seesaw.mig])
   )

 (defn build-avatars-tab []
-  (label "Avatars")
+  (let [bg-stamp-pos (button-group)]
+       (mig-panel
+        :items [[(label "Имя пользователя:") ""]
+                [(text :columns 15) "wrap"]
+                [(label "Положение штампа:")]
+                [(flow-panel :items [(radio :id :top :text "Сверху" :group bg-stamp-pos)
+                                     (radio :id :bottom :text "Снизу" :group bg-stamp-pos)]) "wrap"]
+                [(button :text "Проштамповать") ""]]))
   )
+;;(config! f :content (build-content))
+
 (defn build-posts-tab []
   (label "Posts"))

@@ -16,7 +25,6 @@
             :tabs [ {:title "Аватарки" :content (build-avatars-tab)}
                     {:title "Посты" :content (build-posts-tab)}])
            ]))
-;; (config! f :content (build-content))
 ;; (def f (make-frame (build-content)))
 ;; (show! f)

@@ -26,7 +34,7 @@
    :title "Free Away Admin"
    :on-close :hide
    :size [640 :by 480]
-   :content (label "hello")
+   :content (label "hello") ;; TODO replace label => (build-content)
    ))

 (defn -main [& args]


add try catch for go block persister

add try catch for go block persister

--- kafka-clj/src/kafka_clj/consumer.clj
+++ kafka-clj/src/kafka_clj/consumer.clj
@@ -102,20 +102,22 @@
   (let [{:keys [offset-commit-freq] :or {offset-commit-freq 5000}} conf
         ch (chan 100)]

-    (go
-      (loop [t (timeout offset-commit-freq) state {}]
-          (let [[v c] (alts! [ch t])]
-            (if (= c ch)
-              (if (nil? v)
-                 (write-persister-data group-conn state) ;channel is closed
-		            (if (= c ch)
-		              (recur t (assoc state (clojure.string/join "/" [(:topic v) (:partition v)]) (inc (:offset v))))))
-               ;timeout
-              (do
-                (write-persister-data group-conn state)
-                  (recur (timeout offset-commit-freq)
-                         {}))))))
-
+    (go
+      (try
+	      (loop [t (timeout offset-commit-freq) state {}]
+	          (let [[v c] (alts! [ch t])]
+	            (if (= c ch)
+	              (if (nil? v)
+	                 (write-persister-data group-conn state) ;channel is closed
+			            (if (= c ch)
+			              (recur t (assoc state (clojure.string/join "/" [(:topic v) (:partition v)]) (inc (:offset v))))))
+	               ;timeout
+	              (do
+	                (write-persister-data group-conn state)
+	                  (recur (timeout offset-commit-freq)
+	                         {})))))
+        (catch Exception e (error e e))))
+
     {:ch ch :p-close #(close! ch) :p-send #(>!! ch %)}))

 (defn send-request-and-wait [producer group-conn topic-offsets msg-ch {:keys [fetch-timeout] :or {fetch-timeout 10000} :as conf}]


prevent crash when playing an unimplemented event or operation

--- src/node/game/core.cljs
+++ src/node/game/core.cljs
@@ -61,9 +61,9 @@
                               :brain-damage 0
                               :keep false}})]
     (when-let [corp-init (game.cards/cards (:title corp-identity))]
-      ((do! corp-init) state :corp nil))
+      ((:effect corp-init) state :corp nil))
     (when-let [runner-init (game.cards/cards (:title runner-identity))]
-      ((do! runner-init) state :runner nil))
+      ((:effect runner-init) state :runner nil))
     (swap! game-states assoc gameid state)))

 (def reset-value
@@ -125,7 +125,8 @@
     (if (= (:title card) "Levy AR Lab Access")
       (move state side card :hand :rfg)
       (move state side card :hand :discard))
-    ((get-in game.cards/cards [(:title card) :effect]) state side nil)
+    (when-let [effect (get-in game.cards/cards [(:title card) :effect])]
+      (effect state side nil))
     (system-msg state side (str "plays " (:title card) "."))))

 (defn runner-install [state side card]


Close datapool in writer/upserter task

Close datapool in writer/upserter task

--- src/onyx/plugin/sql.clj
+++ src/onyx/plugin/sql.clj
@@ -141,6 +141,7 @@
     this)

   (stop [this event]
+    (.close (:datasource pool))
     this)

   p/BarrierSynchronization
@@ -189,6 +190,7 @@
     this)

   (stop [this event]
+    (.close (:datasource pool))
     this)

   p/BarrierSynchronization


Update content.cljs

Update content.cljs

Christina: I have received actual figures from NICOR so have updated the 2015 and 2014 tables. I have also added in the 2010-13 data as well.


missing require for clojure.set

missing require for clojure.set

--- src/processing/core.clj
+++ src/processing/core.clj
@@ -11,6 +11,7 @@

 (ns processing.core
   (:import [processing.core PApplet PImage PGraphics PFont PConstants PShape])
+  (:require [clojure.set])
   (:use [processing.constants]
         [processing.util :only [int-like? resolve-constant-key length-of-longest-key gen-padding print-definition-list]]))


Get logging working

Get logging working

--- src/re_frame/utils.cljs
+++ src/re_frame/utils.cljs
@@ -1,34 +1,40 @@
-(ns re-frame.utils)
+(ns re-frame.utils
+  (:require
+    [clojure.set   :refer [difference]]))

 ;; -- Logging -----------------------------------------------------------------
 ;;
-;; re-frame uses various kinds of logging.
-;; Call set-loggers! if you want to override what it uses.
+;; re-frame internally uses a set of logging functions which, by default,
+;; print to js/console.
+;; Use set-loggers! if you want to change this default behaviour.
+;; In production environment, you may want to capture exceptions and POST
+;; them somewhere.  to , you might want to override the way that exceptions are
+;; handled by overridding "error"
 ;;
 (def default-loggers
-  {:log       js/console.log
-   :warn      js/console.warn
-   :error     js/console.error
-   :group     (or js/console.group js/console.log)    ;; group does not exist  < IE 11
-   :groupEnd  (or js/console.groupEnd #())})          ;; groupEnd does not exist  < IE 11
+  {:log       #(.log js/console %)
+   :warn      #(.warn js/console %)
+   :error     #(.error js/console %)
+   :group     #(if (.group js/console) (.group js/console %) (.log js/console %))  ;; group does not exist  < IE 11
+   :groupEnd  #(when (.groupEnd js/console) (.groupEnd js/console))})              ;; groupEnd does not exist  < IE 11

 ;; holds the current set of loggers.
 (def loggers (atom default-loggers))

 (defn set-loggers!
-  "new-loggers should be a map which looks like default-loggers"
+  "Change the set (subset?) of logging functions used by re-frame.
+  'new-loggers' should be a map which looks like default-loggers"
   [new-loggers]
-  (assert  (empty? (clojure.set/difference (set (keys new-loggers)) (set (keys default-loggers)))) "Unknown keys in new-loggers")
+  (assert  (empty? (difference (set (keys new-loggers)) (set (keys default-loggers)))) "Unknown keys in new-loggers")
   (swap! loggers merge new-loggers))

-(defn log      [& args] ({:log loggers}      (apply str args)))
-(defn warn     [& args] ({:warn loggers}     (apply str args)))
-(defn error    [& args] ({:error loggers}    (apply str args)))
-(defn group    [& args] ({:group loggers}    (apply str args)))
-(defn groupEnd [& args] ({:groupEnd loggers} (apply str args)))
-
+(defn log      [& args] ((:log @loggers)      (apply str args)))
+(defn warn     [& args] ((:warn @loggers)     (apply str args)))
+(defn group    [& args] ((:group @loggers)    (apply str args)))
+(defn groupEnd [& args] ((:groupEnd @loggers) (apply str args)))
+(defn error    [& args] ((:error @loggers)    (apply str args)))

 ;; -- Misc --------------------------------------------------------------------

@@ -36,5 +42,5 @@
   [v]
   (if (vector? v)
     (first v)
-    (warn "re-frame: expected a vector event, but got: " v)))
+    (error "re-frame: expected a vector event, but got: " v)))


Improve update-row function

Improve update-row function

--- src/reabledit/core.cljs
+++ src/reabledit/core.cljs
@@ -10,9 +10,7 @@

 (defn update-row
   [data nth-row new-row]
-  (let [[init tail] (split-at nth-row data)]
-    (into [] (concat init [new-row] (rest tail)))))
-
+  (assoc data nth-row new-row))

 ;;
 ;; Main component


Fix advanced compilation

Fix advanced compilation

--- src/reabledit/util.cljs
+++ src/reabledit/util.cljs
@@ -123,7 +123,7 @@

       ;; Trust key property if it's available
       ;; Otherwise do your best with keyCode
-      (let [key (-> e .-nativeEvent .-key)
+      (let [key (-> e .-key)
             from-charcode (.fromCharCode js/String keycode)]
         (.preventDefault e)
         (cond


logging: improve console logging

logging: improve console logging

Bring back console logging by default, change option name to :console? for consistency, and format docstrings.

--- src/riemann/logging.clj
+++ src/riemann/logging.clj
@@ -97,7 +97,7 @@
   "Initialize logging. You will probably call this from the config file. You can
   call init more than once; its changes are destructive. Options:

-  :console          Determine if logging should happen on the console.
+  :console?         Determine if logging should happen on the console.
   :console-layout   Specifying console layout.
   :file             The file to log to. If omitted, log to console only.
   :file-layout      Specifying file layout.
@@ -108,39 +108,49 @@
   :rotate-count     Specifying the number of rotated files to keep. If omitted,
                     keep last 10 rotated files.

-  Layout can be :riemann or :json. If layout omitted, default layout :riemann will be used.
-
-  Example:
-
-  (init {:console true :file \"/var/log/riemann.log\"})
-    or
-  (init {:console false :file \"/var/log/riemann.log\" :rotate-count 10})
-    or
-  (init {:console false :file \"/var/log/riemann.log\" :logsize-rotate 1000000000})
-    or
-  (init {:console false :files [{:file \"/var/log/riemann.log\"}, {:file \"/var/log/riemann.json.log\" :file-layout :json}] :logsize-rotate 100 :rotate-count 5})"
-  ([]
-   (set-level                    Level/INFO)
-   (set-level "riemann.client"   Level/DEBUG)
-   (set-level "riemann.server"   Level/DEBUG)
-   (set-level "riemann.streams"  Level/DEBUG)
-   (set-level "riemann.graphite" Level/DEBUG))
+  Layout can be :riemann or :json. If layout is omitted, the default layout
+  :riemann will be used.
+
+  For example:
+
+      ; Basic console logging
+      (init)
+
+      ; Also log to a file
+      (init {:file \"/var/log/riemann.log\"})
+
+      ; With rotation
+      (init {:console? false :file \"/var/log/riemann.log\" :rotate-count 10})
+
+      ; Rotate at a certain size
+      (init {:console? false
+             :file \"/var/log/riemann.log\"
+             :logsize-rotate 1000000000})
+
+      ; Multiple files in different formats
+      (init {:console? false
+             :files [{:file \"/var/log/riemann.log\"},
+                     {:file \"/var/log/riemann.json.log\" :file-layout :json}]
+             :logsize-rotate 100
+             :rotate-count 5})"
+  ([] (init {}))
   ([opts]
-    (let [{:keys [console
+    (let [{:keys [console?
                   console-layout
                   file
                   file-layout
                   files
                   rotate-count
                   logsize-rotate]
-           :or   {console-layout :riemann
+           :or   {console?       true
+                  console-layout :riemann
                   file-layout    :riemann}} opts
          logger   (get-logger)
          context  (get-context)]

       (.detachAndStopAllAppenders logger)

-      (when console
+      (when console?
         (let [encoder             (doto (encoder console-layout)
                                     (.setContext context)
                                     (.start))
@@ -150,7 +160,8 @@
                                     (.start))]
           (.addAppender logger console-appender)))

-      (doseq [{:keys [file file-layout]} (conj files {:file file :file-layout file-layout})
+      (doseq [{:keys [file file-layout]}
+              (conj files {:file file :file-layout file-layout})
                :when file]
         (if logsize-rotate
           (let [encoder           (doto (encoder file-layout)


suppress meaningless warnings from analyzer tests

--- test/clj/cljs/analyzer_tests.clj
+++ test/clj/cljs/analyzer_tests.clj
@@ -107,8 +107,9 @@
 (def test-cenv (atom {}))
 (def test-env (assoc-in (a/empty-env) [:ns :name] 'cljs.core))

-(e/with-compiler-env test-cenv
-  (a/analyze-file (io/file "src/cljs/cljs/core.cljs")))
+(a/no-warn
+  (e/with-compiler-env test-cenv
+    (a/analyze-file (io/file "src/cljs/cljs/core.cljs"))))

 (deftest basic-inference
   (is (= (e/with-compiler-env test-cenv
@@ -140,8 +141,9 @@
          'function)))

 (deftest if-inference
-  (is (= (e/with-compiler-env test-cenv
-           (:tag (a/analyze test-env '(if x "foo" 1))))
+  (is (= (a/no-warn
+           (e/with-compiler-env test-cenv
+             (:tag (a/analyze test-env '(if x "foo" 1)))))
          '#{number string})))

 (deftest method-inference
@@ -210,26 +212,33 @@
          'number)))

 (deftest test-numeric
-  (is (= (cljs.env/with-compiler-env test-cenv
-           (:tag (a/analyze test-env '(dec x))))
-         'number))
-  (is (= (cljs.env/with-compiler-env test-cenv
-           (:tag (a/analyze test-env '(int x))))
-         'number))
-  (is (= (cljs.env/with-compiler-env test-cenv
-           (:tag (a/analyze test-env '(unchecked-int x))))
-         'number))
-  (is (= (cljs.env/with-compiler-env test-cenv
-           (:tag (a/analyze test-env '(mod x y))))
-         'number))
-  (is (= (cljs.env/with-compiler-env test-cenv
-           (:tag (a/analyze test-env '(quot x y))))
-         'number))
-  (is (= (cljs.env/with-compiler-env test-cenv
-           (:tag (a/analyze test-env '(rem x y))))
-         'number))
-  (is (= (cljs.env/with-compiler-env test-cenv
-           (:tag (a/analyze test-env '(bit-count n))))
+  (is (= (a/no-warn
+           (cljs.env/with-compiler-env test-cenv
+             (:tag (a/analyze test-env '(dec x)))))
+         'number))
+  (is (= (a/no-warn
+           (cljs.env/with-compiler-env test-cenv
+             (:tag (a/analyze test-env '(int x)))))
+         'number))
+  (is (= (a/no-warn
+           (cljs.env/with-compiler-env test-cenv
+             (:tag (a/analyze test-env '(unchecked-int x)))))
+         'number))
+  (is (= (a/no-warn
+           (cljs.env/with-compiler-env test-cenv
+             (:tag (a/analyze test-env '(mod x y)))))
+         'number))
+  (is (= (a/no-warn
+           (cljs.env/with-compiler-env test-cenv
+             (:tag (a/analyze test-env '(quot x y)))))
+         'number))
+  (is (= (a/no-warn
+           (cljs.env/with-compiler-env test-cenv
+             (:tag (a/analyze test-env '(rem x y)))))
+         'number))
+  (is (= (a/no-warn
+           (cljs.env/with-compiler-env test-cenv
+             (:tag (a/analyze test-env '(bit-count n)))))
          'number)))

 ;; =============================================================================


both tests are the same

both tests are the same

--- test/clj_kafka/test/consumer.clj
+++ test/clj_kafka/test/consumer.clj
@@ -29,21 +29,3 @@
             (is (= 0 partition))
             (is (= "Hello, world" (String. value "UTF-8")))))))))

-(deftest test-sending-bytes-message
-  (with-broker
-    (let [p (producer {"metadata.broker.list" "localhost:9999"
-                       "serializer.class" "kafka.serializer.DefaultEncoder"
-                       "partitioner.class" "kafka.producer.DefaultPartitioner"})]
-      (with-resource [c (zk/consumer {"zookeeper.connect" "localhost:2182"
-                                      "group.id" "clj-kafka.test.consumer"
-                                      "auto.offset.reset" "smallest"
-                                      "auto.commit.enable" "false"})]
-        zk/shutdown
-        (send-message p "test" "Hello, world")
-        (let [msgs (zk/messages c "test")
-              msg (to-clojure (first msgs))]
-          (let [{:keys [topic offset partition key value]} msg]
-            (is (= "test" topic))
-            (is (= 0 offset))
-            (is (= 0 partition))
-            (is (= "Hello, world" (String. value "UTF-8")))))))))


First empty list test

First empty list test


tests for file function

tests for file function

--- test/test_core.clj
+++ test/test_core.clj
@@ -28,6 +28,7 @@

   (is false)

+
   (testing "tilde expansion"
     (with-project [p "/foo/bar", tp "~/foo/bar"]
       (is (= (str (System/getProperty "user.home") p)


Add docstrings to tutorial test functions.

--- test/merkle_db/tutorial_test.clj
+++ test/merkle_db/tutorial_test.clj
@@ -7,6 +7,9 @@

 (defn find-code-blocks
+  "Pattern match the text to find fenced code blocks. Returns a sequence of
+  match vectors containing `[match directive? code]`. The directive may be a
+  word appearing inside an HTML comment immediately preceding the block."
   [text]
   (re-seq #"(?:<!-- (\S+) -->\n)?```clojure\n((?:[^`]*\n)*[^`]+)```" text))

@@ -39,6 +42,9 @@

 (defn split-body
+  "Separate a the `:body` string in the given statement map into an input
+  `:form` and `:expected` value (if present). If the body doesn't begin with
+  the prompt string `=>`, it is returned unchanged."
   [statement]
   (let [body (:body statement)]
     (if (str/starts-with? (first body) "=> ")
@@ -57,6 +63,8 @@

 (defn read-form
+  "Read the `:form` in the given statement, if present. Otherwise returns the
+  statement unchanged."
   [statement]
   (if (:form statement)
     (update statement :form #(binding [*default-data-reader-fn* tagged-literal]
@@ -65,6 +73,9 @@

 (defn try-eval
+  "Attempt to evaluate the given form and use the expected output string and
+  any post comments to judge the result. Reports `clojure.test` assertion
+  results and returns a vector containing the result and error values, if any."
   [history form expected post]
   (let [err-class (some->> (first post)
                            (re-seq #"^; (\S*Exception) ")
@@ -122,6 +133,8 @@
                              expected
                              post)]
           ;(puget/cprint [form result err])
+          ; TODO: assertions on result vs expected
+          ; TODO: assert that % of lines different is under some threshold?
           (recur (if-not err
                    (take 3 (cons result history))
                    history)


one more unit test fix.

one more unit test fix.

--- test/metabase/api/setup_test.clj
+++ test/metabase/api/setup_test.clj
@@ -20,7 +20,7 @@
                (sel :one Session :user_id))
       {:id $id})
     (let [resp (http/client :post 200 "setup" {:token setup-token
-                                               :prefs {:site_name "awesomesauce"}
+                                               :prefs {:site_name "Metabase Test"}
                                                :user  {:first_name user-name
                                                        :last_name  user-name
                                                        :email      (str user-name "@metabase.com")


Renaming.

Renaming.

--- src/kolmogorov_music/talk.clj
+++ src/kolmogorov_music/talk.clj
@@ -110,10 +110,10 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn kleene* [elements]
-  (letfn [(expand [strings] (for [s strings e elements] (conj s e)))]
+  (letfn [(append-to [strings] (for [s strings e elements] (conj s e)))]
     (->>
       (lazy-seq (kleene* elements))
-      expand
+      append-to
       (cons []))))

 (defn library-of-babel []


Sort list of build-tools versions before selecting

--- src/leiningen/droid/utils.clj
+++ src/leiningen/droid/utils.clj
@@ -47,7 +47,7 @@
         bt-dir (or build-tools-version
                    (->> (.list bt-root-dir)
                         (filter #(.isDirectory (file bt-root-dir %)))
-                        last))]
+                        sort last))]
     ;; if bt-dir exists (i.e. non-nil) then, probably, it is not empty
     ;; and therefore we can assume that we're running build-tools 17+ revision
     (if bt-dir


Adding boot-cp dependency

Adding boot-cp dependency

Going to use this to generate a classpath for Lumo. How will we use
Lumo? Wait and see. :)

--- build.boot
+++ build.boot
@@ -12,6 +12,7 @@
    [crisptrutski/boot-cljs-test "0.3.0" :scope "test"]
    [deraen/boot-sass "0.3.0" :scope "test"]
    [devcards "0.2.2" :scope "test"]
+   [org.clojars.micha/boot-cp "1.0.1" :scope "test"]
    [org.clojure/tools.nrepl "0.2.12" :scope "test"]
    [org.martinklepsch/boot-gzip "0.1.3" :scope "test"]
    [org.slf4j/slf4j-nop "1.7.21" :scope "test"]


Update deps

Update deps

--- build.boot
+++ build.boot
@@ -7,18 +7,18 @@
                   [org.clojure/clojurescript "1.9.229"]

                   [boot/core              "2.6.0"      :scope "test"]
-                  [adzerk/boot-cljs       "1.7.228-1"  :scope "test"]
+                  [adzerk/boot-cljs       "1.7.228-2"  :scope "test"]
                   [adzerk/boot-cljs-repl  "0.3.3"      :scope "test"]
                   [crisptrutski/boot-cljs-test "0.2.2-SNAPSHOT" :scope "test"]
                   [com.cemerick/piggieback "0.2.1"     :scope "test"]
                   [weasel                 "0.7.0"      :scope "test"]
                   [org.clojure/tools.nrepl "0.2.12"    :scope "test"]
-                  [adzerk/boot-reload     "0.4.13-SNAPSHOT"     :scope "test"]
+                  [adzerk/boot-reload     "0.4.13"     :scope "test"]
                   [metosin/boot-alt-test  "0.1.2"      :scope "test"]
-                  [deraen/boot-less       "0.5.1-SNAPSHOT"      :scope "test"]
+                  [deraen/boot-less       "0.6.0"      :scope "test"]
                   ;; For boot-less
                   [org.slf4j/slf4j-nop    "1.7.21"     :scope "test"]
-                  [deraen/boot-sass       "0.3.0-SNAPSHOT"      :scope "test"]
+                  [deraen/boot-sass       "0.3.0"      :scope "test"]

                   ; Backend
                   [http-kit "2.2.0"]


Bump devtools

Bump devtools

--- build.boot
+++ build.boot
@@ -30,7 +30,7 @@
                  [cljsjs/enquire              "2.1.2-0"]
                  [com.cemerick/piggieback     "0.2.1"]
                  [org.clojars.stumitchell/clairvoyant "0.2.0"]
-                 [binaryage/devtools          "0.5.2"]
+                 [binaryage/devtools          "0.6.0"]
                  [day8/re-frame-tracer        "0.1.0-SNAPSHOT"]
                  [cljsjs/codemirror           "5.10.0-0"]
                  [adzerk/cljs-console "0.1.1"]])


Fix format-commands

Fix format-commands

--- build.boot
+++ build.boot
@@ -37,17 +37,20 @@
   (.startsWith (.toLowerCase (System/getProperty "os.name")) "windows"))

 (defn format-commands
-  [& command-sets]
-  (as-> command-sets c
-        (map (partial concat (if windows? ["cmd" "/c"] ["sh" "-c"])) c)
-        (interleave c (repeat (if windows? "&" ";")))
+  [& commands]
+  (as-> commands c
+        (map (fn [command]
+               (if windows?
+                 (into ["cmd" "/c"] command)
+                 (into ["sh" "-c"]  (str "'" (apply str command) "'"))))
+             c)
+        (interleave c (repeat [(if windows? "&" ";")]))
         (butlast c)
         (apply concat c)))

 (defn run-commands
-  [& command-sets]
-  (util/info (apply format-commands command-sets))
-  (->> command-sets
+  [& commands]
+  (->> commands
        (apply format-commands)
        (apply util/dosh)))


Idiomatic usage of import in ns macro.

Idiomatic usage of import in ns macro.

--- language-adaptors/rxjava-clojure/src/examples/clojure/rx/lang/clojure/examples/rx_examples.clj
+++ language-adaptors/rxjava-clojure/src/examples/clojure/rx/lang/clojure/examples/rx_examples.clj
@@ -1,5 +1,5 @@
 (ns rx.lang.clojure.examples.rx-examples
-  (import rx.Observable)
+  (:import rx.Observable)
   (:require [clj-http.client :as http]))

 ; NOTE on naming conventions. I'm using camelCase names (against clojure convention)


(PE-4299) Moved default env logic

(PE-4299) Moved default env logic

--- src/clj/puppetlabs/master/services/handler/request_handler_service.clj
+++ src/clj/puppetlabs/master/services/handler/request_handler_service.clj
@@ -18,14 +18,16 @@
                [[:JRubyPuppetService get-default-pool-descriptor]]
                (handle-request
                  [this request]
-                 ;; TODO : This should later intelligently choose the pool
-                 ;; TODO : descriptor based up on the environment of the req.
-                 (let [pool-descriptor (get-default-pool-descriptor)
+                 (let [pool-descriptor (if-let [environment (:environment request)]
+                                         (environment->pool-descriptor environment)
+                                         (get-default-pool-descriptor))
                        jruby-service (get-service :JRubyPuppetService)]
                    (handle-request pool-descriptor request jruby-service)))

                (handle-request
                  [this environment request]
-                 (let [pool-descriptor (environment->pool-descriptor environment)
+                 ;; TODO : This should later intelligently choose the pool
+                 ;; TODO : descriptor based up on the environment of the req.
+                 (let [pool-descriptor (get-default-pool-descriptor)
                        jruby-service (get-service :JRubyPuppetService)]
                    (handle-request pool-descriptor request jruby-service))))


fix abort button visibility for completed submissions (#1398)

--- src/cljs/main/broadfcui/page/workspace/monitor/submission_details.cljs
+++ src/cljs/main/broadfcui/page/workspace/monitor/submission_details.cljs
@@ -169,7 +169,7 @@
                                :color (color-for-submission submission)
                                :icon (icon-for-submission submission)}]
            (when (and
-                   contains? moncommon/sub-running-statuses (:status submission)
+                   (contains? moncommon/sub-running-statuses (:status submission))
                    (common/access-greater-than-equal-to? (:user-access-level props) "WRITER"))
              [AbortButton
               {:on-abort (fn []


Added some documentation

Added some documentation

--- src/overtone/music/tuning.clj
+++ src/overtone/music/tuning.clj
@@ -30,13 +30,16 @@
 ;; ratio = (Math/pow 2 (/ 1 24)) => 1.029302236643492
 ;; (perform '((:arabic 100 440) 73 76 79))

-(defmulti perfn first)
+(defmulti perf n first
+    "Multimethod that returns a function taking note numbers to frequencies in \\s^{-1}\\")

 (defmethod perfn :ed [[symb divisions multiplier initial freq]]
+    "Equal divisions of some n-tave."
     (fn [note]
         (* freq (Math/pow multiplier (/ (- note initial) divisions)))))

 (defmethod perfn :edo [[symb divisions initial freq]]
+    "Equal divisions of the octave."
     (perfn (list :ed divisions 2 initial freq)))

 (defmethod perfn :midi [[symb]]


Simplify arguments the editing component gets from the cell component

--- src/reabledit/components.cljs
+++ src/reabledit/components.cljs
@@ -1,25 +1,24 @@
 (ns reabledit.components
-  (:require [reabledit.util :as util]))
+  (:require [reabledit.util :as util]
+            [reagent.core :as reagent]))

 (defn data-table-cell-input
-  [columns data nth-row nth-col state]
-  (let [k (:key (nth columns nth-col))]
-    [:input {:type "text"
-             :auto-focus true
-             :value (get (get-in @state [:edit :updated]) k)
-             :on-change #(swap! state
-                                assoc-in
-                                [:edit :updated k]
-                                (-> % .-target .-value))}]))
+  [cursor]
+  [:input {:type "text"
+           :auto-focus true
+           :value @cursor
+           :on-change #(reset! cursor (-> % .-target .-value))}])

 (defn data-table-cell
   [columns data v nth-row nth-col state]
   (let [selected? (= (:selected @state) [nth-row nth-col])
-        edit? (:edit @state)]
+        edit? (:edit @state)
+        key (:key (nth columns nth-col))
+        cursor (reagent/cursor state [:edit :updated key])]
     [:td {:class (if selected? "selected")
           :on-click #(util/set-selected! state nth-row nth-col)}
      (if (and selected? edit?)
-       [data-table-cell-input columns data nth-row nth-col state]
+       [data-table-cell-input cursor]
        [:span v])]))

 (defn data-table-row


make overlay work for a single channel

make overlay work for a single channel

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@9363 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/SlideExplorer2/src/slide_explorer/image.clj
+++ plugins/SlideExplorer2/src/slide_explorer/image.clj
@@ -30,6 +30,8 @@
     (set! (. lut max) max)
     lut))

+(def black-lut (lut-object Color/BLACK 0 255 1.0))
+
 (defn make-stack
   "Produces an ImageJ ImageStack from a collection
    of ImageProcessors."
@@ -42,11 +44,19 @@
       (.addSlice stack processor))
     stack))

-(defn overlay ;; TODO: fix for when n=1
+(defn overlay
   "Takes n ImageProcessors and n lut objects and produces a BufferedImage
-   that is the overlay."
+   containing the overlay."
   [processors luts]
-  (let [stack (make-stack processors)
+  (let [luts (if (= 1 (count luts))
+               (list (first luts) black-lut)
+               luts)
+        processors (if (= 1 (count processors))
+                     (let [proc (first processors)]
+                       (list proc (.createProcessor proc
+                                    (.getWidth proc) (.getHeight proc))))
+                     processors)
+        stack (make-stack processors)
         img+ (ImagePlus. "" stack)]
     (.setDimensions img+ (.getSize stack) 1 1)
     (.getImage


progress toward flat field correction

progress toward flat field correction

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@10388 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/SlideExplorer2/src/slide_explorer/image.clj
+++ plugins/SlideExplorer2/src/slide_explorer/image.clj
@@ -1,10 +1,11 @@
 (ns slide-explorer.image
   (:import (ij CompositeImage IJ ImagePlus ImageStack)
            (ij.io FileSaver)
-           (ij.plugin ZProjector)
+           (ij.plugin ImageCalculator ZProjector)
            (ij.plugin.filter GaussianBlur)
            (ij.process ByteProcessor LUT ImageProcessor ColorProcessor
-                       ImageStatistics ByteStatistics ShortProcessor)
+                       ImageStatistics ByteStatistics ShortProcessor
+                       FloatProcessor)
            (mmcorej TaggedImage)
            (javax.swing JFrame)
            (java.awt Color)
@@ -81,6 +82,12 @@
   "Converts and ImageJ ImageProcessor to an AWT image."
   [^ImageProcessor proc]
   (.createImage proc))
+
+(defn convert-to-type-like [proc template-proc]
+  (condp = (type template-proc)
+    ByteProcessor (.convertToByte proc false)
+    ShortProcessor (.convertToShort proc false)
+    FloatProcessor (.convertToFloat proc false)))

 ;; Trimming and displacing images

@@ -226,14 +233,33 @@
             .doProjection)
           .getProjection
           .getProcessor)]
-    (condp = (type (first processors))
-      ByteProcessor (.convertToByte float-processor false)
-      ShortProcessor (.convertToShort float-processor false))))
-
-(defn gaussian-blur [processor radius]
+    (convert-to-type-like (first processors))))
+
+(defn gaussian-blur
+  "Applys a gaussian blur to ImageProcessor, with given radius."
+  [processor radius]
   (let [new-proc (.duplicate processor)]
     (.blurGaussian (GaussianBlur.) new-proc radius radius 0.0002)
     new-proc))
+
+(defn normalize
+  "Rescale intensities so the max value of processor is 1.0."
+  [processor]
+  (let [max (.max (.getStatistics processor))
+        float-proc (.convertToFloat processor)]
+    (.multiply float-proc (/ 1 max))
+    float-proc))
+
+(defn divide-processors
+  "Divide processor 1 by processor 2."
+  [proc1 proc2]
+  (-> (ImageCalculator.)
+      (.run
+        "divide float"
+        (ImagePlus. "" proc1)
+        (ImagePlus. "" proc2))
+      .getProcessor
+      (convert-to-type-like proc1)))

 ;; testing


fetch all necessary points

fetch all necessary points

--- src/so/grep/cyanite/store.clj
+++ src/so/grep/cyanite/store.clj
@@ -23,7 +23,7 @@
    (str
     "SELECT path,data,time FROM metric WHERE "
     "path IN ? AND rollup = ? AND period = ? "
-    "AND time >= ? AND time <= ? ORDER BY time ASC;")))
+    "AND time >= ? AND time <= ? ORDER BY time ASC LIMIT ?;")))

 (defn prepare-path-elem-re
   [e]
@@ -126,12 +126,24 @@
   [_ metric]
   metric)

+(defn max-points
+  [paths rollup from to]
+  (let [path-count (count paths)]
+    (-> (- to from)
+        (/ rollup)
+        (long)
+        (inc)
+        (* path-count)
+        (int))))
+
 (defn fetch
   [session agg paths rollup period from to]
-  (debug "fetching paths from store: " paths rollup period from to)
+  (debug "fetching paths from store: " paths rollup period from to
+         (max-points paths rollup from to))

   (let [q (fetchq session)]
     (->> (alia/execute
           session q
-          :values [paths (int rollup) (int period) from to])
+          :values [paths (int rollup) (int period) from to
+                   (max-points paths rollup from to)])
          (map (partial aggregate-with (keyword agg))))))


+(defn benchmark)

+(defn benchmark)

--- src/babel/italiano/benchmark.cljc
+++ src/babel/italiano/benchmark.cljc
@@ -49,8 +49,7 @@
                 #(println (with-out-str
                             (time (mapcat :parses (parse expr)))))))))

-;; lein run -m babel.italiano.benchmark/gen-mark 10
-(defn gen-mark [do-this-many]
+(defn benchmark [spec model do-this-many]
   (let [do-this-many (Integer. do-this-many)
         timings
         (->>
@@ -58,13 +57,8 @@
                (repeatedly
                 #(with-out-str (time (fo
                                       (let [generated
-                                            (generate {:synsem {:subcat '()
-                                                                :essere true
-                                                                :sem {:pred :be-called
-                                                                      :tense :present
-                                                                      :subj :top
-                                                                      :iobj :top}}}
-                                                      :model small)
+                                            (generate spec
+                                                      :model model)
                                             output (log/info (fo generated))]
                                         generated))))))
          (map #(string/replace % #".*time:\s*([0-9.]+).*" "$1"))
@@ -84,6 +78,26 @@
       (println result)
       result)))

+;; lein run -m babel.italiano.benchmark/gen-mark 10
+(defn gen-mark [do-this-many]
+  (let [do-this-many (Integer. do-this-many)]
+    (benchmark {:synsem {:subcat '()
+                         :sem {:pred :be-called
+                               :tense :present
+                               :subj :top
+                               :iobj :top}}}
+               small
+               do-this-many)))
+
+(defn gen-mark2 [do-this-many]
+  (let [do-this-many (Integer. do-this-many)]
+    (benchmark {:synsem {:subcat '()
+                         :essere false
+                         :sem {:pred :do
+                               :tense :past
+                               :aspect :perfect}}}
+               small
+               do-this-many)))


all ttests pass

all ttests pass

--- src/bluebell/utils/party/coll.clj
+++ src/bluebell/utils/party/coll.clj
@@ -24,7 +24,11 @@
   (if (every? utils/comparable? (map first pairs))
     (do
       ;(println "Keys are" (map first pairs))
-      (sort-by first pairs))
+      (try
+        (sort-by first pairs)
+        (catch Throwable e
+          (println "Warning: Failed to sort pairs, maybe both comparables but different types.")
+          pairs)))

     (do
       ;(println "CANNOT BE SORTED" (map first pairs))


Simplified some of the code around how the generator functions are created.

--- src/blutwurst/tuple_generator.clj
+++ src/blutwurst/tuple_generator.clj
@@ -64,26 +64,25 @@
 (defn- complex-columns [table]
   (filter #(= :complex (:type %)) (:properties table)))

-(def ^:private build-generator-fn (memoize (fn [spec table generated-data]
-                                             (let [dependency-selectors (map (partial build-dependency-selector-fn generated-data)
-                                                                             (filter-ignored-columns spec (:dependencies table)))
-                                                   value-generators (map #(hash-map :column %
-                                                                                :generator (->> % (select-generators-for-column spec) :generator))
-                                                                         (value-columns spec table))
-                                                   complex-generators (map #(let [compound-generator (build-generator-fn spec % generated-data)]
-                                                                              (fn [] (list (-> % :name keyword) (compound-generator))))
-                                                                           (complex-columns table))]
-                                               (doseq [c value-generators]
-                                                 (if (nil? (:generator c))
-                                                   (error "Unable to find generator for column " (:column c))))
+(def ^:private build-generator-fn
+ (memoize
+  (fn [spec table generated-data]
+     (let [dependency-selectors (map (partial build-dependency-selector-fn generated-data)
+                                     (filter-ignored-columns spec (:dependencies table)))
+           value-generators (map #(fn[] (list (-> % :name keyword) ((->> % (select-generators-for-column spec) :generator) %)))
+                                 (value-columns spec table))
+           complex-generators (map #(let [compound-generator (build-generator-fn spec % generated-data)]
+                                      (fn [] (list (-> % :name keyword) (compound-generator))))
+                                   (complex-columns table))]
+       (doseq [c value-generators]
+         (if (nil? (:generator c))
+           (error "Unable to find generator for column " (:column c))))

-                                               (fn []
-                                                 (apply hash-map
-                                                        (flatten (concat (map #(%) dependency-selectors)
-                                                                         (map #(%) complex-generators)
-                                                                         (map (fn [a] (list (-> a :column :name keyword)
-                                                                                ((:generator a) (:column a))))
-                                                                              value-generators)))))))))
+       (fn []
+         (->> (concat dependency-selectors complex-generators value-generators)
+              (map #(%))
+              flatten
+              (apply hash-map)))))))

 (defn- generate-tuples-for-table [table-descriptor spec generated-data]
   (let [table-generator (build-generator-fn spec table-descriptor generated-data)]


entity-key is changed to entity-class-key.

--- src/sweet_crossplane/core.clj
+++ src/sweet_crossplane/core.clj
@@ -63,28 +63,28 @@
           (handler request))))))

 (defn param-key
-  [entity-key property-key]
-  (radial-mount/property-message-key entity-key property-key))
-
-(declare entity-keys inputtable-property-keys parse-property-param)
+  [& args]
+  (apply radial-mount/property-message-key args))
+
+(declare entity-class-keys inputtable-property-keys parse-property-param)

 (defn wrap-entity-params
   [handler]
-  (letfn [(assoc-entity-param [request param-key entity-key property-key]
+  (letfn [(assoc-entity-param [request param-key entity-class-key property-key]
             (if-let [param-value (not-empty (get-in request [:params param-key]))]
               (try
-                (assoc-in request [:entity-params param-key] (parse-property-param entity-key property-key param-value))
+                (assoc-in request [:entity-params param-key] (parse-property-param entity-class-key property-key param-value))
                 (catch ParseException _
                   (update-in request [:entity-param-errors param-key] #(vec (conj % :has-the-wrong-format)))))))]
     (fn [request]
-      (handler (reduce (fn [request entity-key]
+      (handler (reduce (fn [request entity-class-key]
                          (reduce (fn [request [property-key param-key]]
                                    (cond-> request
-                                     (.startsWith (name param-key) (name (sweet-crossplane.core/param-key entity-key property-key))) (#(or (assoc-entity-param % param-key entity-key property-key) %))))
+                                     (.startsWith (name param-key) (name (sweet-crossplane.core/param-key entity-class-key property-key))) (#(or (assoc-entity-param % param-key entity-class-key property-key) %))))
                                  request
-                                 (combinatorics/cartesian-product (inputtable-property-keys entity-key) (keys (:params request)))))
+                                 (combinatorics/cartesian-product (inputtable-property-keys entity-class-key) (keys (:params request)))))
                        request
-                       (entity-keys))))))
+                       (entity-class-keys))))))

 (def ^:dynamic *request*
   nil)
@@ -137,68 +137,69 @@

 ;; Models.

-(defn entity-keys
+(defn entity-class-keys
   []
   (keys @database-schema))

-(defn entity-schema
-  [entity-key]
-  (get @database-schema entity-key))
+(defn entity-class-schema
+  [entity-class-key]
+  (get @database-schema entity-class-key))

 (defn property-keys
-  ([entity-key & property-types]
-   (->> (entity-schema entity-key)
+  ([entity-class-key & property-types]
+   (->> (entity-class-schema entity-class-key)
         ((apply juxt property-types))
         (map keys)
         (apply concat)))
-  ([entity-key]
-   (property-keys entity-key :columns :many-to-one-relationships :one-to-many-relationships)))
+  ([entity-class-key]
+   (property-keys entity-class-key :columns :many-to-one-relationships :one-to-many-relationships)))

 (defn inputtable-property-keys
-  [entity-key]
-  (property-keys entity-key :columns :many-to-one-relationships))
+  [entity-class-key]
+  (property-keys entity-class-key :columns :many-to-one-relationships))

 (defn search-condition-property-keys
-  [entity-key]
-  (or (get-in (entity-schema entity-key) [:search-condition :properties])
-      (inputtable-property-keys entity-key)))
+  [entity-class-key]
+  (or (get-in (entity-class-schema entity-class-key) [:search-condition :properties])
+      (inputtable-property-keys entity-class-key)))

 (defn list-property-keys
-  [entity-key]
-  (or (get-in (entity-schema entity-key) [:list :properties])
-      (property-keys entity-key)))
+  [entity-class-key]
+  (or (get-in (entity-class-schema entity-class-key) [:list :properties])
+      (property-keys entity-class-key)))

 (defn sort-keyfn-and-comp
-  [entity-key]
-  (let [[keyfn comp] (get-in (entity-schema entity-key) [:list :sort-by])]
-    [(or keyfn (first (list-property-keys entity-key)))
+  [entity-class-key]
+  (let [[keyfn comp] (get-in (entity-class-schema entity-class-key) [:list :sort-by])]
+    [(or keyfn (first (list-property-keys entity-class-key)))
      (or comp  compare)]))

 (defn representative-property-key
-  [entity-key]
-  (or (:representative (entity-schema entity-key))
-      :name))
+  [entity-class-key]
+  (or (:representative (entity-class-schema entity-class-key))
+      (some #{:name} (property-keys entity-class-key))
+      (first (property-keys entity-class-key))))

 (defn property-schema
-  [entity-key property-key]
-  (let [entity-schema (entity-schema entity-key)]
-    (or (get-in entity-schema [:columns                   property-key])
-        (get-in entity-schema [:many-to-one-relationships property-key])
-        (get-in entity-schema [:one-to-many-relationships property-key]))))
+  [entity-class-key property-key]
+  (let [entity-class-schema (entity-class-schema entity-class-key)]
+    (or (get-in entity-class-schema [:columns                   property-key])
+        (get-in entity-class-schema [:many-to-one-relationships property-key])
+        (get-in entity-class-schema [:one-to-many-relationships property-key]))))

 (defn placeholder
-  [entity-key property-key]
-  (get-in (entity-schema entity-key) [:placeholders property-key]))
+  [entity-class-key property-key]
+  (get-in (entity-class-schema entity-class-key) [:placeholders property-key]))

 (defn property-type
-  [entity-key property-key]
-  (let [entity-schema (entity-schema entity-key)]
-    (or (get-in entity-schema [:columns property-key :type])
-        (and (get-in entity-schema [:many-to-one-relationships property-key]) :many-to-one)
-        (and (get-in entity-schema [:one-to-many-relationships property-key]) :one-to-many))))
+  [entity-class-key property-key]
+  (let [entity-class-schema (entity-class-schema entity-class-key)]
+    (or (get-in entity-class-schema [:columns property-key :type])
+        (and (get-in entity-class-schema [:many-to-one-relationships property-key]) :many-to-one)
+        (and (get-in entity-class-schema [:one-to-many-relationships property-key]) :one-to-many))))

 (defmulti parse-property-param
-  (fn [entity-key property-key param-value] (property-type entity-key property-key)))
+  (fn [entity-class-key property-key param-value] (property-type entity-class-key property-key)))

 (defmethod parse-property-param :integer
   [_ _ param-value]
@@ -232,7 +233,7 @@
   param-value)

 (defmulti format-property-param
-  (fn [entity-key property-key param-value] (property-type entity-key property-key)))
+  (fn [entity-class-key property-key param-value] (property-type entity-class-key property-key)))

 (defmethod format-property-param :date
   [_ _ param-value]
@@ -247,21 +248,21 @@
     ""))

 (defn- format-relationship-property-param
-  [entity-key property-key param-value]
+  [entity-class-key property-key param-value]
   (if param-value
     (if (map? param-value)
-      (let [entity-key   (:table-key (property-schema entity-key property-key))
-            property-key (representative-property-key entity-key)]
-        (format-property-param entity-key property-key (get param-value property-key)))
+      (let [entity-class-key (:table-key (property-schema entity-class-key property-key))
+            property-key     (representative-property-key entity-class-key)]
+        (format-property-param entity-class-key property-key (get param-value property-key)))
       (dog-mission/l10n-format param-value))))

 (defmethod format-property-param :many-to-one
-  [entity-key property-key param-value]
-  (format-relationship-property-param entity-key property-key param-value))
+  [entity-class-key property-key param-value]
+  (format-relationship-property-param entity-class-key property-key param-value))

 (defmethod format-property-param :one-to-many
-  [entity-key property-key param-value]
-  (string/join (dog-mission/translate :comma) (map (partial format-relationship-property-param entity-key property-key) param-value)))
+  [entity-class-key property-key param-value]
+  (string/join (dog-mission/translate :comma) (map (partial format-relationship-property-param entity-class-key property-key) param-value)))

 (defmethod format-property-param :default
   [_ _ param-value]
@@ -319,9 +320,9 @@
           [:span.caret]]
          [:ul.dropdown-menu
           {:role "menu"}
-          (map (fn [entity-key]
-                 [:li (link-to (<< "/~(name entity-key)") (string/capitalize (dog-mission/translate entity-key)))])
-               (entity-keys))]]]]]]
+          (map (fn [entity-class-key]
+                 [:li (link-to (<< "/~(name entity-class-key)") (string/capitalize (dog-mission/translate entity-class-key)))])
+               (entity-class-keys))]]]]]]
     [:article
      [:div.container-fluid
       contents]]
@@ -349,26 +350,26 @@
 ;; controls for input condition.

 (defmulti condition-control
-  (fn [entity-key property-key] (property-type entity-key property-key)))
+  (fn [entity-class-key property-key] (property-type entity-class-key property-key)))

 (defn- string-condition-control
-  [entity-key property-key]
-  (let [param-key (param-key entity-key property-key)]
+  [entity-class-key property-key]
+  (let [param-key (param-key entity-class-key property-key)]
     [:div.form-group
      (label param-key (string/capitalize (dog-mission/translate param-key)))
-     (text-field {:class "form-control", :placeholder (placeholder entity-key property-key)} param-key (format-property-param entity-key property-key (get-in *request* [:entity-params param-key])))]))
+     (text-field {:class "form-control", :placeholder (placeholder entity-class-key property-key)} param-key (format-property-param entity-class-key property-key (get-in *request* [:entity-params param-key])))]))

 (defmethod condition-control :string
-  [entity-key property-key]
-  (string-condition-control entity-key property-key))
+  [& args]
+  (apply string-condition-control args))

 (defmethod condition-control :text
-  [entity-key property-key]
-  (string-condition-control entity-key property-key))
+  [& args]
+  (apply string-condition-control args))

 (defn- number-condition-control
-  [entity-key property-key]
-  (let [param-key   (param-key entity-key property-key)
+  [entity-class-key property-key]
+  (let [param-key   (param-key entity-class-key property-key)
         param-key-1 (keyword (format "%s-1--" (name param-key)))
         param-key-2 (keyword (format "%s-2--" (name param-key)))
         errors-1    (not-empty (get-in *request* [:entity-param-errors param-key-1]))
@@ -382,30 +383,30 @@
                 param-key
                 (if errors
                   (get-in *request* [:params param-key])
-                  (format-property-param entity-key property-key (get-in *request* [:entity-params param-key]))))])]
+                  (format-property-param entity-class-key property-key (get-in *request* [:entity-params param-key]))))])]
       (list
        (label param-key (string/capitalize (dog-mission/translate param-key)))
        (text-field param-key-1 errors-1)
        (text-field param-key-2 errors-2)))))

 (defmethod condition-control :integer
-  [entity-key property-key]
-  (number-condition-control entity-key property-key))
+  [& args]
+  (apply number-condition-control args))

 (defmethod condition-control :decimal
-  [entity-key property-key]
-  (number-condition-control entity-key property-key))
+  [& args]
+  (apply number-condition-control args))

 (defmethod condition-control :boolean
-  [entity-key property-key]
-  (let [param-key (param-key entity-key property-key)]
+  [entity-class-key property-key]
+  (let [param-key (param-key entity-class-key property-key)]
     [:div.form-group
      (label param-key (string/capitalize (dog-mission/translate param-key)))
-     (drop-down {:class "form-control"} param-key (map (partial format-property-param entity-key property-key) [nil true false]) (format-property-param entity-key property-key (get-in *request* [:entity-params param-key])))]))
+     (drop-down {:class "form-control"} param-key (map (partial format-property-param entity-class-key property-key) [nil true false]) (format-property-param entity-class-key property-key (get-in *request* [:entity-params param-key])))]))

 (defn- date-timestamp-condition-control
-  [entity-key property-key]
-  (let [param-key   (param-key entity-key property-key)
+  [entity-class-key property-key]
+  (let [param-key   (param-key entity-class-key property-key)
         param-key-1 (keyword (format "%s-1--" (name param-key)))
         param-key-2 (keyword (format "%s-2--" (name param-key)))
         errors-1    (not-empty (get-in *request* [:entity-param-errors param-key-1]))
@@ -414,13 +415,13 @@
               [:div.form-group
                (if errors
                  {:class "has-error has-feedback"})
-               [:div.input-group.date {:data-type (:type (property-schema entity-key property-key))}
+               [:div.input-group.date {:data-type (:type (property-schema entity-class-key property-key))}
                 (hiccup.form/text-field
                  {:class "form-control"}
                  param-key
                  (if errors
                    (get-in *request* [:params param-key])
-                   (format-property-param entity-key property-key (get-in *request* [:entity-params param-key]))))
+                   (format-property-param entity-class-key property-key (get-in *request* [:entity-params param-key]))))
                 [:span.input-group-addon
                  [:span.glyphicon.glyphicon-calendar]]]])]
       (list
@@ -429,28 +430,28 @@
        (text-field param-key-2 errors-2)))))

 (defmethod condition-control :date
-  [entity-key property-key]
-  (date-timestamp-condition-control entity-key property-key))
+  [& args]
+  (apply date-timestamp-condition-control args))

 (defmethod condition-control :timestamp
-  [entity-key property-key]
-  (date-timestamp-condition-control entity-key property-key))
+  [& args]
+  (apply date-timestamp-condition-control args))

 (defmethod condition-control :many-to-one
-  [entity-key property-key]
-  (let [param-key          (param-key entity-key property-key)
+  [entity-class-key property-key]
+  (let [param-key          (param-key entity-class-key property-key)
         param-key-key      (keyword (format "%s-key"    (name param-key)))
         param-key-name-key (keyword (format "%s-name--" (name param-key-key)))]
     [:div.form-group
      (label param-key-key (string/capitalize (dog-mission/translate param-key)))
      (hidden-field param-key-key (get-in *request* [:entity-params param-key-key]))
      [:div.input-group
-      (text-field {:class "form-control", :readonly "readonly"} param-key-name-key (format-property-param entity-key property-key (get-in *request* [:entity-params param-key-name-key])))
-      [:span.input-group-addon {:data-open-window-uri (to-uri (<< "/~(name (:table-key (property-schema entity-key property-key)))/select?target-element-id=~(URLEncoder/encode (name param-key-key))"))}
+      (text-field {:class "form-control", :readonly "readonly"} param-key-name-key (format-property-param entity-class-key property-key (get-in *request* [:entity-params param-key-name-key])))
+      [:span.input-group-addon {:data-open-window-uri (to-uri (<< "/~(name (:table-key (property-schema entity-class-key property-key)))/select?target-element-id=~(URLEncoder/encode (name param-key-key))"))}
        [:span.glyphicon.glyphicon-search]]]]))

 (defmethod condition-control :default
-  [entity-key property-key]
+  [entity-class-key property-key]
   nil)

 (defn pagination-control
@@ -470,7 +471,7 @@
      (pagination-item-control "»" (< page page-count) false page-count)]))

 (defn search-condition-panel
-  [entity-key & [params]]
+  [entity-class-key & [params]]
   [:div.panel.panel-default
    [:div.panel-heading
     [:div.panel-title (string/capitalize (dog-mission/translate :search-condition))]]
@@ -481,36 +482,36 @@
      (map (fn [[param-name param-value]]
             (hidden-field param-name param-value))
           params)
-     (map (partial condition-control entity-key) (search-condition-property-keys entity-key))
+     (map (partial condition-control entity-class-key) (search-condition-property-keys entity-class-key))
      [:button.btn.btn-primary {:type "submit", :name :command, :value "search"}
       (string/capitalize (dog-mission/translate :search))])]])

 ;; controls for input value.

 (defmulti input-control
-  (fn [entity-key entity property-key] (property-type entity-key property-key)))
+  (fn [entity-class-key entity property-key] (property-type entity-class-key property-key)))

 (defn- string-input-control
-  [entity-key entity property-key]
-  (let [param-key (param-key entity-key property-key)
+  [entity-class-key entity property-key]
+  (let [param-key (param-key entity-class-key property-key)
         errors    (not-empty (get-in *request* [:entity-param-errors param-key]))]
     [:div.form-group
      (if errors
        {:class "has-error has-feedback"})
      (label param-key (string/capitalize (dog-mission/translate param-key)))
-     (text-field {:class "form-control", :placeholder (placeholder entity-key property-key)} param-key (format-property-param entity-key property-key (get entity property-key)))]))
+     (text-field {:class "form-control", :placeholder (placeholder entity-class-key property-key)} param-key (format-property-param entity-class-key property-key (get entity property-key)))]))

 (defmethod input-control :string
-  [entity-key entity property-key]
-  (string-input-control entity-key entity property-key))
+  [& args]
+  (apply string-input-control args))

 (defmethod input-control :text
-  [entity-key entity property-key]
-  (string-input-control entity-key entity property-key))
+  [& args]
+  (apply string-input-control args))

 (defn- number-input-control
-  [entity-key entity property-key]
-  (let [param-key (param-key entity-key property-key)
+  [entity-class-key entity property-key]
+  (let [param-key (param-key entity-class-key property-key)
         errors    (not-empty (get-in *request* [:entity-param-errors param-key]))]
     [:div.form-group
      (if errors
@@ -521,55 +522,55 @@
       param-key
       (if errors
         (get-in *request* [:params param-key])
-        (format-property-param entity-key property-key (get entity property-key))))]))
+        (format-property-param entity-class-key property-key (get entity property-key))))]))

 (defmethod input-control :integer
-  [entity-key entity property-key]
-  (number-input-control entity-key entity property-key))
+  [& args]
+  (apply number-input-control args))

 (defmethod input-control :decimal
-  [entity-key entity property-key]
-  (number-input-control entity-key entity property-key))
+  [& args]
+  (apply number-input-control args))

 (defmethod input-control :boolean
-  [entity-key entity property-key]
-  (let [param-key (param-key entity-key property-key)
+  [entity-class-key entity property-key]
+  (let [param-key (param-key entity-class-key property-key)
         errors    (not-empty (get-in *request* [:entity-param-errors param-key]))]
     [:div.form-group
      (if errors
        {:class "has-error has-feedback"})
      (label param-key (string/capitalize (dog-mission/translate param-key)))
-     (drop-down {:class "form-control"} param-key (map (partial format-property-param entity-key property-key) [nil true false]) (format-property-param entity-key property-key (get entity property-key)))]))
+     (drop-down {:class "form-control"} param-key (map (partial format-property-param entity-class-key property-key) [nil true false]) (format-property-param entity-class-key property-key (get entity property-key)))]))

 (defn- date-timestamp-input-control
-  [entity-key entity property-key]
-  (let [param-key (param-key entity-key property-key)
+  [entity-class-key entity property-key]
+  (let [param-key (param-key entity-class-key property-key)
         errors    (not-empty (get-in *request* [:entity-param-errors param-key]))]
     [:div.form-group
      (if errors
        {:class "has-error has-feedback"})
      (label param-key (string/capitalize (dog-mission/translate param-key)))
-     [:div.input-group.date {:data-type (:type (property-schema entity-key property-key))}
+     [:div.input-group.date {:data-type (:type (property-schema entity-class-key property-key))}
       (hiccup.form/text-field
        {:class "form-control"}
        param-key
        (if errors
          (get-in *request* [:params param-key])
-         (format-property-param entity-key property-key (get entity property-key))))
+         (format-property-param entity-class-key property-key (get entity property-key))))
       [:span.input-group-addon
        [:span.glyphicon.glyphicon-calendar]]]]))

 (defmethod input-control :date
-  [entity-key entity property-key]
-  (date-timestamp-input-control entity-key entity property-key))
+  [entity-class-key entity property-key]
+  (date-timestamp-input-control entity-class-key entity property-key))

 (defmethod input-control :timestamp
-  [entity-key entity property-key]
-  (date-timestamp-input-control entity-key entity property-key))
+  [entity-class-key entity property-key]
+  (date-timestamp-input-control entity-class-key entity property-key))

 (defmethod input-control :many-to-one
-  [entity-key entity property-key]
-  (let [param-key          (param-key entity-key property-key)
+  [entity-class-key entity property-key]
+  (let [param-key          (param-key entity-class-key property-key)
         param-key-key      (keyword (format "%s-key"    (name param-key)))
         param-key-name-key (keyword (format "%s-name--" (name param-key-key)))
         errors             (get-in *request* [:entity-pararam-errors param-key])]
@@ -579,51 +580,51 @@
      (label param-key-key (string/capitalize (dog-mission/translate param-key)))
      (hidden-field param-key-key (get entity (many-to-one-relationship-key-to-physical-column-key property-key)))
      [:div.input-group
-      (text-field {:class "form-control", :readonly "readonly"} param-key-name-key (format-property-param entity-key property-key (get entity property-key)))
-      [:span.input-group-addon {:data-open-window-uri (to-uri (<< "/~(name (:table-key (property-schema entity-key property-key)))/select?target-element-id=~(URLEncoder/encode (name param-key-key))"))}
+      (text-field {:class "form-control", :readonly "readonly"} param-key-name-key (format-property-param entity-class-key property-key (get entity property-key)))
+      [:span.input-group-addon {:data-open-window-uri (to-uri (<< "/~(name (:table-key (property-schema entity-class-key property-key)))/select?target-element-id=~(URLEncoder/encode (name param-key-key))"))}
        [:span.glyphicon.glyphicon-search]]]]))

 (defmethod input-control :one-to-many
-  [entity-key entity property-key]
-  (let [param-key (param-key entity-key property-key)]
+  [entity-class-key entity property-key]
+  (let [param-key (param-key entity-class-key property-key)]
     [:div.form-group
      (label param-key (string/capitalize (dog-mission/translate param-key)))
-     (text-field {:class "form-control", :disabled "disabled"} param-key (format-property-param entity-key property-key (get entity property-key)))]))
+     (text-field {:class "form-control", :disabled "disabled"} param-key (format-property-param entity-class-key property-key (get entity property-key)))]))

 (defmethod input-control :default
-  [entity-key entity property-key]
+  [entity-class-key entity property-key]
   nil)

 (defn input-form-panel
-  [entity-key entity method uri submit-button-caption]
+  [entity-class-key entity method uri submit-button-caption]
   (form-to
    [method uri]
    (hidden-field :index-params (get-in *request* [:params :index-params]))
-   (map (partial input-control entity-key entity) (property-keys entity-key))
+   (map (partial input-control entity-class-key entity) (property-keys entity-class-key))
    [:p
     (submit-button {:class "btn btn-primary"} (string/capitalize (dog-mission/translate submit-button-caption)))
     " "
-    (link-to-with-method-and-params {:class "btn btn-default"} (<< "/~(name entity-key)") :get (base64-decode (get-in *request* [:params :index-params])) (string/capitalize (dog-mission/translate :back)))]))
+    (link-to-with-method-and-params {:class "btn btn-default"} (<< "/~(name entity-class-key)") :get (base64-decode (get-in *request* [:params :index-params])) (string/capitalize (dog-mission/translate :back)))]))

 ;; views.

 (defn list-entities-panel
-  [entity-key entities page-count page entity-command-fn command-fn]
+  [entity-class-key entities page-count page entity-command-fn command-fn]
   (if entities
     (list [:table.table.table-condensed.table-hover
            [:thead
             [:tr
              (map (fn [property-key]
-                    [:th (string/capitalize (dog-mission/translate (param-key entity-key property-key)))])
-                  (list-property-keys entity-key))
+                    [:th (string/capitalize (dog-mission/translate (param-key entity-class-key property-key)))])
+                  (list-property-keys entity-class-key))
              [:th]]]
            [:tbody
             (map (fn [entity]
                    [:tr
                     (map (fn [property-key]
                            [:td
-                            [:div (format-property-param entity-key property-key (get entity property-key))]])
-                         (list-property-keys entity-key))
+                            [:div (format-property-param entity-class-key property-key (get entity property-key))]])
+                         (list-property-keys entity-class-key))
                     [:td.command-cell
                      (entity-command-fn entity)]])
                  entities)]]
@@ -631,33 +632,33 @@
           [:p (command-fn)])))

 (defn index-view
-  [entity-key & [entities page-count page]]
-  (layout (string/capitalize (dog-mission/translate :list-view-title (dog-mission/translate entity-key)))
+  [entity-class-key & [entities page-count page]]
+  (layout (string/capitalize (dog-mission/translate :list-view-title (dog-mission/translate entity-class-key)))
           [:div.row
-           [:div.col-md-3 (search-condition-panel entity-key)]
-           [:div.col-md-9 (list-entities-panel    entity-key entities page-count page
+           [:div.col-md-3 (search-condition-panel entity-class-key)]
+           [:div.col-md-9 (list-entities-panel    entity-class-key entities page-count page
                                                   (fn [entity]
                                                     (list (link-to-with-method-and-params
-                                                           {:class "btn btn-primary btn-xs"} (<< "/~(name entity-key)/~(:key entity)/edit") :get {:index-params (base64-encode (:query-params *request*))}
+                                                           {:class "btn btn-primary btn-xs"} (<< "/~(name entity-class-key)/~(:key entity)/edit") :get {:index-params (base64-encode (:query-params *request*))}
                                                            [:span.glyphicon.glyphicon-pencil])
                                                           " "
                                                           (link-to-with-method-and-params
-                                                           {:class "btn btn-danger btn-xs", :data-confirm (string/capitalize (dog-mission/translate :are-you-sure?))} (<< "/~(name entity-key)/~(:key entity)") :delete {:index-params (base64-encode (:query-params *request*))}
+                                                           {:class "btn btn-danger btn-xs", :data-confirm (string/capitalize (dog-mission/translate :are-you-sure?))} (<< "/~(name entity-class-key)/~(:key entity)") :delete {:index-params (base64-encode (:query-params *request*))}
                                                            [:span.glyphicon.glyphicon-trash])))
                                                   (fn []
-                                                    (link-to-with-method-and-params {:class "btn btn-primary"} (<< "/~(name entity-key)/new") :get {:index-params (base64-encode (:query-params *request*))} (string/capitalize (dog-mission/translate :new)))))]]))
+                                                    (link-to-with-method-and-params {:class "btn btn-primary"} (<< "/~(name entity-class-key)/new") :get {:index-params (base64-encode (:query-params *request*))} (string/capitalize (dog-mission/translate :new)))))]]))

 (defn select-view
-  [entity-key & [entities page-count page]]
+  [entity-class-key & [entities page-count page]]
   (let [target-element-id           (get-in *request* [:params :target-element-id])
-        representative-property-key (representative-property-key entity-key)]
-    (layout (string/capitalize (dog-mission/translate :select-view-title (dog-mission/translate entity-key)))
+        representative-property-key (representative-property-key entity-class-key)]
+    (layout (string/capitalize (dog-mission/translate :select-view-title (dog-mission/translate entity-class-key)))
             [:div.row
-             [:div.col-md-3 (search-condition-panel entity-key {:target-element-id (get-in *request* [:params :target-element-id])})]
-             [:div.col-md-9 (list-entities-panel    entity-key entities page-count page
+             [:div.col-md-3 (search-condition-panel entity-class-key {:target-element-id (get-in *request* [:params :target-element-id])})]
+             [:div.col-md-9 (list-entities-panel    entity-class-key entities page-count page
                                                     (fn [entity]
                                                       (link-to-javascript
-                                                       {:class "btn btn-primary btn-xs"} (<< "$.crossplane.setOpenerSelectProperty('~{target-element-id}', '~(:key entity)', '~(format-property-param entity-key representative-property-key (get entity representative-property-key))'); window.close()")
+                                                       {:class "btn btn-primary btn-xs"} (<< "$.crossplane.setOpenerSelectProperty('~{target-element-id}', '~(:key entity)', '~(format-property-param entity-class-key representative-property-key (get entity representative-property-key))'); window.close()")
                                                        [:span.glyphicon.glyphicon-link]))
                                                     (fn []
                                                       (let [target-element-id (get-in *request* [:params :target-element-id])]
@@ -666,36 +667,36 @@
                                                               (link-to-javascript {:class "btn btn-default"} "window.close()" (string/capitalize (dog-mission/translate :cancel)))))))]])))

 (defn new-view
-  [entity-key entity]
-  (layout (string/capitalize (dog-mission/translate :new-view-title (dog-mission/translate entity-key)))
-          (input-form-panel entity-key entity :post (<< "/~(name entity-key)") :create)))
+  [entity-class-key entity]
+  (layout (string/capitalize (dog-mission/translate :new-view-title (dog-mission/translate entity-class-key)))
+          (input-form-panel entity-class-key entity :post (<< "/~(name entity-class-key)") :create)))

 (defn edit-view
-  [entity-key entity]
-  (layout (string/capitalize (dog-mission/translate :edit-view-title (dog-mission/translate entity-key)))
-          (input-form-panel entity-key entity :patch (<< "/~(name entity-key)/~(:key entity)") :update)))
+  [entity-class-key entity]
+  (layout (string/capitalize (dog-mission/translate :edit-view-title (dog-mission/translate entity-class-key)))
+          (input-form-panel entity-class-key entity :patch (<< "/~(name entity-class-key)/~(:key entity)") :update)))

 ;; Controllers.

 (defmulti condition
-  (fn [entity-key property-key] (property-type entity-key property-key)))
+  (fn [entity-class-key property-key] (property-type entity-class-key property-key)))

 (defn- string-condition
-  [entity-key property-key]
-  (if-let [param-value (get-in *request* [:entity-params (param-key entity-key property-key)])]
+  [entity-class-key property-key]
+  (if-let [param-value (get-in *request* [:entity-params (param-key entity-class-key property-key)])]
     ($like property-key (format "%%%s%%" param-value))))

 (defmethod condition :string
-  [entity-key property-key]
-  (string-condition entity-key property-key))
+  [& args]
+  (apply string-condition args))

 (defmethod condition :text
-  [entity-key property-key]
-  (string-condition entity-key property-key))
+  [& args]
+  (apply string-condition args))

 (defn- range-condition
-  [entity-key property-key]
-  (let [param-key (param-key entity-key property-key)]
+  [entity-class-key property-key]
+  (let [param-key (param-key entity-class-key property-key)]
     (if-let [conditions (not-empty (keep identity [(if-let [param-value (get-in *request* [:entity-params (keyword (format "%s-1--" (name param-key)))])]
                                                      ($>= property-key param-value))
                                                    (if-let [param-value (get-in *request* [:entity-params (keyword (format "%s-2--" (name param-key)))])]
@@ -703,131 +704,131 @@
       (apply $and conditions))))

 (defmethod condition :integer
-  [entity-key property-key]
-  (range-condition entity-key property-key))
+  [& args]
+  (apply range-condition args))

 (defmethod condition :decimal
-  [entity-key property-key]
-  (range-condition entity-key property-key))
+  [& args]
+  (apply range-condition args))

 (defmethod condition :boolean
-  [entity-key property-key]
-  (let [param-value (get-in *request* [:entity-params (param-key entity-key property-key)])]
+  [entity-class-key property-key]
+  (let [param-value (get-in *request* [:entity-params (param-key entity-class-key property-key)])]
     (if-not (nil? param-value)
       (if param-value
         property-key
         ($not property-key)))))

 (defmethod condition :date
-  [entity-key property-key]
-  (range-condition entity-key property-key))
+  [& args]
+  (apply range-condition args))

 (defmethod condition :timestamp
-  [entity-key property-key]
-  (range-condition entity-key property-key))
+  [& args]
+  (apply range-condition args))

 (defmethod condition :many-to-one
-  [entity-key property-key]
-  (if-let [param-value (get-in *request* [:entity-params (keyword (format "%s-key" (name (param-key entity-key property-key))))])]
+  [entity-class-key property-key]
+  (if-let [param-value (get-in *request* [:entity-params (keyword (format "%s-key" (name (param-key entity-class-key property-key))))])]
     ($= (many-to-one-relationship-key-to-physical-column-key property-key) param-value)))

 (defmethod condition :default
-  [entity-key property-key]
+  [entity-class-key property-key]
   nil)

 (defn condition-matched-entities-and-page
-  [entity-key]
+  [entity-class-key]
   (if (and (= (get-in *request* [:params :command]) "search") (empty? (:entity-param-errors *request*)))
-    (let [pages      (->> (-> (->> (if-let [conditions (not-empty (keep (partial condition entity-key) (search-condition-property-keys entity-key)))]
-                                     (apply $and conditions))
-                                   (database-data @database-schema *transaction* entity-key)
-                                   (database      @database-schema))
-                              (get-condition-matched-rows entity-key))
-                          ((apply partial sort-by (sort-keyfn-and-comp entity-key)))
-                          (partition-all 20)
-                          (not-empty))
-          page-count (count pages)
-          page       (let [request-page (Integer/parseInt (get-in *request* [:params :page]))]
-                       (max (min request-page page-count) 1))]
-      [(if (empty? pages)
+    (let [entity-pages (->> (-> (->> (if-let [conditions (not-empty (keep (partial condition entity-class-key) (search-condition-property-keys entity-class-key)))]
+                                       (apply $and conditions))
+                                     (database-data @database-schema *transaction* entity-class-key)
+                                     (database      @database-schema))
+                                (get-condition-matched-rows entity-class-key))
+                            ((apply partial sort-by (sort-keyfn-and-comp entity-class-key)))
+                            (partition-all 20)
+                            (not-empty))
+          page-count   (count entity-pages)
+          page         (let [request-page (Integer/parseInt (get-in *request* [:params :page]))]
+                         (max (min request-page page-count) 1))]
+      [(if (empty? entity-pages)
          []
-         (nth pages (dec page)))
+         (nth entity-pages (dec page)))
        page-count
        page])))

-(defn target-entity-database
-  [entity-key uri-parameters]
-  (->> (database-data @database-schema *transaction* entity-key ($= :key (UUID/fromString (:key uri-parameters))))
+(defn target-contained-database
+  [entity-class-key uri-parameters]
+  (->> (database-data @database-schema *transaction* entity-class-key ($= :key (UUID/fromString (:key uri-parameters))))
        (database      @database-schema)))

 (defn index-controller
-  [entity-key uri-parameters]
+  [entity-class-key uri-parameters]
   (with-db-transaction'
-    (apply index-view entity-key (condition-matched-entities-and-page entity-key))))
+    (apply index-view entity-class-key (condition-matched-entities-and-page entity-class-key))))

 (defn select-controller
-  [entity-key uri-parameters]
+  [entity-class-key uri-parameters]
   (with-db-transaction'
-    (apply select-view entity-key (condition-matched-entities-and-page entity-key))))
+    (apply select-view entity-class-key (condition-matched-entities-and-page entity-class-key))))

 (defn new-controller
-  [entity-key uri-parameters]
-  (new-view entity-key {}))
+  [entity-class-key uri-parameters]
+  (new-view entity-class-key {}))

 (defn create-controller
-  [entity-key uri-parameters]
+  [entity-class-key uri-parameters]
   (with-db-transaction'
-    (let [entity-schema (entity-schema entity-key)
-          entity        (->> (reduce (fn [entity property-key]
-                                       (let [many-to-one? (= (property-type entity-key property-key) :many-to-one)
-                                             column-key   (cond-> property-key
-                                                            many-to-one? (many-to-one-relationship-key-to-physical-column-key))
-                                             param-key    (cond-> (param-key entity-key property-key)
-                                                            many-to-one? (#(keyword (format "%s-key" (name %)))))
-                                             errors       (not-empty (get-in *request* [:entity-param-errors param-key]))]
-                                         (cond-> entity
-                                           (not errors) (assoc column-key (get-in *request* [:entity-params param-key])))))
-                                     {}
-                                     (inputtable-property-keys entity-key)))]
+    (let [entity-class-schema (entity-class-schema entity-class-key)
+          entity              (->> (reduce (fn [entity property-key]
+                                             (let [many-to-one? (= (property-type entity-class-key property-key) :many-to-one)
+                                                   column-key   (cond-> property-key
+                                                                  many-to-one? (many-to-one-relationship-key-to-physical-column-key))
+                                                   param-key    (cond-> (param-key entity-class-key property-key)
+                                                                  many-to-one? (#(keyword (format "%s-key" (name %)))))
+                                                   errors       (not-empty (get-in *request* [:entity-param-errors param-key]))]
+                                               (cond-> entity
+                                                 (not errors) (assoc column-key (get-in *request* [:entity-params param-key])))))
+                                           {}
+                                           (inputtable-property-keys entity-class-key)))]
       (if (not-empty (get-in *request* [:entity-param-errors]))
-        (new-view entity-key entity)
+        (new-view entity-class-key entity)
         (let [database (-> (database @database-schema)
-                           (assoc-in [entity-key (new-key)] entity))]
+                           (assoc-in [entity-class-key (new-key)] entity))]
           (save! @database-schema database *transaction*)
-          (layout (string/capitalize (dog-mission/translate :update-view-title (dog-mission/translate entity-key)))
-                  (javascript-tag (<< "$.crossplane.goToWithMethodAndParams('~(to-uri (<< \"/~(name entity-key)\"))', 'get', ~(json/write-str (base64-decode (get-in *request* [:params :index-params]))));"))))))))
-
+          (layout (string/capitalize (dog-mission/translate :update-view-title (dog-mission/translate entity-class-key)))
+                  (javascript-tag (<< "$.crossplane.goToWithMethodAndParams('~(to-uri (<< \"/~(name entity-class-key)\"))', 'get', ~(json/write-str (base64-decode (get-in *request* [:params :index-params]))));"))))))))
+
 (defn edit-controller
-  [entity-key uri-parameters]
+  [entity-class-key uri-parameters]
   (with-db-transaction'
-    (edit-view entity-key (get-in (target-entity-database entity-key uri-parameters) [entity-key (UUID/fromString (:key uri-parameters))]))))
+    (edit-view entity-class-key (get-in (target-contained-database entity-class-key uri-parameters) [entity-class-key (UUID/fromString (:key uri-parameters))]))))

 (defn update-controller
-  [entity-key uri-parameters]
+  [entity-class-key uri-parameters]
   (with-db-transaction'
-    (let [entity-schema (entity-schema entity-key)
-          database      (->> (reduce (fn [database property-key]
-                                       (let [many-to-one? (= (property-type entity-key property-key) :many-to-one)
-                                             column-key   (cond-> property-key
-                                                            many-to-one? (many-to-one-relationship-key-to-physical-column-key))
-                                             param-key    (cond->> (param-key entity-key property-key)
-                                                            many-to-one? (#(keyword (format "%s-key" (name %)))))
-                                             errors       (not-empty (get-in *request* [:entity-param-errors param-key]))]
-                                         (cond-> database
-                                           (not errors) (assoc-in [entity-key (UUID/fromString (:key uri-parameters)) column-key] (get-in *request* [:entity-params param-key])))))
-                                     (target-entity-database entity-key uri-parameters)
-                                     (inputtable-property-keys entity-key)))]
+    (let [entity-class-schema (entity-class-schema entity-class-key)
+          database            (->> (reduce (fn [database property-key]
+                                             (let [many-to-one? (= (property-type entity-class-key property-key) :many-to-one)
+                                                   column-key   (cond-> property-key
+                                                                  many-to-one? (many-to-one-relationship-key-to-physical-column-key))
+                                                   param-key    (cond->> (param-key entity-class-key property-key)
+                                                                  many-to-one? (#(keyword (format "%s-key" (name %)))))
+                                                   errors       (not-empty (get-in *request* [:entity-param-errors param-key]))]
+                                               (cond-> database
+                                                 (not errors) (assoc-in [entity-class-key (UUID/fromString (:key uri-parameters)) column-key] (get-in *request* [:entity-params param-key])))))
+                                           (target-contained-database entity-class-key uri-parameters)
+                                           (inputtable-property-keys entity-class-key)))]
       (if (not-empty (get-in *request* [:entity-param-errors]))
-        (edit-view entity-key (get-in database [entity-key (UUID/fromString (:key uri-parameters))]))
+        (edit-view entity-class-key (get-in database [entity-class-key (UUID/fromString (:key uri-parameters))]))
         (do (save! @database-schema database *transaction*)
-            (layout (string/capitalize (dog-mission/translate :update-view-title (dog-mission/translate entity-key)))
-                    (javascript-tag (<< "$.crossplane.goToWithMethodAndParams('~(to-uri (<< \"/~(name entity-key)\"))', 'get', ~(json/write-str (base64-decode (get-in *request* [:params :index-params]))));"))))))))
+            (layout (string/capitalize (dog-mission/translate :update-view-title (dog-mission/translate entity-class-key)))
+                    (javascript-tag (<< "$.crossplane.goToWithMethodAndParams('~(to-uri (<< \"/~(name entity-class-key)\"))', 'get', ~(json/write-str (base64-decode (get-in *request* [:params :index-params]))));"))))))))

 (defn destroy-controller
-  [entity-key uri-parameters]
-  (layout (string/capitalize (dog-mission/translate :destroy-view-title (dog-mission/translate entity-key)))
+  [entity-class-key uri-parameters]
+  (layout (string/capitalize (dog-mission/translate :destroy-view-title (dog-mission/translate entity-class-key)))
           (list [:p "destroy"]
-                (link-to-with-method-and-params {:class "btn btn-default"} (to-uri (<< "/~(name entity-key)")) :get (base64-decode (get-in *request* [:params :index-params])) (string/capitalize (dog-mission/translate :back))))))
+                (link-to-with-method-and-params {:class "btn btn-default"} (to-uri (<< "/~(name entity-class-key)")) :get (base64-decode (get-in *request* [:params :index-params])) (string/capitalize (dog-mission/translate :back))))))

 ;; Rouring.

@@ -852,4 +853,4 @@
                     [:get    "/%s/:key/edit" edit-controller]
                     [:patch  "/%s/:key"      update-controller]
                     [:delete "/%s/:key"      destroy-controller]])
-            (entity-keys)))))
+            (entity-class-keys)))))


Add some validation to checkout

Add some validation to checkout

--- src/circle/backend/action/vcs.clj
+++ src/circle/backend/action/vcs.clj
@@ -1,6 +1,8 @@
 (ns circle.backend.action.vcs
   (:require [clj-url.core :as url])
+  (:use [circle.utils.except :only (throw-if-not)])
   (:use [circle.backend.action :only (defaction)])
+  (:use [clojure.tools.logging :only (infof)])
   (:require [circle.backend.action.bash :as bash])
   (:use [circle.backend.build :only (*pwd*)])
   (:use [circle.backend.action.bash :only (remote-bash)])
@@ -21,6 +23,8 @@
                           vcs))

 (defmethod checkout-impl :git [{:keys [build url path revision]}]
+  (throw-if-not (pos? (.length url)) "url must be non-empty")
+  (throw-if-not (pos? (.length path)) "path must be non-empty")
   (println "checking out" url " to " path)
   (if revision
     (remote-bash build [(git clone ~url ~path --no-checkout)


Wrap re-seq in doseqres.

Wrap re-seq in doseqres.

This navigates to each match, not a sequence of matches.

--- src/clj/com/rpl/specter/navs.cljc
+++ src/clj/com/rpl/specter/navs.cljc
@@ -627,7 +627,8 @@
   regex*
   [re]
   (select* [this vals structure next-fn]
-           (next-fn vals (re-seq re structure)))
+           (doseqres NONE [s (re-seq re structure)]
+                     (next-fn vals s)))
   #_(transform* [this vals structure next-fn]
                 (next-fn (clojure.string/replace structure re vals))))


Add get-value, set-text and replace-node to clojure.browser.dom.

--- src/cljs/clojure/browser/dom.cljs
+++ src/cljs/clojure/browser/dom.cljs
@@ -102,5 +102,34 @@
 (defn insert-at [parent child index]
   (gdom/insertChildAt parent child index))

+(defn ensure-element
+  "Coerce the argument to a dom element if possible."
+  [e]
+  (cond (keyword? e) (get-element e)
+        (string? e) (html->dom e)
+        :else e))
+
+(defn replace-node
+  "Replace old-node with new-node. old-node can be an element or a
+   keyword which is the id of the node to replace.  new-node can be an
+   element or an html string."
+  [old-node new-node]
+  (let [old-node (ensure-element old-node)
+        new-node (ensure-element new-node)]
+    (gdom/replaceNode new-node old-node)
+    new-node))
+
+(defn set-text
+  "Set the text content for the passed element returning the
+  element. If a keyword is passed in the place of e, the element with
+  that id will be used and returned."
+  [e s]
+  (gdom/setTextContent (ensure-element e) s))
+
+(defn get-value
+  "Get the value of an element."
+  [e]
+  (.value (ensure-element e)))
+
 ;; TODO CSS class manipulation
 ;; TODO Query syntax


watchable games by default

watchable games by default

--- src/cljs/netrunner/gamelobby.cljs
+++ src/cljs/netrunner/gamelobby.cljs
@@ -50,7 +50,7 @@
    (fn [user]
      (om/set-state! owner :title (str (:username user) "'s game"))
      (om/set-state! owner :editing true)
-     (om/set-state! owner :allowspectator false)
+     (om/set-state! owner :allowspectator true)
      (-> ".game-title" js/$ .select))))

 (defn create-game [cursor owner]
@@ -199,7 +199,7 @@
                                 :value (:title state) :placeholder "Title"}]
             [:p.flash-message (:flash-message state)]
             [:label
-             [:input {:type "checkbox"
+             [:input {:type "checkbox" :checked (om/get-state owner :allowspectator)
                       :on-change #(om/set-state! owner :allowspectator (.. % -target -checked))}]
              "Allow spectators"]]
            (when-let [game (some #(when (= gameid (:gameid %)) %) games)]


spec to the main frame

spec to the main frame

--- src/cljs/triboard/view/frame.cljs
+++ src/cljs/triboard/view/frame.cljs
@@ -1,10 +1,17 @@
 (ns triboard.view.frame
   (:require
+    [cljs.spec :as s]
     [triboard.logic.turn :as turn]
     [triboard.view.board :as board]
+    [triboard.view.callbacks :as cb]
     [triboard.view.panel :as panel]
     ))

+(s/fdef main-frame
+  :args (s/tuple
+          ::turn/turn
+          (s/fspec :args (s/tuple ::board/coord) :ret any?)
+          #(satisfies? cb/CallBacks %)))

 (defn main-frame
   [turn suggestions interactions]


remove goloop

remove goloop

--- src/cljs/tumblrsearch/search.cljs
+++ src/cljs/tumblrsearch/search.cljs
@@ -1,6 +1,8 @@
 (ns tumblrsearch.search
-  (:require [cljs.core.async :as async :refer  [put! chan >! alts! timeout]])
-  (:require-macros  cljs.core.async.macros :refer [go])
+  (:require
+    [cljs.core.async :as async :refer [put! chan >! <! alts! timeout]]
+    [om.core :as om :include-macros true])
+  (:require-macros [cljs.core.async.macros :refer [go]])
   (:import [goog.net Jsonp]
            [goog Uri]))

@@ -17,7 +19,7 @@
         ch  (chan)]
     (.send req nil #(put! ch %))
     (go (let [[v c] (alts! [t ch])]
-          (case
+          (cond
             ; timeout
             (= c t)
             (>! ajax-chan {:error :timeout})
@@ -25,9 +27,10 @@
             (not (= (.. v -meta -status) 200))
             (>! ajax-chan {:error :ajax})
             ; response OK
+            :else
             (let [items (-> (.. v -response)
                             (js->clj :keywordize-keys true)
-                            (#(filter #(= (:type %) "photo"))))]
+                            (#(filter (fn [item] (= (:type item) "photo")))))]
               (>! ajax-chan {:error false
                              :search-term search-term
                              :items items})))))))
@@ -43,29 +46,30 @@
 ;; -----------------------------------------------------------------------------

 (defn init [data ajax-chan]
-  (go-loop []
-    (let [response (<! ajax-chan)]
-      (when (and (= (:current-state @data) :loading)
-                 (= (:current-search @data)
-                    (:search-term response)))
-      (cond
-        ; error
-        (:error response)
-        (om/transact! data
-          #(assoc % :current-state :error
-                    :error (:error response)))
-        ; empty response
-        (empty? (:items response))
-        (if (empty? (:current-items @data))
+  (go (loop []
+      (let [response (<! ajax-chan)]
+      (when
+        (and (= (:current-state @data) :loading)
+             (= (:current-search @data)
+                (:search-term response)))
+        (cond
+          ; error
+          (:error response)
           (om/transact! data
             #(assoc % :current-state :error
-                      :error :empty-search))
-          (om/transact! data
-            #(assoc % :current-state :loaded-final)))
-        :else
-        (om/transact! data
-          #(assoc % :current-state :loaded
-                    :current-items (concat (:current-items @data)
-                                           (:items response))
-                    :before (:timestamp (last (response :items)))))))
-      (recur))))
+                      :error (:error response)))
+          ; empty response
+          (empty? (:items response))
+          (if (empty? (:current-items @data))
+            (om/transact! data
+              #(assoc % :current-state :error
+                        :error :empty-search))
+            (om/transact! data
+              #(assoc % :current-state :loaded-final)))
+          :else
+          (om/transact! data
+            #(assoc % :current-state :loaded
+                      :current-items (concat (:current-items @data)
+                                            (:items response))
+                      :before (:timestamp (last (response :items)))))))
+      (recur)))))