Use set instead of hashmap for 'paths-info'

--- src/cyanite_remover/core.clj
+++ src/cyanite_remover/core.clj
@@ -55,7 +55,7 @@
   (tp-get-data [this])
   (tp-show-stats [this]))

-(def paths-info (atom {}))
+(def paths-info (atom nil))

 (defn- set-inspecting-on!
   "Set the inspecting flag on."
@@ -436,9 +436,8 @@
 (defn- collect-path-info
   "Add a path to the paths info database."
   [path]
-  (let [path-name (:path path)
-        path-info {:leaf (:leaf path)}]
-    (swap! paths-info assoc path-name path-info)))
+  (when (:leaf path)
+    (swap! paths-info conj (:path path))))

 (defn- remove-obsolete-metrics-processor
   "Obsolete metrics removal processor."
@@ -448,6 +447,7 @@
       (mp-get-title [this]
         "Removing obsolete metrics")
       (mp-get-paths [this]
+        (swap! paths-info (fn [_] #{}))
         (get-paths pstore tenant paths (:exclude-paths options) (:sort options)
                    collect-path-info))
       (mp-get-paths-rollups [this]
@@ -495,8 +495,10 @@
                                             tpool)
             obsolete-paths (->> processed-data
                                 (get-paths-from-paths-rollups (first rollups))
-                                (filter #(:leaf (get @paths-info %)))
-                                (sort))]
+                                (filter #(contains? @paths-info %))
+                                (sort)
+                                (doall))]
+        (swap! paths-info (fn [_] nil))
         (process-paths tenant obsolete-paths pstore options
                        remove-obsolete-paths-processor tpool)))
     (catch Exception e


Disposal of distinct

Disposal of distinct

--- src/cyanite_remover/core.clj
+++ src/cyanite_remover/core.clj
@@ -90,8 +90,9 @@

 (defn- get-paths-from-paths-rollups
   "Get paths from a paths-rollups list."
-  [paths-rollups]
+  [rollup paths-rollups]
   (->> paths-rollups
+       (filter #(= (second %) rollup))
        (map first)))

 (defn- dry-mode-warn
@@ -385,7 +386,8 @@
   (let [threshold (:threshold options default-obsolete-metrics-threshold)
         from (timec/to-epoch (time/minus (time/now) (time/seconds threshold)))
         title "Checking metrics"
-        paths-rollups (combine-paths-rollups paths [(first rollups)])
+        rollup (first rollups)
+        paths-rollups (combine-paths-rollups paths [rollup])
         sort (get-sort-or-dummy-fn (:sort options))]
     (prog/set-progress-bar!
      "[:bar] :percent :done/:total Elapsed :elapseds ETA :etas")
@@ -409,7 +411,7 @@
           obsolete-paths (->> futures
                               (process-futures)
                               (remove nil?)
-                              (get-paths-from-paths-rollups)
+                              (get-paths-from-paths-rollups rollup)
                               (sort))
           _ (clog/info (str "Found obsolete metrics on "
                             (count obsolete-paths) " paths"))
@@ -481,9 +483,8 @@
                                             remove-obsolete-metrics-processor
                                             tpool)
             obsolete-paths (->> processed-data
-                                (get-paths-from-paths-rollups)
+                                (get-paths-from-paths-rollups (first rollups))
                                 (filter #(:leaf (get @paths-info %)))
-                                (distinct)
                                 (sort))]
         (process-paths tenant obsolete-paths pstore options
                        remove-obsolete-paths-processor)))
@@ -505,8 +506,7 @@
                                         (:sort options))
                              (filter-obsolete-metrics mstore tpool tenant
                                                       rollups options)
-                             (get-paths-from-paths-rollups)
-                             (distinct)
+                             (get-paths-from-paths-rollups (first rollups))
                              (sort))]
       (newline)
       (dorun (map println obsolete-data)))


Prevent adding filter-items on blur

Prevent adding filter-items on blur

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -126,7 +126,6 @@
                :value       @val
                :style       {:margin 7}
                :auto-focus  true
-               :on-blur     save
                :on-change   #(reset! val (-> % .-target .-value))
                :on-key-down #(case (.-which %)
                                13 (save)


improved debug messages

improved debug messages

--- src/distillery/view/html.clj
+++ src/distillery/view/html.clj
@@ -193,7 +193,7 @@
   (let [w (java.io.StringWriter.)]
     (pprint x w)
     (let [txt (.toString w)]
-      (trace-message "DEBUG: " txt)
+      (trace-message "DEBUG:\n" txt)
       {:tag :pre
        :content [{:tag :strong :content "DEBUG\n" }
                  {:tag :code


add CNAME to generator

add CNAME to generator

--- src/site/generator.clj
+++ src/site/generator.clj
@@ -39,6 +39,7 @@
   (println "Generating into dist:")
   (fs/delete-dir "dist")
   (fs/mkdir "dist")
+  (fs/copy "CNAME" "dist/CNAME")
   (doseq [f (fs/glob "resources/public/*")]
     (println "assets: " (fs/base-name f))
     ((if (fs/directory? f) fs/copy-dir fs/copy)


(SERVER-262) Remove JARS_NO_REQUIRE failing test

Without this patch the test that JARS_NO_REQUIRE is set to true is
destined to fail.  This test should have been removed as part of the
merge conflict resolution process, but was overlooked.

This patch addresses the problem by removing the test.

--- test/unit/puppetlabs/puppetserver/cli/gem_test.clj
+++ test/unit/puppetlabs/puppetserver/cli/gem_test.clj
@@ -14,9 +14,6 @@
       (is (= "/fake/path" ((cli-gem-environment fake-config fake-env)
                             "GEM_HOME"))
           "has GEM_HOME set to /fake/path from the provided config")
-      (is (= "true" ((cli-gem-environment fake-config fake-env)
-                      "JARS_NO_REQUIRE"))
-          "has JARS_NO_REQUIRE set to true")
       (is (= "1" ((cli-gem-environment fake-config fake-env)
                       "FOO_DEBUG"))
           "preserves arbitrary environment vars for the end user"))))


Use new system-simple API instead of osrd

--- src/irresponsible/oolong.clj
+++ src/irresponsible/oolong.clj
@@ -2,7 +2,7 @@
   (:require [com.stuartsierra.component :as cpt]
             [clojure.tools.reader.edn :as edn]
             [clojure.tools.reader.reader-types :as rt]
-            [irresponsible.oolong.util :refer [orsd]]))
+            [irresponsible.oolong.util :refer [simple-system]]))

 ;; oolong is a simple config-based loader for stuartsierra's brilliant
 ;; `component` library that solves our dependency issues.
@@ -37,7 +37,7 @@
    Returns: new system with any dependencies resolved
    Throws: if system cannot be loaded"
   [{:keys [app] :as config}]
-  (orsd {:config config :form app}))
+  (simple-system app (dissoc config :app)))

 (defn brew
   "[backcompat, avoid in new code]


Bug fixing

Bug fixing

Work in progress, may need to find something to unify Duration and
Period.

--- src/tick/core.clj
+++ src/tick/core.clj
@@ -231,8 +231,8 @@
   (hours [n] (Duration/ofHours n))
   (days [n] (Duration/ofDays n))
   (weeks [n] (Duration/ofDays (* n 7)))
-  (months [n] (.multipliedBy (years n) 12))
-  (years [n] (Duration/ofDays (/ n 365.25)))
+  (months [n] (.dividedBy (years n) 12))
+  (years [n] (Duration/ofDays (* n 365.25)))

   Duration
   (nanos [d] (.toNanos d))
@@ -243,7 +243,7 @@
   (days [d] (.toDays d))
   (weeks [d] (.dividedBy (days d) 7))
   (months [d] (.multipliedBy (years d) 12))
-  (years [d] (.dividedBy (days d) 365.24)))
+  (years [d] (/ (days d) 365.24)))

 (defprotocol IDurationCoercion
   (duration [_] [_ _] "Return the duration of the given value, or construct a duration between an amount and units"))


got 'heartbeats' kinda working

got 'heartbeats' kinda working

--- src/viz/core.cljs
+++ src/viz/core.cljs
@@ -12,7 +12,10 @@
 (defn- debug [& args]
   (.log js/console (clojure.string/join " " (map str args))))

-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defn- positive [n] (if (> 0 n) (- n) n))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; initialization

 (defn- window-partial [k]
   (int (* (aget js/document "documentElement" k) 0.95)))
@@ -25,8 +28,9 @@
 (defn- new-state []
   {:frame-rate 15
    :exit-wait-frames 40
-   :tail-length 15
+   :tail-length 7
    :frame 0
+   :dial 0
    :gif-seconds 0
    :grid-width 35 ; from the center
    :ghost (-> (ghost/new-ghost grid/isometric)
@@ -34,6 +38,14 @@
               )
    })

+(defn setup []
+  (let [state (new-state)]
+    (q/frame-rate (:frame-rate state))
+    state))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; scaling and unit conversion related
+
 (defn- curr-second [state]
   (float (/ (:frame state) (:frame-rate state))))

@@ -42,15 +54,40 @@
                   (float (/ (:grid-width state) (window-size 0)))))]
              [(:grid-width state) h]))

-(defn- positive [n] (if (> 0 n) (- n) n))
-
-(defn- spawn-chance [state]
-  "Gives a chance of spawning based on the current run time"
-  (let [period-seconds 1
-        period-frames (* (:frame-rate state) period-seconds)]
-  (if (zero? (rem (:frame state) period-frames))
-    1 100)
-    ))
+(defn- scale [state xy]
+  (map-indexed #(* %2 (float (/ (window-half-size %1)
+                                ((grid-size state) %1)))) xy))
+
+(def bounds-buffer 1)
+
+(defn- in-bounds? [state pos]
+  (let [[w h] (apply vector (map #(- % bounds-buffer) (grid-size state)))
+        min-bound [(- w) (- h)]
+        max-bound [w h]
+        pos-k (keep-indexed #(let [mini (min-bound %1)
+                                   maxi (max-bound %1)]
+                               (when (and (>= %2 mini) (<= %2 maxi)) %2)) pos)]
+    (= (count pos) (count pos-k))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; dials
+
+(def dial-period-seconds 2)
+(def dial-offset-seconds 0.5)
+(def dial-width-frames 1)
+
+(defn- set-dial [state]
+  (let [period-frames (* (:frame-rate state) dial-period-seconds)
+        frame-in-second (rem (:frame state) (int period-frames))
+        offset-frame (int (* (:frame-rate state) dial-offset-seconds))]
+    (assoc state :dial
+           (if (or (and (>= frame-in-second 0) (< frame-in-second dial-width-frames))
+                   (and (>= frame-in-second offset-frame) (< frame-in-second (+ dial-width-frames offset-frame))))
+             1
+             0))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; poss-fn

   ;(let [period-seconds 1
   ;      rad-per-second (float (/ (/ Math/PI 2) period-seconds))
@@ -60,53 +97,28 @@
   ;    (if (> chance-raw 0.97) 3 50)
   ;  ))

-(defn- spawn-all? [state]
-  (let [period-seconds 3
-        period-frames (* (:frame-rate state) period-seconds)]
-  (zero? (rem (:frame state) period-frames))))
-
 (defn- dist-from [pos1 pos2]
   (reduce + (map #(* % %) (map - pos1 pos2))))

+(def mk-poss-fns {
+                  :random (fn [state]
+                            (fn [pos adj-poss]
+                              (take 2 (random-sample 0.6 adj-poss))))
+
+                  :centered (fn [state]
+                              (let [spawn-all? (= 1 (:dial state))]
+                                (fn [pos adj-poss]
+                                  (let [to-take (if spawn-all? (count adj-poss) 1)]
+                                    (take to-take (sort-by #(dist-from % [0 0]) adj-poss))
+                                    ))))
+               })
+
 (defn- mk-poss-fn [state]
-  (let [spawn-all? (spawn-all? state)]
-    (fn [pos adj-poss]
-      (let [adj-poss (filter #(in-bounds? state %) adj-poss)
-            to-take (if spawn-all? (count adj-poss) 1)]
-        (take to-take (sort-by #(dist-from % [0 0]) adj-poss))
-        ))))
-
-;(defn- mk-poss-fn [state]
-;  (let [chance (spawn-chance state)]
-;    (fn [pos adj-poss]
-;      (if (zero? (rand-int chance))
-;        adj-poss
-;        (take 1 (shuffle adj-poss))))
-;    ))
-
-;(defn- mk-poss-fn [state]
-;  (fn [pos adj-poss]
-;    (take 2 (random-sample 0.6 adj-poss))))
-
-(defn setup []
-  (let [state (new-state)]
-    (q/frame-rate (:frame-rate state))
-    state))
-
-(defn- scale [state xy]
-  (map-indexed #(* %2 (float (/ (window-half-size %1)
-                                ((grid-size state) %1)))) xy))
-
-(defn- quil-bounds [state buffer]
-  (let [[w h] (apply vector (map #(- % buffer) (grid-size state)))]
-    [[(- w) (- h)] [w h]]))
-
-(defn- in-bounds? [state pos]
-  (let [[min-bound max-bound] (quil-bounds state 1)
-        pos-k (keep-indexed #(let [mini (min-bound %1)
-                                   maxi (max-bound %1)]
-                               (when (and (>= %2 mini) (<= %2 maxi)) %2)) pos)]
-    (= (count pos) (count pos-k))))
+  (let [chosen-poss-fn :centered
+        inner-fn ((chosen-poss-fn mk-poss-fns) state)]
+    (fn [pos adj-poss] (inner-fn pos (filter #(in-bounds? state %) adj-poss)))))
+
+;; ghost

 (defn- ghost-incr [state poss-fn]
   (update-in state [:ghost] ghost/incr poss-fn))
@@ -118,9 +130,13 @@
 (defn- ghost-update-node-meta [state id f]
   (update-in state [:ghost :forest] forest/update-node-meta id f))

-(defn- ghost-set-nodes-red [state]
-  (reduce #(ghost-update-node-meta %1 %2 (fn [ma] (assoc m :color 0xFFFF0000)))
-          state (get-in state [:ghost :active-node-ids])))
+(defn- ghost-set-nodes-color [state]
+  (let [color (if (zero? (:dial state)) 0xFF000000 0xFFFF0000)]
+    (reduce #(ghost-update-node-meta %1 %2 (fn [ma] (assoc m :color color)))
+            state (get-in state [:ghost :active-node-ids]))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; update

 (defn- maybe-exit [state]
   (if (empty? (get-in state [:ghost :active-node-ids]))
@@ -131,11 +147,15 @@
 (defn update-state [state]
   (let [poss-fn (mk-poss-fn state)]
     (-> state
+        (set-dial)
         (ghost-incr poss-fn)
-        (ghost-set-nodes-red)
+        (ghost-set-nodes-color)
         (maybe-remove-roots)
         (update-in [:frame] inc)
         (maybe-exit))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; draw

 (defn- draw-ellipse [state pos size] ; size is [w h]
   (let [scaled-pos (scale state pos)
@@ -220,6 +240,9 @@
     ;            (gstring/format "spawn-chance:%d" (spawn-chance state))))
     ;        30 30)
   )
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; def

 (q/defsketch viz
   :title ""


Straightening up

Straightening up

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -36,5 +36,6 @@
   (empty $content)
   (empty $header)
   (append $content (wish-ul wishes))
-  (append $header (wishlist-title title)))
+  (append $header  (wishlist-title title)))

+


Update map_data.cljs

Update map_data.cljs

Christina - updated the description of the bars to include predicted range labelling and tweaked a couple of other things


let poly pick the right kind of channel

let poly pick the right kind of channel

--- informing/src/app/core.cljs
+++ informing/src/app/core.cljs
@@ -75,16 +75,11 @@

 (defonce setup-event-channels!
   (do
-    (swap-event-channel!
-     :dom-viewport-resize (poly/channel-for-viewport-resize!))
-    (swap-event-channel!
-     :env-keyboard-key (poly/listen-put! js/window :key (poly/keyboard-e-chan)))
-    (swap-event-channel!
-     :env-mouse-down (poly/listen-put! js/window :mouse-down (poly/mouse-e-chan)))
-    (swap-event-channel!
-     :env-mouse-move (poly/listen-put! js/window :mouse-move (poly/mouse-e-chan)))
-    (swap-event-channel!
-     :env-mouse-up (poly/listen-put! js/window :mouse-up (poly/mouse-e-chan)))
+    (swap-event-channel! :dom-viewport-resize (poly/channel-for-viewport-resize!))
+    (swap-event-channel! :env-keyboard-key (poly/listen-put! js/window :key))
+    (swap-event-channel! :env-mouse-down (poly/listen-put! js/window :mouse-down))
+    (swap-event-channel! :env-mouse-move (poly/listen-put! js/window :mouse-move))
+    (swap-event-channel! :env-mouse-up (poly/listen-put! js/window :mouse-up))
     true))


Add excludes to prevent class confusion

Add excludes to prevent class confusion

Signed-off-by: Wil <41c73e1c187a64e501bf473cfef5419e8eb5a640@twosigma.com>

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -34,7 +34,7 @@
                  [org.clojure/core.cache "0.6.4"]
                  [org.clojure/core.memoize "0.5.8"]
                  [clj-time "0.9.0"]
-                 [org.clojure/core.async "0.2.374"]
+                 [org.clojure/core.async "0.2.374" :exclusions [org.clojure/tools.reader]]
                  [prismatic/schema "0.2.1"
                   :exclusions [potemkin]]
                  [clojure-miniprofiler "0.4.0"]
@@ -44,6 +44,7 @@
                  [riddley "0.1.10"]
                  [com.netflix.fenzo/fenzo-core "0.8.2"
                   :exclusions [org.apache.mesos/mesos
+                               com.fasterxml.jackson.core/jackson-core
                                org.slf4j/slf4j-api
                                org.slf4j/slf4j-simple]]

@@ -63,7 +64,11 @@
                  ;;Networking
                  [clj-http "2.0.0"]
                  [io.netty/netty "3.10.1.Final"]
-                 [cc.qbits/jet "0.5.7"]
+                 [cc.qbits/jet "0.5.7" :exclusions [org.eclipse.jetty/jetty-io
+                                                    org.eclipse.jetty/jetty-security
+                                                    org.eclipse.jetty/jetty-server
+                                                    org.eclipse.jetty/jetty-http
+                                                    cheshire]]
                  [org.eclipse.jetty/jetty-server "9.2.6.v20141205"]
                  [org.eclipse.jetty/jetty-security "9.2.6.v20141205"]

@@ -71,8 +76,8 @@
                  ;;Metrics
                  [metrics-clojure "2.6.1"
                   :exclusions [io.netty/netty org.clojure/clojure]]
-                 [metrics-clojure-ring "2.3.0"
-                  :exclusions [io.netty/netty org.clojure/clojure]]
+                 [metrics-clojure-ring "2.3.0" :exclusions [com.codahale.metrics/metrics-core
+                                                            org.clojure/clojure io.netty/netty]]
                  [io.dropwizard.metrics/metrics-graphite "3.1.2"]
                  [com.aphyr/metrics3-riemann-reporter "0.4.0"]
                  [riemann-clojure-client "0.4.1"]


Bumps version to 1.59.8-SNAPSHOT

Bumps version to 1.59.8-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.59.7"
+(defproject cook "1.59.8-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.10.3"]


Unprivate a few more maven util functions.

--- src/leiningen/util/maven.clj
+++ src/leiningen/util/maven.clj
@@ -151,7 +151,7 @@
       (.setType (or type "jar"))
       (.setExclusions es))))

-(defn- make-repository [[id settings]]
+(defn make-repository [[id settings]]
   (let [repo (Repository.)]
     (.setId repo id)
     (if (string? settings)
@@ -159,14 +159,14 @@
       (.setUrl repo (:url settings)))
     repo))

-(defn- make-license [{:keys [name url distribution comments]}]
+(defn make-license [{:keys [name url distribution comments]}]
   (doto (License.)
     (.setName name)
     (.setUrl url)
     (.setDistribution (and distribution (clojure.core/name distribution)))
     (.setComments comments)))

-(defn- make-mailing-list [{:keys [name archive other-archives
+(defn make-mailing-list [{:keys [name archive other-archives
                                  post subscribe unsubscribe]}]
   (let [mailing-list (MailingList.)]
     (doto mailing-list


Always pass a string to camel->kebab in the defview macro

--- src/main/app_macros/view.clj
+++ src/main/app_macros/view.clj
@@ -116,7 +116,7 @@
   "Generate a function name from fn-sym prefixed with the
    kebab-cased name of a view."
   [fn-sym view-name]
-  (symbol (str (camel->kebab view-name) "-" fn-sym)))
+  (symbol (str (camel->kebab (name view-name)) "-" fn-sym)))

 (defn prefix-fn-name
   "Prefixes the name of the function fn with the name of a view."
@@ -176,7 +176,7 @@
         ~@prop-defns
         (om.next/defui ~name
           ~@component-fn-decls)
-        (def ~(symbol (camel->kebab name))
+        (def ~(symbol (camel->kebab (str name)))
           (om.next/factory ~name ~factory-params))))))

 (defmacro defview


[Issue #82] added opts-map? to :arglists and docstring

--- src/midje/ideas/formulas.clj
+++ src/midje/ideas/formulas.clj
@@ -48,11 +48,19 @@
         [a (gen/string) b (gen/string)]
         (str a b) => (has-prefix a))

-  Currently, we recommend you use generators from test.generative.generators
+  Currently, we recommend you use generators from test.generative.generators.
+  (However we are in the works to create a library of generators with shrinkers, so
+   don't get too attached to test.generative)
+
+  opts-map keys:
+
+     :num-trials - Used to override the number of trials for this formula only.
+                   This is higher precedence than *num-trials*
+                   Must be set to a number 1 or greater.

   The midje.ideas.formulas/*num-trials* dynamic var determines
   how many facts are generated per formula."
-  {:arglists '([docstring? bindings & body])}
+  {:arglists '([docstring? opts-map? bindings & body])}
   [& args]
   (when-valid &form
     (let [[docstring? opts bindings body] (deconstruct-formula-args args)


Actually use default in `branch` if provided.

--- src/overtone/helpers/lib.clj
+++ src/overtone/helpers/lib.clj
@@ -360,4 +360,5 @@
                   (butlast clauses)
                   clauses)]
     (get (apply hash-map clauses)
-         (eval e))))+         (eval e)
+         default)))


Работа надо селектором для chart-2

Работа надо селектором для chart-2

--- radiolamp-6P3S/src/r6p3s/cpt/d3/chart_2.cljs
+++ radiolamp-6P3S/src/r6p3s/cpt/d3/chart_2.cljs
@@ -28,7 +28,7 @@
                                  y-label
                                  title
                                  description
-                                 x-value-as-num-fn
+                                 on-selected-fn
                                  ]
                           :or   {main-width  d3c/full-screen-width
                                  main-height 300
@@ -38,10 +38,11 @@
                                  bottom      20
                                  y-label     ""}

-                          :as   opts}]
+                          :as opts}]
   (let [chart-width  (- main-width left rigth)
         chart-height (- main-height top bottom)
         ;;y-values-scheme (map #(assoc % :path-id (rc/uniq-id "path")) y-values-scheme)-and-data-and-data
+
         ]

@@ -85,38 +86,40 @@

               {:keys [x-value-fn
                       yx-schema
-                      data]}       @app
+                      data]} @app
+
+
               ;; Размерность x
-              x-scale              (-> js/d3 .-time  .scale
-                                       (.domain (d3c/min-max (or x-value-as-num-fn #(-> % x-value-fn .getTime))
-                                                             min max data))
-                                       ;;(.domain (.extent js/d3 data :pdate))
-                                       (.range #js [0 chart-width]))
+              x-scale   (-> js/d3 .-time  .scale
+                            (.domain (d3c/min-max #(-> % x-value-fn .getTime) min max data))
+                            ;;(.domain (.extent js/d3 data :pdate))
+                            (.range #js [0 chart-width]))
               ;; Размерность y
-              all-y                (->> yx-schema
-                                        (map :y-value-fn)
-                                        (reduce
-                                         (fn [a y-value-fn]
-                                           (let [[min max] (d3c/min-max y-value-fn min 1 max 1.1 data)]
-                                             (conj a min max)))
-                                         []))
-              y-min-max            #js [(or domain-y-min (apply min all-y))
-                                        (or domain-y-max (apply max all-y))]
-              y-scale              (-> js/d3 .-scale .linear
-                                       ;;(.domain (min-max y-value-fn min 1 max 1.1 data))
-                                       (.domain y-min-max)
-                                       (.range  #js [chart-height 0]))
+              all-y     (->> yx-schema
+                             (map :y-value-fn)
+                             (reduce
+                              (fn [a y-value-fn]
+                                (let [[min max] (d3c/min-max y-value-fn min 1 max 1.1 data)]
+                                  (conj a min max)))
+                              []))
+              y-min-max #js [(or domain-y-min (apply min all-y))
+                             (or domain-y-max (apply max all-y))]
+              y-scale   (-> js/d3 .-scale .linear
+                            ;;(.domain (min-max y-value-fn min 1 max 1.1 data))
+                            (.domain y-min-max)
+                            (.range  #js [chart-height 0]))

               ;; Линейки
-              x-axis               (-> js/d3 .-svg .axis (.scale x-scale) (.orient "bottom"))
-              y-axis               (-> js/d3 .-svg .axis (.scale y-scale) (.orient "left"))
-
-
-
-              yx-schema-array      (into-array yx-schema)
+              x-axis (-> js/d3 .-svg .axis (.scale x-scale) (.orient "bottom"))
+              y-axis (-> js/d3 .-svg .axis (.scale y-scale) (.orient "left"))
+
+
+
+              yx-schema-array (into-array yx-schema)

               ]

+          ;; PATHES ------------------------------------------------------------------------------------------------
           (let [paths (-> chart-pano
                           (.select "g.charting.pathes")
                           (.selectAll "path")
@@ -151,7 +154,7 @@
                 .remove))

-          ;; Масштабные линейки
+          ;; Масштабные линейки -----------------------------------------------------------------------------------
           (-> chart-pano
               (.selectAll "g.y.axis")
               (.call y-axis))
@@ -160,13 +163,13 @@
               (.selectAll "g.x.axis")
               (.call x-axis))

-          ;; Селектор [<--selector-->]
+          ;; Селектор [<--selector-->] ----------------------------------------------------------------------------
           (when on-brushend-fn
             (let [brush (-> js/d3 .-svg .brush (.x x-scale))]
               (.on brush "brushend"
                    (fn [v]
                      (let [selected (js->clj (.extent brush))
-                           [x1 x2] selected]
+                           [x1 x2]  selected]

                        ;; Левая пунктирная линия
                        (-> chart-pano
@@ -184,7 +187,37 @@
                            (.attr "x2" (x-scale x2))
                            (.attr "y2" (+ chart-height 7)))

-                       (on-brushend-fn selected))))
+                       ;; CIRCLES and TEXTS -----------------------------------------------------------------------
+                       (let [selected-rows (->> data
+                                                (filter
+                                                 (fn [row]
+                                                   (let [v (x-value-fn row)]
+                                                     (and (<= x1 v) (<= v x2)))))
+                                                vec)
+                             selected-rows (if-not (empty? selected-rows) selected-rows
+                                                   ;; Тогда выбираем первое от первого селектора
+                                                   (loop [[r & t] data]
+                                                     (cond (nil? r)               []
+                                                           (>= (x-value-fn r) x1) [r]
+                                                           :else                  (recur t))))
+
+                             x1-row (first selected-rows)
+                             x2-row (last selected-rows)
+
+                             interval (condp = (count selected-rows)
+                                        0 []
+                                        1 [x1-row]
+                                        [x1-row x2-row])
+                             ]
+
+                         (println "CHART -> SELECT INTERVAL: " interval)
+
+                         ;; вызов функции по реальному селектору
+                         (when on-selected-fn
+                           (on-selected-fn {:interval interval :selected-rows selected-rows})))
+
+
+                       (on-brushend-fn selected))))

               (-> chart-pano
                   (.selectAll "g.x.brush")
@@ -201,7 +234,7 @@
                   (.attr "y1" 0)
                   (.attr "x2" 0)
                   (.attr "y2" 0))
-
+
               #_(on-brushend-fn [nil nil])
               ))


demo-var and demo-atom

demo-var and demo-atom

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

--- plugins/SlideExplorer2/src/slide_explorer/canvas.clj
+++ plugins/SlideExplorer2/src/slide_explorer/canvas.clj
@@ -143,6 +143,12 @@
       .show)
     panel))

+(defn demo-var []
+  (canvas-frame (var temp-data)))
+
+(defn demo-atom []
+  (canvas-frame grafix))
+
 (defn demo-animation [reference]
   (dotimes [i 200]
   (Thread/sleep 30)


Small fix and no beaming run when there's already a ghost

--- desktop/src-common/ds3/enemy.clj
+++ desktop/src-common/ds3/enemy.clj
@@ -275,9 +275,10 @@
                           non-drifters (filter #(not= (:movement-state %) :drifting) enemies)
                           capturers (filter #(= (:movement-state %) :capturing) non-drifters)
                           master (filter #(:master? %) enemies)
+                          ghost (filter #(:ghost? %) non-enemies)
                           entity (first drifters)
                           attacker (cond entity
-                                         (if (and (:boss? entity) (empty? capturers) (empty? master))
+                                         (if (and (:boss? entity) (empty? capturers) (empty? master) (empty? ghost))
                                            (let [n-m-s :capturing]
                                              (assoc entity :movement-state n-m-s :current-time 0
                                                :spline (splines/calibrate-spline (assoc entity :movement-state n-m-s))))
@@ -381,4 +382,4 @@
                                         :else (:movement-state entity)))))

 (defn- update-towing [screen entity]
-  (update-returning entity screen towing-speed))
+  (update-returning screen entity towing-speed))


Refactor of color generation

Refactor of color generation

--- desktop/src-common/ds3/space.clj
+++ desktop/src-common/ds3/space.clj
@@ -9,10 +9,8 @@
 (def star-speed-fast (c/screen-to-world -0.4))
 (def star-speeds [star-speed-slow star-speed-med star-speed-fast])
 (def star-alpha 0.75)
-(def star-color-degree 0.75)
-(def star-colors [(color 1 1 1 star-alpha) (color 1 1 star-color-degree star-alpha) (color 1 star-color-degree 1 star-alpha)
-                  (color star-color-degree 1 1 star-alpha) (color star-color-degree star-color-degree  1 star-alpha)
-                  (color star-color-degree 1 star-color-degree star-alpha) (color 1 star-color-degree star-color-degree star-alpha)])
+(def star-color-dim 0.75)
+(def star-color-full 1.0)

 (defn create-star-texture [c]
   (let [pix-map (pixmap* 1 1 (pixmap-format :r-g-b-a8888))]
@@ -30,9 +28,11 @@
     :speed (first (shuffle star-speeds))))

 (defn create-space []
-  (let [star-textures (map (fn [c] (create-star-texture c)) star-colors)]
+  (let [colors [star-color-dim star-color-full]
+        color-list (rest (for [x colors y colors z colors] (color x y z star-alpha)));create all binary combinations, drop [dim dim dim]
+        star-textures (map (fn [c] (create-star-texture (color c))) color-list)]
     (for [count (range star-count)]
-      (create-star (c/screen-to-world (rand-int c/game-width)) (c/screen-to-world (rand-int c/game-height)) (first (shuffle star-textures)) )
+      (create-star (c/screen-to-world (rand-int c/game-width)) (c/screen-to-world (rand-int c/game-height)) (first (shuffle star-textures)))
       )))

 (defn move-star [screen {:keys [:y :speed] :as entity}]
@@ -41,4 +41,3 @@
                     (+ y speed))]
   (assoc entity :y new-y)))

-


Yet more tests

Yet more tests

--- test/compojure/html/html.clj
+++ test/compojure/html/html.clj
@@ -61,13 +61,30 @@
           "</" tag ">")))

 (fact "Attributes maps can have many values"
-  [attrs [{:a "1" :b "2" :c "3" :d "4"}]]
-  (= (xml [:tag attrs])
-     (str "<tag a=\"1\" b=\"2\" c=\"3\" d=\"4\" />")))
+  [attr-map [{:a "1" :b "2" :c "3" :d "4"}
+             {:id "a" :class "b"}]
+   attr-str ["a=\"1\" b=\"2\" c=\"3\" d=\"4\""
+             "class=\"b\" id=\"a\""]]
+  (= (xml [:div attr-map])
+     (str "<div " attr-str " />")))

-(fact "HTML tag vectors have syntax sugar for class attributes")
+(fact "Special characters are escaped in attributes"
+  [char    ["\""     "<"    ">"    "&"]
+   escaped [""" "<" ">" "&"]]
+  (= (xml [:div {:id char}])
+     (str "<div id=\"" escaped "\" />")))

-(fact "HTML tag vectors have syntax sugar for id attributes")
+(fact "HTML tag vectors have syntax sugar for class attributes"
+  [tag   (rand-tags)
+   class (rand-strs ascii-letters 1 20)]
+  (= (html [tag {:class class}])
+     (html [(str tag "." class)])))
+
+(fact "HTML tag vectors have syntax sugar for id attributes"
+  [tag (rand-tags)
+   id  (rand-strs ascii-letters 1 20)]
+  (= (html [tag {:id id}])
+     (html [(str tag "#" id)])))

 (fact "The contents of HTML block tags are indented")


Print port

Print port

--- src/servisne_info/webapp.clj
+++ src/servisne_info/webapp.clj
@@ -14,6 +14,7 @@
     (reset! server nil)))

 (defn -main [& [port]]
+  (puts "PORT: " port)
   (let [port (Integer. (or port (env :port) 5000))]
     (reset! server (run-server handler/app {:port port}))
     (.addShutdownHook (Runtime/getRuntime) (Thread. stop-server))


Reording with ssh and without cache rebuild actions.

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -1228,8 +1228,8 @@
              (when (and (build-model/can-cancel? build) has-write-settings?)
                (forms/managed-button
                  [:a.build-action
-                  {:data-loading-text "Canceling",
-                   :title             "Cancel this build",
+                  {:data-loading-text "Canceling"
+                   :title             "Cancel this build"
                    :on-click #(raise! owner [:cancel-build-clicked {:build-id build-id
                                                                     :vcs-url vcs-url
                                                                     :build-num build-num}])}
@@ -1247,6 +1247,15 @@
                   "Rebuild"])
                [:button.btn.dropdown-toggle {:data-toggle "dropdown"} [:span.caret]]
                [:ul.dropdown-menu
+                [:li (forms/managed-button
+                       [:a
+                        {:data-loading-text "Rebuilding",
+                         :title             "Retry without cache",
+                         :on-click #(raise! owner [:retry-build-clicked {:build-id build-id
+                                                                         :vcs-url vcs-url
+                                                                         :build-num build-num
+                                                                         :no-cache? true}])}
+                        "without cache"])]
                 ;; XXX Temporarily remove the ssh button for OSX builds
                 (when (not (feature/enabled-for-project? project :osx))
                   [:li (forms/managed-button
@@ -1256,16 +1265,7 @@
                            :on-click #(raise! owner [:ssh-build-clicked {:build-id build-id
                                                                          :vcs-url vcs-url
                                                                          :build-num build-num}])}
-                          "with ssh"])])
-                [:li (forms/managed-button
-                       [:a
-                        {:data-loading-text "Rebuilding",
-                         :title             "Retry without cache",
-                         :on-click #(raise! owner [:retry-build-clicked {:build-id build-id
-                                                                         :vcs-url vcs-url
-                                                                         :build-num build-num
-                                                                         :no-cache? true}])}
-                        "without cache"])]]])
+                          "with ssh"])])]])
             [:a.build-action
              {:href (routes/v1-project-settings {:org  (get-in data (conj state/project-plan-path :org_name))
                                                  :repo (get-in data (conj state/project-path :reponame))})}


Factor *eval-fn* to one binding

Factor *eval-fn* to one binding

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -189,7 +189,8 @@
   [source expression? print-nil-expression?]
   (binding [ana/*cljs-ns* @current-ns
             *ns* (create-ns @current-ns)
-            r/*data-readers* tags/*cljs-data-readers*]
+            r/*data-readers* tags/*cljs-data-readers*
+            cljs.js/*eval-fn* cljs/js-eval]
     (let [expression-form (and expression? (repl-read-string source))]
       (if (repl-special? expression-form)
         (let [env (assoc (ana/empty-env) :context :expr
@@ -207,8 +208,7 @@
                   (try (cljs/eval st
                                   expr
                                   {:ns   @current-ns
-                                   :context :expr
-                                   :eval cljs/js-eval}
+                                   :context :expr}
                                   print-error)
                        (catch js/Error e (prn :caught e)))))
           (prn nil))
@@ -220,7 +220,6 @@
             (merge
               {:ns         @current-ns
                :load       load
-               :eval       cljs/js-eval
                :source-map false
                :verbose    (:verbose @app-env)}
               (when expression?


fix burst time issues

fix burst time issues

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -123,13 +123,13 @@
        "ZPositionUm" (get-in state [:last-stage-positions (state :default-z-drive)])
       })))

-(defn annotate-image [img event state]
+(defn annotate-image [img event state elapsed-time-ms]
   {:pix (:pix img)
    :tags
    (merge
      (generate-metadata event state)
      (:tags img)
-     {"ElapsedTime-ms" (burst-time (:tags img) state)}
+     {"ElapsedTime-ms" elapsed-time-ms}
      )}) ;; include any existing metadata

 (defn make-TaggedImage [annotated-img]
@@ -288,7 +288,8 @@
               (swap! state assoc
                      :burst-time-offset (- (elapsed-time @state)
                                            (core-time-from-tags (image :tags)))))
-            (.put out-queue (make-TaggedImage (annotate-image image evt @state))))
+            (.put out-queue (make-TaggedImage (annotate-image image evt @state
+                                                              (burst-time (:tags image) @state)))))
           (when (core isBufferOverflowed)
             (swap! state assoc :stop true)
             (ReportingUtils/showError "Circular buffer overflowed."))))
@@ -299,13 +300,13 @@
 (defn collect-snap-image [event out-queue]
   (let [image
          {:pix (core getImage)
-          :tags {"ElapsedTime-ms" (@state :last-image-time)}}]
+          :tags nil}]
     (do (log "collect-snap-image: "
                (select-keys event [:position-index :frame-index
                                    :slice-index :channel-index]))
       (when out-queue
           (.put out-queue
-                (make-TaggedImage (annotate-image image event @state)))))
+                (make-TaggedImage (annotate-image image event @state (elapsed-time @state))))))
     image))

 (defn return-config []
@@ -616,7 +617,7 @@
   (binding [state (atom (create-basic-state))]
     (let [event (create-basic-event)]
       (core snapImage)
-      (annotate-image (collect-snap-image event nil) event @state))))
+      (annotate-image (collect-snap-image event nil) event @state nil))))

 (defn show-image [display tagged-img focus]
   (let [myTaggedImage (make-TaggedImage tagged-img)
@@ -649,14 +650,16 @@
       (if on
         (let [event (create-basic-event)
               state (create-basic-state)
-              first-image (atom true)]
+              first-image (atom true)
+              start-time (jvm-time-ms)]
           (dosync (ref-set live-mode-running true))
           (core startContinuousSequenceAcquisition 0)
           (log "started sequence acquisition")
           (.start (Thread.
                     #(do (while @live-mode-running
                            (let [raw-image {:pix (core getLastImage) :tags nil}
-                                 img (annotate-image raw-image event state)]
+                                 elapsed-time-ms (- (jvm-time-ms) start-time)
+                                 img (annotate-image raw-image event state elapsed-time-ms)]
                               (reset-snap-window img)
                               (show-image @snap-window img @first-image)
                               (reset! first-image false)))


Throw away old unused code.

Throw away old unused code.

--- src/wanderlust/svg_draft.clj
+++ src/wanderlust/svg_draft.clj
@@ -30,35 +30,6 @@
           rx (rand-int r)
           ry (rand-int r)]
       [(opx x rx) (opy y ry)])))
-
-
-(defn generate-draft
-  ([] (generate-draft {}))
-  ([{:keys [name desc width height location-step location-deviation]
-     :or   {name "Terra Incognita"
-            desc "HC SVNT DRACONES"
-            width  1000
-            height 500
-            location-step 50
-            location-deviation 35}}]
-   (reset-ids!)
-   (let [locations (locations-grid width height location-step location-deviation) ]
-     [:dali/page {:width width :height height}
-      (s/css "circle.location {stroke: yellow; fill: red;}")
-      #_(into [:g {:id "terrain" :inkscape:groupmode "layer" :inkscape:label "terrain"}]
-              (voronoi-lines (locations-grid 1000 500 20 18)))
-      [:g {:id "terrain shapes" :inkscape:groupmode "layer" :inkscape:label "terrain-shapes"}
-       [:rect {:id "primal-ocean" :stroke :midnightblue :fill :midnightblue}
-        [0 0] [width height]]]
-      [:g {:id "connections" :inkscape:groupmode "layer" :inkscape:label "connections"}
-       [:circle {:stroke :black :stroke-width 1 :fill :indigo} [0 0] 1]]
-      [:g {:id "pathways" :inkscape:groupmode "layer" :inkscape:label "pathways"}
-       [:circle {:stroke :black :stroke-width 1 :fill :indigo} [0 0] 1]]
-      (into
-        [:g {:id "locations" :inkscape:groupmode "layer" :inkscape:label "locations"}]
-        (map (fn [coord] [:circle {:id (gen-id! "location") :class "location"} coord 3]) locations))
-      [:g {:id "labels" :inkscape:groupmode "layer" :inkscape:label "labels"}
-       [:circle {:stroke :black :stroke-width 1 :fill :indigo} [0 0] 1]]])))

 (defn gen-locations [{:keys [width height] :as chart}]
@@ -186,7 +157,6 @@
     (let [locations
           (reduce
             (fn [res {:keys [attrs data]}]
-              (prn attrs text)
               (assoc res (:id attrs)
                          {:coords [(Double/parseDouble (:cx attrs))
                                    (Double/parseDouble (:cy attrs))]
@@ -262,7 +232,6 @@
            [(keyword c)
             (mapv #(Double/parseDouble %)
                   (let [res (re-seq #"[+-]*[\d.]+" pts)]
-                    (prn res)
                     res))]))))

 (defn linerize-path-commands [path-commands]


Only reset when we need to

Only reset when we need to

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -426,7 +426,7 @@
   (end? [this]
         (.-end? iterator)))

-(deftype Join [seek-key iterators var->iterators ^:mutable end?]
+(deftype Join [seek-key iterators var->iterators var->iterator->reset? ^:mutable end?]
   Object
   (reset [this]
          (debug)
@@ -448,11 +448,11 @@

            (== old-var new-var)
            ;; ACROSS: assumes prefixes all equal, keys not all equal, iterators sorted by ascending key, nothing at end
-           (let [iterators (aget var->iterators new-var)
-                 num-iterators (alength iterators)
-                 previous (mod (- current 1) num-iterators)
-                 max-key (.key-at (aget iterators previous) new-var)
-                 iterator (aget iterators current)
+           (let [var-iterators (aget var->iterators new-var)
+                 num-var-iterators (alength var-iterators)
+                 previous (mod (- current 1) num-var-iterators)
+                 max-key (.key-at (aget var-iterators previous) new-var)
+                 iterator (aget var-iterators current)
                  min-key (.key-at iterator new-var)
                  old-key (.inner-key iterator)]
              (debug :search max-key current seek-key)
@@ -471,15 +471,15 @@
                      (do
                        (aset seek-key new-var max-key)
                        (recur new-var (+ new-var 1) 0))
-                     (recur new-var new-var (mod (+ current 1) num-iterators)))))))
+                     (recur new-var new-var (mod (+ current 1) num-var-iterators)))))))

            (< new-var old-var)
            ;; UP: assumes prefixes and keys all equal, nothing at end
            (if (== old-var 0)
              (set! end? true)
              (let [new-var (- old-var 1)
-                   iterators (aget var->iterators new-var)
-                   iterator (aget iterators (- (alength iterators) 1))]
+                   var-iterators (aget var->iterators new-var)
+                   iterator (aget var-iterators (- (alength var-iterators) 1))]
                (debug :up old-var seek-key)
                (when (< old-var (alength var->iterators))
                  (aset seek-key old-var least))
@@ -501,14 +501,18 @@
            (if (== old-var (- (alength var->iterators) 1))
              nil ;; done
              (let [new-var (+ old-var 1)
-                   iterators (aget var->iterators new-var)]
+                   var-iterators (aget var->iterators new-var)
+                   iterator->reset? (aget var->iterator->reset? new-var)]
                (debug :down old-var old-key seek-key)
                (dotimes [i (alength iterators)]
-                 (doto (aget iterators i) (.reset) (.seek seek-key))) ;; TODO this could be implemented more efficiently
-               (js/goog.array.sort iterators (fn [i0 i1] (compare (.key-at i0 new-var) (.key-at i1 new-var))))
-               (if (== (.key-at (aget iterators 0) new-var) (.key-at (aget iterators (- (alength iterators) 1)) new-var))
+                 (debug :resets iterator->reset? :for new-var)
+                 (when (true? (aget iterator->reset? i))
+                   (debug :resetting i :to seek-key :at new-var)
+                   (doto (aget iterators i) (.reset) (.seek seek-key)))) ;; TODO this could be implemented more efficiently
+               (js/goog.array.sort var-iterators (fn [i0 i1] (compare (.key-at i0 new-var) (.key-at i1 new-var))))
+               (if (== (.key-at (aget var-iterators 0) new-var) (.key-at (aget var-iterators (- (alength var-iterators) 1)) new-var))
                  (do
-                   (aset seek-key new-var (.key-at (aget iterators 0) new-var))
+                   (aset seek-key new-var (.key-at (aget var-iterators 0) new-var))
                    (recur new-var (+ new-var 1) 0))
                  (recur new-var new-var 0))))))
   (next [this]
@@ -539,7 +543,12 @@
                                   (when (true? (aget iterator->var->present? i j))
                                     (apush var-iterators (aget join-iterators i))))
                                 var-iterators))
-        join (Join. seek-key join-iterators var->iterators false)]
+        var->iterator->reset? (amake [j num-vars]
+                                     (amake [i (alength iterators)]
+                                            (and (> j 0)
+                                                 (true? (aget iterator->var->present? i j))
+                                                 (false? (aget iterator->var->present? i (- j 1))))))
+        join (Join. seek-key join-iterators var->iterators var->iterator->reset? false)]
     (.reset join)
     join))


Removed deprecated version of verify function

--- src/ais/core.clj
+++ src/ais/core.clj
@@ -110,15 +110,6 @@
             (ais-ex/parse "payload" msg-b))
            (ais-ex/parse "fill-bits" msg-b))))

-(defn verify [& msgs]
-  (for [msg msgs]
-    (let [[env chksum] (ais-ex/parse "env-chksum" msg)]
-      (if (not-any? nil? [env chksum])
-        (if (= (ais-util/checksum env) chksum)
-          msg
-          (throw (ais.exceptions.ChecksumVerificationException. (str "CHKSUM(" env ") != " chksum ", == " (ais-util/checksum env)))))
-        (throw (ais.exceptions.MessageFormatException. (str "Failed parsing (env, chksum) from " msg)))))))
-
 (defn verify [& in-msgs]
   (loop [msgs in-msgs
          verified []]


Set electoral district type validation to warning

--- src/vip/data_processor/validation/data_spec/v3_0.clj
+++ src/vip/data_processor/validation/data_spec/v3_0.clj
@@ -192,7 +192,7 @@
     :stats true
     :columns [{:name "id" :required :critical :format format/all-digits :coerce coerce/coerce-integer}
               {:name "name" :required :critical}
-              {:name "type" :format format/electoral-district-type}
+              {:name "type" :format format/electoral-district-type :severity :warnings}
               {:name "number" :format format/all-digits :coerce coerce/coerce-integer}]}
    {:filename "locality.txt"
     :table :localities


add rules to cope with gender symbols in morphological analysis, since we've removed the redundant lexical entries (e.g. "I (♀)") that used to compensate for this lack.

--- src/babel/english/morphology.cljc
+++ src/babel/english/morphology.cljc
@@ -592,6 +592,20 @@
       ;; default case.
       (str english "s"))))

+(def gender-symbol-female
+  {#" \(♀\)$"
+   {:replace-with ""
+    :unify-with {:synsem {:cat :noun
+                          :agr {:gender :fem}}}}})
+
+(def gender-symbol-male
+  {#" \(♂\)$"
+   {:replace-with ""
+    :unify-with {:synsem {:cat :noun
+                          :agr {:gender :fem}}}}})
+
+;; TODO: do other unicode entities/emojis like soccer ball and music staff.
+
 (def plural-to-singular-noun
   {#"s$"
    {:replace-with ""
@@ -703,6 +717,8 @@
   "return the map incorporating the lexical information about a surface form."
   (let [replace-pairs
         (merge
+         gender-symbol-female
+         gender-symbol-male
          plural-to-singular-noun
          infinitive-to-infinitive
          infinitive-to-1sing-present


allow transaction items to be selected by reconciliation status

--- src/clj_money/models/storage/sql_storage.clj
+++ src/clj_money/models/storage/sql_storage.clj
@@ -279,10 +279,17 @@

   (select-transaction-items-by-account-id
     [_ account-id options]
-    (query db-spec (-> (transaction-item-base-query)
-                       (h/where [:= :i.account_id account-id])
-                       (h/order-by [:i.index :desc])
-                       (append-paging options))))
+    (let [sql (-> (transaction-item-base-query)
+                  (h/where [:= :i.account_id account-id])
+                  (h/order-by [:i.index :desc])
+                  (append-paging options))
+          sql (cond-> sql
+                (contains? options :reconciled?)
+                (h/merge-where (if (:reconciled? options)
+                                 [:= :r.status "completed"]
+                                 [:or [:= :r.status nil]
+                                      [:= :r.status "new"]])))]
+      (query db-spec sql)))

   (count-transaction-items-by-account-id
     [this account-id]


Isolate state mutation in events namespace.

--- src/cljs/personal_photos_reagent/events.cljs
+++ src/cljs/personal_photos_reagent/events.cljs
@@ -17,74 +17,107 @@

 ;; # Picture events
 (defonce select-picture-chan (async/chan))
+
 (async/sub event-publisher :select-picture select-picture-chan)
+
+(defn- toggle-select-picture
+  [pictures-state picture-id album-name]
+  (let [existing-selections (get-in pictures-state [picture-id :selected])]
+    (if (contains? existing-selections album-name)
+      (update-in pictures-state [picture-id :selected] disj album-name)
+      (update-in pictures-state [picture-id :selected] conj album-name))))
+
+(defn- select-picture-event
+  [event]
+  (let [current-pictures-state @(app-state :pictures)
+        picture-id-to-select (get-in event [:payload :picture :id])
+        album-to-select-picture-in (get-in event [:payload :album])
+        new-pictures-state (toggle-select-picture current-pictures-state picture-id-to-select album-to-select-picture-in)]
+    (compare-and-set! (app-state :pictures) current-pictures-state new-pictures-state)))
+
 (defn- process-select-picture-events []
   (go
     (while true
-      (let [event (async/<! select-picture-chan)
-            pic-id (get-in event [:payload :picture :id])
-            album-name (get-in event [:payload :album])
-            existing-selections (get-in @(app-state :pictures) [pic-id :selected])]
-        (if (contains? existing-selections album-name)
-          (swap! (app-state :pictures) update-in [pic-id :selected] disj album-name)
-          (swap! (app-state :pictures) update-in [pic-id :selected] conj album-name))))))
+      (let [event (async/<! select-picture-chan)]
+        (select-picture-event event)))))
+
 (process-select-picture-events)
+
+;; ## Deselect pictures events

 (defonce deselect-pictures-chan (async/chan))
 (async/sub event-publisher :deselect-pictures deselect-pictures-chan)
+
+(defn- deselect-picture
+  [[pic-id pic]]
+  [pic-id (assoc pic :selected #{})])
+
+(defn- deselect-pictures
+  [ps]
+  (into {}
+        (map deselect-picture ps)))
+
 (defn- deselect-pictures-event
-  [e]
-  (letfn [(deselect-picture
-            [[pic-id pic]]
-            [pic-id (assoc pic :selected #{})])
-          (deselect-pictures
-            [ps]
-            (into {}
-                  (map deselect-picture ps)))]
-    (swap! (app-state :pictures) deselect-pictures)))
+  [event]
+  (let [current-pictures-state @(app-state :pictures)
+        new-pictures-state (deselect-pictures current-pictures-state)]
+    (compare-and-set! (app-state :pictures) current-pictures-state new-pictures-state)))

 (defn- process-deselect-pictures-events []
   (go
     (while true
       (let [event (async/<! deselect-pictures-chan)]
         (deselect-pictures-event event)))))
+
 (process-deselect-pictures-events)

+;; ## Pictures changed events
 (defonce pictures-changed-chan (async/chan))
 (async/sub event-publisher :pictures-changed pictures-changed-chan)
+
+(defn- pictures-changed-event
+  [event]
+  (let [current-picture-state @(app-state :pictures)
+        current-album-state @(app-state :albums)
+        pictures (vals current-picture-state)
+        unsorted-pictures-ids {"No album" (map :id (remove (comp seq :albums) pictures))}
+        album-pictures-ids (apply merge-with concat (mapcat #(for [a (:albums %)]
+                                                               {a [(:id %)]})
+                                                            pictures))
+        new-album-state (merge album-pictures-ids unsorted-pictures-ids)]
+    (compare-and-set! (app-state :albums) current-album-state new-album-state)))
+
 (defn- process-pictures-changed-events []
   (go
     (while true
-      (let [event (async/<! pictures-changed-chan)
-            pictures (get event :payload)
-            unsorted-pictures {"No album"
-                               (map :id
-                                    (remove (comp seq :albums)
-                                            pictures))}
-            pictures-albums (apply merge-with concat (mapcat #(for [a (:albums %)]
-                                                                {a [(:id %)]})
-                                                             pictures))
-            albums (merge pictures-albums unsorted-pictures)]
-        (reset! (app-state :albums) albums)))))
+      (let [event (async/<! pictures-changed-chan)]
+        (pictures-changed-event event)))))
+
 (process-pictures-changed-events)

 ;; ## Select album events
 (defonce select-album-chan (async/chan))
 (async/sub event-publisher :select-album select-album-chan)

+(defn- add-album-to-picture
+  [album picture]
+  (update-in picture [:albums] conj album))
+
 (defn- add-pictures-to-album
-  [pictures album]
-  ())
+  [pictures-map album]
+  (let [pictures (vals pictures-map)
+        selected-pictures (filter (comp seq :selected) pictures)
+        with-album (map (partial add-album-to-picture album) selected-pictures)
+        with-album-map (into {} (map #(vector (:id %) %) with-album))]
+    (merge pictures-map with-album-map)))

 (defn- select-album-event
-  [e]
-  (let [album (get e :payload)
-        pictures @(app-state :pictures)
-        ps (vals pictures)
-        selected-pictures (filter (comp seq :selected) ps)]
-    (doseq [p selected-pictures]
-      (swap! (app-state :pictures) update-in [(:id p) :albums] conj album))
-    (publish-event :event :pictures-changed :payload (vals @(app-state :pictures)))))
+  [event]
+  (let [album (get event :payload)
+        current-picture-state @(app-state :pictures)
+        with-new-albums (add-pictures-to-album current-picture-state album)]
+    (when (compare-and-set! (app-state :pictures) current-picture-state with-new-albums)
+      (publish-event :event :pictures-changed))))

 (defn- process-select-album-events []
   (go


Refactor code

Refactor code

--- src/cljs/salava/extra/passport/ui/block.cljs
+++ src/cljs/salava/extra/passport/ui/block.cljs
@@ -20,7 +20,7 @@

 (defn ^:export terms_fr []
-  [:div {:style {:padding "30px"}}
+  [:div.terms-container #_{:style {:padding "30px" }}
    [:div
     [:h1 {:style {:text-align "center"}} (clojure.string/upper-case "Conditions d’utilisation")]]
    [:div {:style {:text-align "center"}}
@@ -162,7 +162,7 @@

 (defn ^:export terms []
-  [:div {:style {:padding "30px"}}
+  [:div.terms-container #_{:style {:padding "30px"}}
    [:div
     [:h1 {:style {:text-align "center"}} "TERMS OF USE"]]
    [:div {:style {:text-align "center"}}
@@ -222,7 +222,7 @@
     [:p "These Terms of Use and the contractual relation related thereto shall be governed by the Laws of Finland. Disputes arising out of these Terms of Use or the contractual relation related thereto will be attempted to be settled amicably. If no agreement is attained, the dispute shall be settled in the District Court of the City of Oulu, Finland as the first instance."]
     [:p "If you have questions regarding these Terms of Use, please contact the Service Provider " [:a {:href "mailto:contact@openbadgepassport.com"} "(contact@openbadgepassport.com)."]]
     [:p "The Privacy Notice document complements the Terms of Use and is incorporated into these Terms of Use by reference."]
-    [:div {:style {:padding "15px"}}
+    [:div #_{:style {:padding "15px"}}
      [:h1 {:style {:text-align "center"}} " Privacy Notice"]
      [:div
       [:p {:style {:text-align "center"}} "Updated 29.01.2019"]


added history option, cleanup log view #260

--- src/cljs/swarmpit/component/service/log.cljs
+++ src/cljs/swarmpit/component/service/log.cljs
@@ -1,17 +1,28 @@
 (ns swarmpit.component.service.log
-  (:require [material.components :as comp]
+  (:require [material.icon :as icon]
+            [material.components :as comp]
             [swarmpit.component.state :as state]
             [swarmpit.component.mixin :as mixin]
             [swarmpit.ajax :as ajax]
+            [swarmpit.time :as time]
             [swarmpit.routes :as routes]
             [clojure.string :as string]
-            [material.icon :as icon]
             [sablono.core :refer-macros [html]]
             [rum.core :as rum]))

 (def line-num (atom 0))
 (def last-scroll (atom 0))
 (def last-glow (atom 0))
+
+(def history-options
+  {"15m" "15 minutes"
+   "30m" "30 minutes"
+   "60m" "1 hour"
+   "4h"  "4 hours"
+   "8h"  "8 hours"
+   "12h" "12 hours"
+   "24h" "24 hours"
+   nil   "all"})

 (defn- auto-scroll!
   []
@@ -49,26 +60,33 @@
        (map #(assoc-in % [:key] (swap! line-num inc)))))

 (defn- log-handler
-  [service-id task-id]
+  [service-id task-id since]
   (ajax/get
     (routes/path-for-backend :service-logs {:id service-id})
     {:state      [:fetching]
-     :on-success (fn [{:keys [response]}]
-                   (let [logs (filter-logs task-id response)]
-                     (reset! last-glow (count logs))
-                     (state/update-value [:initialized] true state/form-state-cursor)
-                     (state/set-value logs state/form-value-cursor)))
-     :on-error   #(state/update-value [:error] true state/form-state-cursor)}))
+     :params     (when since {:since since})
+     :on-success (fn [{:keys [origin? response]}]
+                   (when origin?
+                     (let [logs (filter-logs task-id response)]
+                       (reset! last-glow (count logs))
+                       (state/update-value [:initialized] true state/form-state-cursor)
+                       (state/set-value logs state/form-value-cursor))))
+     :on-error   (fn [{:keys [origin?]}]
+                   (when origin?
+                     (state/update-value [:error] true state/form-state-cursor)))}))

 (defn- log-append-handler
-  [service-id task-id from-timestamp]
+  [service-id task-id since]
   (ajax/get
     (routes/path-for-backend :service-logs {:id service-id})
     {:state      [:fetching]
-     :params     (if from-timestamp {:from from-timestamp})
-     :on-success (fn [{:keys [response]}]
-                   (state/set-value (-> (state/get-value state/form-value-cursor)
-                                        (concat (filter-logs task-id response))) state/form-value-cursor))}))
+     :params     (if since
+                   {:since (-> since (time/to-unix) (inc))}
+                   {:since "1m"})
+     :on-success (fn [{:keys [origin? response]}]
+                   (when origin?
+                     (state/set-value (-> (state/get-value state/form-value-cursor)
+                                          (concat (filter-logs task-id response))) state/form-value-cursor)))}))

 (defn- init-form-state
   []
@@ -76,6 +94,7 @@
   (reset! last-scroll 0)
   (reset! line-num 0)
   (state/set-value {:filter      {:predicate ""}
+                    :history     "15m"
                     :initialized false
                     :fetching    false
                     :autoscroll  false
@@ -85,21 +104,25 @@
 (def mixin-refresh-form
   (mixin/refresh-form
     (fn [{{:keys [id taskId]} :params}]
-      (when (not (:fetching (state/get-value state/form-state-cursor)))
-        (log-append-handler id taskId (-> (state/get-value state/form-value-cursor)
-                                          (last)
-                                          :timestamp))))))
+      (let [state (state/get-value state/form-state-cursor)]
+        (when (not (:fetching state))
+          (log-append-handler id
+                              taskId
+                              (-> (state/get-value state/form-value-cursor)
+                                  (last)
+                                  :timestamp)))))))

 (def mixin-init-form
   (mixin/init-form
     (fn [{{:keys [id taskId]} :params}]
       (init-form-state)
       (service-handler id)
-      (log-handler id taskId))))
+      (log-handler id taskId "15m"))))

 (rum/defc line < rum/static [service item index]
   [:div
-   [:a.log-info {:href (routes/path-for-frontend :service-task-log {:id (:serviceName service) :taskId (:task item)})}
+   [:a.log-info {:href (routes/path-for-frontend :service-task-log {:id     (:serviceName service)
+                                                                    :taskId (:task item)})}
     (str (subs (:task item) 0 7))]
    [:span {:class (if (< @last-glow index)
                     (do (swap! last-glow inc)
@@ -107,34 +130,78 @@
                     "log-body")}
     (str " " (:line item))]])

+(rum/defc form-history < rum/reactive [history id taskId]
+  (let [anchorEl (state/react (conj state/form-state-cursor :historyAnchorEl))]
+    (html
+      [:div
+       [:div.Swarmpit-log-history-fab
+        (comp/button
+          {:variant "extendedFab"
+           :onClick #(state/update-value [:historyAnchorEl] (.-currentTarget %) state/form-state-cursor)}
+          (icon/access-time {:className "Swarmpit-log-history-fab-ico"})
+          (get history-options history))]
+       (comp/menu
+         {:id              "list-filter-menu"
+          :anchorEl        anchorEl
+          :anchorOrigin    {:vertical   "top"
+                            :horizontal "right"}
+          :transformOrigin {:vertical   "top"
+                            :horizontal "right"}
+          :open            (some? anchorEl)
+          :onClose         #(state/update-value [:historyAnchorEl] nil state/form-state-cursor)}
+         (comp/menu-item
+           {:className "Swarmpit-menu-info"
+            :disabled  true}
+           (html [:span (str "Period of last")]))
+         (map
+           (fn [[k v]]
+             (comp/menu-item
+               {:key      (str "item-" v)
+                :selected (= k history)
+                :onClick  (fn [e]
+                            (state/update-value [:initialized] false state/form-state-cursor)
+                            (log-handler id taskId k)
+                            (state/update-value [:history] k state/form-state-cursor)
+                            (state/update-value [:historyAnchorEl] nil state/form-state-cursor))}
+               v)) history-options))])))
+
+(rum/defc form-scroll < rum/static [autoscroll]
+  (html
+    [:div.Swarmpit-log-fab
+     (comp/button
+       {:variant "fab"
+        :color   (if autoscroll "primary")
+        :mini    true
+        :onClick (fn []
+                   (reset! last-scroll 0)
+                   (state/update-value [:autoscroll] (not autoscroll) state/form-state-cursor))}
+       icon/scroll-down)]))
+
+(rum/defc form-logs < rum/static [{:keys [initialized error service]} logs filtered-logs]
+  (html
+    [:div#autoscroll.Swarmpit-log
+     (cond
+       error [:span "Logs for this service couldn't be fetched."]
+       (and (empty? logs) initialized) [:span "No logs for given period."]
+       (not initialized) [:span "Loading..."]
+       :else (->> filtered-logs
+                  (take-last 500)
+                  (map #(rum/with-key (line service % (:key %)) (:key %)))))]))
+
 (rum/defc form < rum/reactive
                  mixin-init-form
                  mixin-refresh-form
                  {:did-mount  (fn [state] (auto-scroll!) state)
-                  :did-update (fn [state] (auto-scroll!) state)} [{{:keys [id]} :params}]
-  (let [{:keys [filter autoscroll initialized error service]} (state/react state/form-state-cursor)
+                  :did-update (fn [state] (auto-scroll!) state)} [{{:keys [id taskId]} :params}]
+  (let [{:keys [filter autoscroll history] :as log-state} (state/react state/form-state-cursor)
         logs (state/react state/form-value-cursor)
         filtered-logs (filter-items logs (:predicate filter))]
     (comp/mui
       (html
         [:div
-         [:div.Swarmpit-log-fab
-          (comp/button
-            {:variant "fab"
-             :color   (if autoscroll "primary")
-             :mini    true
-             :onClick (fn []
-                        (reset! last-scroll 0)
-                        (state/update-value [:autoscroll] (not autoscroll) state/form-state-cursor))}
-            icon/scroll-down)]
-         [:div#autoscroll.Swarmpit-log
-          (cond
-            error [:span "Logs for this service couldn't be fetched."]
-            (and (empty? logs) initialized) [:span "Log is empty in this service."]
-            (not initialized) [:span "Loading..."]
-            :else (->> filtered-logs
-                       (take-last 500)
-                       (map #(rum/with-key (line service % (:key %)) (:key %)))))]]))))
+         (form-history history id taskId)
+         (form-scroll autoscroll)
+         (form-logs log-state logs filtered-logs)]))))

 (rum/defc form-task < form [params]
   (form params))


feature metadata

feature metadata

--- src/clojure/zensols/nlparse/feature/lang.clj
+++ src/clojure/zensols/nlparse/feature/lang.clj
@@ -148,8 +148,11 @@
      {:in-dict-ratio (ratio-true lemmas wn/in-dictionary?)
       :in-english-word-list-ratio (ratio-true lemmas #(wl/in-word-list? lang %))})))

-(defn dictionary-feature-metas []
-  [[:in-dict-ratio 'numeric]])
+(defn dictionary-feature-metas
+  "See [[dictionary-features]]."
+  []
+  [[:in-dict-ratio 'numeric]
+   [:in-english-word-list-ratio 'numeric]])

 (defn- token-average-length [tokens]
   (->> (map :text tokens)


Allow passing custom inner graphql parser

--- src/com/wsscode/pathom/connect/graphql2.cljc
+++ src/com/wsscode/pathom/connect/graphql2.cljc
@@ -389,39 +389,41 @@

 (defn graphql-resolve [{::keys [demung] :as config} env]
   (let [env' (merge env config)
+        parser-item' (::parser-item config parser-item)
         q    (build-query env')
         gq   (query->graphql q config)]
     (let-chan [{:keys [data errors]} (request env' gq)]
-      (-> (parser-item {::p/entity               data
-                        ::p/errors*              (::p/errors* env)
-                        ::p/placeholder-prefixes (::p/placeholder-prefixes env')
-                        ::demung                 (or demung identity)
-                        ::base-path              (vec (butlast (::p/path env)))
-                        ::graphql-query          gq
-                        ::errors                 (index-graphql-errors errors)}
-            q)
+      (-> (parser-item' {::p/entity               data
+                         ::p/errors*              (::p/errors* env)
+                         ::p/placeholder-prefixes (::p/placeholder-prefixes env')
+                         ::demung                 (or demung identity)
+                         ::base-path              (vec (butlast (::p/path env)))
+                         ::graphql-query          gq
+                         ::errors                 (index-graphql-errors errors)}
+                        q)
           (pull-idents)))))

 (defn graphql-mutation [{::keys [demung] :as config} env]
   (let [{:keys     [ast]
          ::pc/keys [source-mutation]
          :as       env'} (merge env config)
+        parser-item' (::parser-item config parser-item)
         query (p/ast->query {:type :root :children [(assoc ast :key source-mutation :dispatch-key source-mutation)]})
         gq    (query->graphql query config)]
     (let-chan [{:keys [data errors]} (request env' gq)]
       #_ (js/console.log "Mutation response" data errors env config)
       (let [parser-response
-            (-> (parser-item {::p/entity      data
-                              ::p/errors*     (::p/errors* env)
-                              ::base-path     (vec (butlast (::p/path env)))
-                              ::demung        (or demung identity)
-                              ::graphql-query gq
-                              ::errors        (index-graphql-errors errors)}
-                  (p/ast->query {:type     :root
-                                 :children [(assoc ast
-                                              :type :join
-                                              :key (keyword source-mutation)
-                                              :dispatch-key (keyword source-mutation))]})))]
+            (-> (parser-item' {::p/entity      data
+                               ::p/errors*     (::p/errors* env)
+                               ::base-path     (vec (butlast (::p/path env)))
+                               ::demung        (or demung identity)
+                               ::graphql-query gq
+                               ::errors        (index-graphql-errors errors)}
+                              (p/ast->query {:type     :root
+                                             :children [(assoc ast
+                                                               :type :join
+                                                               :key (keyword source-mutation)
+                                                               :dispatch-key (keyword source-mutation))]})))]
         (get parser-response (keyword source-mutation))))))

 (defn defgraphql-resolver [{::pc/keys [resolver-dispatch mutate-dispatch]} {::keys [resolver] :as config}]


Update docstrings

Update docstrings

--- src/braid/core/module_helpers.clj
+++ src/braid/core/module_helpers.clj
@@ -1,4 +1,10 @@
 (ns braid.core.module-helpers
+  "Helpers for the Braid module system.
+  The important things here are:
+  - The `defhook` macro, which Clojure & Clojurescript should use to
+    define extension points for modules
+  - The `gen-module-requires` and `gen-module-loads` macros, which
+    `modules.cljs` uses to set up cljs module extensions"
   (:require
    [clojure.tools.reader.edn :as edn]
    [clojure.java.io :as io]))
@@ -51,7 +57,10 @@
 (defmacro gen-module-requires
   "Generate the `require` statements to pull in all necessary
   namespaces to be able to connect the modules. That is, all the
-  namespaces named in both `:extends` and `:provides`."
+  namespaces named in both `:extends` and `:provides`.
+  It seems that this should be in a separate namespace from
+  `gen-module-loads`, or the namespaces won't yet be loaded when the
+  extension calls are made."
   []
   (let [modules (read-all-modules)
         provides (->> modules
@@ -74,7 +83,9 @@
   Doing this with a macro instead of a function because we want the
   parsing of the EDN files to happen at compile time, by Clojure,
   rather than at runtime with ClojureScript (particularly because
-  ClojureScript can't actually read said module.edn files)."
+  ClojureScript can't actually read said module.edn files).
+  This should be in a namespace that requires another ns that invokes
+  the `gen-module-requires` macro."
   []
   (let [modules (read-all-modules)
         provides (->> modules
@@ -90,8 +101,8 @@

 (defmacro defhook
   "Macro to generate a module extension point.
-  `:writer` will be a function name that should be in the
-  `:provides` section of the module.edn.
+  `:writer` will be a function name that should be in the `:provides`
+  section of the module.edn.
   `:reader` will be deref-able and will give a collection of the
   values passed to the writer.

@@ -117,6 +128,10 @@
             [_#]
             (reduce
               (fn [vs# th#]
+                ;; In Clojure the module-loading will store the Vars
+                ;; themselves so we can just deref them, but in
+                ;; Clojurescript vars aren't reified at runtime, so
+                ;; module loading passes thunks
                 (~add-fn vs# (~(if clojure?
                                  `deref
                                  `(fn [x#] (x#)))


Remove signup page.

Remove signup page.

--- src/circleci/web/views/signup.clj
+++ src/circleci/web/views/signup.clj
@@ -1,52 +0,0 @@
-(ns circleci.web.views.signup
-  (:use noir.core
-       hiccup.core
-       hiccup.page-helpers
-       hiccup.form-helpers)
-  (:use circleci.web.views.common)
-  (:use [circleci.db :only (with-conn)])
-  (:use [ring.util.response :only (redirect)])
-  (:require [circleci.model.beta-notify :as beta]))
-
-(defpage "/signup" []
-  (layout
-   [:div#page_title_wrap
-    [:div#page_title
-     [:h3 "Signup for CircleCI"]
-     [:div#clear]]]
-   [:div#content_wrap
-    [:div#content
-     [:div#main_content_wide_wpadding.left
-      [:h1 "Sign up"]
-      [:p.subheading "CircleCI is in alpha right now. Provide your contact information, and we'll contact you when it's ready to try out."]
-      [:p.subheading "Tell us about your environment (which heroku stack, which languages, tools you're using, etc), and which features are most important to you, and we'll prioritize them."]
-      [:form#account {:action "/signup" :method "POST"}
-       [:fieldset
-        [:h3 "Information"]
-        (unordered-list
-         [(list (label "email" "Email address")
-                (text-field {:id "email"
-                             :type "text"} "email"))
-          (list (label "environment" "Your environment")
-                (text-area {:id "environment"
-                            :type "text"
-                            :rows "3"
-                            :cols "50"} "environment"))
-          (list (label "priorities" "Important features")
-                (text-area {:id "priorities"
-                            :type "text"
-                            :rows "3"
-                            :cols "50"} "comments"))])]
-       [:fieldset
-        [:input.call_to_action {:type "submit"
-                                :value "Get Notified"}]]]]]]
-   [:div.clear]))
-
-(defpage "/beta-thanks" []
-  (layout
-   [:div#page_title_wrap
-    [:div#page_title
-     [:h3 "Success"]]]
-   [:div#content_wrap
-    [:div#content
-     [:div "Thanks for your input! We'll contact you as soon as we're ready."]]]))


Add error handling in user/viz-update.

Add error handling in user/viz-update.


Implments get-training-data function.

Implments get-training-data function.

--- src/cadence/model.clj
+++ src/cadence/model.clj
@@ -120,6 +120,20 @@
                        {$set {:random_point [(rand) 0]}}))
     result))

+(defn get-training-data
+  "Returns cadences to be used to train a classifier as a tuple of bad cadences
+  and good cadences."
+  [user-id phrase-id]
+  (let [find-cadences (fn [by-user _]
+                        (mc/find-maps
+                          "cadences"
+                          {:phrase_id phrase-id
+                           :user_id (if (by-user)
+                                      user-id
+                                      {$ne user-id})
+                           :random_point {"$near" (rand)}}))]
+    [(find-cadences false 50) (find-cadences true 10)]))
+
 (defn store-classifier
   "Stores the given classifier with the given user/phrase pair."
   [user-id phrase-id classifier]


solved problem 8

solved problem 8

--- euler-clj/src/euler_clj/core.clj
+++ euler-clj/src/euler_clj/core.clj
@@ -133,7 +133,7 @@
   "Return the greatest product of m consecutive digits in a number n."
   [m n]
   (apply max
-    (loop [p      (map #(java.lang.Integer/parseInt %) (rest (string/split (str n) #"")))
+    (loop [p      (pmap #(bigint (java.lang.Integer/parseInt %)) (rest (string/split (str n) #"")))
            result []]
       (let [result (conj result (apply * (take m p)))]
         (if (<= (count p) m)


Added tile 1010 to Peru

Added tile 1010 to Peru


keep server alive when Mutate trashes ice that is only card in server

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -252,12 +252,13 @@

    "Mutate"
    {:req (req (seq (filter (every-pred rezzed? ice?) (all-installed state :corp))))
+    :prompt "Choose a rezzed piece of ICE to trash"
     :choices {:req (every-pred rezzed? ice?)}
     :msg (msg "to trash " (:title target))
     :effect (req (let [i (ice-index state target)
                        [reveal r] (split-with (complement ice?) (get-in @state [:corp :deck]))
                        titles (->> (conj (vec reveal) (first r)) (filter identity) (map :title))]
-                   (trash state side target {:cause :ability-cost})
+                   (trash state side target {:cause :ability-cost :keep-server-alive true})
                    (when (seq titles)
                      (system-msg state side (str "reveals " (clojure.string/join ", " titles) " from R&D")))
                    (if-let [ice (first r)]


Added more informative message when using Interns

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -216,7 +216,8 @@
     :choices {:req #(and (not= (:type %) "Operation")
                          (= (:side %) "Corp")
                          (#{[:hand] [:discard]} (:zone %)))}
-    :effect (effect (corp-install target nil {:no-install-cost true}))}
+    :effect (effect (corp-install target nil {:no-install-cost true}))
+    :msg (msg "install " (if (:seen target) (:title target) "an unseen card") (if (= (:zone target) [:hand]) " from HQ" " from Archives"))}

    "Invasion of Privacy"
    {:trace {:base 2 :msg "reveal the Runner's Grip and trash up to X resources or events"


add accounts/reload

add accounts/reload

--- src/clj_money/models/accounts.clj
+++ src/clj_money/models/accounts.clj
@@ -142,6 +142,11 @@
   [storage-spec id]
   (prepare-for-return
     (find-account-by-id (storage storage-spec) id)))
+
+(defn reload
+  "Returns a fresh copy of the specified account from the data store"
+  [storage-spec {:keys [id]}]
+  (find-by-id storage-spec id))

 (defn select-by-entity-id
   "Returns a list of all accounts in the system"


Don't show button pane to spectator

Don't show button pane to spectator

--- src/cljs/netrunner/gameboard.cljs
+++ src/cljs/netrunner/gameboard.cljs
@@ -627,98 +627,98 @@
                 (om/build rfg-view {:cards (:play-area me)})
                 (om/build rfg-view {:cards (:current opponent) :name "Current"})
                 (om/build rfg-view {:cards (:current me) :name "Current"})]
-
-               [:div.button-pane { :on-mouse-over card-preview-mouse-over
-                                   :on-mouse-out  card-preview-mouse-out  }
-                (when-not (:keep me)
-                  [:div.panel.blue-shade
-                   [:h4 "Keep hand?"]
-                   [:button {:on-click #(send-command "keep")} "Keep"]
-                   [:button {:on-click #(send-command "mulligan")} "Mulligan"]])
-
-                (when (:keep me)
-                  (if-let [prompt (first (:prompt me))]
+               (if (= (:user me) (:user @app-state))
+                 [:div.button-pane { :on-mouse-over card-preview-mouse-over
+                                    :on-mouse-out  card-preview-mouse-out  }
+                  (when-not (:keep me)
                     [:div.panel.blue-shade
-                     [:h4 (for [item (get-message-parts (:msg prompt))] (create-span item))]
-                     (if-let [n (get-in prompt [:choices :number])]
-                       [:div
-                        [:div.credit-select
-                         [:select#credit (for [i (range (inc n))]
-                                           [:option {:value i} i])]]
-                        [:button {:on-click #(send-command "choice"
-                                                           {:choice (-> "#credit" js/$ .val js/parseInt)})}
-                         "OK"]]
-                       (case (:choices prompt)
-                         "credit" [:div
-                                   [:div.credit-select
-                                    [:select#credit (for [i (range (inc (:credit me)))]
-                                                      [:option {:value i} i])] " credits"]
-                                   [:button {:on-click #(send-command "choice"
-                                                                      {:choice (-> "#credit" js/$ .val js/parseInt)})}
-                                    "OK"]]
-                         "counter" [:div
-                                    [:div.credit-select
-                                     [:select#credit (for [i (range (inc (get-in prompt [:card :counter])))]
-                                                       [:option {:value i} i])] " credits"]
-                                    [:button {:on-click #(send-command "choice"
-                                                                       {:choice (-> "#credit" js/$ .val js/parseInt)})}
-                                     "OK"]]
-                         (for [c (:choices prompt)]
-                           (if (string? c)
-                             [:button {:on-click #(send-command "choice" {:choice c})}
-                                       (for [item (get-message-parts c)] (create-span item))]
-                              (let [[title code] (extract-card-info (add-image-codes (:title c)))]
-                                [:button {:on-click #(send-command "choice" {:card @c}) :id code} title])))))]
-                    (if run
-                      (let [s (:server run)
-                            kw (keyword (first s))
-                            server (if-let [n (second s)]
-                                     (get-in cursor [:corp :servers kw n])
-                                     (get-in cursor [:corp :servers kw]))]
-                        (if (= side :runner)
-                          [:div.panel.blue-shade
-                           (when-not (:no-action run) [:h4 "Waiting for Corp's actions" ])
-                           (if (zero? (:position run))
-                             (cond-button "Succesful Run" (:no-action run) #(send-command "access"))
-                             (cond-button "Continue" (:no-action run) #(send-command "continue")))
-                           (cond-button "Jack Out" (not (get-in cursor [:run :cannot-jack-out]))
-                                        #(send-command "jack-out"))]
-                          [:div.panel.blue-shade
-                           (cond-button "No more action" (not (:no-action run))
-                                        #(send-command "no-action"))]))
+                     [:h4 "Keep hand?"]
+                     [:button {:on-click #(send-command "keep")} "Keep"]
+                     [:button {:on-click #(send-command "mulligan")} "Mulligan"]])
+
+                  (when (:keep me)
+                    (if-let [prompt (first (:prompt me))]
                       [:div.panel.blue-shade
-                       (when-let [warning (:warning state)] [:h4 warning])
-                       (if (= (keyword active-player) side)
-                         (when (and (zero? (:click me)) (not end-turn))
-                           [:button {:on-click #(handle-end-turn cursor owner)} "End Turn"])
-                         (when end-turn
-                           [:button {:on-click #(send-command "start-turn")} "Start Turn"]))
-                       (when (= side :runner)
+                       [:h4 (for [item (get-message-parts (:msg prompt))] (create-span item))]
+                       (if-let [n (get-in prompt [:choices :number])]
                          [:div
-                          (cond-button "Remove Tag"
-                                       (and (>= (:click me) 1) (>= (:credit me) 2) (>= (:tag me) 1))
-                                       #(send-command "remove-tag"))
-                          [:div.run-button
-                           (cond-button "Run" (and (>= (:click me) 1)
-                                                   (not (get-in me [:register :cannot-run])))
-                                        #(-> (om/get-node owner "servers") js/$ .toggle))
-                           (let [remotes (get-in cursor [:corp :servers :remote])
-                                 servers (concat (remote-list remotes) ["HQ" "R&D" "Archives"])]
-                             [:div.blue-shade.panel.servers-menu {:ref "servers"}
-                              (map (fn [label]
-                                     [:div {:on-click #(do (send-command "run" {:server label})
-                                                           (-> (om/get-node owner "servers") js/$ .fadeOut))}
-                                      label])
-                                   servers)])]])
-                       (when (= side :corp)
-                         (cond-button "Purge" (>= (:click me) 3) #(send-command "purge")))
-                       (when (= side :corp)
-                         (cond-button "Trash Resource" (and (> (:click me) 0) (> (:credit me) 1)
-                                                            (or (> (:tagged opponent) 0)
-                                                                (> (:tag opponent) 0)))
-                                      #(send-command "trash-resource")))
-                       (cond-button "Draw" (>= (:click me) 1) #(send-command "draw"))
-                       (cond-button "Gain Credit" (>= (:click me) 1) #(send-command "credit"))])))]]
+                          [:div.credit-select
+                           [:select#credit (for [i (range (inc n))]
+                                             [:option {:value i} i])]]
+                          [:button {:on-click #(send-command "choice"
+                                                             {:choice (-> "#credit" js/$ .val js/parseInt)})}
+                           "OK"]]
+                         (case (:choices prompt)
+                           "credit" [:div
+                                     [:div.credit-select
+                                      [:select#credit (for [i (range (inc (:credit me)))]
+                                                        [:option {:value i} i])] " credits"]
+                                     [:button {:on-click #(send-command "choice"
+                                                                        {:choice (-> "#credit" js/$ .val js/parseInt)})}
+                                      "OK"]]
+                           "counter" [:div
+                                      [:div.credit-select
+                                       [:select#credit (for [i (range (inc (get-in prompt [:card :counter])))]
+                                                         [:option {:value i} i])] " credits"]
+                                      [:button {:on-click #(send-command "choice"
+                                                                         {:choice (-> "#credit" js/$ .val js/parseInt)})}
+                                       "OK"]]
+                           (for [c (:choices prompt)]
+                             (if (string? c)
+                               [:button {:on-click #(send-command "choice" {:choice c})}
+                                (for [item (get-message-parts c)] (create-span item))]
+                               (let [[title code] (extract-card-info (add-image-codes (:title c)))]
+                                 [:button {:on-click #(send-command "choice" {:card @c}) :id code} title])))))]
+                      (if run
+                        (let [s (:server run)
+                              kw (keyword (first s))
+                              server (if-let [n (second s)]
+                                       (get-in cursor [:corp :servers kw n])
+                                       (get-in cursor [:corp :servers kw]))]
+                          (if (= side :runner)
+                            [:div.panel.blue-shade
+                             (when-not (:no-action run) [:h4 "Waiting for Corp's actions" ])
+                             (if (zero? (:position run))
+                               (cond-button "Succesful Run" (:no-action run) #(send-command "access"))
+                               (cond-button "Continue" (:no-action run) #(send-command "continue")))
+                             (cond-button "Jack Out" (not (get-in cursor [:run :cannot-jack-out]))
+                                          #(send-command "jack-out"))]
+                            [:div.panel.blue-shade
+                             (cond-button "No more action" (not (:no-action run))
+                                          #(send-command "no-action"))]))
+                        [:div.panel.blue-shade
+                         (when-let [warning (:warning state)] [:h4 warning])
+                         (if (= (keyword active-player) side)
+                           (when (and (zero? (:click me)) (not end-turn))
+                             [:button {:on-click #(handle-end-turn cursor owner)} "End Turn"])
+                           (when end-turn
+                             [:button {:on-click #(send-command "start-turn")} "Start Turn"]))
+                         (when (= side :runner)
+                           [:div
+                            (cond-button "Remove Tag"
+                                         (and (>= (:click me) 1) (>= (:credit me) 2) (>= (:tag me) 1))
+                                         #(send-command "remove-tag"))
+                            [:div.run-button
+                             (cond-button "Run" (and (>= (:click me) 1)
+                                                     (not (get-in me [:register :cannot-run])))
+                                          #(-> (om/get-node owner "servers") js/$ .toggle))
+                             (let [remotes (get-in cursor [:corp :servers :remote])
+                                   servers (concat (remote-list remotes) ["HQ" "R&D" "Archives"])]
+                               [:div.blue-shade.panel.servers-menu {:ref "servers"}
+                                (map (fn [label]
+                                       [:div {:on-click #(do (send-command "run" {:server label})
+                                                             (-> (om/get-node owner "servers") js/$ .fadeOut))}
+                                        label])
+                                     servers)])]])
+                         (when (= side :corp)
+                           (cond-button "Purge" (>= (:click me) 3) #(send-command "purge")))
+                         (when (= side :corp)
+                           (cond-button "Trash Resource" (and (> (:click me) 0) (> (:credit me) 1)
+                                                              (or (> (:tagged opponent) 0)
+                                                                  (> (:tag opponent) 0)))
+                                        #(send-command "trash-resource")))
+                         (cond-button "Draw" (>= (:click me) 1) #(send-command "draw"))
+                         (cond-button "Gain Credit" (>= (:click me) 1) #(send-command "credit"))])))])]

               [:div.board
                (om/build board-view {:player opponent :run run})