Add additional test functionality

Add additional test functionality

Looks like my last run wasn't so great after all.
Now comparing directly to NUM_INFORMED, to see if we
can win, using a small set of graphs.

--- src/spellcast/core.clj
+++ src/spellcast/core.clj
@@ -312,8 +312,8 @@
 (defn mk-graph
   "[[x y]] -> Graph
   assumes points are connected"
-  [points]
-  (Graph. 1.0 1.1 1.2 ;; "standard" t-range, i-range, s-range
+  [t-range i-range s-range points]
+  (Graph. t-range i-range s-range
           (vec (map (fn [[x y]] (Graph$P. x y)) points))))

 ;; for repeatable results, specify seed for test vector
@@ -347,6 +347,23 @@
     (java.util.Collections/shuffle al rng)
     (clojure.lang.RT/vector (.toArray al))))

+(defn uniform-graph
+  "different strategy of generating connected graphs,
+  where points are put into boxes in order, making sure
+  they always have a neighbor"
+  [n]
+  (let [peturb (repeatedly n (fn [] [(* 0.5 (.nextDouble test-rng))
+                                     (* 0.5 (.nextDouble test-rng))]))
+        grid (for [i (range 0 25 0.5)
+                   j (range 0 25 0.5)]
+               [i j])
+
+        ;; peturb each grid point.
+        nodes (map (fn [[x y] [dx dy]] [(+ x dx) (+ y dy)])
+                   peturb
+                   (cycle grid))]
+    (mk-graph 1.0 1.1 1.2 nodes)))
+
 (def test-graphs
   (vec
     (concat
@@ -356,164 +373,196 @@
          ;  x - 1 - 2 - 5 - 6
          ;
          ;  optimal: 0 1 2 3 5
+         1.0 1.1 1.2 ;; "standard" t-range, i-range, s-range
          [[0 0] [0 1] [0 2] [1 2] [2 2] [0 3] [0 4]])]
       (for [n (range 20 200 20)]
+        (uniform-graph n))
+      (for [n (range 20 200 20)
+            i (range 3)] ; repeat each n
         ;; shuffle,
-        (mk-graph (shuffle-with test-rng (take n (rand-walk))))))))
-
-(defn error-function
-  "evalulate program inside greedy algorithm, compared to lower bound (bfs-depth).
+        (mk-graph 1.0 1.1 1.2 ;; "standard" t-range, i-range, s-range
+          (shuffle-with test-rng (take n (rand-walk))))))))
+
+(defn run-tests
+  "evalulate selector inside greedy algorithm, compared to lower bound (bfs-depth).
   For most graphs, bfs-depth is too low, so programs can't be perfect (0 vector).
   But otherwise, it's a decent function with forgiving slope."
+  [selector]
+  (vec (for [graph test-graphs]
+         (double (/ (HCABS/run graph selector)
+                    (.depth graph))))))
+
+(defn error-function
+  "evalulate push program."
   [program]
-  (let [selector (push-based-selector program)]
-    (vec (for [graph test-graphs]
-           (double (/ (HCABS/run graph selector)
-                      (.depth graph)))))))
+  (run-tests (push-based-selector program)))

 (comment (defn -main [& args]
            (println
              "test run:"
              (HCABS/run (test-graphs 0) Selector/NUM_UNINFORMED))))

-(defn -main [& args]
-  (if (not-empty args)
-    (doseq [n (range 0 (count test-graphs))]
-      (let [ps (.ps (test-graphs n))
-            x (map #(.x %) ps)
-            y (map #(.y %) ps)]
-        (spit (str "test-data-" n ".svg")
-              (chart/emit-svg
-                (-> (chart/xy-plot :width 500 :height 500
-                                   :xmin 0 :xmax 25
-                                   :ymin 0 :ymax 25
-                                   :r 1)
-                    (chart/add-points [x y] :transpose-data?? true
-                                      :fill "rgba(0,0,0,0.1)"
-                                      :size (/ 500 25))
-                    (chart/add-points [x y] :transpose-data?? true
-                                      :fill "rgba(0,255,0,1)"
-                                      :size 1))))))
-    (do
-      (pushgp
-        {:error-function error-function
-         :error-threshold (* (count test-graphs) 1.50)
-         :atom-generators '(
-                            exec_y
-                            exec_pop
-                            exec_eq
-                            exec_stackdepth
-                            exec_rot
-                            exec_when
-                            exec_do*times
-                            exec_do*count
-                            exec_s
-                            exec_do*range
-                            exec_if
-                            exec_k
-                            exec_yank
-                            exec_yankdup
-                            exec_swap
-                            exec_dup
-                            exec_shove
-
-                            boolean_pop
-                            boolean_dup
-                            boolean_swap
-                            boolean_rot
-                            boolean_flush
-                            boolean_eq
-                            boolean_stackdepth
-                            boolean_yank
-                            boolean_yankdup
-                            boolean_shove
-                            boolean_and
-                            boolean_or
-                            boolean_not
-                            boolean_xor
-                            boolean_invert_first_then_and
-                            boolean_invert_second_then_and
-                            boolean_frominteger
-
-                            integer_flush
-                            integer_stackdepth
-                            integer_yank
-                            integer_yankdup
-                            integer_shove
-                            integer_add
-                            integer_div
-                            integer_dup
-                            integer_eq
-                            integer_gt
-                            integer_lt
-                            integer_mod
-                            integer_mult
-                            integer_pop
-                            integer_rot
-                            integer_sub
-                            integer_swap
-                            integer_fromboolean
-                            integer_min
-                            integer_max
-
-                            node_pop
-                            node_dup
-                            node_swap
-                            node_rot
-                            node_flush
-                            node_eq
-                            node_stackdepth
-                            node_yank
-                            node_yankdup
-                            node_shove
-                            return_fromnode
-
-                            bitset_pop
-                            bitset_dup
-                            bitset_swap
-                            bitset_rot
-                            bitset_flush
-                            bitset_eq
-                            bitset_stackdepth
-                            bitset_yank
-                            bitset_yankdup
-                            bitset_shove
-
-                            reduce-max
-                            reduce-min
-
-                            get-time
-                            get-depth
-                            nodes-of
-                            neighbors-of
-                            interferers-of
-                            sensors-of
-                            bfs-children
-
-                            set-cardinality
-                            is-empty
-                            get-informed
-                            get-active
-                            get-able
-
-                            set-and
-                            set-or
-                            set-xor
-                            set-intersects
-                            set-get
-                            set-flip
-                            set-set
-                            set-clear
-                            in-set
-
-                            bfs-depth
-                            bfs-decendents
-                            bfs-child-count
-                            bfs-parent
-                            )
+(def atoms '(
+             exec_y
+             exec_pop
+             exec_eq
+             exec_stackdepth
+             exec_rot
+             exec_when
+             exec_do*times
+             exec_do*count
+             exec_s
+             exec_do*range
+             exec_if
+             exec_k
+             exec_yank
+             exec_yankdup
+             exec_swap
+             exec_dup
+             exec_shove
+
+             boolean_pop
+             boolean_dup
+             boolean_swap
+             boolean_rot
+             boolean_flush
+             boolean_eq
+             boolean_stackdepth
+             boolean_yank
+             boolean_yankdup
+             boolean_shove
+             boolean_and
+             boolean_or
+             boolean_not
+             boolean_xor
+             boolean_invert_first_then_and
+             boolean_invert_second_then_and
+             boolean_frominteger
+
+             integer_flush
+             integer_stackdepth
+             integer_yank
+             integer_yankdup
+             integer_shove
+             integer_add
+             integer_div
+             integer_dup
+             integer_eq
+             integer_gt
+             integer_lt
+             integer_mod
+             integer_mult
+             integer_pop
+             integer_rot
+             integer_sub
+             integer_swap
+             integer_fromboolean
+             integer_min
+             integer_max
+
+             node_pop
+             node_dup
+             node_swap
+             node_rot
+             node_flush
+             node_eq
+             node_stackdepth
+             node_yank
+             node_yankdup
+             node_shove
+             return_fromnode
+
+             bitset_pop
+             bitset_dup
+             bitset_swap
+             bitset_rot
+             bitset_flush
+             bitset_eq
+             bitset_stackdepth
+             bitset_yank
+             bitset_yankdup
+             bitset_shove
+
+             reduce-max
+             reduce-min
+
+             get-time
+             get-depth
+             nodes-of
+             neighbors-of
+             interferers-of
+             sensors-of
+             bfs-children
+
+             set-cardinality
+             is-empty
+             get-informed
+             get-active
+             get-able
+
+             set-and
+             set-or
+             set-xor
+             set-intersects
+             set-get
+             set-flip
+             set-set
+             set-clear
+             in-set
+
+             bfs-depth
+             bfs-decendents
+             bfs-child-count
+             bfs-parent
+             ))
+
+(defn viz
+  []
+  (doseq [n (range 0 (count test-graphs))]
+    (let [ps (.ps (test-graphs n))
+          x (map #(.x %) ps)
+          y (map #(.y %) ps)]
+      (spit (str "test-data-" n ".svg")
+            (chart/emit-svg
+              (-> (chart/xy-plot :width 500 :height 500
+                                 :xmin 0 :xmax 25
+                                 :ymin 0 :ymax 25
+                                 :r 1)
+                  (chart/add-points [x y] :transpose-data?? true
+                                    :fill "rgba(0,0,0,0.1)"
+                                    :size (/ 500 25))
+                  (chart/add-points [x y] :transpose-data?? true
+                                    :fill "rgba(0,255,0,1)"
+                                    :size 1)))))))
+
+(defn average
+  [coll]
+  (/ (apply + coll) (count coll)))
+
+(defn -main
+  ([arg & [file]]
+   (case arg
+     "viz" (viz)
+     "retest" ;; read best program from file and compare
+              ;; could do more extensive test against more graphs here
+     (let [input (slurp file)
+           code (read-string input)
+           input-errors (error-function code)
+           paper-errors (run-tests Selector/NUM_UNINFORMED)]
+       (println "input errors: " input-errors)
+       (println "sum " (apply + input-errors))
+       (println "paper errors: " paper-errors)
+       (println "sum " (apply + paper-errors))
+       )))
+  ([]
+   (pushgp
+     {:error-function error-function
+      ;; try to beat paper's best average
+      :error-threshold (average (run-tests Selector/NUM_UNINFORMED))
+      :atom-generators atoms
       ; :use-single-thread true
-      :population-size 200
-      :max-generations 1000
+      :population-size 500
+      :max-generations 100
       :max-points 500
       :max-points-in-initial-program 200
       :evalpush-limit 500
@@ -522,9 +571,7 @@
       :crossover-probability 0.50
       :simplification-probability 0.0
       :ultra-probability 0.0
-      :print-json-logs true
       :print-csv-logs true
-      :json-log-program-strings true
       :report-simplifications 0
       :print-history false})
-      (shutdown-agents))))
+   (shutdown-agents)))


pure: normalize is a no-op for now

pure: normalize is a no-op for now

--- src/io/cyanite/store/pure.clj
+++ src/io/cyanite/store/pure.clj
@@ -21,8 +21,7 @@

 (defn normalize
   [data]
-  (let [keyset (keys (group-by :id data))]
-    ))
+  data)

 (defn empty-series
   [min-point max-point precision]


added error handler around event decode-message

--- src/lcmap/clownfish/event.clj
+++ src/lcmap/clownfish/event.clj
@@ -9,6 +9,7 @@
             [camel-snake-kebab.extras :refer [transform-keys]]
             [cheshire.core :as json]
             [clojure.tools.logging :as log]
+            [dire.core :as dire]
             [langohr.core :as rmq]
             [langohr.basic :as lb]
             [langohr.channel :as lch]
@@ -20,14 +21,14 @@
 (defn decode-message
   "Convert byte payload to JSON or nil."
   [metadata payload]
-  (try
-    (transform-keys ->snake_case_keyword
-                     (json/decode (String. payload "UTF-8")))
-    (catch Exception e
-      (log/debugf "cannot decode message: %s"
-                  {:metadata metadata :payload payload :exception e})
-      nil)))
+  (transform-keys ->snake_case_keyword (json/decode (String. payload "UTF-8"))))

+(dire/with-handler! #'decode-message
+  java.lang.Exception
+  (fn [e & args]
+    (log/debugf "cannot decode message: %s"
+                {:metadata (first args) :payload (second args) :exception e})
+    nil))

 (declare amqp-connection amqp-channel)


add boot-cljsjs dependency

add boot-cljsjs dependency

--- src/leiningen/new/tenzing.clj
+++ src/leiningen/new/tenzing.clj
@@ -70,7 +70,8 @@
           (om?      opts) (conj "om \"0.7.3\"" "cljsjs/react \"0.11.2\"")
           (reagent? opts) (conj "reagent \"0.4.3\"" "cljsjs/react \"0.12.1\"")
           (garden?  opts) (conj "boot-garden \"1.2.5-1\"")
-          (sass?    opts) (conj "boot-sassc  \"0.1.0\"")))
+          (sass?    opts) (conj "boot-sassc  \"0.1.0\"")
+          (or (om? opts) (reagent? opts)) (conj "cljsjs/boot-cljsjs \"0.2.3-SNAPSHOT\"")))

 (defn build-requires [opts]
   (cond-> []


Add some log messages

Add some log messages

--- src/maestro/messages/data.clj
+++ src/maestro/messages/data.clj
@@ -187,6 +187,7 @@
         {:keys [tyranitar]} state
         {:keys [deployment-params]} tyranitar
         {:keys [desired-capacity max min]} deployment-params]
+    (log/write "Validating capacity.")
     (cond (< max min)
           (error-with (ex-info "Maximum capacity is lower than minimum capacity." {:type ::invalid-capacity}))
           (< desired-capacity min)
@@ -344,6 +345,7 @@
         image-id (get-in state [:image-details :id])
         {:keys [tags]} image-details
         {:keys [embargo]} tags]
+    (log/write "Checking for embargo.")
     (if (and (seq embargo) (some #(= environment %) (str/split embargo #",")))
       (do
         (log/write (format "Image '%s' is embargoed in '%s'" image-id environment))
@@ -361,6 +363,7 @@
         {:keys [deployment-params]} tyranitar
         {:keys [instance-type]} deployment-params
         allowed-instances (v/allowed-instances virt-type)]
+    (log/write "Checking instance type compatibility.")
     (if (contains? allowed-instances instance-type)
       (success parameters)
       (error-with (ex-info (format "Instance type %s is incompatible with virtualisation type %s" instance-type virt-type) {:type ::unknown-virtualisation-type})))))


Refactor checking code to expose more internal functions.

--- src/active/clojure/config.cljc
+++ src/active/clojure/config.cljc
@@ -631,107 +631,119 @@
       (reduce (partial merge-config-objects-sans-profiles schema []) config-object profiles))
     config-object))

+(declare normalize&check-config-object-internal)
+
+(defn complete-section
+  [inherited-map path section]
+  (let [key (section-key section)]
+    (if-let [entry (get inherited-map key)]
+      {key entry}
+      (let [res
+            (normalize&check-config-object-internal (section-schema section) {}
+                                                    inherited-map (concat path [key]))]
+        (c/assert (not (range-error? res)) (pr-str res))
+        {key res}))))
+
+(defn complete-settings
+  [inherited-map settings-map]
+  (zipmap (keys settings-map)
+          (map (fn [setting]
+                 (or (get inherited-map (setting-key setting))
+                     (setting-default-value setting)))
+               (vals settings-map))))
+
+(defn check-section
+  [section val inherited-map path]
+  (normalize&check-config-object-internal (section-schema section)
+                                          val
+                                          inherited-map
+                                          (conj (vec path) (section-key section))))
+
+(defn- normalize&check-config-object-internal
+  [schema config inherited-map path]
+  (letfn []
+    (cond
+      (map-schema? schema)
+      (if (not (map? config))
+        (make-range-error nil path config)
+        (let [sections-map (map-schema-sections-map schema)
+              res
+              ;; go through the settings first, as we need to collect
+              ;; the inherited settings
+              (loop [entries (seq config)
+                     c {}
+                     inherited-map inherited-map
+                     settings-map (map-schema-settings-map schema)]
+                (if entries
+                  (let [[key val] (first entries)]
+                    (if-let [setting (get settings-map key)]
+                      (let [range (setting-range setting)
+                            res ((range-completer range) range (concat path [key]) val)]
+                        (if (range-error? res)
+                          res
+                          (recur (next entries)
+                                 (assoc c key res)
+                                 (if (setting-inherit? setting)
+                                   (assoc inherited-map key val)
+                                   inherited-map)
+                                 (dissoc settings-map key))))
+                      (if (contains? sections-map key) ; do sections later
+                        (recur (next entries) c inherited-map settings-map)
+                        (make-range-error nil (concat path [key]) val))))
+                  [(merge c (complete-settings inherited-map settings-map))
+                   inherited-map settings-map]))]
+          (if (range-error? res)
+            res
+            (let [[c inherited-map settings-map] res]
+              ;; now go through the sections
+              (loop [entries (seq config)
+                     c c
+                     inherited-map inherited-map
+                     sections-map sections-map]
+                (if entries
+                  (let [[key val] (first entries)]
+                    (if-let [section (get sections-map key)]
+                      (let [res (check-section section val inherited-map path)]
+                        (if (range-error? res)
+                          res
+                          (recur (next entries)
+                                 (assoc c key res)
+                                 (if (section-inherit? section)
+                                   (assoc inherited-map key res)
+                                   inherited-map)
+                                 (dissoc sections-map key))))
+                      (recur (next entries) c inherited-map sections-map)))
+                  (apply merge c
+                         (map (partial complete-section inherited-map path)
+                              (vals sections-map)))))))))
+
+      (sequence-schema? schema)
+      (let [el-schema (sequence-schema-element-schema schema)]
+        (loop [idx 0
+               els config   ; FIXME: now misnamed
+               res (transient [])]
+          (if (empty? els)
+            (persistent! res)
+            (let [r (normalize&check-config-object-internal el-schema
+                                                            (first els)
+                                                            inherited-map
+                                                            (concat path [idx]))]
+              (if (range-error? r)
+                r
+                (recur (+ 1 idx)
+                       (rest els)
+                       (conj! res r))))))))))
+
 (defn normalize&check-config-object
   "Normalize and check the validity of a configuration object.

   In  the result, every setting has an associated value."
   ([schema profile-names config]
-     (normalize&check-config-object schema profile-names config {} []))
+   (normalize&check-config-object schema profile-names config {} []))

   ([schema profile-names config inherited-map path]
-     (let [config (apply-profiles schema config profile-names)]
-       (letfn [(complete-settings
-                 [inherited-map settings-map]
-                 (zipmap (keys settings-map)
-                         (map (fn [setting]
-                                (or (get inherited-map (setting-key setting))
-                                    (setting-default-value setting)))
-                              (vals settings-map))))
-               (complete-section
-                 [inherited-map section]
-                 (let [key (section-key section)]
-                   (if-let [entry (get inherited-map key)]
-                     {key entry}
-                     (let [res
-                           (normalize&check-config-object (section-schema section) profile-names {}
-                                                       inherited-map (concat path [key]))]
-                       (c/assert (not (range-error? res)) (pr-str res))
-                       {key res}))))]
-
-         (cond
-           (map-schema? schema)
-           (if (not (map? config))
-             (make-range-error nil path config)
-             (let [sections-map (map-schema-sections-map schema)
-                   res
-                   ;; go through the settings first, as we need to collect
-                   ;; the inherited settings
-                   (loop [entries (seq config)
-                          c {}
-                          inherited-map inherited-map
-                          settings-map (map-schema-settings-map schema)]
-                     (if entries
-                       (let [[key val] (first entries)]
-                         (if-let [setting (get settings-map key)]
-                           (let [range (setting-range setting)
-                                 res ((range-completer range) range (concat path [key]) val)]
-                             (if (range-error? res)
-                               res
-                               (recur (next entries)
-                                      (assoc c key res)
-                                      (if (setting-inherit? setting)
-                                        (assoc inherited-map key val)
-                                        inherited-map)
-                                      (dissoc settings-map key))))
-                           (if (contains? sections-map key) ; do sections later
-                             (recur (next entries) c inherited-map settings-map)
-                             (make-range-error nil (concat path [key]) val))))
-                       [(merge c (complete-settings inherited-map settings-map))
-                        inherited-map settings-map]))]
-               (if (range-error? res)
-                 res
-                 (let [[c inherited-map settings-map] res]
-                   ;; now go through the sections
-                   (loop [entries (seq config)
-                          c c
-                          inherited-map inherited-map
-                          sections-map sections-map]
-                     (if entries
-                       (let [[key val] (first entries)]
-                         (if-let [section (get sections-map key)]
-                           (let [res (normalize&check-config-object (section-schema section)
-                                                                 profile-names
-                                                                 val
-                                                                 inherited-map
-                                                                 (concat path [key]))]
-                             (if (range-error? res)
-                               res
-                               (recur (next entries)
-                                      (assoc c key res)
-                                      (if (section-inherit? section)
-                                        (assoc inherited-map key res)
-                                        inherited-map)
-                                      (dissoc sections-map key))))
-                           (recur (next entries) c inherited-map sections-map)))
-                       (apply merge c (map (partial complete-section inherited-map) (vals sections-map)))))))))
-
-           (sequence-schema? schema)
-           (let [el-schema (sequence-schema-element-schema schema)]
-             (loop [idx 0
-                    els config   ; FIXME: now misnamed
-                    res (transient [])]
-               (if (empty? els)
-                 (persistent! res)
-                 (let [r (normalize&check-config-object el-schema
-                                                     profile-names
-                                                     (first els)
-                                                     inherited-map
-                                                     (concat path [idx]))]
-                   (if (range-error? r)
-                     r
-                     (recur (+ 1 idx)
-                            (rest els)
-                            (conj! res r))))))))))))
+   (let [config (apply-profiles schema config profile-names)]
+     (normalize&check-config-object-internal schema config inherited-map path))))

 (define-record-type ^{:doc "Validated and expanded configuration object."}
   Configuration


DeCLOBify Field descriptions :yum:

DeCLOBify Field descriptions :yum:

--- src/metabase/models/field.clj
+++ src/metabase/models/field.clj
@@ -106,7 +106,7 @@
 (extend (class Field)
   i/IEntity (merge i/IEntityDefaults
                    {:hydration-keys     (constantly [:destination :field :origin])
-                    :types              (constantly {:base_type :keyword, :field_type :keyword, :special_type :keyword})
+                    :types              (constantly {:base_type :keyword, :field_type :keyword, :special_type :keyword, :description :clob})
                     :timestamped?       (constantly true)
                     :can-read?          (constantly true)
                     :can-write?         i/superuser?


CAST(x AS INTEGER) doesn't work for MySQL :unamused:

--- src/metabase/models/query.clj
+++ src/metabase/models/query.clj
@@ -1,6 +1,7 @@
 (ns metabase.models.query
   (:require (toucan [db :as db]
                     [models :as models])
+            [metabase.db :as mdb]
             [metabase.util :as u]
             [metabase.util.honeysql-extensions :as hx]))

@@ -12,17 +13,28 @@
   "Fetch the average execution time (in milliseconds) for query with QUERY-HASH if available.
    Returns `nil` if no information is available."
   ^Integer [^bytes query-hash]
+  {:pre [(instance? (Class/forName "[B") query-hash)]}
   (db/select-one-field :average_execution_time Query :query_hash query-hash))
+
+(defn- int-casting-type
+  "Return appropriate type for use in SQL `CAST(x AS type)` statement.
+   MySQL doesn't accept `integer`, so we have to use `unsigned`; Postgres doesn't accept `unsigned`.
+   so we have to use `integer`. Yay SQL dialect differences :D"
+  []
+  (if (= (mdb/db-type) :mysql)
+    :unsigned
+    :integer))

 (defn update-average-execution-time!
   "Update the recorded average execution time for query with QUERY-HASH."
   ^Integer [^bytes query-hash, ^Integer execution-time-ms]
+  {:pre [(instance? (Class/forName "[B") query-hash)]}
   (or
    ;; if there's already a matching Query update the rolling average
    (db/update-where! Query {:query_hash query-hash}
-     :average_execution_time (hx/cast :integer (hx/round (hx/+ (hx/* 0.9 :average_execution_time)
-                                                               (*    0.1 execution-time-ms))
-                                                         0)))
+     :average_execution_time (hx/cast (int-casting-type) (hx/round (hx/+ (hx/* 0.9 :average_execution_time)
+                                                                         (*    0.1 execution-time-ms))
+                                                                   0)))
    ;; otherwise add a new entry, using the value of EXECUTION-TIME-MS as a starting point
    (db/insert! Query
      :query_hash             query-hash


add TODO

add TODO

--- src/babel/workbook.clj
+++ src/babel/workbook.clj
@@ -25,6 +25,7 @@
    [hiccup.core :refer [html]]
 ))

+;; TODO: move (parse) and (expr) to separate namespace: 'workbook/useful-user-functions' or something.
 ;; TODO: add other languages (English and Spanish)
 (defn parse [string]
   (concat


Show element quantity with player color

Show element quantity with player color

--- src/obb_demo/boardground.cljs
+++ src/obb_demo/boardground.cljs
@@ -84,12 +84,20 @@
   (if-let [cost (get (:possible-attacks game-data) coord)]
     [:div.possible-target]))

+(defn- player-label
+  "Gets a label element for a player"
+  [player]
+  (if (= player :p1)
+    :span.label.label-success
+    :span.label.label-info))
+
 (defn- element-quantity
   "Shows element quantity"
   [game-data element]
   (if element #_(selected? game-data element)
     [:div.element-quantity
-     [:span.label.label-default (element/element-quantity element)]]))
+     [(player-label (element/element-player element))
+      (element/element-quantity element)]]))

 (defn- action-coords
   "Gathers coordinates that participated in the action"


[fix #9] Add money to user, when he create new event.

--- src/ombs/handler/addevent.clj
+++ src/ombs/handler/addevent.clj
@@ -26,11 +26,12 @@
   "Main function for creating new event."
   (if (isvalid/new-event? event price date)
     (do
-      (dbpay/debit-payment (db/get-eid event date) (sess/get :username)
-                           (read-string price))
       (if (zero? (funcs/parse-int parts))
         (add-solid-event params)
         (add-partial-event (update params :parts funcs/parse-int)))
+      (dbpay/debit-payment (db/get-eid event date)
+                           (db/get-uid (sess/get :username))
+                           (read-string price))
       (when (not-empty users) (add-participants params))
       (redirect "/user"))
     ;if validation fails


nasty link fixed

nasty link fixed

--- src/clj/ceres/core.clj
+++ src/clj/ceres/core.clj
@@ -25,7 +25,7 @@
   [:#bootstrap-theme-css] (set-attr "src" "static/bootstrap/css/bootstrap-theme.min.css")
   [:#react-js] (set-attr "src" "static/react/react-0.9.0.min.js")
   [:#jquery-js] (set-attr "src" "static/jquery/jquery-1.11.0.min.js")
-  [:#bootstrap-js] (set-attr "src" "static/bootstrap/3.1.1/js/bootstrap.min.js")
+  [:#bootstrap-js] (set-attr "src" "static/bootstrap/js/bootstrap.min.js")
   [:#js-files] (substitute (html [:script {:src "static/main.js" :type "text/javascript"}])))


new card implementation and fixes

new card implementation and fixes

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -27,6 +27,10 @@
      :runner-turn-begins {:req (req (zero? (:bad-publicity corp))) :msg "give the Corp 1 bad publicity"
                           :effect (effect (gain :corp :bad-publicity 1))}}}

+   "Adjusted Chronotype"
+   {:events {:runner-loss {:req (req (some #{:click} target)) :once :per-turn
+                           :msg "gain [Click]" :effect (effect (gain :runner :click 1))}}}
+
    "Adonis Campaign"
    {:data {:counter 12}
     :events {:corp-turn-begins {:msg "gain 3 [Credits]" :counter-cost 3
@@ -126,6 +130,10 @@
                  :prompt "How many [Credits]?" :choices :counter :msg (msg "gain " target " [Credits]")
                  :effect (req (gain state side :credit target)
                                  (when (= target (:counter card)) (trash state :runner card)))}]}
+
+   "Beach Party"
+   {:effect (effect (gain :max-hand-size 5)) :leave-play (effect (lose :max-hand-size 5))
+    :events {:runner-turn-begins {:msg "lose [Click]" :effect (effect (lose :click 1))}}}

    "Beanstalk Royalties"
    {:effect (effect (gain :credit 3))}
@@ -644,6 +652,10 @@
    {:events {:successful-run {:msg "gain 2 [Credits]" :once :per-turn
                               :effect (effect (gain :credit 2)) :req (req (= target :hq))}}}

+   "Game Day"
+   {:msg (msg "draw " (- (:max-hand-size runner) (count (:hand runner))) " cards")
+    :effect (effect (draw (- (:max-hand-size runner) (count (:hand runner)))))}
+
    "Geothermal Fracking"
    {:data {:counter 2}
     :abilities [{:cost [:click 1] :counter-cost 1 :msg "gain 7 [Credits] and take 1 bad publicity"
@@ -704,7 +716,8 @@

    "Haas Arcology AI"
    {:advanceable :while-unrezzed
-    :abilities [{:cost [:click 1] :advance-counter-cost 1 :effect (effect (gain :click 2))}]}
+    :abilities [{:label "Gain [Click]" :once :per-turn :msg "gain [Click]"
+                 :cost [:click 1] :advance-counter-cost 1 :effect (effect (gain :click 2))}]}

    "Haas-Bioroid: Engineering the Future"
    {:events {:corp-install {:once :per-turn :msg "gain 1 [Credits]"
@@ -1177,7 +1190,7 @@

    "Panic Button"
    {:init {:root "HQ"} :abilities [{:cost [:credit 1] :effect (effect (draw))
-                                     :req (req (and run (= (first (:server run)) :hq)))}]}
+                                    :req (req (and run (= (first (:server run)) :hq)))}]}

    "Paper Tripping"
    {:effect (effect (lose :tag :all))}


Immediately hide control bar when mouse cursor leaves terminal area

--- src/asciinema/player/view.cljs
+++ src/asciinema/player/view.cljs
@@ -335,8 +335,11 @@
           (swap! channels set/union (m/get-channels message @player-atom))))
       (recur))))

-(defn player* [player ui-ch mouse-moves-ch]
-  (let [on-mouse-move (send! mouse-moves-ch true)
+(defn player* [player ui-ch]
+  (let [mouse-moves-ch (chan (dropping-buffer 1))
+        on-mouse-move (send! mouse-moves-ch true)
+        on-mouse-enter (send! ui-ch (m/->ShowHud true))
+        on-mouse-leave (send! ui-ch (m/->ShowHud false))
         on-key-press (send-value! ui-ch handle-key-press)
         on-key-down (send-value! ui-ch handle-key-down)
         loading (reaction (:loading @player))
@@ -355,13 +358,18 @@
         current-time (reaction (:current-time @player))
         total-time (reaction (:duration @player))
         {:keys [title author author-url author-img-url]} @player]
+    (pipe
+     (activity-chan mouse-moves-ch 3000 (chan 1 (map m/->ShowHud)))
+     ui-ch)
     (fn []
       [:div.asciinema-player-wrapper {:tab-index -1
                                       :on-key-press on-key-press
                                       :on-key-down on-key-down
-                                      :on-mouse-move on-mouse-move
                                       :class-name @wrapper-class-name}
-       [:div.asciinema-player {:class-name @player-class-name}
+       [:div.asciinema-player {:class-name @player-class-name
+                               :on-mouse-move on-mouse-move
+                               :on-mouse-enter on-mouse-enter
+                               :on-mouse-leave on-mouse-leave}
         [terminal width height font-size screen cursor-on]
         [recorded-control-bar playing current-time total-time ui-ch]
         (when (or title author) [title-bar title author author-url author-img-url])
@@ -369,16 +377,13 @@
         (when @loading [loading-overlay])]])))

 (defn player-component [player]
-  (let [ui-ch (chan)
-        mouse-moves-ch (chan (dropping-buffer 1))]
+  (let [ui-ch (chan)]
     (fn []
       (reagent/create-class
        {:display-name "asciinema-player"
-        :reagent-render #(player* player ui-ch mouse-moves-ch)
+        :reagent-render #(player* player ui-ch)
         :component-did-mount (fn [this]
-                               (let [source-ch (source/init (:source @player))
-                                     user-activity-ch (activity-chan mouse-moves-ch 3000 (chan 1 (map m/->ShowHud)))]
-                                 (pipe user-activity-ch ui-ch)
+                               (let [source-ch (source/init (:source @player))]
                                  (start-message-loop! player #{ui-ch source-ch})))
         :component-will-unmount (fn [this]
                                   (source/close (:source @player)))}))))


remove {:tense :present} from "be-called"

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -164,7 +164,6 @@
                               :sem {:aspect :progressive
                                     :pred :be-called
                                     :reflexive true
-                                    :tense :present
                                     :subj the-real-subj
                                     :obj the-real-subj
                                     :iobj the-obj}


add :number = singular or plural for possessive pronouns "his" and "her"

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -813,11 +813,17 @@
                    :obj {:human true}}}}
    "her"
    [{:synsem {:cat :det
+              :agr {:number :sing}
               :sem {:pred :lei
                     :gender :fem
                     :number :sing}
               :def :possessive}}
-
+    {:synsem {:cat :det
+              :agr {:number :plur}
+              :sem {:pred :lei
+                    :gender :fem
+                    :number :sing}
+              :def :possessive}}
     {:synsem {:cat :noun
               :pronoun true
               :case :acc
@@ -860,11 +866,18 @@
              :sem {:human true}
              :subcat '()}}

-   "his" {:synsem {:cat :det
-                   :sem {:pred :lui
-                         :gender :masc
-                         :number :sing}
-                   :def :possessive}}
+   "his" [{:synsem {:cat :det
+                    :agr {:number :sing}
+                    :sem {:pred :lui
+                          :gender :masc
+                          :number :sing}
+                    :def :possessive}}
+          {:synsem {:cat :det
+                    :agr {:number :plur}
+                    :sem {:pred :lui
+                          :gender :masc
+                          :number :sing}
+                    :def :possessive}}]

    "hit" {:english {:past "hit"}
              :synsem {:cat :verb


added pensare

added pensare

--- src/babel/italiano/lexicon.clj
+++ src/babel/italiano/lexicon.clj
@@ -1430,6 +1430,15 @@
       (unify common1 intransitive intransitive-unspecified-obj)

       (unify common2 intransitive intransitive-unspecified-obj)))
+
+
+    "pensare"
+    {:synsem {:cat :verb
+              :essere false
+              :sem {:pred :think
+                    :activity false
+                    :discrete false
+                    :subj {:human true}}}}

    "piangere" {:italiano {:passato "pianto"}
             :synsem {:cat :verb


Tokenizer works :) also there is an example clojure syntax.

--- src/clj_highlight/core.clj
+++ src/clj_highlight/core.clj
@@ -1,17 +1,84 @@
 (ns clj-highlight.core
   (:import java.util.Scanner))

-(defn- token-seq* [s token-def defs]
-  (lazy-seq
-   (if (empty? defs)
-     (throw (Exception. (str "Unknown token: " s)))
-     (let [[[regexp kind] & defs] defs]
-       (if (empty? s)
-	 '()
-	 (if-let [token (re-find regexp s)]
-	  (cons [kind token] (token-seq* (subs s (count token)) token-def token-def))
-	  (token-seq* s token-def defs)))))))

-(defn token-seq [s tokens]
-  (token-seq* s tokens tokens))+(defn- token-seq* [s token-def defs state states]
+   (lazy-seq (if (empty? defs)
+    (throw (Exception. (str "Unknown token: " s)))
+    (let [[[matcher kind & [new-state]] & defs] defs]
+      (if (empty? s)
+	'()
+	(if-let [token (matcher s states)]
+	  (cond
+;	   (prn token kind) nil
+	   (nil? new-state)
+	    (conj (token-seq* (subs s (count token)) token-def (get token-def state) state states) [kind token])
+	    (= new-state :pop)
+	    (let [states (pop states)
+		  state (first states)]
+	      (conj (token-seq* (subs s (count token)) token-def (get token-def state) states states) [kind token]))
+	    :else
+	    (conj (token-seq* (subs s (count token)) token-def (get token-def new-state) new-state (conj states new-state)) [kind token]))
+	  (token-seq* s token-def defs state states)))))))
+
+
+(defn re-token [re]
+  (fn [s _] (re-find (re-pattern (str "^(?:" re ")")) s)))
+
+
+(def didgets "0123456789abcdefghijklmnopqrstuvwxyz")
+
+(let [basic-identifier* "(?i)[a-z$%$*_+!?&<>=-][a-z0-9§$&*=+!_?<>-]*(?-i)"
+      identifier* (str "(?:[@']?(?:"basic-identifier*"\\.)*"basic-identifier*"(?:/"basic-identifier*")?\\.?)|\\.\\.?")
+      symbol* (str "::?"identifier*)
+      number-token (fn [s _]
+		       (if-let [p (re-find #"^(\d+)r" s)]
+			 (let [[prefix precision] p
+			       precision (Integer/parseInt precision)
+			       number-re (re-pattern (str "^" prefix "[" (subs didgets 0 precision) "]+"))]
+			   (if-let [num (re-find number-re)]
+			     num
+			     nil))
+			 (if-let [num (re-find #"^\d+(?:(?:/\d+)|(?:(?:.\d*)?(?:e[+-]\d+)?))" s)]
+			   num
+			   nil)))]
+  (def clj-syntax
+       {:keywords #{"do"}
+	:initial
+	[
+	 [(re-token identifier*) :identifyer]
+	 [(re-token symbol*) :symbol]
+	 [(re-token #"\"(?:\\.|[^\"])*\"") :string]
+	 [(re-token #"[\s,\n]+") :space]
+	 [(re-token #"[\(\)\[\]{}]") :pren]
+	 [(re-token #"[\(\)\[\]{}]") :pren]
+	 [(re-token #";.*\n?") :comment]
+	 [(re-token #"\\.") :string]
+	 [(re-token #"[#.'`]") :operator]
+	 [number-token :number]
+	 ]}))
+
+
+(defn mangle-tokens [kind mangle-fn tokenizer]
+  (fn mangle-tokens*
+    ([string state]
+       (map (fn [[k t]]
+	 (if (= k kind)
+	   (mangle-fn k t)
+	   [k t]))
+	    (tokenizer string state)))
+    ([string]
+       (mangle-tokens* string :initial))))
+
+
+(defn tokenizer [syntax]
+  (let [tkn
+    	(fn tokenizer*
+	  ([string state]
+	     (token-seq* string syntax (get syntax state) state (list state)))
+	  ([string]
+	  (tokenizer* string :initial)))]
+    (if-let [keywords (:keywords syntax)]
+      (mangle-tokens :identifyer (fn [k t] (if (keywords t) [:keyword t] [k t])) tkn)
+      tkn)))


Removed collection from non-small list.

Removed collection from non-small list.

--- src/cmr/indexer/system.clj
+++ src/cmr/indexer/system.clj
@@ -18,7 +18,7 @@
 (def collections-with-separate-indexes
   "Configuration function that will return a list of collections with separate indexes for their
   granule data."
-  (cfg/config-value-fn :colls-with-separate-indexes "C1000000120-FIX_PROV1" #(str/split % #",")))
+  (cfg/config-value-fn :colls-with-separate-indexes "" #(str/split % #",")))

 (def
   ^{:doc "Defines the order to start the components."


Allow inline chaining on :all route.

Allow inline chaining on :all route.

--- src/catacumba/impl/routing.clj
+++ src/catacumba/impl/routing.clj
@@ -27,8 +27,10 @@
   [^Chain chain [_ & handlers-and-path]]
   (let [path (first handlers-and-path)]
     (if (string? path)
-      (.handler chain path (handlers/ratpack-adapter (second handlers-and-path)))
-      (.handler chain (handlers/ratpack-adapter path)))))
+      (let [^List handlers (map handlers/ratpack-adapter (rest handlers-and-path))]
+        (.handler chain path (Handlers/chain handlers)))
+      (let [^List handlers (map handlers/ratpack-adapter handlers-and-path)]
+        (.handler chain (Handlers/chain handlers))))))

 (defmethod attach-route :error
   [^Chain chain [_ error-handler]]


Remove dead file

Remove dead file

--- src/circleci/views/welcome.clj
+++ src/circleci/views/welcome.clj
@@ -1,10 +0,0 @@
-(ns circleci.views.welcome
-  (:require [circleci.views.common :as common]
-            [noir.content.pages :as pages])
-  (:use noir.core
-        hiccup.core
-        hiccup.page-helpers)
-  (:use [ring.util.response :only (file-response)]))
-
-(defpage "/" []
-  (file-response "resources/public/html/index.html"))


[#244] comment the projections param

[#244] comment the projections param

* TODO:
* Recover projections when index is up
* https://github.com/akvo/akvo-flow/issues/3932

--- api/src/clojure/org/akvo/flow_api/datastore/stats.clj
+++ api/src/clojure/org/akvo/flow_api/datastore/stats.clj
@@ -42,7 +42,11 @@
            (ds/reducible-gae-query ds
                                    {:kind "QuestionAnswerStore"
                                     :filter (q/= "questionID" (str question-id))
-                                    :projections {"value" String
+                                    :sort-by "createdDateTime"
+                                    ;; TODO:
+                                    ;; Recover projections when index is up
+                                    ;; https://github.com/akvo/akvo-flow/issues/3932
+                                    #_#_:projections {"value" String
                                                   "surveyInstanceId" Long}}
                                    {})))))


Deleted debug output

Deleted debug output

--- src/layzee/adapters/web/api.clj
+++ src/layzee/adapters/web/api.clj
@@ -30,9 +30,7 @@
 (defn- search[]
   (let [results (lazy-web/run { :search-adapter-fn lazy-web-search } {:count 10} )]
     (let [results-with-replies (pmap (partial assoc-replies-for settings/oauth-credential) (:result results))]
-      (println replies)
-      (assoc results :result results-with-replies)
-      )))
+      (assoc results :result results-with-replies))))

 (defn- reply-core[]
   (try


Abstract out turning hiccup link data into simple maps

--- src/clj/comic_reader/sites.clj
+++ src/clj/comic_reader/sites.clj
@@ -1,6 +1,14 @@
 (ns comic-reader.sites
   (:refer-clojure :exclude [list])
   (:require [clojure.string :as s]))
+
+(defn gen-link->map [process-name process-url]
+  (fn [{[name] :content
+        {url :href} :attrs}]
+    {:name (process-name name)
+     :url (process-url url)}))
+
+(def simple-link->map (gen-link->map identity identity))

 (def list
   [(let [canonical-url "http://mangafox.me"
@@ -10,31 +18,27 @@
       :name "Manga Fox"
       :url manga-url
       :selector [:div.manga_list :ul :li :a]
-      :normalize (fn [{[name] :content
-                       {url :href} :attrs}]
-                   {:name name
-                    :url url})
+      :normalize simple-link->map
       :chapter-list-data (fn [chapter-url]
                            {:url chapter-url
                             :selector [:div#chapters :ul.chlist
                                        :li :div :h3 :a]
-                            :normalize (fn [data] data)})
+                            :normalize simple-link->map})
       :url->feed (fn [url]
                    (some->> url
                             (re-matches manga-pattern)
                             second
                             (format "%s/rss/%s.xml" canonical-url)))})

-   (let [canonical-url "http://www.mangareader.net/"]
+   (let [canonical-url "http://www.mangareader.net/"
+         link->map (gen-link->map s/trim
+                                  (partial str canonical-url))]
      {:id :manga-reader
       :name "Manga Reader"
       :url (str canonical-url "alphabetical")
       :selector [:div.series_alpha :ul :li :a]
-      :normalize (fn [{[name] :content
-                       {url :href} :attrs}]
-                   {:name (s/trim name)
-                    :url (str canonical-url url)})
+      :normalize link->map
       :chapter-list-data (fn [chapter-url]
                            {:url chapter-url
                             :selector [:div#chapterlist :tr :td :a]
-                            :normalize (fn [data] data)})})])
+                            :normalize link->map})})])


properly parse evidence list

properly parse evidence list

--- src/clj/salava/badge/parse.clj
+++ src/clj/salava/badge/parse.clj
@@ -351,14 +351,15 @@
                                                   :ctime now
                                                   :mtime now}]
                    ;; list of evidences
-                   (coll? (:evidence assertion)) (mapv #({:id nil
+                   (coll? (:evidence assertion)) (mapv (fn [e]
+                                                         {:id nil
                                                             :user_badge_id nil
-                                                            :url (:id %)
-                                                            :narrative (:narrative %)
-                                                            :name (:name %)
-                                                            :description (:description %)
-                                                            :genre (:genre %)
-                                                            :audience (:audience %)
+                                                            :url (:id e)
+                                                            :narrative (:narrative e)
+                                                            :name (:name e)
+                                                            :description (:description e)
+                                                            :genre (:genre e)
+                                                            :audience (:audience e)
                                                             :ctime now
                                                             :mtime now}) (:evidence assertion))
                    :else [])


Verify ticks

Verify ticks

--- src/clj_simple_chart/ticks.clj
+++ src/clj_simple_chart/ticks.clj
@@ -2,6 +2,7 @@

 ; The following code is ported from d3-array:
 ; Original source: https://github.com/d3/d3-array/blob/master/src/ticks.js
+; 04cf783

 (def e10 (Math/sqrt 50))
 (def e5 (Math/sqrt 10))


Remove cruft from main.cljs

Remove cruft from main.cljs

--- src/cljs/clojuredocs/main.cljs
+++ src/cljs/clojuredocs/main.cljs
@@ -446,10 +446,3 @@

 (.attach js/FastClick js/document.body)
-
-(def strings ["foo" "bar" "baz"])
-
-
-#_(->> strings
-     (map #(fuzzy/levensthein % "f"))
-     prn)


indent

indent

--- src/cljs/dragonspawn/core.cljs
+++ src/cljs/dragonspawn/core.cljs
@@ -110,13 +110,13 @@
            (let [{:keys [player]} current
                  [player-x player-y] player]
              (assoc current
-               :player (boundary
-                         (condp = direction
-                           :left [(dec player-x) player-y]
-                           :right [(inc player-x) player-y]
-                           :forward [player-x (dec player-y)]
-                           :back [player-x (inc player-y)]
-                           player)))))))
+                    :player (boundary
+                              (condp = direction
+                                :left [(dec player-x) player-y]
+                                :right [(inc player-x) player-y]
+                                :forward [player-x (dec player-y)]
+                                :back [player-x (inc player-y)]
+                                player)))))))

 (defn timeup?
   [start-time]


RR: indentation

RR: indentation

--- src/cljs/hatti/map/viewby.cljs
+++ src/cljs/hatti/map/viewby.cljs
@@ -61,15 +61,15 @@
 (defn field->colors [field]
   "Returns the appropriate set of colors given the field."
   (cond
-   ;; if too many options w/in select-one field, fall back to select-all style
-   (f/select-one? field) (if (<= (count (:children field))
-                                 (count qualitative-palette))
-                           qualitative-palette
-                           (repeat "#f30"))
-   (f/numeric? field)    sequential-palette
-   (f/calculate? field)  sequential-palette
-   (f/time-based? field) sequential-palette
-   (f/select-all? field) (repeat "#f30")))
+    ;; if too many options w/in select-one field, fall back to select-all style
+    (f/select-one? field) (if (<= (count (:children field))
+                                  (count qualitative-palette))
+                            qualitative-palette
+                            (repeat "#f30"))
+    (f/numeric? field)    sequential-palette
+    (f/calculate? field)  sequential-palette
+    (f/time-based? field) sequential-palette
+    (f/select-all? field) (repeat "#f30")))

 (defn viewby-info
   "Produces a set of data structures / functions for view-by.


Added content into createarticle.cljs

Added content into createarticle.cljs

--- src-cljs/rmfu_ui/createarticle.cljs
+++ src-cljs/rmfu_ui/createarticle.cljs
@@ -1,4 +1,134 @@
 (ns rmfu-ui.createarticle)

 (defn createarticle []
-  [:h1 "create article"])
+  [:div.container.jumbotron
+ {:style {:max-width "700px"}}
+ [:div.row
+  [:div.col-lg-12
+   [:h1.text-center
+    "Create Article"]
+   [:h4
+    "Title of Article"]
+   [:input.form-control
+    {:type "text", :placeholder "Milk contains up to 10% of the following hormones upon bottling.", :value ""}]
+   [:br]
+   [:h4
+    "Link to Article (optional):"]
+   [:input.form-control
+    {:type "text", :placeholder "http://www.milksafe.com/hormones.html", :value ""}]
+   [:br]
+   [:h4
+    "Description of Article (optional):"]
+   [:textarea.form-control
+    {:rows "4"}
+    "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis auteirure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident\n          "]
+   [:br]
+   [:h4
+    "Relevant to these Regions"]
+   [:div.input-group.select-group
+    [:div.col-lg-10
+     {:style {:padding-right "0"}}
+     [:input.form-control
+      {:type "text", :placeholder "Enter Zip Code", :value ""}]]
+    [:select.c-select.col-lg-2
+     [:option
+      "Item 1"]
+     [:option
+      "Item 2"]
+     [:option
+      "Item 3"]]
+    [:div.input-group-btn
+     [:button.btn.btn-default
+      {:name "type", :type "button", :value "add"}
+      "Add"]]]
+   [:br]
+   [:h4
+    "Relevant to these Topics"]
+   [:div.input-group
+    [:input.form-control
+     {:type "topics", :placeholder "Enter Keywords or select from suggestions below", :value ""}]
+    [:span.input-group-btn
+     [:button.btn.btn-default
+      {:type "button", :value "add"}
+      "Add"]]]
+   [:ul.list-inline
+    [:li
+     [:a
+      {:href "#"}
+      "Dairy"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Organic"]]
+    [:li
+     [:a
+      {:href "#"}
+      "GMO"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Fertilizer"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Equipment"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Poultry"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Sustainable"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Green"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Pests"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Tobacco"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Fuel"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Seeds"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Wool"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Solar"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Wind"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Legislation"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Vegetables"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Fruit"]]
+    [:li
+     [:a
+      {:href "#"}
+      "Polls"]]]
+   [:p.text-center
+    [:button.btn
+     {:name "type", :type "button", :value "create_article"}
+     "Create the Article"]]]]])


Do not allow selecting a selected row

Do not allow selecting a selected row

--- src/tango/cljs/client.cljs
+++ src/tango/cljs/client.cljs
@@ -404,30 +404,31 @@
           (presentation/make-time-schedule-activity-presenter
             (om/props this)
             (first (:class/_rounds (:activity/source (om/props this)))))
-          is-selected? (seq (filter #(= (:activity/id (om/props this)) (:activity/id %))
+          selected? (seq (filter #(= (:activity/id (om/props this)) (:activity/id %))
                                     (:selected-activity (om/props this))))

           completed? (= (:round/status (:activity/source (om/props this))) :completed)]
       ;(log (:selected-activity (om/props this)))
-      (dom/tr #js {:className (if is-selected? "info" "")
+      (dom/tr #js {:className (if selected? "info" "")
                    :onClick   #(when-not completed?
-                                (om/transact!
-                                  this
-                                  `[(app/select-activity
-                                      {:activity/id    ~(:activity/id (om/props this))
-                                       :activity/name  ~name
-                                       :round/recall   ~(:round/recall (:activity/source
-                                                                         (om/props this)))
-                                       :round/name     ~round
-                                       :round/heats    ~(:round/heats (:activity/source
-                                                                        (om/props this)))
-                                       :round/starting ~(:round/starting (:activity/source
+                                (when-not selected?
+                                  (om/transact!
+                                    this
+                                    `[(app/select-activity
+                                        {:activity/id    ~(:activity/id (om/props this))
+                                         :activity/name  ~name
+                                         :round/recall   ~(:round/recall (:activity/source
                                                                            (om/props this)))
-                                       :round/panel    ~(:round/panel (:activity/source
-                                                                        (om/props this)))
-                                       :round/dances   ~(:round/dances (:activity/source
-                                                                         (om/props this)))})
-                                    :app/selected-activity]))}
+                                         :round/name     ~round
+                                         :round/heats    ~(:round/heats (:activity/source
+                                                                          (om/props this)))
+                                         :round/starting ~(:round/starting (:activity/source
+                                                                             (om/props this)))
+                                         :round/panel    ~(:round/panel (:activity/source
+                                                                          (om/props this)))
+                                         :round/dances   ~(:round/dances (:activity/source
+                                                                           (om/props this)))})
+                                      :app/selected-activity])))}
         (dom/td nil time)
         (dom/td nil number)
         (dom/td nil name)


increase logging level to speed up graphql

--- src/graphql_clj/parser.clj
+++ src/graphql_clj/parser.clj
@@ -3,6 +3,9 @@
             [clojure.java.io :as io]
             [taoensso.timbre :as log]
             [graphql-clj.type :as type]))
+
+(log/merge-config! {:level :info
+                    :appenders {:println {:async? false}}})

 (def whitespace
   (insta/parser


Change actions-column function to a defmethod

--- src/hatti/views/table.cljs
+++ src/hatti/views/table.cljs
@@ -14,6 +14,7 @@
             [hatti.ona.forms :as forms
              :refer [get-label format-answer get-column-class]]
             [hatti.views :refer [action-buttons
+                                 actions-column
                                  table-page table-header table-search
                                  label-changer submission-view]]
             [hatti.views.record]
@@ -124,7 +125,7 @@
   (str "<input type=\"checkbox\" id=\"" select-unselect-all-records-id "\">"))
 (def delete-record-class "delete-record")

-(defn actions-column
+(defmethod actions-column :default
   [owner has-hxl?]
   {:id "actions"
    :field _id
@@ -440,7 +441,8 @@
                            {:new-columns
                             (flat-form->sg-columns flat-form
                                                    :get-label? (= :label %)
-                                                   :language   new-language)})]
+                                                   :language   new-language
+                                                   :owner owner)})]
         (when (not= new-language language)
           (om/set-state! owner :language new-language)
           (colset! field-key))


some front descriptions

some front descriptions

--- src/house/rooms/front.cljc
+++ src/house/rooms/front.cljc
@@ -6,18 +6,47 @@
             [house.puzzles.gate-door :refer [gate-door]]
             [house.puzzles.oak-door :refer [large-key]]))

+;; FIXME turn radio off
+(def radio (item/make "radio" "It was making an annoying noise: the transmission was over."
+                      :light "It was already on."
+                      :use "I didn't know my way around those things"))
+
+(def wool (item/make ["thread of wool" "thread" "wool"] "It was coming from the east bedroom." :take "I had no use for that."))
+(def clock (item/make ["clock" "longcase clock" "grandfather clock"] "The clock was stopped at five past nine." :open "This is not Day of the Tentacle."))
+
 (def living (->
               (room/make "Living room"
-                         "There were bedrooms on either side of the central living room and a corridor leading to the back section."
+                         "The central living room with bedrooms on either side, the gate door to the vestibule and the passage to the back of the house."
+                         :initial-description "At the core of the building was the central living room, with bedrooms on either side. South was the wrought-iron gated door that led to the vestibule, and the street, and north the passage leading to the back section of the house."
                          :known true)
               (room/add-item mailbox "Just by the gate door was a bronze mailbox.")
+              (room/add-item (item/make ["Passage" "passageway" "corridor"] "it led to the back section of the house" :enter :front-hall) "")
+              (room/add-item (item/make ["table" "dining table"] "Not as big as the one in the back.") "There was a longcase clock and a dining table and not far from it a big radio.")
+              (room/add-item radio "The radio was on, making a static noise.")
+              (room/add-item wool "\n \nA thread of wool stupidly crossed the room, coming out of one of the bedrooms and disappearing under the gated door.")
+              (room/add-item clock "")
               (room/add-item gate-door "")))

 ; TODO add sofa, bed, wardrobe, camphor chest, table, knitting basket
 (def woman-bedroom (room/make "Woman's bedroom"
                               " "))

-; TODO add rolltop desk and put large-key inside of it
+(def papers (item/make ["pile of papers" "papers"] "A pile of written papers."
+                       :read "We like the house because, apart from its being old and spacious (in a day when old houses go down for a profitable auction of their construction materials), it keeps the memories of great‐grandparents, our paternal grandfather, our parents and the whole of childhood. Irene and I got used to staying in the house by ourselves, which is crazy, eight people could live in this place and not get in each other's way. We rise at seven in the morning and get the cleaning done, and about eleven I leave Irene to finish off whatever rooms and go to the kitchen. We lunch at noon precisely; then there is nothing left to do but a few dirty plates. It is pleasant to take lunch and commune with the great hollow, silent house, and it is enough for us just to keep it clean..."))
+
+(defn post-desk-open
+  [_ gs]
+  (let [desk (utils/find-first gs "desk")
+        new-desk (assoc desk
+                        :description "a wooden rolltop desk, with the cover up."
+                        :close "Better left open.")]
+    (utils/replace-item gs desk new-desk)))
+
+(def rolltop-desk (item/make ["rolltop desk" "desk"] "A wooden rolltop desk, with the cover down."
+                             :closed true
+                             :open {:pre true :say "I rolled up the cover." :post `post-desk-open}
+                             :items #{papers large-key}))
+
 (def man-bedroom (->
                   (room/make "Man's bedroom" " ")
-                  (room/add-item large-key)))
+                  (room/add-item rolltop-desk)))


Add events controller

Add events controller

--- src/madouc/controllers.clj
+++ src/madouc/controllers.clj
@@ -4,6 +4,7 @@
             [madouc.services.login :refer [valid-user?]]
             [madouc.services.token :as token]
             [madouc.services.user :as user]
+            [madouc.services.events :as events]
             [clj-time.core :as t]))

 (defn login-controller
@@ -20,5 +21,15 @@
     (if username
       (http-resp/ok (user/get-info username))
       (http-resp/unauthorized {:error "Unauthorized"}))))
-

+(defn events-controller
+  [req]
+  (let [username (get-in req [:identity :sub])]
+    (if username
+      (try
+        (http-resp/ok (events/get-batch username))
+        (catch Exception e
+          (case (-> (ex-data e) :reason)
+            :no-token (http-resp/not-found "Token not found")
+            (http-resp/internal-server-error (.getMessage e)))))
+      (http-resp/unauthorized {:error "Unauthorized"}))))


Do parallel deserializing from disk.

Do parallel deserializing from disk.

--- src/replikativ/p2p/fetch.cljc
+++ src/replikativ/p2p/fetch.cljc
@@ -97,7 +97,11 @@

 (defn store-commits! [store cvs]
-  (go-try
+  (->> cvs
+       (map (fn [[k v]] (k/assoc-in store [k] v)))
+       doall
+       async/merge)
+  #_(go-try
    (doseq [[k v] cvs]
      (<? (k/assoc-in store [k] v)))))

@@ -125,12 +129,18 @@
   (go-loop-super [{:keys [ids id] :as m} (<? fetch-ch)]
                  (when m
                    (info "fetch:" ids)
-                   (let [fetched (loop [[id & r] (seq ids)
+                   (let [#_fetched #_(loop [[id & r] (seq ids)
                                         res {}]
                                    (if id
                                      (recur r (assoc res id (<? (k/get-in store [id]))))
                                      res))
-
+                         fetched (->> (seq ids)
+                                      (map (fn [id] (go-try [id (<? (k/get-in store [id]))])))
+                                      doall
+                                      async/merge
+                                      (async/into {})
+                                      <?)
+;_ (println "FETCHED" fetched)
                          #_(->> (go-for [id ids] [id (<? (k/get-in store [id]))])
                                       (async/into {})
                                       <?)]
@@ -169,7 +179,7 @@
   (let [{{:keys [cold-store mem-store]} :volatile} @peer
         new-in (chan)
         p (pub in fetch-dispatch)
-        pub-ch (chan 1000)
+        pub-ch (chan 10000)
         fetch-ch (chan)
         binary-fetch-ch (chan)]
     (sub p :pub/downstream pub-ch)


Move cell key outside of component definition

--- src/connect_four/frontend.cljs
+++ src/connect_four/frontend.cljs
@@ -32,8 +32,8 @@
                            (drop-piece (:column best-move))
                            (.log js/console "Win Percentage: " (:percentage best-move))))))

-(defn cell [text column row]
-  ^{:key (str row column)}[:td {:style {:border "1px solid black"
+(defn cell [text column]
+  [:td {:style {:border "1px solid black"
                 :width "60px"
                 :height "60px"}
         :on-click #(player-click column)}
@@ -53,9 +53,10 @@
      [winner-display]
      [:table {:style {:border-collapse "collapse"}}
       (doall (for [row (range (dec rows) -1 -1)]
-               ^{:key row}[:tr
-                           (doall (for [column (range columns)]
-                                    [cell (pieces (get (state column) row 0)) column row]))]))]]))
+               [:tr {:key (str "row-" row)}
+                (doall (for [column (range columns)]
+                         ^{:key (str column row)}
+                         [cell (pieces (get (state column) row 0)) column]))]))]]))

 (reagent/render-component [game-board]
                           (.-body js/document))


Sequences are more general than collections

--- src/devtools/core.cljs
+++ src/devtools/core.cljs
@@ -1,7 +1,7 @@
 (ns devtools.core
   (:require [devtools.debug :as debug]))

-(def max-collection-elements 10)
+(def max-seq-elements 10)
 (def max-map-elements 5)
 (def max-set-elements 7)
 (def abbreviation-string "…")
@@ -63,12 +63,12 @@
   (template "span" "color:#f00" (reference value) "fn"))

 ; TODO: convert to idiomatic clojure code
-(defn header-collection-template [value]
+(defn header-seq-template [value]
   (let [arr (template "span" "color:#000" "[")]
-    (doseq [x (take max-collection-elements value)]
+    (doseq [x (take max-seq-elements value)]
       (.push arr (inlined-value-template x) (spacer x)))
     (.pop arr)
-    (if (> (count value) max-collection-elements)
+    (if (> (count value) max-seq-elements)
       (.push arr abbreviation-string))
     (.push arr "]")
     arr))
@@ -114,7 +114,7 @@
   (cond
     (map? value) (header-map-template value)
     (set? value) (header-set-template value)
-    (coll? value) (header-collection-template value)
+    (seq? value) (header-seq-template value)
     ))

 (defn inlined-value-template [value]


Change icon

Change icon

--- src/discuss/debug.cljs
+++ src/discuss/debug.cljs
@@ -29,7 +29,7 @@
            " "
            (dom/button #js {:className "btn btn-default"
                             :onClick   #(discuss.sidebar/toggle)}
-                       (vlibs/fa-icon "fa-clipboard"))
+                       (vlibs/fa-icon "fa-bars"))
            " "
            (dom/button #js {:className "btn btn-default"
                             :onClick   #(discuss.communication/ajax-get (get-in data [:debug :last-api]))}


Removed search pull down.

Removed search pull down.

--- src/cornwalltechjam/layout.clj
+++ src/cornwalltechjam/layout.clj
@@ -114,15 +114,8 @@
               [:label {:for "checkbox_remember1"} "Remember me"]]
              [:button {:type "submit", :class "btn btn-ar btn-primary pull-right"} "Login"]
              [:div {:class "clearfix"}]]]]]
-         [:div {:class "dropdown animated fadeInDown animation-delay-13"}
-          [:a {:href "#", :class "dropdown-toggle", :data-toggle "dropdown"}
-           [:i {:class "fa fa-search"}]]
-          [:div {:class "dropdown-menu dropdown-menu-right dropdown-search-box animated fadeInUp"}
-           [:form {:role "form"}
-            [:div {:class "input-group"}
-             [:input {:type "text", :class "form-control", :placeholder "Search..."}]
-             [:span {:class "input-group-btn"}
-              [:button {:class "btn btn-ar btn-primary", :type "button"} "Go!"]]]]]]]]]
+      ]]]
+
       [:nav {:class "navbar navbar-default navbar-header-full navbar-dark yamm navbar-static-top", :role "navigation", :id "header"}
        [:div {:class "container"}
         "<!-- Brand and toggle get grouped for better mobile display -->"


AW + NE | 237 | Use mooncake routing for pagination links

--- src/mooncake/view/feed.clj
+++ src/mooncake/view/feed.clj
@@ -73,23 +73,26 @@
     (add-no-active-activity-sources-message enlive-m)
     (add-activities enlive-m activities)))

+(defn feed-path-url-with-page-number [value]
+  (str (routes/path :feed) "?page-number=" value))
+
 (defn render-newer-activities-link [enlive-m page-number]
   (let [page-number-not-null (or page-number 1)
-        dec-page-number (String/valueOf (- page-number-not-null 1))]
+        dec-page-number (dec page-number-not-null)]
     (if (= page-number 1)
       (html/at enlive-m [:.clj--newer-activities__link] (html/do->
                                                           (html/add-class "clj--STRIP")))
       (html/at enlive-m [:.clj--newer-activities__link] (html/do->
-                                                          (html/set-attr :href (str "/?page-number=" dec-page-number)))))))
+                                                          (html/set-attr :href (feed-path-url-with-page-number dec-page-number)))))))

 (defn render-older-activities-link [enlive-m is-last-page? page-number]
   (let [page-number-not-null (or page-number 1)
-        inc-page-number (String/valueOf (+ page-number-not-null 1))]
+        inc-page-number (inc page-number-not-null)]
     (if is-last-page?
       (html/at enlive-m [:.clj--older-activities__link] (html/do->
                                                           (html/add-class "clj--STRIP")))
       (html/at enlive-m [:.clj--older-activities__link] (html/do->
-                                                          (html/set-attr :href (str "/?page-number=" inc-page-number)))))))
+                                                          (html/set-attr :href (feed-path-url-with-page-number inc-page-number)))))))

 (defn feed [request]
   (let [activities (get-in request [:context :activities])]


Remove aborted cli

Remove aborted cli

--- src/ctia/import/threatgrid.clj
+++ src/ctia/import/threatgrid.clj
@@ -59,41 +59,4 @@
          judgements)))

 (comment
-  (load-judgements-from-feed-file "test/data/rat-dns.json" "http://localhost:3000/" "domain" :domain))
-
-(def commands                           ; FIXME replace with function
-                                        ; to support redefinition.
-  {"import-feed" import-feed-comment})
-
-(defn global-arguments []
-  [["-?" "--help" "Print Usage"
-    :default false]
-   ["-d" "--debug" "Turn on debug logging"
-    :default false]
-   ["-v" "--verbose" "Turn on info logging"
-    :default false]
-   [nil "--ctia URL" "CTIA URL"
-    :default "http://localhost:3000"]])
-
-(defn -main [& args]
-  (let [{:keys [options arguments errors summary]}
-        (parse-opts args (global-arguments) :in-order true)
-        [command & command-arguments]
-        arguments
-        usage (fn [text]
-                (print (str text "\n\nAvailable Commands:\n  "
-                            (join ", " (keys commands))
-                            "\n\nGlobal Options:\n" summary))
-                -1)]
-    (let [command (or command "import-feed")]
-      (cond errors                        ; unknown arguments
-            (usage (join "\n" errors))
-            (:help options)               ; help
-            (usage "Usage")
-            (not command)                 ; missing command
-            (usage "No command provided.")
-            (not (get commands command))  ; unknown command
-            (usage (str "Unknown command: '" command "'"))
-            true                          ; continue processing
-            ((get commands command) global-options command-arguments)))))
-
+  (load-judgements-from-feed-file "test/data/rat-dns.json" "http://localhost:4000/" "domain" :domain))


Only allow #'buffer-data with internal servers

--- src/overtone/sc/buffer.clj
+++ src/overtone/sc/buffer.clj
@@ -171,6 +171,8 @@
 (defn buffer-data
   "Get the floating point data for a buffer on the internal server."
   [buf]
+  (when-not (internal-server?)
+    (throw (Exception. (str "Only able to fetch buffer data directly from an internal server. Try #'buffer-read instead."))))
   (let [buf-id (buffer-id buf)
         snd-buf (.getSndBufAsFloatArray @sc-world* buf-id)]
     snd-buf))


Rewrite locate-defs-in-module using for

Rewrite locate-defs-in-module using for

--- src/oxcart/passes/defs.clj
+++ src/oxcart/passes/defs.clj
@@ -22,12 +22,10 @@
   Helper function which implements definition location within the
   context of a single module."
   [module options]
-  (reduce (fn [module form]
-            (if (pattern/def? form)
-              (assoc-in module
-                        [:symbols (pattern/def->symbol form)] form)
-              module))
-          module (:forms module)))
+  (->> (for [form (:forms module)
+             :when (pattern/def? form)]
+         [(pattern/def->symbol form) form])
+       (assoc module :symbols)))

 (defn- locate-publics-in-module


JC | Added descriptions to config values

--- src/stonecutter/config.clj
+++ src/stonecutter/config.clj
@@ -2,9 +2,31 @@
   (:require [environ.core :as env]
             [clojure.tools.logging :as log]))

-(def env-vars #{:port :host :base-url :mongo-port-27017-tcp-addr
+(def vars [:port "The port that app listens"
+           :host "The host IP that app listens on"
+           :base-url "Base url that app is deployed at"
+           :mongo-port-27017-tcp-addr "IP address of mongo container linked on port 27017 (should be supplied by container linking)"
+           :mongo-uri "URI of mongo database"
+           :client-credentials-file-path "Location of file containing client registrations"
+           :secure "If set to true will only allow traffic proxied through HTTPS"
+           :email-script-path "Location of script used to send e-mails"
+           :app-name "Then name of the application"
+           :header-bg-color "Background colour of top bar"
+           :header-font-color "Colour of font in top bar"
+           :header-font-color-hover "Hover colour of font in top bar"
+           :static-resources-dir-path "Optional location of additional static resources (i.e. logo and favicon)"
+           :logo-file-name "Name of logo file in static resources directory"
+           :favicon-file-name "Name of favicon file in static resources directory"
+           :admin-login "Username of admin user"
+           :admin-password "Password of admin user"
+           :password-reset-expiry "Time (in hours) before password-reset email expires"
+           :open-id-connect-id-token-lifetime-minutes "Time (in minutes) before Open ID Connect token expires"
+           :rsa-keypair-file-path "Location of json file containing RSA keypair (for Open ID Connect)"
+           ])
+
+(def env-var-set #{:port :host :base-url :mongo-port-27017-tcp-addr
                 :mongo-uri :client-credentials-file-path
-                :theme :secure :email-script-path :app-name
+                :secure :email-script-path :app-name
                 :header-bg-color :header-font-color :header-font-color-hover
                 :static-resources-dir-path :logo-file-name
                 :favicon-file-name :admin-login :admin-password
@@ -13,19 +35,19 @@
                 :rsa-keypair-file-path})

 (def roles {:default "default"
-            :admin "admin"})
+            :admin   "admin"})

 (defn create-config []
-  (select-keys env/env env-vars))
+  (select-keys env/env env-var-set))

 (defn get-env
   "Like a normal 'get' except it also ensures the key is in the env-vars set"
   ([config-m key]
    (get-env config-m key nil))
   ([config-m key default]
-   (when-not (env-vars key)
+   (when-not (env-var-set key)
      (throw (Exception. (format "Trying to get-env with key '%s' which is not in the env-vars set" key))))
-   (get config-m (env-vars key) default)))
+   (get config-m (env-var-set key) default)))

 (defn port [config-m]
   (Integer. (get-env config-m :port "3000")))
@@ -48,9 +70,6 @@

 (defn client-credentials-file-path [config-m]
   (get-env config-m :client-credentials-file-path "client-credentials.yml"))
-
-(defn theme [config-m]
-  (get-env config-m :theme))

 (defn app-name [config-m]
   (get-env config-m :app-name "Stonecutter"))


Prevent enter key from adding new blank notes

--- labs/architecture-examples/om/src/todomvc/app.cljs
+++ labs/architecture-examples/om/src/todomvc/app.cljs
@@ -7,6 +7,7 @@
             [om.dom :as dom :include-macros true]
             [secretary.core :as secretary]
             [todomvc.utils :refer [pluralize now guid store]]
+            [clojure.string :as string]
             [todomvc.item :as item])
   (:import [goog History]
            [goog.history EventType]))
@@ -98,9 +99,10 @@
 (defn handle-new-todo-keydown [e app owner]
   (when (identical? (.-which e) ENTER_KEY)
     (let [new-field (om/get-node owner "newField")]
-      (om/update! app [:todos] conj
-        {:id (guid) :title (.-value new-field) :completed false})
-      (set! (.-value new-field) ""))
+      (when-not (string/blank? (.. new-field -value trim))
+        (om/update! app [:todos] conj
+          {:id (guid) :title (.-value new-field) :completed false})
+        (set! (.-value new-field) "")))
     false))

 (defn destroy-todo [app {:keys [id]}]


Update to ClojureScript 1.9.562

Update to ClojureScript 1.9.562

--- planck-cljs/project.clj
+++ planck-cljs/project.clj
@@ -1,6 +1,6 @@
 (defproject planck "0.1.0"
   :profiles {:dev
-             {:dependencies [[org.clojure/clojurescript "1.9.542"]
+             {:dependencies [[org.clojure/clojurescript "1.9.562"]
                              [org.clojure/test.check "0.9.0"]
                              [tubular "1.0.0"]]
               :source-paths ["dev"]}
@@ -9,7 +9,7 @@
              :build-commit
              {}}
   :dependencies [[org.clojure/clojure "1.8.0"]
-                 [org.clojure/clojurescript "1.9.542"]
+                 [org.clojure/clojurescript "1.9.562"]
                  [org.clojure/test.check "0.9.0"]
                  [org.clojure/tools.reader "1.0.0-beta4"]
                  [com.cognitect/transit-clj "0.8.297"]


don't double up on output

don't double up on output

--- frontend/controllers/ws.cljs
+++ frontend/controllers/ws.cljs
@@ -98,8 +98,7 @@
     (let [{action-index :step container-index :index action-log :log} (utils/js->clj-kw data)]
       (-> state
           (build-model/fill-containers container-index action-index)
-          (update-in (state/action-path container-index action-index) merge action-log)
-          (update-in (state/action-path container-index action-index) action-model/format-latest-output)))))
+          (update-in (state/action-path container-index action-index) merge action-log)))))

 (defmethod ws-event :build/append-action


removing on-blur validations for mutation and changing login form style

--- src_cljs/rrm/corecljs.cljs
+++ src_cljs/rrm/corecljs.cljs
@@ -109,7 +109,6 @@
                                 [v/string  :message "Enter valid password"]])))

 (defn input-element [id ttype data-set placeholder in-focus]
-  ;;(js/console.log @data-set)
   [:input.form-control {:id id
                         :type ttype
                         :value (@data-set id)
@@ -118,23 +117,17 @@
                         :on-blur  #(reset! in-focus "on")
                         }])

-
-(defn login-input-element [id label span-class ttype data-set placeholder focus]
+(defn login-input [id span-class ttype data-set label focus]
   (let [input-focus (r/atom nil)]
     (fn []
-      [:div.form-group
-       [:div.row
-        [:div.col-sm-12
-         [:label label]
-         [:div.input-group.col-sm-10
-          [:span {:class span-class}]
-          [input-element id ttype data-set placeholder input-focus]]
-         (if (or @input-focus @focus)
-           (if (= nil (login-validator @data-set))
-             [:div]
-             [:div {:style  {:color "red"}} [:b (str (first ((login-validator @data-set) id)))]])
-           [:div])]]])))
-
+      [:div.form-group.has-feedback
+        [input-element id ttype data-set label input-focus]
+        [:span {:class span-class}]
+        (if (or @input-focus @focus)
+          (if (= nil (login-validator @data-set))
+            [:div]
+            [:div {:style  {:color "red"}} [:b (str (first ((login-validator @data-set) id)))]])
+          [:div])])))

 (defn submit-login [data-set focus]
   (if (= nil (login-validator @data-set))
@@ -145,28 +138,28 @@
                       ;;(js/console.log (.-_2 (getdata json)))
                       (reset-login-page)
                       (secretary/dispatch! "/"))))]
-      (http-post (str serverhost "login")
-                 onresp (.serialize (Serializer.) (clj->js @data-set ))))
+      (http-post (str serverhost "login") onresp (.serialize (Serializer.) (clj->js @data-set ))))
     (reset! focus "on")))

 (defn submit-button [data-set focus]
-  [:div.form-group
-   [:div.col-md-6
-    [button-tool-bar
-     [button {:bs-style "primary" :on-click #(submit-login data-set focus)} "Submit" ]]]])
+  [:div.row
+   [:div.col-md-4
+    [:button {:class "btn btn-primary btn-block btn-flat" :on-click #(submit-login data-set focus)} "Sign In" ]]])

 (defn login []
   (let [my-data (r/atom  {})
         focus (r/atom nil)]
     (fn []
-      [:div.container
-       [:div.panel.panel-primary.modal-dialog
-        [:div.panel-heading
-         [:h2 "Log-in"]]
-        [:div.panel-body
-         [login-input-element :username "Email"  "input-group-addon glyphicon glyphicon-user" "email" my-data "Email" focus]
-         [login-input-element :password "Password"  "input-group-addon glyphicon glyphicon-lock" "password" my-data "password" focus]
+      [:div.hold-transition.login-page {:style {:width "100%" :height "100%"}}
+       [:div.login-box
+        [:div.login-logo
+         [:b "Log-in"]]
+        [:div.login-box-body
+         [:p.login-box-msg "Sign in to start your session"]
+         [login-input :username "glyphicon glyphicon-envelope form-control-feedback" "email" my-data "Email" focus]
+         [login-input :password "glyphicon glyphicon-lock form-control-feedback" "password" my-data "password" focus]
          [submit-button my-data focus ]]]])))
+

 ;; ====================================================================================================
 ;; end of login-form
@@ -311,8 +304,6 @@
     [:div.row
      [pager val trec]]))

-
-
 (defn cancel [event]
   (secretary/dispatch! "/"))

@@ -379,7 +370,6 @@
 ;; --------------------------------------------------------------------------
 ;; mutation form

-
 (defn form-validator [data-set]
   (first (b/validate data-set
                      :mutationnumber [[v/required :message "Field is required"]]
@@ -387,7 +377,8 @@
                      :nameofthesecondparty [[v/required :message "Field is required"]]
                      :dateofinstitution [[v/required :message "Field is required"]]
                      :nameofpo [[v/required :message "Field is required"]]
-                     :dateofdecision [[v/required :message "Field is required"]]
+                     :dateofdecision [[v/required :message "Field is required"]
+                                      [v/datetime :message "Please enter valid date"]]
                      :title [[v/required :message "Field is required"]]
                      :khasranumber [[v/required :message "Field is required"]]
                      ;; :area [[v/required :message "Field is required"]]
@@ -406,7 +397,7 @@
                         :value (@data-set id)
                         :placeholder placeholder
                         :on-change #(swap! data-set assoc id (-> % .-target .-value))
-                        :on-blur  #(reset! in-focus "on")
+                        ;; :on-blur  #(reset! in-focus "on")
                         :disabled bool
                         }])

@@ -436,7 +427,7 @@
                         :value (@data-set id)
                         :placeholder placeholder
                         :on-change #(swap! data-set assoc id (-> % .-target .-value))
-                        :on-blur  #(reset! in-focus "on")
+                        ;; :on-blur  #(reset! in-focus "on")
                         } [datalist ]])

 (defn form-input-combo [id label data-set focus]
@@ -966,10 +957,9 @@
     [:div.box-header
      [:h3.box-title "List of Mutations"]]
     [:div {:class "box-body table-responsive"}
-     [:table {:class "table table-bordered table-striped"
-              :style {:width: "100%"}}
+     [:table {:class "table table-bordered table-striped"}
       [:thead
-       [:tr ;; {:style {:background-color "#f2d284"}}
+       [:tr
         (when (is-admin-or-super-admin) [:th ""])
         (when (is-admin-or-super-admin) [:th ""])
         [:th "Mutation Number"]
@@ -993,7 +983,7 @@
        (doall (for [mt mutations]
                 ^{:key (.-id mt)} [:tr
                                    (when (and  (.-senddate mt) (not (.-receiveddate mt)))
-                                     {:style {:background-color "#f6be9f"}})
+                                     {:style {:background-color "#fbcfd1"}})
                                    (when (is-admin-or-super-admin) [:td  [button {:bs-style "success"  :on-click  #(click-update (.-id mt))} "Update"]])
                                    (when (is-admin-or-super-admin) [:td  [button {:bs-style "danger"  :on-click  #(delete (.-id mt))} "Delete"]])
                                    [:td (.-mutationnumber (.-numbers mt))]
@@ -1034,30 +1024,12 @@

 (defroute documents-path1 "/mutations/update/:id" [id]
   (let [upd-data (first (filter (fn[obj] (=(.-id obj) (.parseInt js/window id))) (get-value! :mutations)))
-
-        ;; sub-id  (r/atom nil)
-        ;; dist-id  (r/atom nil)
-
         vill-res (fn[json](set-key-value :villages (getdata json)))
         sub-res (fn[json](set-key-value :subdivisions (getdata json)))
         dist-res (fn[json] ((set-key-value :districts (getdata json))
                            (set-page! [mutation-update-template id upd-data])))]
     (do
-      ;; (http-get (str serverhost "villages/" (.-villageid upd-data))
-      ;;           (fn [json]
-      ;;             (let [dt (getdata json)]
-      ;;               (reset! sub-id dt ))))
-
-      ;; (http-get (str  serverhost "subdivisions/" (.-subdivisionid sub-id))
-      ;;             (fn [json]
-      ;;               (reset! dist-id (getdata json))))
-
-      ;; (js/console.log upd-data)
-      ;; (js/console.log sub-id)
-      ;; (js/console.log )
       (http-get-auth (str serverhost "districts") dist-res)
-      ;; (http-get (str serverhost "districts" (.-districtid dist-id) "subdivisions") sub-res)
-      ;; (http-get (str serverhost "subdivisions" (.-subdivionid sub-id) "villages") vill-res)
       (http-get-auth (str serverhost "villages") vill-res)
       (http-get-auth (str serverhost "subdivisions") sub-res))))

@@ -1255,6 +1227,7 @@
 (defn revenue-add [event]
   (secretary/dispatch! "/revenue/add"))

+
 (defn render-revenue [revenues]
   [:div
    [:div {:class "box"}
@@ -1264,13 +1237,10 @@
      [:div.col-md-12
       [:div.form-group
        [:input {:type "button" :value "Add"
-                :class "btn btn-primary" :on-click revenue-add}]
-       ;; [:input {:id "getall" :type "button" :value "Refresh"
-       ;;          :class "btn btn-primary" :on-click get-all-click}]
-       ]
+                :class "btn btn-primary" :on-click revenue-add}]]
       [:div {:class "box-body"}

-       [:table {:class "table table-bordered table-striped dataTable"}
+       [:table {:class "table table-bordered table-striped dataTable" :border "2" :width "100px" :style {:table-layout "fixed"}}
         [:thead
          [:tr
           (when (is-admin-or-super-admin)[:th " "])


throwing when type is lacking env data

throwing when type is lacking env data

--- src/celestial/puppet_standalone.clj
+++ src/celestial/puppet_standalone.clj
@@ -12,7 +12,6 @@
 (ns celestial.puppet-standalone
   "A standalone puppet provisioner"
   (:use
-    clojure.pprint
     [clj-yaml.core :as yaml]
     [clojure.java.io :only (file)]
     [clojure.core.strint :only (<<)]
@@ -20,7 +19,9 @@
     [celestial.model :only (pconstruct)]
     [taoensso.timbre :only (debug info error warn trace)]
     [supernal.core :only (ns- lifecycle copy run execute env)]
-    [clojure.string :only (join)]))
+    [clojure.string :only (join)])
+  (:require
+    [slingshot.slingshot :refer [throw+]]))

 (defn copy-module [remote {:keys [src name]}]
   {:pre [(remote :host) src name]}
@@ -85,9 +86,10 @@
 (defmethod pconstruct :puppet-std
   [{:keys [run-opts] :as type :or {run-opts {}}} {:keys [machine env] :as spec}]
   (let [remote {:host (machine :ip) :user (or (machine :user) "root")}]
-    (Standalone. remote
-      (-> (get-in type [:puppet-std env])
-        (update-in [:args] (fn [a] (concat a (run-opts :args))))
-        (merge (select-keys run-opts [:classes]))
-        (assoc :hostname (machine :hostname))
-        ))))
+    (if-let [m (get-in type [:puppet-std env])]
+      (Standalone. remote
+        (-> m
+          (update-in [:args] (fn [a] (concat a (run-opts :args))))
+          (merge (select-keys run-opts [:classes]))
+          (assoc :hostname (machine :hostname))))
+        (throw+ {:type ::missing-env} (<< "Type ~(type :type) is missing environment ~{env} values")))))


Enable user search

Enable user search

--- src/checkin_halake/models/users.clj
+++ src/checkin_halake/models/users.clj
@@ -12,6 +12,9 @@
 (def initial-tickets
   (zipmap (keys ticket/ticket-types)
           (repeat 0)))
+
+(defn find-user [id]
+  (fix-user (mc/find-one-as-map db "users" {:_id id})))

 (defn register-user [email password name phone]
   (let [password (encrypt password)


Update to new AMI: SSL, installing RVM via pallet.

--- src/circle/backend/nodes/circle.clj
+++ src/circle/backend/nodes/circle.clj
@@ -29,7 +29,7 @@
 (def circle-group
   (pallet.core/group-spec
    "circle"
-   :circle-node-spec {:ami "ami-efd61d86"
+   :circle-node-spec {:ami "ami-0b805562"
                       :name "www"
                       :availability-zone "us-east-1a"
                       :instance-type "m1.small"


added idomainstore interface.

added idomainstore interface.

--- src/clj/elephantdb/common/iface.clj
+++ src/clj/elephantdb/common/iface.clj
@@ -1,5 +1,41 @@
 (ns elephantdb.common.iface
   (:import [elephantdb Utils]))
+
+;; Domains could also implement comparable... Anyway, the idea here is
+;; that we need something that implements IDomainStore to contain
+;; shards.
+
+domain store, either remote or local, that should
+;; be able to provide paths and connections within its guts (but have
+;; no real knowledge of the filesyste, etc.
+
+
+;; The IDomainStore interface is service-facing; actual elephantDB
+;; applications will need a lower-level interface that reaches into
+;; these domain stores to provide access to individual shard paths.
+;;
+;; On the other hand, we might find that it's enough to provide a path
+;; to the latest version; if a "version" can be fully synched between
+;; between filesystems then we're good to go.
+;;
+;; The filesystem implementation should not be tied to hadoop. With an
+;; interface like this it becomes possible to create varying records
+;; and types; if they fulfill this interface, and the interface
+;; required for transfer, that should be enough.
+
+(defprotocol IDomainStore
+  (allVersions [_]
+    "Returns a sequence of available version timestamps.")
+  (latestVersion [_]
+    "Returns the timestamp (in seconds) of the latest versions.")
+  (latestVersionPath [_]
+    "Returns the timestamp (in seconds) of the latest versions.")
+  (hasData [_]
+    "Does the domain contain any domains at all?")
+  (cleanup [_ to-keep]
+    "Destroys all but the last `to-keep` versions.")
+  (spec [_]
+    "Returns a clojure datastructure containing the DomainStore's spec."))

 (defprotocol IShutdownable
   (shutdown [_]))
@@ -29,7 +65,7 @@
   (defrecord Icing [color]
     Cake
     (face [this] "hi."))
-
+
   "after arg vector, defrecord implement combinations of
    protocol/interface and methods."
   (defrecord ElephantClient [arg1]


Remove `nil`s from the sensors readings

Remove `nil`s from the sensors readings

--- src/clj/kixi/hecuba/api/devices.clj
+++ src/clj/kixi/hecuba/api/devices.clj
@@ -126,7 +126,8 @@
        (mapcat (fn [sensor]
                  (if (= "PULSE" (:period sensor))
                    [sensor (calculated-sensor sensor)] [sensor])))
-       flatten))
+       flatten
+       (keep identity)))

 (defn create-default-sensors
   "Creates default sensors whenever new device is added: *_differenceSeries for CUMULATIVE,