cleanup

cleanup

--- ccw.core/src/ccw/debug/serverrepl.clj
+++ ccw.core/src/ccw/debug/serverrepl.clj
@@ -10,9 +10,7 @@
 ; *******************************************************************************/
 ; Totally footprint free embedded evaluation server
 ; (do not have any namespace / symbol presence)
-(ns ccw.debug.serverrepl
-  (:require [clojure.contrib.duck-streams :as cocks])
-  (:use clojure.contrib.repl-utils))
+(ns ccw.debug.serverrepl)

 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; library code


loading the sql file and creating a yesql query

--- src/bitfondue/database.clj
+++ src/bitfondue/database.clj
@@ -2,4 +2,5 @@
   (:require [yesql.core :refer [defquery]]))

 (defquery insert-user<! "bitfondue/sql/insert-user.sql")
+(defquery get-user "bitfondue/sql/get-user.sql")


Update Validation to accomodate for :print-and-braille? field

--- src/catalog/validation.clj
+++ src/catalog/validation.clj
@@ -82,7 +82,8 @@
   :genre-text s/Str
   :producer-brief ProducerBrief
   :rucksackbuch? s/Bool
-  (s/optional-key :rucksackbuch-number) s/Int})
+  (s/optional-key :rucksackbuch-number) s/Int
+  (s/optional-key :print-and-braille?) s/Bool})

 (abstract-map/extend-schema
  Taktil CatalogItem [:taktilesbuch]


custom redirect logic

custom redirect logic

--- src/celestial/security.clj
+++ src/celestial/security.clj
@@ -17,6 +17,7 @@
   (:require
     [celestial.roles :as roles]
     [celestial.persistency :as p]
+    [clojure.core.strint :refer (<<)]
     [cemerick.friend :as friend]
     (cemerick.friend [workflows :as workflows]
                      [credentials :as creds])))
@@ -31,11 +32,17 @@
       (app req))))

+(defn login-redirect
+  [{:keys [form-params params] :as request}]
+  (let [ user (java.net.URLEncoder/encode (or (get form-params "username") (:username params "")))
+         param (<< "&login_failed=Y&user=~{user}")]
+   (ring.util.response/redirect (<< "/login?~{param}"))))
+
 (defn secured-app [routes]
   (friend/authenticate
     (friend/wrap-authorize (user-tracking routes) roles/user)
     {:allow-anon? true
      :credential-fn #(if (p/user-exists? (:username %)) (creds/bcrypt-credential-fn p/get-user! %) nil)
      :unauthenticated-handler #(assoc (workflows/http-basic-deny "basic-celestial" %) :body {:message "login failed" } )
-     :workflows [(workflows/interactive-form) (workflows/http-basic :realm "basic-celestial")]}))
+     :workflows [(workflows/interactive-form :login-failure-handler login-redirect) (workflows/http-basic :realm "basic-celestial")]}))


remove unused declare, better error msg

remove unused declare, better error msg

--- src/chat/client/store.cljs
+++ src/chat/client/store.cljs
@@ -54,7 +54,6 @@
 (defn- key-by-id [coll]
   (into {} (map (juxt :id identity)) coll))

-(declare display-error!)
 (defn- transact! [ks f]
   (let [old-state @app-state]
     (swap! app-state update-in ks f)
@@ -62,7 +61,7 @@
       (check-app-state! @app-state)
       (catch ExceptionInfo e
         (errorf "State consistency error updating %s to %s: %s"
-                ks (get-in @app-state ks) (ex-data e))
+                ks (get-in @app-state ks) (:error (ex-data e)))
         (reset! app-state old-state)
         ; Not just calling display-error! to avoid possibility of infinite loop
         (swap! app-state update-in [:errors] conj


After catching the 'no such instance exception', don't NPE

--- src/circle/backend/ec2.clj
+++ src/circle/backend/ec2.clj
@@ -159,7 +159,7 @@
                    ;; started.
                    (when (not= "InvalidInstanceID.NotFound" (.getErrorCode e))
                      (throw e))))
-          state (-> inst :state (bean) :name (keyword))
+          state (-?> inst :state (bean) :name (keyword))
           ip (-> inst :publicIpAddress)
           sleep-interval 5]
       (println "block-until-running:" instance-id state)


more fun

more fun

--- src/cljs/cezanne/core.cljs
+++ src/cljs/cezanne/core.cljs
@@ -14,7 +14,7 @@
                     0.1
                     1000)
         renderer (js/THREE.WebGLRenderer.)
-        geometry (js/THREE.CubeGeometry. 2 2 5e-2)
+        geometry (js/THREE.CubeGeometry. 2 2 2)
         material (js/THREE.MeshNormalMaterial. )
         cube (js/THREE.Mesh. geometry material)
         cube-2 (js/THREE.Mesh. geometry material)


OO: Make :map view the default selection

--- src/cljs/hatti/shared.cljs
+++ src/cljs/hatti/shared.cljs
@@ -34,7 +34,7 @@
   []
   (atom
    {:views {:all [:overview :map :table :chart :settings]
-            :selected :overview}
+            :selected :map}
     :map-page {:data []
                :submission-clicked {:data nil}
                :geofield {}}


Show "?" when last set DNE

Show "?" when last set DNE

--- src/cljs/ji/ui/status.cljs
+++ src/cljs/ji/ui/status.cljs
@@ -23,7 +23,7 @@
     [:h5.subheader
      "Cards Remaining: " [:span (or cards-remaining "?")]]]
    [:div.last-set.columns
-    [:h5.subheader "Last Set: " [:span (:player-id last-set)]]
+    [:h5.subheader "Last Set: " (if last-set [:span (:player-id last-set)] "?")]
     [:div.row.collapse
      [:div.large-6.large-centered.columns (card/set-tmpl (:cards last-set))]]] ])


Minor changes

Minor changes

--- src/cyanite_cache/core.clj
+++ src/cyanite_cache/core.clj
@@ -15,10 +15,8 @@
     (time (cache/put! scache "tenant" 123 60 117293 "my.metric" 20.0 600))
     (cache/-show-keys scache)
     (cache/-show-cache scache)
-
     (time (cache/put! scache "tenant" 123 60 117293 "my.metric" 30.0 600))
     (cache/-show-keys scache)
     (cache/-show-cache scache))
-
   (Thread/sleep (* 190 1000))
   (System/exit 0))


In order to support different database configs (say, "main" versus "test"), refactor this to build a config map by passing in the name of the database to configure.

--- src/doctopus/db/schema.clj
+++ src/doctopus/db/schema.clj
@@ -10,11 +10,18 @@
   (let [tpl "//%s:%d/%s"]
     (format tpl host port db)))

-(def db-spec {:classname "org.postgresql.Driver"
-              :subprotocol "postgresql"
-              :subname (get-subname (:database (server-config)))
-              :user (:user (:database (server-config)))
-              :password (:password (:database (server-config)))})
+(defn build-db-spec
+  [{:keys [user password] :as cfg-map}]
+  {:classname "org.postgresql.Driver"
+   :subprotocol "postgresql"
+   :subname (get-subname cfg-map)
+   :user user
+   :password password})
+
+(defn build-db-spec-by-name
+  [db-name]
+  (let [db-map (get-in (server-config) [:database db-name])]
+    (build-db-spec db-map)))

 (defn table-created?
   "check our database for a table"


created a method to encapsulate the common task of transforming a zipper

--- src/midje/midje_forms/translating.clj
+++ src/midje/midje_forms/translating.clj
@@ -37,26 +37,33 @@
         fake-bodies (partition-arrow-forms fakes)]
     (map make-fake fake-bodies)))

+
+(defn first-true-fn [ preds arg]
+  (when (seq preds)
+    (if ((first preds) arg)
+        (first preds)
+        (first-true-fn (rest preds) arg))))
+
+(defn transform [form & more]
+  (loop [loc (zip/seq-zip form)]
+      (if (zip/end? loc)
+          (zip/root loc)
+          (if-let [true-fn (first-true-fn (map first (partition 2 more)) loc)]
+            (recur (zip/next ((get (apply hash-map more) true-fn) loc)))
+            (recur (zip/next loc))))))
+
 (defn translate-fact-body [multi-form]
-  (loop [loc (zip/seq-zip multi-form)]
-    (if (zip/end? loc)
-      (zip/root loc)
-      (recur
-       (zip/next
-        (cond (is-start-of-check-sequence? loc)
-              (wrap-with-expect__then__at-rightmost-expect-leaf loc)
-
-              (is-head-of-form-providing-prerequisites? loc)
-              (let [fake-calls (expand-prerequisites-into-fake-calls loc)
+  (transform multi-form
+    is-start-of-check-sequence?
+    wrap-with-expect__then__at-rightmost-expect-leaf
+
+    is-head-of-form-providing-prerequisites?
+    (fn [loc ] (let [fake-calls (expand-prerequisites-into-fake-calls loc)
                     full-expect-form (delete_prerequisite_form__then__at-previous-full-expect-form loc)]
-                (tack-on__then__at-rightmost-expect-leaf fake-calls full-expect-form))
-
-              (is-semi-sweet-keyword? loc)
-              (skip-to-rightmost-leaf loc)
-
-              :else loc))))))
-
-+                 (tack-on__then__at-rightmost-expect-leaf fake-calls full-expect-form)))
+
+    is-semi-sweet-keyword?
+    skip-to-rightmost-leaf))

 (declare midjcoexpand)
@@ -213,13 +220,9 @@

 (defn unfold-prerequisites [form]
   (with-fresh-generated-metadata-names
-    (loop [loc (zip/seq-zip form)]
-      (if (zip/end? loc)
-        (zip/root loc)
-        (recur (zip/next (cond (loc-is-at-full-expect-form? loc)
-                               (unfold-expect-form__then__stay_put loc)
-
-                               :else loc)))))))
+    (transform form
+        loc-is-at-full-expect-form?
+        unfold-expect-form__then__stay_put)))

 (defn- replace-loc-line [loc loc-with-line]
   (let [m (fn [loc] (meta (zip/node loc)))
@@ -255,18 +258,10 @@
     (str "{" (str-join ", " entries) "}")))

 (defn add-one-binding-note [expect-containing-form ordered-binding-map]
-  (loop [loc (zip/seq-zip expect-containing-form)]
-    (cond (zip/end? loc)
-          (zip/root loc)
-
-          (loc-is-at-full-expect-form? loc)
-          (recur (zip/next
-                  (skip-to-rightmost-leaf
-                   (add-key-value-within-arrow-branch__then__at_arrow
-                    :binding-note (binding-note ordered-binding-map) loc))))
-
-          :else
-          (recur (zip/next loc)))))
+  (transform expect-containing-form
+  	  loc-is-at-full-expect-form?
+  	  (fn [loc] (skip-to-rightmost-leaf
+             (add-key-value-within-arrow-branch__then__at_arrow :binding-note (binding-note ordered-binding-map) loc)))))

 (defn add-binding-notes [expect-containing-forms ordered-binding-maps]
   (map (partial apply add-one-binding-note)


Fixes info model.g

Fixes info model.g

--- src/onyx/kafka/information_model.cljc
+++ src/onyx/kafka/information_model.cljc
@@ -154,6 +154,7 @@
      :kafka/offset-reset
      :kafka/force-reset?
      :kafka/deserializer-fn
+     :kafka/key-deserializer-fn
      :kafka/receive-buffer-bytes
      :kafka/commit-interval
      :kafka/wrap-with-metadata?
@@ -168,6 +169,7 @@
      :kafka/zookeeper
      :kafka/partition
      :kafka/serializer-fn
+     :kafka/key-serializer-fn
      :kafka/request-size
      :kafka/no-seal?
      :kafka/producer-opts]}})


Don't be so generous with years from URLs by taking out non-numeric characters (will prevent duplicate URLs to the same content).

--- src/open_company/resources/report.clj
+++ src/open_company/resources/report.clj
@@ -17,10 +17,17 @@

 ;; ----- Validations -----

+(defn- not-a-number?
+  "Return `true` if the string cannot be converted into an integer."
+  [string]
+  (try (Integer. string) false
+    (catch NumberFormatException e true)))
+
 (defun valid-year?
   "Return `true` if the specified period is valid, `false` if not."
   ([year :guard integer?] (and (> year 1900) (< year 3000)))
-  ([year :guard string?] (valid-year? (Integer. (re-find  #"\d+" year)))))
+  ([year :guard #(and (string? %) (not-a-number? %))] false)
+  ([year :guard string?] (valid-year? (Integer. year))))

 (defn valid-period?
   "Return `true` if the specified period is valid, `false` if not."


typo in auth_test

typo in auth_test

--- test/clj/backtype/storm/security/auth/auth_test.clj
+++ test/clj/backtype/storm/security/auth/auth_test.clj
@@ -154,7 +154,7 @@
         nimbus_client (.getClient client)]
     (log-message "(Positive authorization) Authorization plugin should accept client request")
     (.activate nimbus_client "security_auth_test_topology")
-    (.close (.transport client))))
+    (.close client)))

 (deftest deny-authorization-test
   (launch-server-w-wait 6629 1000 nil


Change some punctuation.

Change some punctuation.

--- test/clojure_the_language/clojure_numerics_test.clj
+++ test/clojure_the_language/clojure_numerics_test.clj
@@ -260,33 +260,33 @@
 (def max-long-plus-1 9223372036854775808N)

 (fact "The 'ordinary' operators"
-  (fact "...throw exceptions on overflow"
+  (fact "Throw exceptions on overflow"
     (inc Long/MAX_VALUE) => (throws ArithmeticException "integer overflow"))
   (fact "We can avoid overflow exceptions by coercing to BigInt first"
     (inc (bigint Long/MAX_VALUE)) => max-long-plus-1))

 (fact "The xxxx' operators"
-  (fact "...auto-promote"
+  (fact "Auto-promote"
     (inc' Long/MAX_VALUE) => max-long-plus-1)
-  (fact "...only change the type if necessary"
+  (fact "Only change the type if necessary"
     (==-and-same-type (inc' 1) 2) => true)
-  (fact "...do not demote"
+  (fact "Do not demote"
     (type (dec' (inc' Long/MAX_VALUE)))
     => clojure.lang.BigInt))

 (def boxed-max-long Long/MAX_VALUE)

 (fact "The unchecked-xxxx operators"
-  (fact "...don't check for overflow"
+  (fact "Don't check for overflow"
     (unchecked-inc Long/MAX_VALUE) => Long/MIN_VALUE)
-  (fact "...only do what you expect on longs, not Longs"
+  (fact "Only do what you expect on longs, not Longs"
     ;; The doc strings for unchecked operations only define what happens
     ;; for (unboxed) longs, not for (boxed) Longs.
     ;; - See https://groups.google.com/d/msg/clojure/1tefVmYKmpc/2hKlXU-c13sJ
-    (fact "...with a boxed value it seems weird"
+    (fact "With a boxed value it seems weird"
       (unchecked-inc boxed-max-long) => (throws ArithmeticException
                                                 "integer overflow"))
-    (fact "...but with an unboxed value it's as you'd expect"
+    (fact "But with an unboxed value it's as you'd expect"
       (let [unboxed-max-long Long/MAX_VALUE]
         (unchecked-inc unboxed-max-long))
       => Long/MIN_VALUE)))


horrible hack to fix the click to chat functionality

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -973,16 +973,20 @@
   [browser-state message {:keys [id-str]} state]
    (-> state
      (assoc-in state/chat-opened-path true)
-     (assoc-in state/chat-mobile-opened-path true)
-     (update-in [:chat :body] (fn [s]
-                                (str (when (seq s)
-                                       ;; maybe separate with space
-                                       (str s (when (not= " " (last s)) " ")))
-                                     "@" id-str " ")))))
+     (assoc-in state/chat-mobile-opened-path true)))

 (defmethod post-control-event! :chat-user-clicked
-  [browser-state message _ previous-state current-state]
-  (.focus (goog.dom/getElement "chat-input")))
+  [browser-state message {:keys [id-str]} previous-state current-state]
+  (let [chat-input (goog.dom/getElement "chat-input")]
+    (.focus chat-input)
+    ;; TODO: need a better way to handle this, possibly by resurrecting
+    ;;       the inputs things I built for Circle
+    (let [s (.-value chat-input)]
+      (set! (.-value chat-input)
+            (utils/inspect (str (when (seq s)
+                                  ;; maybe separate with space
+                                  (str s (when (not= " " (last s)) " ")))
+                                "@" id-str " "))))))

 (defmethod control-event :self-updated
   [browser-state message {:keys [name]} state]


Lazy copy paste bug

Lazy copy paste bug

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -1057,8 +1057,7 @@

 (defmethod post-control-event! :ui-v2-beta-feedback
   [target message _ state]
-  (feature/disable-in-cookie :ui-v2)
-  (track-and-redirect "UI V2 Beta Feedback Clicked" {} js/location))
+  (analytics/track "UI V2 Beta Feedback Clicked"))

 (defmethod post-control-event! :project-experiments-feedback-clicked
   [target message _ previous-state current-state]


use '->' for code clarity

use '->' for code clarity

--- src/puppetlabs/trapperkeeper/core.clj
+++ src/puppetlabs/trapperkeeper/core.clj
@@ -253,7 +253,8 @@
          (map? cli-data)]
    :post [(instance? TrapperKeeperApp %)]}
   (let [debug           (cli-data :debug)
-        config-data     (assoc (parse-config-file (cli-data :config)) :debug debug)
+        config-data     (-> (parse-config-file (cli-data :config))
+                            (assoc :debug debug))
         config-service  (config-service config-data)
         _               (if-let [global-config (config-data :global)]
                           (configure-logging! (global-config :logging-config) debug))


Fix :users sub

Fix :users sub

--- src/braid/core/client/core/subs.cljs
+++ src/braid/core/client/core/subs.cljs
@@ -56,7 +56,7 @@
 (reg-sub
   :users
   (fn [{:keys [open-group-id] :as state} _]
-    (get state [:groups open-group-id :users])))
+    (vals (get-in state [:groups open-group-id :users]))))

 (reg-sub
   :user-is-group-admin?


start loop by default in looping-go

start loop by default in looping-go

--- src/brainbot/nozzle/async_helper.clj
+++ src/brainbot/nozzle/async_helper.clj
@@ -28,7 +28,7 @@
   "call f in a loop from a go block. f must return a channel, from
 which we read one message, put the result on dest-ch if given. sleep
 ms milliseconds before calling f again"
-  [ms f & {:keys [start]}]
+  [ms f & {:keys [start] :or {start true}}]
   (assert (ifn? f) "f must be a function")
   (let [ctrl-ch (chan)
         dest-ch (chan)]


Send env-vars in upper-case, add tree_id to env-vars

--- src/cider_ci/dispatcher/dispatch.clj
+++ src/cider_ci/dispatcher/dispatch.clj
@@ -136,9 +136,10 @@
         submodules (get-submodule-definitions (:git_commit_id branch))
         trial-id (:id trial)
         environment-variables (conj (or (:environment_variables task-spec) {})
-                                    {:cider_ci_execution_id execution-id
-                                     :cider_ci_task_id (:task_id trial)
-                                     :cider_ci_trial_id trial-id})
+                                    {:CIDER_CI_EXECUTION_ID execution-id
+                                     :CIDER_CI_TASK_ID (:task_id trial)
+                                     :CIDER_CI_TRIAL_ID trial-id
+                                     :CIDER_CI_TREE_ID (:tree_id branch)})
         data {:trial_attachments (:trial_attachments task-spec)
               :tree_attachments (:tree_attachments task-spec)
               :trial_attachments_url (trial-attachments-url executor trial-id)


add dependencies

add dependencies

--- src/clj/forma/hadoop/jobs/update.clj
+++ src/clj/forma/hadoop/jobs/update.clj
@@ -53,9 +53,13 @@
          estimated-s3        (path :s3out "estimated")
          merged-estimated-s3 (path :s3out "merged-estimated")
          gfw-site-s3         (path :s3out "gfw-site")
+         forma-site-s3       (path :s3out "forma-site-" (:threshold conf))
          david-s3            (path :s3out "david")]
      (workflow
       [tmp-root]
+      start-workflow
+      ([] (println "Starting workflow."))
+
       preprocess-modis
       ([]
        (println "Preprocessing MODIS data")
@@ -66,7 +70,8 @@
                           (:modis-layers conf)))

       pre-rain
-      ([:tmp-dirs rain-output]
+      ([:tmp-dirs rain-output
+        :deps start-workflow]
        (println "Preprocessing rain")
        (p/PreprocessRain (path :archive "PRECL")
                          rain-output
@@ -80,14 +85,11 @@
        (p/ExplodeRain rain-output
                       exploded-rain-output
                       (:spatial-res conf)
-                      (:tiles conf))
-       ;; rain=$output
-       ;; rainoutput="$TMP/rain"
-       ;; $LAUNCHER "$PREPROCESSNS.ExplodeRain" $rain $rainoutput $SRES "$TILES"
-       )
+                      (:tiles conf)))

       ndvi-timeseries
-      ([:tmp-dirs ndvi-series-output]
+      ([:tmp-dirs ndvi-series-output
+        :deps start-workflow]
        (println "NDVI timeseries")
        (ts/ModisTimeseries (:pailpath storage)
                            ndvi-series-output
@@ -96,7 +98,8 @@
                            "ndvi"))

       ndvi-filter
-      ([:tmp-dirs filtered-ndvi-output]
+      ([:tmp-dirs filtered-ndvi-output
+        :deps ndvi-timeseries]
        (println "Filtering NDVI")
        (r/TimeseriesFilter (:spatial-res conf)
                            (:temporal-res conf)
@@ -125,7 +128,7 @@
                  est-start))

       trends->pail
-      ([]
+      ([:deps trends]
        (println "Adding trends series to pail")
        (r/TrendsPail (:spatial-res conf)
                      (:temporal-res conf)
@@ -134,7 +137,7 @@
                      (:pailpath storage)))

       merge-trends
-      ([]
+      ([:deps trends->pail]
        (println "Merging trends time series stored in pail")
        (r/MergeTrends (:spatial-res conf)
                       (:temporal-res conf)
@@ -143,7 +146,8 @@
                       merged-trends-s3))

       preprocess-fires
-      ([:tmp-dirs fire-output]
+      ([:tmp-dirs fire-output
+        :deps start-workflow]
        (println "Preprocessing fires")
        (p/PreprocessFire (path :archive "/fires")
                          fire-output
@@ -152,7 +156,8 @@
                          (:tiles conf)))

       forma-tap
-      ([:tmp-dirs forma-tap-output]
+      ([:tmp-dirs forma-tap-output
+        :deps [preprocess-fires merge-trends]]
        (println "Prepping FORMA tap for neighbor analysis")
        (r/FormaTap (:spatial-res conf)
                    (:temporal-res conf)
@@ -163,7 +168,8 @@
                    forma-tap-output))

       neighbors
-      ([:tmp-dirs neighbors-output]
+      ([:tmp-dirs neighbors-output
+        :deps forma-tap]
        (println "Merging neighbors")
        (r/NeighborQuery (:spatial-res conf)
                         (:temporal-res conf)
@@ -171,7 +177,8 @@
                         neighbors-output))

       beta-data-prep
-      ([:tmp-dirs beta-data-output]
+      ([:tmp-dirs beta-data-output
+        :deps neighbors]
        (println "Beta data prep - only keep data through training period")
        (r/BetaDataPrep (:spatial-res conf)
                        (:temporal-res conf)
@@ -181,7 +188,7 @@
                        true))

       gen-betas
-      ([]
+      ([:deps beta-data-prep]
        (println "Generating beta vectors")
        (r/GenBetas (:spatial-res conf)
                    (:temporal-res conf)
@@ -201,7 +208,7 @@
                         (:super-eco? conf)))

       probs-pail
-      ([]
+      ([:deps forma-estimate]
        (println "Add probability output to pail")
        (r/ProbsPail (:spatial-res conf)
                     (:temporal-res conf)
@@ -210,7 +217,7 @@
                     (:pailpath storage)))

       merge-probs
-      ([]
+      ([:deps probs-pail]
        (println "Merge probability time series.")
        (r/MergeProbs (:spatial-res conf)
                      (:temporal-res conf)
@@ -219,7 +226,7 @@
                      merged-estimated-s3))

       gadm2-eco-ids
-      ([]
+      ([:deps merge-probs]
        (println "Merging in gadm2 and eco fields")
        (r/ProbsGadm2 merged-estimated-s3
                      (:gadm2 storage)
@@ -227,7 +234,7 @@
                      (:gadm2eco storage)))

       common-data-conversion
-      ([]
+      ([:deps gadm2-eco-ids]
        (println "Prepping for website")
        (r/FormaWebsite (:threshold conf)
                        (:zoom conf)
@@ -241,7 +248,7 @@
                        gfw-site-s3))

       download-prep
-      ([]
+      ([:deps gadm2-eco-ids]
        ;; # prep data for FORMA download
        (println "Prepping data for FORMA download link")
        (r/FormaDownload (:threshold conf)
@@ -249,10 +256,10 @@
                         (:temporal-res conf)
                         (:nodata conf)
                         (:gadm2eco storage)
-                        gfw-site-s3))
+                        forma-site-s3))

       blue-raster
-      ([]
+      ([:deps gadm2-eco-ids]
        (println "Converting for Blue Raster")
        (r/BlueRaster (:spatial-res conf)
                      (:temporal-res conf)
@@ -262,7 +269,7 @@
                      (:blueraster storage)))

       david-conversion
-      ([]
+      ([:deps gadm2-eco-ids]
        (println "Converting for David")
        (r/FormaDavid (:nodata conf)
                      (:gadm2eco storage)


defined android-resource macro to query android resources the same way as other resources

--- src/clojure/android/clojure/util.clj
+++ src/clojure/android/clojure/util.clj
@@ -1,5 +1,6 @@
 (ns android.clojure.util
-  (:import [android.app Activity]
+  (:import [android.R]
+           [android.app Activity]
            [android.view View MotionEvent]

            [java.util.Timer]
@@ -73,6 +74,34 @@
        (defrecord ~record-name ~fields ~@defrecord-opts)
        ~@field-accessors)))

+(defmacro android-resource
+  ([id] `(resource :id ~id))
+  ([resource-type resource-name]
+     `(. ~(case resource-type
+            :anim         android.R$anim
+            :animator     android.R$animator
+            :array        android.R$array
+            :attr         android.R$attr
+            :bool         android.R$bool
+            :color        android.R$color
+            :dimen        android.R$dimen
+            :drawable     android.R$drawable
+            :fraction     android.R$fraction
+            :id           android.R$id
+            :integer      android.R$integer
+            :interpolator android.R$interpolator
+            :layout       android.R$layout
+            :menu         android.R$menu
+            :mipmap       android.R$mipmap
+            :plurals      android.R$plurals
+            :raw          android.R$raw
+            :string       android.R$string
+            :style        android.R$style
+            :xml          android.R$xml
+            (throw (RuntimeException.
+                    (str "invalid android resource type: " resource-type))))
+         ~(symbol (name resource-name)))))
+
 ;; (defn make-async-task [^Activity activity
 ;;                        on-start
 ;;                        update


add docstrings

add docstrings

--- src/link_checker/check.clj
+++ src/link_checker/check.clj
@@ -18,22 +18,6 @@
   [status]
   (and (integer? status) (> 300 status 199)))

-(defn- send-final-message
-  "Sends a results event containing total row and message event summarizing checked links."
-  [send-to time links]
-  (send-to
-   "message"
-   (if (zero? (count links))
-     "No links found. Check your link and selector."
-     (let [invalid-links (count (remove #(successful-status? (:status %)) links))]
-       (format "%s It took %ss to fetch %s links."
-               (case invalid-links
-                 0 "All links are valid!"
-                 1 "1 link did not return a 2XX response."
-                 (str invalid-links " links did not return a 2XX response."))
-              time
-              (count links))))))
-
 (def default-clj-http-options
   {:max-redirects 5
    :throw-exceptions false
@@ -49,7 +33,7 @@
   (client/head url default-clj-http-options))

 (defn- build-status
-  "status is an error string, a message for 3XX or a number"
+  "Returns status as an error string, a message for 3XX or a status number"
   [resp]
   (if (:error resp) (str "Request failed: " (:error resp))
       (if (> 400 (:status resp) 299)
@@ -59,7 +43,9 @@
                 (clojure.string/join " , " (rest (:trace-redirects resp))))
         (:status resp))))

-(defn- fetch-link [url]
+(defn- fetch-link
+  "Fetches a url and returns a map to render its status in a table."
+  [url]
   (log/info :msg (format "Verifying link %s ..." url))
   (let [resp (try (let [head (client-head url)]
                     (if (> 400 (:status head) 199)
@@ -78,7 +64,9 @@

 (def ^{:doc "Map of IDs to remaining links count"} link-counts (atom {}))

-(defn- fetch-link-and-send-row [send-to url total-links client-id link]
+(defn- fetch-link-and-send-row
+  "Fetches a link and sends its status via a server side event"
+  [send-to url total-links client-id link]
   (let [result-map (fetch-link link)]
     (when (get @link-counts client-id)
       (swap! link-counts update-in [client-id] dec)
@@ -91,6 +79,7 @@
     result-map))

 (defn- body->links
+  "Converts a url's body to links."
   [string options]
   (-> string
       (java.io.StringReader.)
@@ -108,11 +97,13 @@

 ;;; thanks to alida's util.cl
 (defn- expand-relative-links
+  "Expands links in order to validate them."
   [url links]
   (let [jurl (URL. url)]
     (map #(str (URL. jurl %)) links)))

 (defn- url->links
+  "Converts a url to a list of links. Returns nil if response is not a 200."
   [url options]
   (let [resp (try
                (client-get url)
@@ -126,8 +117,25 @@
             (remove invalid-link?))))))

 (defn- valid-selector?
+  "Only allow the most basic selector i.e. no whitespace, alphanumeric chars and div or id."
   [selector]
   (re-find #"^[\.#a-zA-Z0-9_-]+$" selector))
+
+(defn- send-final-message
+  "Sends a results event containing total row and message event summarizing checked links."
+  [send-to time links]
+  (send-to
+   "message"
+   (if (zero? (count links))
+     "No links found. Check your link and selector."
+     (let [invalid-links (count (remove #(successful-status? (:status %)) links))]
+       (format "%s It took %ss to fetch %s links."
+               (case invalid-links
+                 0 "All links are valid!"
+                 1 "1 link did not return a 2XX response."
+                 (str invalid-links " links did not return a 2XX response."))
+              time
+              (count links))))))

 (defn- stream-links*
   "Sends 3 different sse events (message, results, end-message) depending on


Introducing «draw-concept-lattice»

Introducing «draw-concept-lattice»

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/draw/lattices.clj
+++ src/conexp/contrib/draw/lattices.clj
@@ -8,6 +8,7 @@

 (ns conexp.contrib.draw.lattices
   (:use [conexp.base                       :only (ns-doc, defnk)]
+        [conexp.fca.lattices               :only (concept-lattice)]
         [conexp.layouts                    :only (standard-layout)]
         [conexp.layouts.util               :only (scale-layout)]
         [conexp.contrib.draw.scenes        :only (scene-canvas,
@@ -130,6 +131,14 @@
         layout-fn (get map :layout-fn standard-layout)]
     (apply draw-layout (layout-fn lattice) map)))

+(defn draw-concept-lattice
+  "Draws the concept lattice of a given context, passing all remaining
+  args to draw-lattice."
+  [ctx & args]
+  (apply draw-lattice (concept-lattice ctx) args))
+
+;;;
+
 (defnk draw-lattice-to-file             ;does not work
   ""
   [lattice file-name


First correct results.

First correct results.

--- src/angelic/search/incremental/implicit.clj
+++ src/angelic/search/incremental/implicit.clj
@@ -67,8 +67,8 @@
   (live?            [s] (= status :live))
   (optimal-solution [s] (when (= status :solved) (assert opt-sol) opt-sol)))

-(defn make-live-summary [max-reward] (SimpleSummary. max-reward :live nil))
-(defn make-blocked-summary [max-reward] (SimpleSummary. max-reward :blocked nil))
+(defn make-live-summary [max-reward plan] (SimpleSummary. max-reward :live plan))
+(defn make-blocked-summary [max-reward plan] (SimpleSummary. max-reward :blocked plan))
 (defn make-solved-summary [max-reward opt-sol] (SimpleSummary. max-reward :solved opt-sol))

 (defn blocked? [summary]
@@ -79,7 +79,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Common Ops ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(def +worst-summary+ (make-live-summary is/neg-inf))
+(def +worst-summary+ (make-live-summary is/neg-inf []))
 (def +best-summary+  (make-solved-summary is/pos-inf []))

 (defn better-summary? [s1 s2]
@@ -96,15 +96,20 @@
     arg1))

 (defn max-summary [& stats] (apply max-compare better-summary? (cons +worst-summary+ stats) ))
-(defn min-summary [& stats] (apply max-compare (complement better-summary?) (cons +best-summary+ stats)))
+;(defn min-summary [& stats] (apply max-compare (complement better-summary?) (cons +best-summary+ stats)))
+
+(defn bound-summary [summary max-rew]
+  (when (optimal-solution summary) (assert (<= (max-reward summary) max-rew)))
+  (SimpleSummary. (min max-rew (:max-rew summary)) (:status summary) (:opt-sol summary)))
+

 (def zero-summary (SimpleSummary. 0 :solved []))
 (defn add-summaries [s1 s2]
   (SimpleSummary. (+ (max-reward s1)
               (max-reward s2))
            (min-key status-val (:status s1) (:status s2))
-           (when (and (= (:status s1) :solved) (= (:status s2) :solved))
-             (concat (:opt-sol s1) (:opt-sol s2)))))
+           #_(when (and (= (:status s1) :solved) (= (:status s2) :solved)))
+           (concat (:opt-sol s1) (:opt-sol s2))))

 (defn viable-summary? [summary]
@@ -197,6 +202,8 @@

 (defrecord OutputSetNode    [plans child-pointers])

+(def osn-child-pointers :child-pointers)
+
 (defn make-initial-output-set-node [init-set action opt-reward]
   (OutputSetNode.
    (lazy-seq (for [[constraint ref] (angelic/immediate-refinements-set action init-set)
@@ -208,12 +215,22 @@
 ;; TODO: summaries making it into child-pointers

-(defn osn-plan-summary [osn] (apply max-summary (map :summary (:plans osn))))
-(defn osn-child-summary [osn ecs] (apply max-summary (map full-osp-summary (remove ecs (:child-pointers osn)))))
-(defn osn-summary [osn ecs] (max-summary (osn-plan-summary osn) (osn-child-summary osn ecs)))
-
-(def osn-child-pointers :child-pointers)
-(defn osn-add-plans [osn plans] (update-in osn [:plans] concat plans))
+(defn osn-plan-summary
+  "Summary of the plans stored directly at this osn"
+  [osn] (apply max-summary (map :summary (:plans osn))))
+
+(defn osn-child-summary
+  "Summary of non-excluded descendents of this osn"
+  [osn ecs] (apply max-summary (map full-osp-summary (remove ecs (:child-pointers osn)))))
+
+(defn osn-summary [osn ecs]
+  "Summary of direct plans plus non-excluded descendents."
+  (max-summary (osn-plan-summary osn) (osn-child-summary osn ecs)))
+
+
+(defn osn-add-plans [osn plans]
+  "Return a new OSN with the new plans added.  Presumed mutex output sets."
+  (update-in osn [:plans] concat plans))

 ;; osn/osp
 (defn merge-children
@@ -261,14 +278,14 @@
 (def +worst-osp+ (TerminalOutputSetPointer. +worst-summary+ state-set/empty-lfss))

 (declare active-osp-summary)
-(defrecord OutputSetPointer [subproblem parent-pointer output-set node-atom alt-summary]
+(defrecord OutputSetPointer [subproblem parent-pointer output-set node-atom reward-bound]
   OSP
   (osp-summary [osp ecs] (active-osp-summary osp ecs))
   (osp-output-set [osp] output-set))

 (defn make-child-osp [parent-osp output-set plans]
-  (OutputSetPointer. (:subproblem parent-osp) parent-osp output-set (OutputSetNode. plans nil) +best-summary+))
+  (OutputSetPointer. (:subproblem parent-osp) parent-osp output-set (OutputSetNode. plans nil) is/pos-inf))

 (defn osp-ancestors [osp]
   (when-let [p (:parent-pointer osp)]
@@ -278,17 +295,16 @@

 ;; Used when deciding when to split.
 (defn osp-descendent-summary [osp excluded-child-set]
-  (min-summary (:alt-summary osp)
-               (osn-summary @(:node-atom osp) excluded-child-set)))
+  (bound-summary (osn-summary @(:node-atom osp) excluded-child-set) (:reward-bound osp)))

 (defn osp-ancestor-summary [osp]
   (apply max-summary (map osn-plan-summary (osp-ancestors osp))))

 (defn active-osp-summary [osp excluded-child-set]
-  (min-summary (:alt-summary osp)
-              (max-summary (osp-descendent-summary osp excluded-child-set)
-                           (osp-ancestor-summary osp))))
+  (bound-summary
+   (max-summary (osp-descendent-summary osp excluded-child-set) (osp-ancestor-summary osp))
+   (:reward-bound osp)))

 (defn refine-osp!
@@ -324,7 +340,9 @@

 ;;;;;;;;;;;;;;;;;;;;;;; Making and Splitting Subproblems ;;;;;;;;;;;;;;;;;;;;;;;

-;; TODO: terminal (solution) if concrete & primitive,
+;; TODO: nothing is ever live ? everything is eager ?
+
+;;       terminal (solution) if concrete & primitive,
 ;;       termianl (blocked) if primitive or cannot refine from current set.
 (defn make-subproblem [logged-input-set state-context action reward-bound-fn]
   (let [prim?        (env/primitive? action)]
@@ -338,10 +356,10 @@
       (let [[opt rew]    (angelic/optimistic-set-and-reward action logged-input-set)
             rew          (min (or rew is/neg-inf) (reward-bound-fn))]
         (if (or (= rew is/neg-inf) prim? (not (angelic/can-refine-from-set? action logged-input-set)))
-          (TerminalOutputSetPointer. (make-blocked-summary rew) opt)
+          (TerminalOutputSetPointer. (make-blocked-summary rew [:z action]) opt)
           (let [subproblem   (Subproblem. logged-input-set state-context action (HashMap.))
                 init-node    (make-initial-output-set-node logged-input-set action rew)
-                init-pointer (OutputSetPointer. subproblem nil opt (atom init-node) (make-blocked-summary rew))]
+                init-pointer (OutputSetPointer. subproblem nil opt (atom init-node) rew)]
 ;           (.put ^HashMap (:output-set-cache subproblem) opt init-pointer)
             init-pointer))))))

@@ -366,10 +384,9 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Plans ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-; TODO: available splits must contribute to live status.

 (defrecord PlanNode [sub-output-set-pointer excluded-child-set output-constraint
-                     summary-bound output-set output-summary])
+                     reward-bound output-set output-summary])

 (defn compute-plan-node-output-set [input-set sub-output-set-pointer output-constraint]
   (state-set/constrain (state/transfer-effects input-set (osp-output-set sub-output-set-pointer))
@@ -378,25 +395,25 @@

 (defn make-live-for-split [sub-osp ecs summary]
   (if (and (blocked? summary) (can-split-osp? sub-osp ecs))
-    (make-live-summary (max-reward summary))
+    (make-live-summary (max-reward summary) [(:action (:subproblem sub-osp))])
     summary))

-(defn compute-plan-node-output-summary [input-summary sub-output-set-pointer ecs summary-bound]
+(defn compute-plan-node-output-summary [input-summary sub-output-set-pointer ecs reward-bound]
   (->> (full-osp-summary sub-output-set-pointer)
-       (min-summary summary-bound)
+       (#(bound-summary % reward-bound))
        (make-live-for-split sub-output-set-pointer ecs)
        (add-summaries input-summary)))

 (defn make-plan-node [input-set input-summary sub-output-set-pointer
-                      excluded-child-set output-constraint summary-bound]
-  (PlanNode. sub-output-set-pointer excluded-child-set output-constraint summary-bound
+                      excluded-child-set output-constraint reward-bound]
+  (PlanNode. sub-output-set-pointer excluded-child-set output-constraint reward-bound
              (compute-plan-node-output-set input-set sub-output-set-pointer output-constraint)
-             (compute-plan-node-output-summary input-summary sub-output-set-pointer excluded-child-set summary-bound)))
+             (compute-plan-node-output-summary input-summary sub-output-set-pointer excluded-child-set reward-bound)))

 (defn make-initial-plan-node [action [input-set input-summary]]
   (let [sub (get-subproblem-root-pointer input-set action (constantly is/pos-inf))]
-    (make-plan-node input-set input-summary sub #{} {} +best-summary+)))
+    (make-plan-node input-set input-summary sub #{} {} is/pos-inf)))

 (defn plan-node-output-set-and-summary [pn]
   [(:output-set pn) (:output-summary pn)])
@@ -407,9 +424,9 @@

 (defn refine-pn [pn input-summary min-reward]
-  (let [{:keys [sub-output-set-pointer excluded-child-set summary-bound]} pn]
+  (let [{:keys [sub-output-set-pointer excluded-child-set reward-bound]} pn]
     (refine-osp! sub-output-set-pointer min-reward excluded-child-set)
-    (assoc pn :output-summary (compute-plan-node-output-summary input-summary sub-output-set-pointer excluded-child-set summary-bound))))
+    (assoc pn :output-summary (compute-plan-node-output-summary input-summary sub-output-set-pointer excluded-child-set reward-bound))))

 (defn split-pn-output [pn input-set input-summary min-step-reward]
@@ -419,24 +436,24 @@
           new-summary     (osp-summary sub-output-set-pointer new-ecs)]
       (concat
        (when (viable-summary? new-summary) [(assoc pn :excluded-child-set new-ecs :output-summary new-summary)])
-       (for [child split-children] (make-plan-node input-set input-summary child nil {} +best-summary+))))))
+       (for [child split-children] (make-plan-node input-set input-summary child nil {} is/pos-inf))))))

 (defn patch-pn-summary-tuple- [pn new-input-summary]
-  (let [{:keys [sub-output-set-pointer excluded-child-set summary-bound output-set]} pn
-        new-output-summary (compute-plan-node-output-summary new-input-summary sub-output-set-pointer excluded-child-set summary-bound)]
+  (let [{:keys [sub-output-set-pointer excluded-child-set reward-bound output-set]} pn
+        new-output-summary (compute-plan-node-output-summary new-input-summary sub-output-set-pointer excluded-child-set reward-bound)]
     (when (viable-summary? new-output-summary)
       [[false output-set new-output-summary] (assoc pn :output-summary new-output-summary)])))

 (defn update-pn-input [[set-changed? new-input-set new-input-summary] pn]
-  (let [{:keys [sub-output-set-pointer output-constraint summary-bound output-set]} pn]
+  (let [{:keys [sub-output-set-pointer output-constraint reward-bound output-set]} pn]
     (if set-changed?
       (let [new-osp (refine-osp-input sub-output-set-pointer new-input-set)]
         (if (identical? new-osp sub-output-set-pointer)
           (patch-pn-summary-tuple- pn new-input-summary)
           (let [new-pn (make-plan-node new-input-set new-input-summary new-osp nil
                                 (osp-output-set sub-output-set-pointer)
-                                (make-blocked-summary (max-reward (full-osp-summary sub-output-set-pointer)))) ;; This is just the bound, equal to the initial thing.
+                                (max-reward (full-osp-summary sub-output-set-pointer)))
                 new-output-pair (plan-node-output-set-and-summary new-pn)]
             (when (viable-output-set-and-summary? new-output-pair)
               [(cons (not (= (:output-set new-pn) output-set)) new-output-pair) new-pn]))))


Updating gorilla repl to newer version. Updating spritn 36 demo.

--- common-lib/project.clj
+++ common-lib/project.clj
@@ -36,11 +36,12 @@
                  [compojure "1.4.0"]
                  [ring/ring-json "0.4.0"]
                  ;; Excludes things that are specified with other parts of the CMR
-                 [gorilla-repl "0.3.4"  :exclusions [org.clojure/java.classpath
-                                                     ch.qos.logback/logback-classic
-                                                     javax.servlet/servlet-api
-                                                     compojure
-                                                     ring-json]]]
+                 ;; 0.3.5-SNAPSHOT is used because it gives us the ability to clear the output.
+                 [gorilla-repl "0.3.5-SNAPSHOT"  :exclusions [org.clojure/java.classpath
+                                                             ch.qos.logback/logback-classic
+                                                             javax.servlet/servlet-api
+                                                             compojure
+                                                             ring-json]]]

   :plugins [[lein-test-out "0.3.1"]
             [lein-exec "0.3.2"]]


Remove avatar & nickname checks in /register endpoint

The avatar, as per previous commit, wasn't being used, so this upload
was pointless. Ditto the nickname, which is generated from the user email.

--- src/braid/core/server/routes/api/public.clj
+++ src/braid/core/server/routes/api/public.clj
@@ -107,7 +107,7 @@
     (edn-response (not (group/group-with-slug-exists? (get-in req [:params :slug])))))

   ; accept an email invite to join a group
-  (POST "/register" [token invite_id nickname password email now hmac avatar :as req]
+  (POST "/register" [token invite_id password email now hmac :as req]
     (let [fail {:status 400 :headers {"Content-Type" "text/plain"}}]
       (cond
         (string/blank? password) (assoc fail :body "Must provide a password")
@@ -117,31 +117,18 @@

         (string/blank? invite_id)
         (assoc fail :body "Invalid invitation ID")
-
-        (not (valid-nickname? nickname))
-        (assoc fail :body "Nickname must be 1-30 characters without whitespace")
-
-        (user/nickname-taken? nickname)
-        (assoc fail :body "nickname taken")
-
-        ; TODO: be smarter about this
-        (not (#{"image/jpeg" "image/png"} (:content-type avatar)))
-        (assoc fail :body "Invalid image")

         :else
         (let [invite (invitation/invite-by-id (java.util.UUID/fromString invite_id))]
           (if-let [err (:error (invites/verify-invite-nonce invite token))]
             (assoc fail :body "Invalid invite token")
-            (let [avatar-url (invites/upload-avatar avatar)
-                  user-id (db/uuid)
+            (let [user-id (db/uuid)
                   referer (get-in req [:headers "referer"] (config :site-url))
                   [proto _ referrer-domain] (string/split referer #"/")]
               (do
                 (db/run-txns!
                   (user/create-user-txn {:id user-id
                                          :email email
-                                         :avatar avatar-url
-                                         :nickname nickname
                                          :password password}))
                 (events/user-join-group! user-id (invite :group-id))
                 (db/run-txns!


improve reconciliations search critera building

--- src/cljs/clj_money/api/reconciliations.cljs
+++ src/cljs/clj_money/api/reconciliations.cljs
@@ -1,6 +1,8 @@
 (ns clj-money.api.reconciliations
   (:refer-clojure :exclude [find update])
-  (:require [dgknght.app-lib.web :refer [serialize-date
+  (:require [dgknght.app-lib.core :refer [update-in-if]]
+            [dgknght.app-lib.dates :refer [nominal-comparatives]]
+            [dgknght.app-lib.web :refer [serialize-date
                                          unserialize-date]]
             [dgknght.app-lib.api :as api]))

@@ -11,13 +13,19 @@
 (defn search
   [{:keys [account-id] :as criteria} success-fn error-fn]
   {:pre [account-id]}
-
-  (api/get (api/path :accounts
-                     account-id
-                     :reconciliations)
-           (dissoc criteria account-id)
-           (comp success-fn #(map after-read %))
-           error-fn))
+  (let [prepared-criteria (-> criteria
+                              (update-in-if [:status] name)
+                              (update-in-if [:desc] name)
+                              (nominal-comparatives :end-of-period)
+                              (update-in-if [:end-of-period-or-after] serialize-date)
+                              (update-in-if [:end-of-period-or-before] serialize-date)
+                              (dissoc account-id))]
+    (api/get (api/path :accounts
+                       account-id
+                       :reconciliations)
+             prepared-criteria
+             (comp success-fn #(map after-read %))
+             error-fn)))

 (defn find
   [criteria success-fn error-fn]


search listens to a channel in the shared state

--- src-cljs/core.cljs
+++ src-cljs/core.cljs
@@ -80,13 +80,29 @@
                  [title artist album duration button]
                  [artist album title duration button]))))))

+
+(defn xhr-search [term]
+  (let [channel (chan)]
+    (.send XhrIo (string/join "?" ["/tracks.json" ])
+           (fn [e]
+             (let [xhr (.-target e)
+                   o (.getResponseJson xhr)
+                   r (js->clj o)]
+               (put! channel r)))
+           "POST"
+           term
+           {"Content-Type" "text/plain"}
+           )
+    channel))
+
 (defn results-view [app owner]
   (reify
     om/IWillMount
     (will-mount [_]
-      (let [channel (om/get-state owner :new-results)]
+      (let [channel (om/get-shared owner :search-channel)]
         (go (loop []
-              (let [tracks (<! channel)
+              (let [search-for (<! channel)
+                    tracks (<! (xhr-search search-for))
                     sorted (sort-by
                             #(vector (get % "artist")
                                      (get % "album")
@@ -155,27 +171,6 @@
                )))))

 ;; XXX need to do some url encoding here, I rather suspect
-(defn query-string-for-map [h]
-  (string/join "&"
-            (map (fn [[k v]] (str (name k) "=" v)) h)))
-
-(defn send-query [term filters channel]
-  (.send XhrIo (string/join "?" ["/tracks.json" (query-string-for-map filters)])
-         (fn [e]
-           (let [xhr (.-target e)
-                 o (.getResponseJson xhr)
-                 r (js->clj o)]
-             (put! channel r)))
-         "POST"
-         term
-         {"Content-Type" "text/plain"}
-         ))
-
-(defn send-search-xhr [term owner {:keys [new-results search-term]}]
-  (let [filters (:filters @app-state)]
-    (om/set-state! owner :search-term term)
-    (send-query term filters new-results)))
-
 (defn filters-view [app owner]
   (reify
     om/IWillMount
@@ -185,7 +180,7 @@
               (let [new-filter (<! channel)]
                 (println [:new-filter new-filter])
                 (om/transact! app [:filters] #(merge % new-filter))
-                (send-query
+                #_ (send-query
                  (om/get-state owner :search-term)
                  (:filters @app)
                  (om/get-state owner :new-results))
@@ -193,6 +188,7 @@
     om/IRenderState
     (render-state [this state]
       (let [chan (:update-filters state)
+            search-chan (om/get-shared owner :search-channel)
             filters (:filters app)]
         (dom/div nil
                  (dom/h1
@@ -203,7 +199,11 @@
                                   :type "text"
                                   :placeholder "Search artist/album/title"
                                   :value (:search-term state)
-                                  :onChange #(send-search-xhr (.. % -target -value) owner state)
+                                  :onChange
+                                  (fn [e]
+                                    (let [term (.. e -target -value)]
+                                      (om/set-state! owner :search-term term)
+                                      (put! search-chan term)))
                                   }))
                  (apply dom/div #js {:className "filters" }
                         (map #(dom/span #js {:className "filter"
@@ -259,8 +259,10 @@
                ))))

 (defn init []
-  (let [el (. js/document (getElementById "om-app"))]
+  (let [el (. js/document (getElementById "om-app"))
+        search (chan)]
     (om/root app-view app-state
-             {:target el})))
+             {:target el
+              :shared {:search-channel search}})))

 (.addEventListener js/window "load" init)


Tweak project.clj (#1073)

Tweak project.clj (#1073)

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -193,6 +193,8 @@
    :test-console
    [:test {:jvm-opts ["-Dcook.test.logging.console"]}]

+   :override-maven {:local-repo ~(System/getenv "COOK_SCHEDULER_MAVEN_LOCAL_REPO")}
+
    :docker
    ; avoid calling javac in docker
    ; (.java sources are only used for unit test support)


prefuse-vals is no longer used

prefuse-vals is no longer used

--- src/onyx/messaging/acking_daemon.clj
+++ src/onyx/messaging/acking_daemon.clj
@@ -49,16 +49,6 @@
   []
   (.nextLong (java.util.concurrent.ThreadLocalRandom/current)))

-; (defn prefuse-vals
-;   "Prefuse values on a peer before sending them to the acking
-;   daemon to decrease packet size."
-;   [vals]
-;   (reduce (fn [running v]
-;             (if v
-;               (bit-xor running v)
-;               running))
-;           (or (first vals) 0)
-;           (rest vals)))
 (defn generate-acks
   "Batch generates acks."
   [cnt]


Implement rich text field #46 - more functions for vectors

--- test/flatgui/util/vectorutil_test.clj
+++ test/flatgui/util/vectorutil_test.clj
@@ -48,4 +48,11 @@
   (test/is (= [] (vu/dropv 2 [1])))
   (test/is (= [] (vu/dropv 2 [1 2])))
   (test/is (= [3] (vu/dropv 2 [1 2 3])))
-  (test/is (= [3 4] (vu/dropv 2 [1 2 3 4]))))+  (test/is (= [3 4] (vu/dropv 2 [1 2 3 4]))))
+
+(test/deftest emptyv?-test
+  (test/is (true? (vu/emptyv? nil)))
+  (test/is (true? (vu/emptyv? [])))
+  (test/is (false? (vu/emptyv? [1])))
+  (test/is (false? (vu/emptyv? [1 2])))
+  (test/is (false? (vu/emptyv? [1 2 3]))))


add in a cache for paths

add in a cache for paths

--- src/org/spootnik/cyanite/es_path.clj
+++ src/org/spootnik/cyanite/es_path.clj
@@ -77,11 +77,20 @@
     (dorun (map #(if (not (path-exists? (:path %)))
                    (write-key (:path %) %)) paths))))

+(defn path-exists-cache?
+  [path-exists? store path]
+  (if (contains? @store path)
+    true
+    (if (path-exists? path)
+      (do (swap! store assoc path true) true)
+      false)))
+
 (defn es-rest
   [{:keys [index url]
     :or {index "cyanite_paths" url "http://localhost:9200"}}]
-  (let [conn (esr/connect url)
-        existsfn (partial esrd/present? conn index ES_DEF_TYPE)
+  (let [store (atom {})
+        conn (esr/connect url)
+        existsfn (partial path-exists-cache? (partial esrd/present? conn index ES_DEF_TYPE) store)
         updatefn (partial esrd/put conn index ES_DEF_TYPE)
         scrollfn (partial esrd/scroll-seq conn)
         queryfn (partial esrd/search conn index ES_DEF_TYPE)]
@@ -95,12 +104,14 @@
       (lookup [this tenant path]
               (map :path (search queryfn scrollfn tenant path true))))))

+
 (defn es-native
   [{:keys [index host port cluster_name]
     :or {index "cyanite_paths" host "localhost" port 9300}}]
-  (let [conn (esn/connect [[host port]]
+  (let [store (atom {})
+        conn (esn/connect [[host port]]
                          {"cluster.name" cluster_name})
-        existsfn (partial esnd/present? conn index ES_DEF_TYPE)
+        existsfn (partial path-exists-cache? (partial esnd/present? conn index ES_DEF_TYPE) store)
         updatefn (partial esnd/put conn index ES_DEF_TYPE)
         scrollfn (partial esnd/scroll-seq conn)
         queryfn (partial esnd/search conn index ES_DEF_TYPE)]


Namespace midi-controller-gui: fixed bug in function that sets slider value based on given min/max

--- src/overtime/midi_controller_gui.clj
+++ src/overtime/midi_controller_gui.clj
@@ -3,7 +3,7 @@
             [overtime.instr-gui :as gui]
             [overtime.midi-controllers :as mc]))

-(defn- dflt-slider-f [val-f min max] (* val-f (- max min)))
+(defn- dflt-slider-f [val-f min max] (+ (* val-f (- max min)) min))

 (defn- init-xs-hdlrs
   [frame-key & {:keys [instr device sliders play stop] :or {sliders []}}]


Trace log ZK connection loss exceptions.

--- src/onyx/log/zookeeper.clj
+++ src/onyx/log/zookeeper.clj
@@ -1,7 +1,7 @@
 (ns onyx.log.zookeeper
   (:require [clojure.core.async :refer [chan >!! <!! close! thread]]
             [com.stuartsierra.component :as component]
-            [taoensso.timbre :refer [fatal warn]]
+            [taoensso.timbre :refer [fatal warn trace]]
             [zookeeper :as zk]
             [onyx.extensions :as extensions]
             [onyx.compression.nippy :refer [compress decompress]])
@@ -209,9 +209,11 @@
                      (recur)))))
              (recur (inc position)))))
        (catch org.apache.zookeeper.KeeperException$ConnectionLossException e
+         (trace e)
          ;; ZooKeeper has been shutdown, close the subscriber cleanly.
          (close! ch))
        (catch org.apache.zookeeper.KeeperException$SessionExpiredException e
+         (trace e)
          (close! ch))
        (catch Throwable e
          (fatal e))))


Take vals & concat for ingress, same as egress.

--- src/onyx/queue/hornetq.clj
+++ src/onyx/queue/hornetq.clj
@@ -171,9 +171,9 @@
 (defmethod extensions/create-queue HornetQConnection
   [queue task]
   (let [session (extensions/create-tx-session queue)
-        ingress-queue (:ingress-queues task)
+        ingress-queue (vals (:ingress-queues task))
         egress-queues (vals (:egress-queues task))]
-    (doseq [queue-name (conj egress-queues ingress-queue)]
+    (doseq [queue-name (concat egress-queues ingress-queue)]
       (extensions/create-queue-on-session queue session queue-name))
     (.close session)))


ensure buffer-info is declared before use

--- src/overtone/sc/buffer.clj
+++ src/overtone/sc/buffer.clj
@@ -2,6 +2,8 @@
   (:use
     [overtone util]
     [overtone.sc core allocator]))
+
+(declare buffer-info)

 ;; ## Buffer functions
 ;;


docstring formatting

docstring formatting

--- src/overtone/sc/sample.clj
+++ src/overtone/sc/sample.clj
@@ -71,17 +71,17 @@
         sample))))

 (defn load-sample
-  "Synchronously load a .wav or .aiff file into a memory buffer. Returns the
-  buffer.
+  "Synchronously load a .wav or .aiff file into a memory buffer. Returns
+   the buffer.

     ; e.g.
     (load-sample \"~/studio/samples/kit/boom.wav\")

-  Takes optional params :start and :size. Allocates buffer to number of channels
-  of file and number of samples requested (:size), or fewer if sound file is
-  smaller than requested. Reads sound file data from the given starting frame
-  in the file (:start). If the number of frames argument is less than or equal
-  to zero, the entire file is read."
+  Takes optional params :start and :size. Allocates buffer to number of
+  channels of file and number of samples requested (:size), or fewer if
+  sound file is smaller than requested. Reads sound file data from the
+  given starting frame in the file (:start). If the number of frames
+  argument is less than or equal to zero, the entire file is read."
   [path & args]
   (let [path (canonical-path path)]
     (if-let [sample (get @loaded-samples* [path args])]
@@ -92,10 +92,10 @@
           (apply load-sample* path args))))))

 (defn load-samples
-  "Takes a directoy path or glob path (see #'overtone.helpers.file/glob) and
-  loads up all matching samples and returns a seq of maps representing
-  information for each loaded sample (see load-sample). Samples should be in
-  .aiff or .wav format."
+  "Takes a directoy path or glob path (see #'overtone.helpers.file/glob)
+   and loads up all matching samples and returns a seq of maps
+   representing information for each loaded sample (see
+   load-sample). Samples should be in .aiff or .wav format."
   [& path-glob]
   (let [path  (apply mk-path path-glob)
         path  (resolve-tilde-path path)
@@ -133,9 +133,10 @@
     (free-loaded-sample loaded-sample)))

 (defn free-sample
-  "Free the buffer associated with smpl and the memory it consumes. Uses the
-  cached version from @loaded-samples* in case the server has crashed or been
-  rebooted. Also remove the sample from @loaded-samples."
+  "Free the buffer associated with smpl and the memory it consumes. Uses
+   the cached version from @loaded-samples* in case the server has
+   crashed or been rebooted. Also remove the sample from
+   @loaded-samples."
   [smpl]
   (assert sample? smpl)
   (let [path (:path smpl)
@@ -146,9 +147,9 @@

 (defn sample-player
   "Play the specified sample with either a mono or stereo player
-  depending on the number of channels in the sample. Accepts same args
-  as both players, namely:
-  [buf 0 rate 1.0 start-pos 0.0 loop? 0 vol 1]"
+   depending on the number of channels in the sample. Accepts same args
+   as both players, namely: [buf 0 rate 1.0 start-pos 0.0 loop? 0 vol
+   1]"
   [smpl & pargs] {:pre [(sample? smpl)]}
   (let [{:keys [path args]}     smpl
         {:keys [id n-channels]} (get @loaded-samples* [path args])


whitespace fix

whitespace fix

--- src/overtone/sc/sample.clj
+++ src/overtone/sc/sample.clj
@@ -17,7 +17,7 @@
   (do
     (defsynth mono-player
       "Plays a single channel audio buffer."
-      [buf 0 rate 1.0 start-pos 0.0 loop? 0 vol 1 out-bus 0 ]
+      [buf 0 rate 1.0 start-pos 0.0 loop? 0 vol 1 out-bus 0]
       (out out-bus (* vol
                       (pan2
                        (scaled-play-buf 1 buf rate


Use double semi-colons for comments

Use double semi-colons for comments

--- src/petulant_life/main.clj
+++ src/petulant_life/main.clj
@@ -7,26 +7,27 @@

   (:require [petulant-life.rendering :as r]))

-; Defining some width and height constraints to the program.
+;; Defining some width and height constraints to the program.
 (def width 640)
 (def height 480)

-; Initializing the OpenGL window.
+;; Initializing the OpenGL window.
 (defn create []
-  (Display/setDisplayMode (DisplayMode. width height))
-  (Display/create (PixelFormat.)
-                  (-> (ContextAttribs. 3 2)
-                      (.withForwardCompatible    true)
-                      (.withProfileCore true)))
-  (Display/setTitle "Petulant Life")
+  (let [bgi 0.9]
+    (Display/setDisplayMode (DisplayMode. width height))
+    (Display/create (PixelFormat.)
+                    (-> (ContextAttribs. 3 2)
+                        (.withForwardCompatible    true)
+                        (.withProfileCore true)))
+    (Display/setTitle "Petulant Life")
+    (GL11/glClearColor bgi bgi bgi 1)))

-  (GL11/glClearColor 0.9 0.9 0.9 1))

-; Cleaning up the LWJGL context.
+;; Cleaning up the LWJGL context.
 (defn destroy []
   (Display/destroy))

-; Running the simulation / graphics.
+;; Running the simulation / graphics.
 (defn run []
   (while (and running (not (Display/isCloseRequested)))
     (do (GL11/glClear GL11/GL_COLOR_BUFFER_BIT)
@@ -42,7 +43,7 @@
      (finally
        (~close-fn))))

-; Entry point.
+;; Entry point.
 (defn -main [& args]
   (with-cleanup destroy
     (create)


disable making a connection pool when we are talking to datawarehouses.

--- src/metabase/driver/postgres/connection.clj
+++ src/metabase/driver/postgres/connection.clj
@@ -16,6 +16,7 @@
         {:keys [host dbname port host]} details]
     (-> details
         (assoc :host host                                     ; e.g. "localhost"
+               :make-pool? false
                :db-type :postgres                             ; HACK hardcoded to postgres for time being until API has a way to choose DB type !
                :port (Integer/parseInt port))                 ; convert :port to an Integer
         (cond-> (config/config-bool :mb-postgres-ssl) (assoc :ssl true :sslfactory "org.postgresql.ssl.NonValidatingFactory"))


Use :key in example, and explain why

Use :key in example, and explain why

--- test/demo.cljs
+++ test/demo.cljs
@@ -81,7 +81,7 @@
 (defn lister [props]
   [:ul
    (for [item (:items props)]
-     [:li "Item " item])])
+     [:li {:key item} "Item " item])])

 (defn lister-user []
   [:div
@@ -174,7 +174,14 @@
    [:code "seq"] "." ]

    [demo-component {:comp lister-user
-                    :defs [:lister :lister-user]}]])
+                    :defs [:lister :lister-user]}]
+
+   [:p [:strong "Note: "]
+    "The " [:code "{:key item}"] " part of the " [:code ":li"] " isn't
+    really necessary in this simple example, but passing a unique key
+    for every item in a dynamically generated list of components is
+    good practice, and helps React to improve performance a lot for
+    large lists."]])

 (defn managing-state []
   [:div


rename rule

rename rule

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -272,7 +272,7 @@
                                           :synsem {:cat :verb
                                                    :subcat '()
                                                    :sem head-sem}}
-                                   :rule "s-modified-with-adjunct-adjunct-first"}))
+                                   :rule "s-modified-modifier-first"}))

                    (unify-check h00
                                 modified
@@ -290,7 +290,7 @@
                                                    :infl head-infl
                                                    :subcat '()
                                                    :sem head-sem}}
-                                   :rule "s-modified-with-adjunct-head-first"}))
+                                   :rule "s-modified-modifier-last"}))

                    (unify-check c10
                                 root-is-head-root


remove ([:comp :phrasal] = false) from np1 and np2: this probably removes a workaround for a bug i'm going to try to fix.

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -171,8 +171,7 @@
                                        :sem {:number number-agreement
                                              :mod '()}}
                               :head {:phrasal false
-                                     :synsem {:propernoun propernoun}}
-                              :comp {:phrasal false}})) ;; rathole prevention ;; TODO: see if this can be removed.
+                                     :synsem {:propernoun propernoun}}}))

                    (unifyc c10
                            comp-specs-head
@@ -185,8 +184,7 @@
                                        :propernoun propernoun
                                        :sem {:number number-agreement}}
                               :head {:phrasal true
-                                     :synsem {:propernoun propernoun}}
-                              :comp {:phrasal false}})) ;; rathole prevention ;; TODO: see if this can be removed.
+                                     :synsem {:propernoun propernoun}}}))
                    (unifyc h10
                            {:rule "prepositional-phrase"
                             :synsem {:cat :prep}})


added more verbs from

added more verbs from

http://www.123teachme.com/learn_spanish/100_most_common_spanish_verbs

--- src/babel/espanol/lexicon.cljc
+++ src/babel/espanol/lexicon.cljc
@@ -96,6 +96,8 @@
                :synsem {:cat :verb
                         :sem {:pred :have-lunch}}}

+   andar
+
    "anunciar" {:synsem {:cat :verb
                         :sem {:pred :announce}}}

@@ -257,6 +259,7 @@

    dañar
+
    "dar" {:espanol  {:present {:1sing "doy"
                                :2plur "dais"}
                      :preterito {:1sing "di"
@@ -612,6 +615,7 @@
                             :reflexive true
                             :sem subject-semantics}}}})

+   lavar
    leer

    "levantarse"
@@ -672,6 +676,9 @@
                (unify shared-part-of-llevar
                       {:synsem {:sem {:pred :bring}}})])

+   llorar
+   manejar
+
    "me" {:synsem {:cat :noun
                   :pronoun true
                   :reflexive true
@@ -685,6 +692,7 @@
                       :sem {:pred :lie}}}

    mirar
+   mostrar

    "mujer"
    (unify agreement-noun
@@ -842,6 +850,7 @@
    romper

    saber
+   sacar

    "salir" {:espanol  {:present {:1sing "salgo"}}
             :synsem {:cat :verb
@@ -865,10 +874,12 @@
                     :number :plur}
               :subcat '()}}]

-
-   sentarse
+  seguir
+  sentarse

   sentir
+  sentirse
+  soñar

    "te" {:synsem {:cat :noun
                   :pronoun true
@@ -945,6 +956,8 @@
                    :pred :voi}
              :subcat '()}}

+
+   valer
    vender

    "venir" {:espanol {:futuro-stem "vendr"
@@ -964,9 +977,11 @@
           :synsem {:cat :verb
                    :sem {:pred :see}}}

+   vestirse
    viajar
    vivir
    volar
+   volver

    "vosotras"
    {:synsem {:cat cat-of-pronoun


Remove unused function threads-with-tag

Remove unused function threads-with-tag

I believe this functionality has been subsumed by the search functions

--- src/braid/server/db/thread.clj
+++ src/braid/server/db/thread.clj
@@ -117,32 +117,6 @@
                 [?group :group/user ?user]
                 [?user :user/id ?user-id]]
               (d/db conn) thread-id user-id))))
-
-(defn threads-with-tag
-  "Find threads with a given tag that the user is allowed to see, ordered by
-  most recent message.
-  Paginates results, dropping `skip` threads and returning `limit`.
-  Returns the threads and a count of how many threads remain."
-  [conn user-id tag-id skip limit]
-  (let [all-thread-eids (d/q '[:find ?thread (max ?time)
-                               :in $ ?tag-id
-                               :where
-                               [?tag :tag/id ?tag-id]
-                               [?thread :thread/tag ?tag]
-                               [?msg :message/thread ?thread]
-                               [?msg :message/created-at ?time]]
-                             (d/db conn) tag-id)
-        thread-eids (->> all-thread-eids
-                         (sort-by second #(compare %2 %1))
-                         (map first)
-                         (drop skip)
-                         (take limit))]
-    {:threads (into ()
-                    (comp (map db->thread)
-                          (filter #(user-can-see-thread? conn user-id (% :id)))
-                          (map #(thread-add-last-open-at conn % user-id)))
-                    (d/pull-many (d/db conn) thread-pull-pattern thread-eids))
-     :remaining (- (count all-thread-eids) (+ skip (count thread-eids)))}))

 (defn open-threads-for-user
   [conn user-id]


minor clean

minor clean

--- glue/src/clj/cljpy/example.clj
+++ glue/src/clj/cljpy/example.clj
@@ -5,11 +5,12 @@

 (defmacro with-test-interp [& body]
   `(base/with-interpreter
-     ;{:libpaths ["test/clojure_python/"]}
      {:libpaths ["src/py/"]}
      ~@body))

-(defn -main []
+(defn demo-interop
+  "demontsrate interop"
+  []
   (println "main")
   (with-test-interp
     (base/py-import-lib example)
@@ -19,3 +20,6 @@
     (println (calc 2)))
   (Testing/ja)
   (println "main end"))
+
+(defn -main []
+  (demo-interop))


Improve page-normalize-pattern description

--- src/clj/comic_reader/sites.clj
+++ src/clj/comic_reader/sites.clj
@@ -86,7 +86,8 @@
   (:chapter-list-selector options))

 (defn page-normalize-pattern
-  "A regular expression to extract the page number from the content."
+  "A regular expression to extract the page number from the page
+  select option value."
   []
   (:page-normalize-pattern options))


Added Improved Protein Source, reformatted Project Ares

--- src/clj/game/cards-agendas.clj
+++ src/clj/game/cards-agendas.clj
@@ -283,6 +283,12 @@
     :abilities [{:counter-cost 1 :msg "do 1 net damage" :req (req (:run @state)) :once :per-run
                  :effect (effect (damage :net 1 {:card card}))}]}

+   "Improved Protein Source"
+     {:msg (msg "make the Runner gain 4 [Credits]")
+      :effect (effect (gain :runner :credit 4))
+      :stolen {:msg "gain 4 [Credits]"
+               :effect (effect (gain :credit 4))}}
+
    "Improved Tracers"
    {:effect (req (update-all-ice state side))
     :events {:pre-ice-strength {:req (req (has-subtype? target "Tracer"))
@@ -362,17 +368,17 @@
                           :bad-publicity (Integer/parseInt target)))}

    "Project Ares"
-   {:req (req #(and (> (:advance-counter card) 4) (> (count (all-installed state :runner)) 0)))
-    :msg (msg "force the Runner to trash " (- (:advance-counter card) 4) " installed cards and take 1 bad publicity")
-	  :effect (req (let [ares card]
-	                 (resolve-ability
-	                   state :runner
-	                   {:prompt (msg "Choose " (- (:advance-counter ares) 4) " installed cards to trash")
-                      :choices {:max (- (:advance-counter ares) 4) :req #(and (:installed %) (= (:side %) "Runner"))}
-                      :effect (effect (trash-cards targets)
-                                      (system-msg (str "trashes " (join ", " (map :title targets)))))}
-                    card nil))
-	               (gain state :corp :bad-publicity 1))}
+     {:req (req #(and (> (:advance-counter card) 4) (> (count (all-installed state :runner)) 0)))
+      :msg (msg "force the Runner to trash " (- (:advance-counter card) 4) " installed cards and take 1 bad publicity")
+      :effect (req (let [ares card]
+                     (resolve-ability
+                       state :runner
+                       {:prompt (msg "Choose " (- (:advance-counter ares) 4) " installed cards to trash")
+                        :choices {:max (- (:advance-counter ares) 4) :req #(and (:installed %) (= (:side %) "Runner"))}
+                        :effect (effect (trash-cards targets)
+                                        (system-msg (str "trashes " (join ", " (map :title targets)))))}
+                       card nil))
+                   (gain state :corp :bad-publicity 1))}

    "Project Atlas"
    {:effect (effect (set-prop card :counter (max 0 (- (:advance-counter card) 3))))


Updated agendas to :yes-abiilty :optional structure.

--- src/clj/game/cards-agendas.clj
+++ src/clj/game/cards-agendas.clj
@@ -5,10 +5,10 @@
    {:optional {:prompt "Look at the top 3 cards of R&D?"
                :msg (msg (let [c (count (filter #(= (:type %) "ICE") (take 3 (:deck corp))))]
                            (str "install " c " ICE and trash " (- 3 c) " cards")))
-               :effect (req (doseq [c (take 3 (:deck corp))]
-                              (if (= (:type c) "ICE")
-                                (corp-install state side c nil {:no-install-cost true :install-state :rezzed})
-                                (trash state side c))))}}
+               :yes-ability {:effect (req (doseq [c (take 3 (:deck corp))]
+                                           (if (= (:type c) "ICE")
+                                             (corp-install state side c nil {:no-install-cost true :install-state :rezzed})
+                                             (trash state side c))))}}}

    "Ancestral Imager"
    {:events {:jack-out {:msg "do 1 net damage" :effect (effect (damage :net 1))}}}
@@ -98,7 +98,8 @@

    "Explode-a-palooza"
    {:access {:optional {:prompt "Gain 5 [Credits] with Explode-a-Palooza ability?"
-                        :msg "gain 5 [Credits]" :effect (effect (gain :corp :credit 5))}}}
+                        :msg "gain 5 [Credits]"
+                        :yes-ability {:effect (effect (gain :corp :credit 5))}}}}

    "False Lead"
    {:abilities [{:req (req (>= (:click runner) 2)) :msg "force the Runner to lose [Click][Click]"
@@ -145,11 +146,12 @@
    {:events {:corp-turn-begins
              {:optional
               {:prompt "Add 1 card from Archives to bottom of R&D?"
-               :effect (effect (resolve-ability
-                                 {:prompt "Choose a card" :choices (:discard corp)
-                                  :effect (effect (move target :deck))
-                                  :msg (msg "add " (if (:seen target) (:title target) "a card")
-                                            " to the bottom of R&D")} card target))}}}}
+               :yes-ability {:effect (effect (resolve-ability
+                                              {:prompt "Choose a card"
+                                               :choices (:discard corp)
+                                               :effect (effect (move target :deck))
+                                               :msg (msg "add " (if (:seen target) (:title target) "a card")
+                                                         " to the bottom of R&D")} card target))}}}}}

    "Helium-3 Deposit"
    {:choices ["0", "1", "2"] :prompt "How many power counters?"
@@ -239,7 +241,7 @@
    "Posted Bounty"
    {:optional {:prompt "Forfeit Posted Bounty to give the Runner 1 tag and take 1 bad publicity?"
                :msg "give the Runner 1 tag and take 1 bad publicity"
-               :effect (effect (gain :bad-publicity 1) (gain :runner :tag 1) (forfeit card))}}
+               :yes-ability {:effect (effect (gain :bad-publicity 1) (gain :runner :tag 1) (forfeit card))}}}

    "Priority Requisition"
    {:choices {:req #(and (= (:type %) "ICE") (not (:rezzed %)))}


make Hades Fragment manually triggered

make Hades Fragment manually triggered

will avoid Corp decking themselves with empty R&D and a scored Hades Fragment

--- src/clj/game/cards-agendas.clj
+++ src/clj/game/cards-agendas.clj
@@ -206,15 +206,13 @@
    {:abilities [{:cost [:click 1] :effect (effect (gain :credit 3)) :msg "gain 3 [Credits]"}]}

    "Hades Fragment"
-   {:events {:corp-turn-begins
-             {:optional
-              {:prompt "Add 1 card from Archives to bottom of R&D?"
-               :yes-ability {:effect (effect (resolve-ability
-                                              {:prompt "Choose a card"
-                                               :choices (:discard corp)
-                                               :effect (effect (move target :deck))
-                                               :msg (msg "add " (if (:seen target) (:title target) "a card")
-                                                         " to the bottom of R&D")} card target))}}}}}
+   {:events {:runner-turn-ends
+             {:effect (req (toast state :corp
+                                  (str "Click Hades Fragment to add 1 card from Archives to the bottom of R&D.") "info"))}}
+    :abilities [{:prompt "Choose a card to add to the bottom of R&D"
+                 :choices (req (:discard corp))
+                 :effect (effect (move target :deck))
+                 :msg (msg "add " (if (:seen target) (:title target) "a card") " to the bottom of R&D")}]}

    "Helium-3 Deposit"
    {:choices ["0", "1", "2"] :prompt "How many power counters?"


remove meta print statement

remove meta print statement

--- kafka-clj/src/kafka_clj/metadata.clj
+++ kafka-clj/src/kafka_clj/metadata.clj
@@ -114,7 +114,6 @@
     metadata-producer))

 (defn get-metadata-recreate! [metadata-producers conf & args]
-  (prn "get-meta-recreate!")
   (try
     [metadata-producers (apply get-metadata (smart-deref metadata-producers) conf args)]
     (catch Exception e (let [producers2 (doall (map (partial recreate-producer-if-closed! conf) metadata-producers))]


Remove useles parameter.

Remove useles parameter.

--- src/uxbox/ui/workspace/sidebar/options.cljs
+++ src/uxbox/ui/workspace/sidebar/options.cljs
@@ -480,9 +480,6 @@
          {:style {:visibility "hidden"}}]
         ]]]
      )))
-
-
-

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Components
@@ -516,7 +513,7 @@
     :mixins [mx/static rum/reactive (mx/local)]}))

 (defn options-toolbox-render
-  [own shape]
+  [own]
   (let [workspace (rum/react wb/workspace-l)
         close #(rs/emit! (dw/toggle-flag :element-options))
         shape (when (and (:selected workspace)


Fix wrong argument name in find-by-css functions' docstrings

--- src/sparkledriver/core.clj
+++ src/sparkledriver/core.clj
@@ -127,12 +127,12 @@
   (.findElementsByXPath browser-or-elem xpath))

 (defn find-by-css
-  "Return the first element that matches `xpath`, starting from `browser-or-elem` (which can be a browser or element). Throws an exception if there's no such element!"
+  "Return the first element that matches `css-selector`, starting from `browser-or-elem` (which can be a browser or element). Throws an exception if there's no such element!"
   [browser-or-elem css-selector]
   (.findElementByCssSelector browser-or-elem css-selector))

 (defn find-by-css*
-  "Return all elements that match `xpath`, starting from `browser-or-elem` (which can be a browser or element) or an empty sequence."
+  "Return all elements that match `css-selector`, starting from `browser-or-elem` (which can be a browser or element) or an empty sequence."
   [browser-or-elem css-selector]
   (.findElementsByCssSelector browser-or-elem css-selector))


all the debugging prints

all the debugging prints

--- statspop/src/statspop/detection.cljs
+++ statspop/src/statspop/detection.cljs
@@ -26,17 +26,37 @@
   [vov]
   (map-indexed #(identity {:index %1 :vals %2}) vov))

-(defn id-num-mapped
-  "convenience function for mapping "
-  [proportion m]
-  )
-
 (defn get-indexes-of-matches
   "filter the index-maps by testing values against identify-numeric
   this could really be optimized with transducer. too much unnecessary intermediate collection"
   [indexed-maps proportion]
   (let [matches (filter #(identify-numeric proportion (:vals %)) indexed-maps)]
   (mapv :index matches)))
+
+(defn find-runs
+  [indices minsize]
+  (loop [all-regions []
+         active-region []
+         cur-idx (first indices)
+         remaining (rest indices)]
+    (do
+      (println {:stage "in" :all all-regions :active active-region :item cur-idx :rest remaining})
+      (cond
+        (= 0 (count remaining)) all-regions
+        (= active-region [])
+        (do
+          (println {:stage "appending to empty region" :all all-regions :active active-region :item cur-idx :rest remaining})
+          (recur all-regions (conj active-region cur-idx) (first remaining) (rest remaining)))
+        (= (inc (last active-region)) cur-idx)
+        (do
+          (println {:stage "appending to unbroken run" :all all-regions :active active-region :item cur-idx :rest remaining})
+          (recur all-regions (conj active-region cur-idx) (first remaining) (rest remaining)))
+        :else (if (>= (count active-region) minsize)
+                (do
+                  (println {:stage "run broken, appending to all-regions" :all all-regions :active active-region :item cur-idx :rest remaining})
+                  (recur (conj all-regions active-region) [] (first remaining) (rest remaining)))
+                (do (println {:stage "run-broken, not appending (too small)" :all all-regions :active active-region :item cur-idx :rest remaining})
+                    (recur active-region [] (first remaining) (rest remaining))))))))

 (def test-lines "123 abc
   foo bar baa
@@ -49,3 +69,9 @@
   12
   1 2
   1 a 1 2")
+
+(def l (lines test-lines))
+
+(def il (make-index-maps l))
+
+(def im (get-indexes-of-matches il 0.5))


Removed unused code

Removed unused code

--- src/freecoin/handlers/tags.clj
+++ src/freecoin/handlers/tags.clj
@@ -29,16 +29,6 @@
             [freecoin.blockchain :as blockchain]
             [freecoin.views.tags :as tv]))

-(defn get-tags-and-counts
-  "Retrieves all the tags in the system, together with the count of transactions
-that were tagged with each of them."
-  [blockchain]
-  (let [tags (blockchain/list-tags blockchain {})]
-    (reduce-kv (fn [acc tag txs]
-                 (assoc acc (count txs)))
-               {}
-               tags)))
-
 (lc/defresource get-tags [blockchain]
   :allowed-methods [:get]
   :available-media-types ["text/html"]


Adds test for granule in future

Adds test for granule in future

Ingests a granule with an end date 1 hour in the future and a collection
wih an end date that is in the far futre, but has an
ends-at-present=true.

--- system-int-test/test/cmr/system_int_test/ingest/granule_validation_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/granule_validation_test.clj
@@ -13,7 +13,10 @@
             [cmr.spatial.mbr :as m]
             [cmr.system-int-test.utils.url-helper :as url]
             [cmr.ingest.services.messages :as msg]
-            [cmr.system-int-test.utils.dev-system-util :as dev-sys-util]))
+            [cmr.system-int-test.utils.dev-system-util :as dev-sys-util]
+            [cmr.common.time-keeper :as tk]
+            [clj-time.format :as tf]
+            [clj-time.core :as t]))

 (use-fixtures :each (ingest/reset-fixture {"provguid1" "PROV1" "provguid2" "PROV2"}))

@@ -49,6 +52,26 @@
   (let [invalid-granule-xml "<Granule>invalid xml</Granule>"
         expected-errors ["Line 1 - cvc-complex-type.2.3: Element 'Granule' cannot have character [children], because the type's content type is element-only."
                          "Line 1 - cvc-complex-type.2.4.b: The content of element 'Granule' is not complete. One of '{GranuleUR}' is expected."]]
+
+    (testing "granule with end date slightly in the future and collection with
+             EndsAtPresentFlag=true and end date in the far future"
+             (let [collection (dc/collection {:entry-title "correct"
+                                              :short-name "S1"
+                                              :version-id "V1"
+                                              :temporal (dc/temporal
+                                                          {:beginning-date-time "2009-03-08T00:00:00Z"
+                                                           :ending-date-time "2121-11-04T00:00:00Z"
+                                                           :ends-at-present? true})})
+                   coll-concept (d/item->concept collection)
+                   future-date-time (t/plus (tk/now) (t/hours 1))
+                   time-formatter (tf/formatters :date-time-no-ms)
+                   future-date-time-str (tf/unparse time-formatter future-date-time)
+                   granule (assoc (dg/granule collection)
+                                  :temporal (dg/temporal {:beginning-date-time "2010-11-04T00:00:00Z"
+                                                          :ending-date-time future-date-time-str}))]
+               (assert-validation-success
+                 (d/item->concept granule)
+                 coll-concept)))

     (testing "with collection as additional parameter"
       (let [collection (dc/collection-dif {})
@@ -321,14 +344,14 @@

 ;; TODO uncomment this test when implementing CMR-1239
 #_(deftest duplicate-granule-ur-test
-  (testing "same granule-ur and native-id across providers is valid"
-    (assert-valid
-      {}
-      {:granule-ur "UR-1" :concept-id "G1-PROV1" :native-id "Native1"})
-    (assert-valid
-      {}
-      {:granule-ur "UR-1" :concept-id "G1-PROV2" :native-id "Native1" :provider-id "PROV2"}))
-  (testing "granule-ur must be unique for a provider"
-    (assert-conflict
-      {:granule-ur "UR-1" :concept-id "G2-PROV1" :native-id "Native2"}
-      ["The Granule Ur [UR-1] must be unique. The following concepts with the same entry title were found: [G1-PROV1]."])))
+    (testing "same granule-ur and native-id across providers is valid"
+      (assert-valid
+        {}
+        {:granule-ur "UR-1" :concept-id "G1-PROV1" :native-id "Native1"})
+      (assert-valid
+        {}
+        {:granule-ur "UR-1" :concept-id "G1-PROV2" :native-id "Native1" :provider-id "PROV2"}))
+    (testing "granule-ur must be unique for a provider"
+      (assert-conflict
+        {:granule-ur "UR-1" :concept-id "G2-PROV1" :native-id "Native2"}
+        ["The Granule Ur [UR-1] must be unique. The following concepts with the same entry title were found: [G1-PROV1]."])))


Show google bucket name on the workspace summary page

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/summary/summary_tab.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/summary/summary_tab.cljs
@@ -73,7 +73,11 @@
             (style/create-link
               #(swap! state assoc :editing-acl? true)
               "Sharing...")
-            ")"])])]
+            ")"])])
+      (when-let [bucketName (get-in ws ["workspace" "bucketName"])]
+        [:div {}
+         (style/create-section-header "Google Bucket")
+         (style/create-paragraph [:div {} bucketName])])]
      (common/clear-both)]))

 (react/defc Summary


better interaction when selecting competition

--- src/tango/cljs/client.cljs
+++ src/tango/cljs/client.cljs
@@ -41,6 +41,7 @@
   (d/transact! conn [{:db/id -1 :app/id 1}
                      {:db/id -1 :selected-page :competitions}
                      {:db/id -1 :app/import-status :none}
+                     {:db/id -1 :app/status :running}
                      {:db/id -1 :app/selected-competition {}}
                      ]))

@@ -71,7 +72,8 @@
       (let [clean-data (uidb/sanitize d)]
         (log "Crazzzy")
         (om/transact! reconciler `[(app/add-competition ~clean-data) :app/competitions])))
-    (om/transact! reconciler `[(app/set-import-status {:status :none})]))
+    (om/transact! reconciler `[(app/set-import-status {:status :none})])
+    (om/transact! reconciler `[(app/status {:status :running})]))
   )

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -196,6 +198,16 @@
               (log q)
               q))})

+(defmethod read :app/status
+  [{:keys [state query]} key params]
+  {:value (do
+            (log "Read Status")
+            (let [q (d/q '[:find ?status .
+                           :where [[:app/id 1] :app/status ?status]]
+                         (d/db state))]
+              (log q)
+              q))})
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Mutate

@@ -230,6 +242,12 @@
   {:value {:keys [:app/import-status]}
    :action (fn []
              (d/transact! state [{:app/id 1 :app/import-status status}]))})
+
+(defmethod mutate 'app/status
+  [{:keys [state]} key {:keys [status] :as params}]
+  {:value {:keys [:app/status]}
+   :action (fn []
+             (d/transact! state [{:app/id 1 :app/status status}]))})

 (defmethod mutate 'app/select-competition
   [{:keys [state]} key {:keys [name]}]
@@ -372,12 +390,11 @@
    (let [competition (om/props this)
          name (:competition/name competition)]
      (dom/tr
-      ;; TODO - this should be handle be some remote mechanism
-      ;; TODO - set app status to remote query then reset at query done
+      ;; TODO - this should be handle by some remote mechanism
       #js {:onClick #(do
                        (chsk-send! [:event-manager/query ['[*] [:competition/name name]]])
                        (om/transact! this `[(app/select-competition {:name ~name})])
-                       ;(om/transact! this `[(app/select-competition {:name {}})])
+                       (om/transact! this `[(app/status {:status :querying})])
                        )}
       (dom/td nil name)
       (dom/td nil (:competition/location competition))))))
@@ -389,39 +406,41 @@
   (render
    [this]
    (let [competitions (:competitions (om/props this))
+         import-status (:import-status (om/props this))
          status (:status (om/props this))]
      (log "Render CompetitionView")
      (log (om/props this))
-     (log "Import Status")
-      (log status)
-     (dom/div
-      nil
-      (dom/h2
-       nil
-       "Mina tävlingar")
-      (dom/span nil "Välj en tävling att arbete med.")
-      (dom/table
-       #js {:className "table table-hover"}
-       (dom/thead
-        nil
-        (dom/tr
-         nil
-         (dom/th nil "Namn")
-         (dom/th nil "Plats")))
-       (apply dom/tbody nil (map competition competitions)))
-
-      (dom/div
-       nil
-       (dom/span #js {:className (str "btn btn-default btn-file"
-                                      (when (= status :importing) " disabled"))} "Importera.."
-                 (dom/input #js {:type "file"
-                                 :onChange #(do
-                                              (om/transact! reconciler `[(app/set-import-status
-                                                                          {:status :importing})])
-                                              (on-click-import-file %))}))
-       (condp = status
-         :none (dom/h3 nil "")
-         :importing (dom/h3 nil "Importerar, vänligen vänta..")))))))
+     (log "Status")
+     (log status)
+     (cond
+       (= status :querying) (dom/div nil (dom/h3 nil (str "Laddar tävlingen, vänligen vänta..")))
+       (= import-status :none) (dom/div
+                                nil
+                                (dom/h2
+                                 nil
+                                 "Mina tävlingar")
+                                (dom/span nil "Välj en tävling att arbete med.")
+
+                                (dom/table
+                                 #js {:className "table table-hover"}
+                                 (dom/thead
+                                  nil
+                                  (dom/tr
+                                   nil
+                                   (dom/th nil "Namn")
+                                   (dom/th nil "Plats")))
+                                 (apply dom/tbody nil (map competition competitions)))
+
+                                (dom/div
+                                 nil
+                                 (dom/span #js {:className (str "btn btn-default btn-file"
+                                                                (when (= import-status :importing) " disabled"))} "Importera.."
+                                           (dom/input #js {:type "file"
+                                                           :onChange #(do
+                                                                        (om/transact! reconciler `[(app/set-import-status
+                                                                                {:status :importing})])
+                                                                        (on-click-import-file %))}))))
+       (= import-status :importing) (dom/h3 nil "Importerar, vänligen vänta..")))))

 ;;;;;;;;;;;;;;;;;;;;
 ;; Classes
@@ -568,6 +587,7 @@
   (query [this]
          [:app/selected-page
           :app/import-status
+          :app/status
           {:app/competitions (om/get-query Competition)}
           {:app/selected-competition
            (concat (om/get-query ClassesView)
@@ -608,7 +628,9 @@

       (dom/div #js {:className "container-fluid"}
                (dom/div #js {:className "row"}
-                        (when (not (empty? selected-competition))
+                        (when (and (not (empty? selected-competition))
+                                   (= :running (:app/status (om/props this)))
+                                   (not= :importing (:app/import-status (om/props this))))
                           (dom/div #js {:className "col-sm-2 col-md-2 sidebar"}
                                    (dom/div nil (dom/u nil (:competition/name selected-competition)) )
                                    (apply dom/ul #js {:className "nav nav-sidebar"}
@@ -626,7 +648,8 @@
                                    :classes ((om/factory ClassesView) selected-competition)
                                    :competitions ((om/factory CompetitionsView)
                                                   {:competitions competitions
-                                                   :status (:app/import-status (om/props this))
+                                                   :import-status (:app/import-status (om/props this))
+                                                   :status (:app/status (om/props this))
                                                    })
                                    :schedule ((om/factory ScheduleView) selected-competition)
                                    :adjudicators ((om/factory AdjudicatorsView) selected-competition)


Don't need not-empty test.

Don't need not-empty test.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -173,23 +173,19 @@
     (assign-position positions actx-id)
     ["
" actx-id
      "
" (vis-html-loop-state vis (:loop-state actx-info)) "
"
-     "
"
-     "
"
+     "

"
      (mapv (fn [ch-ch-info]
              (let [ch-info (second ch-ch-info)
                    ch-id (:id ch-info)]
                (assign-position positions ch-id)
                ["
" ch-id ": " (:msgs ch-info) "
"]))
            (get actx-ch-ch-infos actx))
-     "
"
-     "
"
-     (if (not-empty children)
-       ["
" (mapv (fn [child-actx]
-                       ["
" (vis-html-actx vis child-actx positions actx-ch-ch-infos)
-                        "
"])
-                     (sort #(compare (last %1) (last %2)) (keys children)))
-        "
"]
-       [])
+     "

"
+     ["
" (mapv (fn [child-actx]
+                     ["
" (vis-html-actx vis child-actx positions actx-ch-ch-infos)
+                      "
"])
+                   (sort #(compare (last %1) (last %2)) (keys children)))
+      "
"]
      "
"]))

 (defn vis-svg-actxs [vis positions deltas phase]


get player counter value atomically

get player counter value atomically

--- src/clj/mpd/ws.clj
+++ src/clj/mpd/ws.clj
@@ -28,8 +28,7 @@

 (defn handle [req]
   (with-channel req channel
-    (swap! player_counter inc)
-    (let [id @player_counter]
+    (let [id (swap! player_counter inc)]
       (opened id channel)
       (on-receive channel #(received id channel %))
       (on-close channel #(closed id channel %)))))


A typo fixed: extens -> externs

A typo fixed: extens -> externs

--- src/cljs/deps.cljs
+++ src/cljs/deps.cljs
@@ -1,3 +1,3 @@
 {:foreign-libs [{:file "foo.js"
                  :provides ["foo.bar"]}]
- :extens ["foo.ext.js"]}
+ :externs ["foo.ext.js"]}


Use tail recursion instead of atoms. More explanatory naming.

--- src/cping/core.clj
+++ src/cping/core.clj
@@ -16,7 +16,7 @@

 (defn summarize
-  "Create the summary histogram of"
+  "Create the summary histogram"
   [good]
   (let [last_10 (max 0 (- good 50))
         first_50 (int (/ (+ (min 0 (- good 50)) 50) 10))]
@@ -38,19 +38,17 @@

   (let [host (first args)]
     (println (str "The host is: " host))
-    (let [sec (atom 0)
-          good (atom 0)]
-      (while true
-        (let [{:keys [out exit] :as result} (ping! host)]
-          (swap! sec inc)
-          (if (= exit 0) (swap! good inc))
-          (print (if (= exit 0) "#" "."))
-          (flush)
-          (if (= @sec 60)
-            (do
-              (println (summarize @good))
-              (reset! sec 0)
-              (reset! good 0)))
-          (Thread/sleep 500)))))
+    (loop [sec 1, good-old 0]
+      (let [{:keys [out exit] :as result} (ping! host)
+            good? (zero? exit)
+            good (if good? (inc good-old) good-old)
+            last? (= sec 60)]
+        (print (if good? "#" "."))
+        (flush)
+        (if last? (println (summarize good)))
+        (Thread/sleep 500)
+        (if last?
+          (recur 1 0)
+          (recur (inc sec) good)))))

   (System/exit 0))