List published entries with incomplete follow-ups for the specified user.

--- src/oc/storage/resources/entry.clj
+++ src/oc/storage/resources/entry.clj
@@ -27,6 +27,10 @@
 (def ignored-properties
   "Properties of a resource that are ignored during an update."
   (disj reserved-properties :board-uuid :status))
+
+(def list-properties
+  "Set of properties we want when listing entries."
+  ["uuid" "headline" "body" "reaction" "author" "created-at" "updated-at"])

 ;; ----- Utility functions -----

@@ -432,7 +436,7 @@
          (#{:published :draft} status)]}
   (db-common/read-resources-and-relations conn table-name :status-org-uuid-author-id [[status org-uuid user-id]]
                                           :interactions common/interaction-table-name :uuid :resource-uuid
-                                          ["uuid" "headline" "body" "reaction" "author" "created-at" "updated-at"] {:count count})))
+                                          list-properties {:count count})))

 (schema/defn ^:always-validate list-entries-by-board
   "Given the UUID of the board, return the published entries for the board with any interactions."
@@ -440,13 +444,24 @@
   {:pre [(db-common/conn? conn)]}
   (db-common/read-resources-and-relations conn table-name :status-board-uuid [[:published board-uuid]]
                                           :interactions common/interaction-table-name :uuid :resource-uuid
-                                          ["uuid" "headline" "body" "reaction" "author" "created-at" "updated-at"] {:count count}))
+                                          list-properties {:count count}))

 (schema/defn ^:always-validate list-all-entries-by-board
   "Given the UUID of the board, return all the entries for the board."
   [conn board-uuid :- lib-schema/UniqueID]
   {:pre [(db-common/conn? conn)]}
   (db-common/read-resources conn table-name :board-uuid [board-uuid] ["uuid" "status"]))
+
+(schema/defn ^:always-validate list-all-entries-by-follow-ups
+  "Given the UUID of the user, return all the published entries with incomplete follow-ups for the user."
+  [conn user-id :- lib-schema/UniqueID]
+  {:pre [(db-common/conn? conn)]}
+  (db-common/read-resources-and-relations conn "entries" :status-follow-ups-completed?-assignee-user-id
+                                          [[:published false user-id]]
+                                          :interactions common/interaction-table-name :uuid :resource-uuid
+                                          list-properties {:count false}))
+
+;; ----- Entry follow-up manipulation -----

 (schema/defn ^:always-validate add-follow-ups! :- (schema/maybe common/Entry)
   "Add a follow-up for the give entry uuid"


fix media type for post request response

--- src/open_company/api/companies.clj
+++ src/open_company/api/companies.clj
@@ -144,7 +144,7 @@

   :available-charsets [common/UTF8]
   :available-media-types (by-method {:get [company-rep/collection-media-type]
-                                     :post ["application/json"]})
+                                     :post [company-rep/media-type]})
   :allowed-methods [:options :post :get]
   :allowed? (by-method {
     :options (fn [ctx] (common/allow-anonymous ctx))
@@ -209,4 +209,4 @@
   (GET "/companies/" [] (company-list))
   (GET "/companies" [] (company-list))
   (POST "/companies/" [] (company-list))
-  (POST "/companies" [] (company-list)))+  (POST "/companies" [] (company-list)))


CMR-1863 Documents fn parser behavior.

CMR-1863 Documents fn parser behavior.

--- umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/dsl.clj
+++ umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/dsl.clj
@@ -5,7 +5,10 @@
   how to construct the UMM records from the source document. This is done through a series of nested
   maps with different :type attributes. The structure of the maps should mirror that of the JSON
   schema. This allows the addition of parsing types which give instructions to the parser on what
-  Clojure object to construct when parsing from the XML.")
+  Clojure object to construct when parsing from the XML.
+
+  You may also provide a function anywhere a parsing type map is allowed. The function will be
+  called with the current xpath-context and should return the desired parsed value.")

 (defn object
   "Defines a mapping for an object with the given properties map. A UMM record will be instantiated


join -> str

join -> str

--- src/org/spootnik/cyanite/store.clj
+++ src/org/spootnik/cyanite/store.clj
@@ -147,7 +147,7 @@
                            (info e "Fetching exception"))))
                     paths))]
     (doall (map deref-limiter futures))
-    (str/join ["{" (str/join "," @series) "}"])))
+    (str "{" (str/join "," @series) "}")))

 (defn cassandra-metric-store
   "Connect to cassandra and start a path fetching thread.


Optimize fetcher

Optimize fetcher

--- src/org/spootnik/cyanite/store.clj
+++ src/org/spootnik/cyanite/store.clj
@@ -116,7 +116,6 @@
         from (long from)
         to (long to)
         asize (inc (time-to-ndx from rollup to))
-        series (atom ())
         futures
         (doall (map #(future
                        (try
@@ -139,17 +138,11 @@
                                               (first metric-raw))]
                                  (aset points (time-to-ndx from rollup time)
                                        metric)))
-                             (let [jpoints (str/join ["\"" % "\":"
-                                                      (points-to-json points)])]
-                               (swap! series (fn [s]
-                                               (if (empty? s)
-                                                 (list jpoints)
-                                                 (conj s jpoints)))))))
+                             (str/join ["\"" % "\":" (points-to-json points)])))
                          (catch  Exception e
                            (info e "Fetching exception"))))
                     paths))]
-    (doall (map deref-limiter futures))
-    (str "{" (str/join "," @series) "}")))
+    (str "{" (str/join "," (remove nil? (map deref-limiter futures))) "}")))

 (defn cassandra-metric-store
   "Connect to cassandra and start a path fetching thread.
@@ -163,7 +156,7 @@
   (let [cluster (if (sequential? cluster) cluster [cluster])
         session (-> (alia/cluster
                      {:contact-points cluster
-                      :compression :lz4
+                      ;;:compression :lz4
                       :pooling-options {:max-connections-per-host
                                         {:local 8192
                                          :remote 8192}
@@ -172,7 +165,8 @@
                                          :remote 128}
                                         :load-balancing-policy
                                         (alia_lbp/token-aware-policy
-                                         (alia_lbp/dc-aware-round-robin-policy ""))}
+                                         (alia_lbp/dc-aware-round-robin-policy
+                                          "us-east"))}
                       :socket-options {:read-timeout-millis 1000000
                                        :receive-buffer-size 8388608
                                        :send-buffer-size 1048576


Fix whole-ast pass behavior

Fix whole-ast pass behavior

 - save the reduction map for later
 - don't clobber pass history due to rewriting
 - emit the appropriate metadata on new defs
 - don't rewrite previously rewritten fns

--- src/oxcart/passes/fn_reduction.clj
+++ src/oxcart/passes/fn_reduction.clj
@@ -97,7 +97,7 @@
                   (pattern/def->symbol wrapping-def)
                   (count (first raw-method))
                   (some (partial = '&) (first raw-method)))]
-    (ast `(def ~new-name
+    (ast `(def ^:single ^:static ~new-name
             (fn* ~raw-method))
          env)))

@@ -193,7 +193,9 @@
   bound with defs, as by the requirement of lambda lifting this must
   be the set of all fns in the input program."
   [ast munged-fns-atom]
-  (if-not (pattern/def? ast)
+  (if-not (and (pattern/def? ast)
+               (not (contains? @munged-fns-atom
+                               (pattern/def->var ast))))
     ast
     (let [top-level-forms (atom [])
           new-ast         (update ast :init
@@ -229,7 +231,7 @@
     (postwalk top-ast
               (fn [{:keys [op fn args env] :as node}]
                 (if (and (= op :invoke)
-                         (= :var (:op fn)))
+                         (#{:var :the-var} (:op fn)))
                   (if-let [arities (munged-fns (-> fn :var))]
                     (if-let [var (get munged-fns
                                       (count args)
@@ -258,16 +260,11 @@
   Options
   -----------
     This pass takes no options"
-  [whole-ast options]
-  (let [munged-fns (atom #{})]
+  [{:keys [arity-reduction-map] :as whole-ast} options]
+  (let [munged-fns (atom arity-reduction-map)]
     (-> whole-ast
         (require-pass lift-lambdas)
         (update-forms rewrite-fn-decls   munged-fns)
         (update-forms rewrite-fn-invokes munged-fns)
-        ;; FIXME
-        ;;   Is this something I need to do? Are there cases in which
-        ;;   this analysis is itself desructive? all existing fns,
-        ;;   defs and vars should be preserved by this, including all
-        ;;   metadata on them.
-        (clobber-passes)
+        (assoc :arity-reduction-map @munged-fns)
         (record-pass reduce-fn-arities))))


Add fns to process provided references and highlight them

--- src/discuss/integration.cljs
+++ src/discuss/integration.cljs
@@ -1,13 +1,13 @@
 (ns discuss.integration
   "Listen for mouse clicks, get references and highlight them in the article."
   (:require-macros [cljs.core.async.macros :refer [go]])
-  (:require
-    [goog.dom :as gdom]
-    [goog.events :as events]
-    [cljs.core.async :refer [put! chan <!]]
-    [clojure.string :as string]
-    [discuss.lib :as lib]
-    [discuss.extensions])
+  (:require [goog.dom :as gdom]
+            [goog.events :as events]
+            [om.dom :as dom :include-macros true]
+            [cljs.core.async :refer [put! chan <!]]
+            [clojure.string :as string]
+            [discuss.lib :as lib]
+            [discuss.extensions])
   (:import [goog.dom]))

 (defn get-selection
@@ -42,22 +42,44 @@
 ;;; Integrate references and highlight them in the article
 ;; So I have to iterate through all DOM elements...?
 ;; http://stackoverflow.com/questions/4256339/javascript-how-to-loop-through-all-dom-elements-on-a-page
+(defn minify-doms
+  "Removes dom-elements, which can never be used as a reference."
+  [doms]
+  (remove #(or (= "SCRIPT" (.-nodeName %))
+               (= "path"   (.-nodeName %))
+               (= "svg"    (.-nodeName %))
+               (= "circle" (.-nodeName %))
+               (= "HTML"   (.-nodeName %))
+               (= "HEAD"   (.-nodeName %))
+               (= "META"   (.-nodeName %))
+               (= "BUTTON" (.-nodeName %)))
+          doms))
+
+(defn get-parent
+  "Assuming that the last occurence of my reference is the closest parent of it,
+   this function will return it."
+  [doms ref]
+  (last
+    (filter
+      identity
+      (map (fn [dom]
+             (when (lib/substring? ref (.-innerHTML dom))
+                       dom))
+           doms))))
+
 (defn convert-reference [ref]
-  (let [body js/document.body.innerHTML
-        ;tspan (str "" ref "")
-        span (gdom/createElement "span")
-        tspan "foo"
-        regex-ref (re-pattern ref)
-        nbody (string/replace body regex-ref (.-innerHTML span))]
-    ;(gdom/setTextContent span ref)
-    (println "Convert...")
-    ;(set! (.. js/document -body -innerHTML) nbody)
-
-    ))
+  (let [doms-raw  (.getElementsByTagName js/document "*")
+        doms      (minify-doms doms-raw)
+        parent    (get-parent doms ref)
+        dom-parts (string/split (.-innerHTML parent) (re-pattern ref))
+        dom-ref   (str "" ref "")
+        new-dom   (str (first dom-parts) dom-ref (last dom-parts))]
+    (when parent
+      (set! (.-innerHTML parent) new-dom))))

 (defn process-references
   "Receives references through the API and prepares them for the next steps."
   [refs]
   (println "Received" (count refs) "references")
   (println refs)
-  (convert-reference "Debug"))+  (doall (map #(convert-reference %) refs)))


re-order keys in the "medium" grammar

re-order keys in the "medium" grammar

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -609,19 +609,19 @@
         lexicon-for-generation (lexicon-for-generation lexicon)
         rules (map #(keyword (get-in % [:rule])) grammar)]
     {:name "medium"
-     :language "it"
-     :language-keyword :italiano
-     :morph fo
-     :lookup (fn [arg]
-               (analyze arg parse-lexicon))
      :enrich enrich
      :generate {:lexicon lexicon-for-generation}
      :grammar grammar
+     :index (create-index grammar (flatten (vals lexicon)) head-principle)
+     :language "it"
+     :language-keyword :italiano
+     :lexicon lexicon
+     :lookup (fn [arg]
+               (analyze arg parse-lexicon))
+     :morph fo
      :rules rules
      :rule-map (zipmap rules
                        grammar)
-     :lexicon lexicon
-     :index (create-index grammar (flatten (vals lexicon)) head-principle)
      }))

 (def np-grammar


add casa which does not take a determiner

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -538,15 +538,24 @@
                :synsem {:cat :verb
                         :sem {:pred :caricare}}}
    "casa"
-   (unify agreement-noun
-          common-noun
-          countable-noun
-          feminine-noun
-          {:synsem {:sem {:pred :casa
-                          :activity false ;; should not need this probably: should be inferrable from  :place==true or perhaps :artifact==true.
-                          :buyable true
-                          :artifact true
-                          :place true}}})
+   [(unify agreement-noun
+           common-noun
+           countable-noun
+           feminine-noun
+           {:synsem {:sem {:pred :casa
+                           :city false
+                           :activity false ;; should not need this probably: should be inferrable from  :place==true or perhaps :artifact==true.
+                           :buyable true
+                           :artifact true
+                           :place true}}})
+
+    ;; in the sense of "a casa": no article needed.
+    {:synsem {:cat :noun
+              :sem {:city false
+                    :place true
+                    :animate false
+                    :pred :casa}
+              :subcat '()}}]

     "cattivo"
      (unify adjective


[fix] mailbox get-current-wnode-address

[fix] mailbox get-current-wnode-address

wrong symbol was introduced in recent PR

Signed-off-by: Eric Dvorsak <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@dvorsak.fr>

--- src/status_im/transport/inbox.cljs
+++ src/status_im/transport/inbox.cljs
@@ -44,7 +44,7 @@
 (defn get-current-wnode-address [db]
   (let [network  (get (:networks (:account/account db)) (:network db))
         chain    (ethereum/network->chain-keyword network)
-        wnode-id (get-in db [:account/account :settings :wnode network])]
+        wnode-id (get-in db [:account/account :settings :wnode chain])]
     (get-in db [:inbox/wnodes chain wnode-id :address])))

 (defn initialize-offline-inbox-flow []
@@ -181,8 +181,8 @@

 (handlers/register-handler-fx
  :inbox/check-peer-added
-  ;; We check if the wnode is part of the peers list
-  ;; if not we dispatch a new fetch-peer event for later
+ ;; We check if the wnode is part of the peers list
+ ;; if not we dispatch a new fetch-peer event for later
  (fn [{{:keys [web3 network-status] :as db} :db} [_ peers retries]]
    (let [wnode    (get-current-wnode-address db)]
      (log/info "offline inbox: fetch-peers response" peers)


Add some comments

Add some comments

--- src-cljs/visibility_2d/dali.cljs
+++ src-cljs/visibility_2d/dali.cljs
@@ -2,12 +2,16 @@
   (:require [goog.dom :as dom]))

 (defn- rect? [{:keys [x y w h]}]
+  "Private function that checks for a rect."
   (and (number? x) (number? y) (number? w) (number? h)))

 (defn context-2d [canvas]
+  "Returns the 2D context from a canvas element."
   (.getContext canvas "2d"))

-(defn setup-canvas! [canvas w h]
+(defn setup-canvas!
+  "Sets up a canvas element by scaling it and its context to the right size."
+  [canvas w h]
   {:pre [(number? w) (number? h)]}
   (let [ctx (context-2d canvas)
         scale-factor (dom/getPixelRatio)]
@@ -21,14 +25,17 @@
     ctx))

 (defn fill-style! [ctx color]
+  "Sets the fill style of a context to the specified color."
   (set! (.-fillStyle ctx) color)
   ctx)

 (defn stroke-style! [ctx color]
+  "Sets the stroke style of a context to the specified color."
   (set! (.-strokeStyle ctx) color)
   ctx)

 (defn fill-rect! [ctx rect]
+  "Color fills a rect in the given context by the currently set fill color (see `fill-style!`)."
   {:pre  [(rect? rect)]
    :post [(= ctx %)]}
   (let [{:keys [x y w h]} rect]


Log messages sent/received over websockets

--- src/time_tracker/timers/pubsub.clj
+++ src/time_tracker/timers/pubsub.clj
@@ -44,10 +44,22 @@

 ;; Utils ----------------------

+(defn send-data!
+  "Wrapper of send! that logs data and encodes JSON."
+  [channel data]
+  ;; TODO: Somehow log the recepient host.
+  (log/debug (merge {:event     ::sent-data
+                     :google-id (get @channel->google-id channel)}
+                    data))
+  (send! channel (json/encode data)))
+
 (defn broadcast-to!
   "Serializes data and sends it to all connections belonging to
   google-id."
   [google-id data]
+  (log/debug (merge {:event     ::broadcasted-data
+                     :google-id google-id}
+                    data))
   (let [str-data (json/encode data)]
     (doseq [channel (get @active-connections google-id)]
       (send! channel str-data))))
@@ -60,8 +72,8 @@

 (defn send-error!
   [channel message]
-  (send! channel (json/encode
-                  {:error message})))
+  (send-data! channel
+              {:error message}))

 (defn send-invalid-args!
   [channel]
@@ -215,6 +227,7 @@
 (defn dispatch-command!
   "Calls the appropriate timer command."
   [channel command-data]
+  (log/debug (merge {:event ::received-data} command-data))
   (if-let [google-id (get @channel->google-id channel)]
     (if-let [command-fn (command-map (get command-data :command))]
       (command-fn channel google-id (dissoc command-data :command))


Improve show variable access.

Improve show variable access.

--- src/afterglow/show.clj
+++ src/afterglow/show.clj
@@ -207,12 +207,19 @@
     {:type :manual}))

 ;; TODO: Someday generate feedback on assigned MIDI channels, etc...
-(defn set-variable
+(defn set-variable!
   "Set a value for a variable associated with [[*show*]]."
   {:doc/format :markdown}
   [key newval]
   {:pre [(some? *show*) (some? key)]}
   (swap! (:variables *show*) #(assoc % (keyword key) newval)))
+
+(defn get-variable
+  "Get the value of a variable associated with [[*show]]."
+  {:doc/format :markdown}
+  [key]
+  {:pre [(some? key)]}
+  ((keyword key) @(:variables *show*)))

 (defn add-midi-control-to-var-mapping
   "Cause the specified variable in [[*show*]] to be updated by any


don't use siliently for now

don't use siliently for now

--- src/cake/tasks/dependencies.clj
+++ src/cake/tasks/dependencies.clj
@@ -1,6 +1,5 @@
 (ns cake.tasks.dependencies
   (:use cake cake.ant
-        [useful :only [silently]]
         [cake.project :only [group]]
         [clojure.java.shell :only [sh]])
   (:import [org.apache.maven.artifact.ant DependenciesTask RemoteRepository WritePomTask Pom]
@@ -96,10 +95,9 @@
   (fetch-subprojects deps dest)
   (when-let [deps (seq (remove subproject? deps))]
     (let [ref-id (str "cake.deps.fileset." (.getName dest))]
-      (silently :unless (verbose?)
-         (ant DependenciesTask {:fileset-id ref-id :path-id (:name project)}
-              (add-repositories (into repositories (:repositories project)))
-              (add-dependencies deps)))
+      (ant DependenciesTask {:fileset-id ref-id :path-id (:name project)}
+           (add-repositories (into repositories (:repositories project)))
+           (add-dependencies deps))
       (ant Copy {:todir dest :flatten true}
            (.addFileset (get-reference ref-id)))))
   (extract-native


Sort chapters on the new ch-num key

Sort chapters on the new ch-num key

Fixes #2

--- src/clj/comic_reader/server.clj
+++ src/clj/comic_reader/server.clj
@@ -35,7 +35,7 @@
 (defn get-comic-chapter [site comic chapter]
   (first
    (drop (dec chapter)
-         (sort-by :url
+         (sort-by :ch-num
                   (scrape/fetch-list
                    (sites/chapter-list-data site
                                             comic))))))


Moved reprojection functions from static over into forma.reproject. Generalized functions to work with rain dataset as well.

--- src/clj/forma/source/static.clj
+++ src/clj/forma/source/static.clj
@@ -35,7 +35,6 @@
                           (duck/read-lines old-file)))]
         (println line)))))

-
 ;; ### Sampling

 (defn sample-modis


fix typo

fix typo

--- src/clj_money/authorization.clj
+++ src/clj_money/authorization.clj
@@ -21,7 +21,7 @@
   [resource type-key]
   (vary-meta resource #(assoc % ::resource-type type-key)))

-(defn ^:private auth-context (atom {}))
+(def ^:private auth-context (atom {}))

 (defn ->context
   [key value]


Fix the img-component not rendering correctly

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -97,7 +97,7 @@
                  [:br]]]
             (when comic-imgs
               (into component
-                    (map (partial img-component site location)
+                    (map (partial vector img-component site location)
                          comic-imgs)))))))))

 (defn comic-reader []


Implement cancel button

Implement cancel button

--- src/cljs/iframe_app/footer.cljs
+++ src/cljs/iframe_app/footer.cljs
@@ -8,10 +8,9 @@
     [iframe-app.conditions-manager :refer [conditions-manager]]
     [iframe-app.selections-manager :refer [reset-irrelevant-selections update-conditions
                                            selections-manager]]
-    [om-tools.dom :as dom :include-macros true]
+    [om-tools.dom :include-macros true]
     [om-tools.core :refer-macros [defcomponent]]
-    [sablono.core :as html :refer-macros [html]]
-    [ankha.core :as ankha]
+    [sablono.core :refer-macros [html]]
     [iframe-app.utils :refer [active-conditions form->form-kw]]
     [iframe-app.fetch-data :refer [fetch-ticket-forms]]
     [cljs.core.async :refer [put! chan <!]]))
@@ -33,7 +32,7 @@
                                            (get-persisted-conditions))]
     (if (empty? first-diff)
       (count (clojure.set/difference (get-persisted-conditions)
-                               conditions))
+                                     conditions))
       (count first-diff))))

 (defcomponent footer [app-state owner]
@@ -48,13 +47,27 @@
           [:button.delete.text-error.deleteAll
            {:style {:display :none}}
            "Delete all conditional rules for this form"]
-          [:div.action-buttons.pull-right
-           [:button.btn.cancel {:disabled "disabled"} "Cancel changes"]
-           [:button.btn.btn-primary.save
-            (let [conditions-changed? (> changed-conditions-count 0)]
+          (let [conditions-changed? (> changed-conditions-count 0)]
+            [:div.action-buttons.pull-right
+             [:button.btn.cancel
+              {:disabled (if-not conditions-changed? "disabled")
+               :on-click (fn [e]
+                           (om/update! app-state
+                                       [:conditions (:user-type selections) (form->form-kw (:ticket-form selections))]
+                                       (get-persisted-conditions))
+
+                           (let [selector-channel (om/get-shared owner :selector-channel)]
+                             (put! selector-channel
+                                   {:selection-to-update :master-field
+                                    :new-value           nil}))
+
+                           (om/refresh! owner))}
+              "Cancel changes"]
+             [:button.btn.btn-primary.save
+
               {:disabled (if-not conditions-changed? "disabled")
                :on-click (fn [e]
                            (when conditions-changed?
                              (persist-conditions! @conditions)
-                             (om/refresh! owner)))})
-            (save-button-text changed-conditions-count)]]]]))))+                             (om/refresh! owner)))}
+              (save-button-text changed-conditions-count)]])]]))))


more convenient populate buttons

more convenient populate buttons

--- src/cljs/oxylab/components.cljs
+++ src/cljs/oxylab/components.cljs
@@ -9,27 +9,23 @@
             [oxylab.resources :as resources]))

 (defn panel []
-  [:div.btn-group
-   [:a.btn.btn-success {:on-click act/start!
-                        :class (when (:running @s/state) "disabled")}
-    "Start"]
-   [:a.btn.btn-default {:on-click act/pause!
-                        :class (when-not (:running @s/state) "disabled")}
-    "Pause"]
-   [:a.btn.btn-default {:on-click act/resume!
-                        :class (when (:running @s/state) "disabled")}
-    "Resume"]
-   [:a.btn.btn-warning {:on-click act/stop!}
-    "Stop"]
-   [:div.btn-group
-    [:a#populate-dd.btn.btn-default.dropdown-toggle
-     {:data-toggle "dropdown"
-      :class (when-not (:running @s/state) "disabled")}
-     "populate cell "
-     [:span.caret]]
-    [:ul.dropdown-menu {:aria-labelledby "populate-dd"}
-     (for [[k spec] (get-in @s/state [:world :species])]
-       [:li [:a {:on-click #(act/populate! k)} (name k)]])]]])
+  [:div.row
+   [:div.btn-group.col-xs-4
+    [:a.btn.btn-success {:on-click act/start!
+                         :class (when (:running @s/state) "disabled")}
+     "Start"]
+    [:a.btn.btn-default {:on-click act/pause!
+                         :class (when-not (:running @s/state) "disabled")}
+     "Pause"]
+    [:a.btn.btn-default {:on-click act/resume!
+                         :class (when (:running @s/state) "disabled")}
+     "Resume"]
+    [:a.btn.btn-warning {:on-click act/stop!}
+     "Stop"]]
+   (when (seq (get-in @s/state [:world :species]))
+     [:div.btn-group.col-xs-8
+      (for [[k spec] (get-in @s/state [:world :species])]
+        [:a.btn.btn-primary {:on-click #(act/populate! k)} (name k)])])])

 (defn bar [cap v max]
   [:div.row


Make sure neighboring files/dirs aren't mistaken as children

--- src/clojure/nightcode/utils.clj
+++ src/clojure/nightcode/utils.clj
@@ -2,7 +2,8 @@
   (:require [clojure.edn :as edn]
             [clojure.java.io :as io]
             [clojure.xml :as xml])
-  (:import [java.util Locale]
+  (:import [java.io File]
+           [java.util Locale]
            [java.util.prefs Preferences]
            [javax.swing.tree TreePath]))

@@ -126,4 +127,4 @@
       (and parent-path
            child-path
            (.isDirectory (io/file parent-path))
-           (.startsWith child-path parent-path))))
+           (.startsWith child-path (str parent-path File/separator)))))


testing inner join on dbpedia samples

testing inner join on dbpedia samples

--- test/corpusmaker/test_entities.clj
+++ test/corpusmaker/test_entities.clj
@@ -34,23 +34,41 @@
       (is (= "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" relation))
       (is (= "http://www.w3.org/2002/07/owl#Thing" target)))))

+(def agg-cons (c/agg cons ()))
+
 (deftest entity-literal-parsing-test
   (with-log-level :warn
     (with-tmp-files [sink (temp-path "corpusmaker-test-sink")]
-      (let [flow (c/flow
-        {"abstracts" (c/lfs-tap (c/text-line "line") *long-abstract*)}
-        (c/lfs-tap (c/text-line) sink)
-        (->
-          (c/pipe "abstracts")
-          (c/map #'extract-property
-            :< "line"
-            :fn> ["resource" "property" "value" "lang"]
-            :> ["resource" "value"])
-          (c/map #'serialize-tuple :< Fields/ALL :fn> "line" :> "line")))]
+
+      (let [p-abstracts ;; first pipe to extract abstracts data
+            (->
+              (c/pipe "abstracts")
+              (c/map #'extract-property
+                :< "line"
+                :fn> ["resource" "p_abstract" "abstract" "lang"]
+                :> ["resource" "abstract"]))
+            p-types ;; second pipe to extract typing info
+            (->
+              (c/pipe "types")
+              (c/map #'extract-relation
+                :< "line"
+                :fn> ["resource" "p_type" "type"]
+                :> ["resource" "type"]))
+            flow
+            (c/flow
+              {"abstracts" (c/lfs-tap (c/text-line "line") *long-abstract*)
+               "types" (c/lfs-tap (c/text-line "line") *instance-type*)}
+              (c/lfs-tap (c/text-line) sink)
+              (-> [p-abstracts p-types]
+                (c/inner-join
+                  [["resource"] ["resource"]]
+                  ["resource1" "abstract" "resource2" "type"])
+                (c/select ["resource1" "abstract" "type"])
+                (c/map #'serialize-tuple :< Fields/ALL :fn> "line" :> "line")))]
         (c/exec flow)
         (let [results (map read-string (ds/read-lines (ju/file sink "part-00000")))]
-          (is (= 23 (.size results)))
-          (let [[resource value] (first results)]
+          (is (= 54 (.size results)))
+          (let [[resource value type] (first results)]
             (is (= "http://dbpedia.org/resource/!!!" resource))
-            (is (= "!!! is a dance-punk band" (.substring value 0 24)))))))))
-
+            (is (= "!!! is a dance-punk band" (.substring value 0 24)))
+            (is (= "http://dbpedia.org/ontology/Band" type))))))))


Fixup destructuring bugs

Fixup destructuring bugs

--- src/honeysql_talk/slides.clj
+++ src/honeysql_talk/slides.clj
@@ -178,14 +178,16 @@
            (some? id) (str " id = " id)
            (and (some? id)
                 (some? spam)) (str " AND ")
-           (some? spam) (str " spam = " spam))))]
+           (some? spam) (str "spam = " spam))))]
      [:br]
      [:spam.fragment
       [:p "Have you done this?"]
       [:p "Spot any potential bugs?"]]]
     [:section
      [:p "SQL Injection?"]
-     [:p.fragment "We forgot to insert driver-specific placeholders and track the values in an array so we can pass those separately to JDBC."]]
+     [:p.fragment "I forgot to insert driver-specific placeholders and track the values in an array so I can pass those separately to JDBC."]
+     [:p "String building?"]
+     [:p.fragment "I left out a space around spam. This will result in something like \"WHEREspam=\" if id isn't given."]]
     [:section
      [:p "Easy, right?"]
      [:span.fragment
@@ -203,8 +205,8 @@
                              (some? spam) (#(do (swap! params conj %)
                                                 (str " spam = ?"))))
                            @params]))
-             [sql params] (selector id spam)]
-         (clojure.java.jdbc/query db sql params)))]]
+             [sql & params] (selector id spam)]
+         (apply clojure.java.jdbc/query db sql params)))]]
     [:section
      [:p "Yikes! Maybe something does this for us?"]]
     [:section
@@ -221,8 +223,8 @@
                              (some? id) (merge-where [:= :id id])
                              (some? spam) (merge-where [:= :spam spam]))
                            honeysql.core/format))
-            [sql params] (selector id spam)]
-        (clojure.java.jdbc/query db sql params)))]
+            [sql & params] (selector id spam)]
+        (apply clojure.java.jdbc/query db sql params)))]
     [:section
      [:p "AST Advantages"]
      [:ul


Fix error from remote read when key not found

--- src/server/chatom/parser.clj
+++ src/server/chatom/parser.clj
@@ -11,7 +11,7 @@
 (defmethod read :default
   [{:keys [db query]} key params]
   (println "default read called")
-  {:value "not-found"})
+  {})

 (defmethod mutate :default
   [{:keys [db query]} key params]


Add matches-spec

Add matches-spec

--- test/icecap/handlers/core_test.clj
+++ test/icecap/handlers/core_test.clj
@@ -48,29 +48,34 @@
   [names]
   (into (empty names) (map td/success-step names)))

+(defn matches-spec
+  "Asserts that the plan matches this execution spec.
+
+  This fn asserts; it is not a predicate. It also first compares the
+  execution order to the contents of the spec.
+
+  "
+  [plan spec]
+  (let [order (execution-order plan)]
+    (is (= (frequencies (apply concat spec)) (frequencies order)))
+    (is (match-seq-spec spec order))))
+
 (deftest execute-tests
   (testing "execute single step"
-    (let [plan (td/success-step 1)
-          order (execution-order plan)]
-      (is (match-seq-spec [[1]] order))))
+    (matches-spec (td/success-step 1) [[1]]))
   (testing "execute some plans consisting of ordered steps"
-    (let [names (vec (range 10))
-          plan (success-steps names)
-          order (execution-order plan)]
-      (is (match-seq-spec [names] order))))
+    (let [names (vec (range 10))]
+      (matches-spec (success-steps names) [names])))
   (testing "execute some plans consisting of unordered steps"
-    (let [names (set (range 10))
-          plan (success-steps names)
-          order (execution-order plan)
-          spec [(set names)]]
-      (is (match-seq-spec spec order))))
+    (let [names (set (range 10))]
+      (matches-spec (success-steps names) [(set names)])))
   (testing "execute complex plans"
     (let [ordered-head (success-steps [1 2 3])
           unordered-middle (success-steps #{4 5 6})
           ordered-tail (success-steps [7 8 9])
           plan (vec (concat ordered-head [unordered-middle] ordered-tail))
           spec [[1 2 3] #{4 5 6} [7 8 9]]]
-      (is (match-seq-spec spec (execution-order plan))))))
+      (matches-spec plan spec))))

 (deftest defstep-tests
   (testing "literal schema"


Make use of io.aviso.toolchest.metadata

Make use of io.aviso.toolchest.metadata

--- src/io/aviso/rook/schema.clj
+++ src/io/aviso/rook/schema.clj
@@ -2,7 +2,8 @@
   "Some small enhancements to Prismatic Schema that are valuable to, or needed by, the Swagger support."
   {:added "0.1.27"}
   (:require [schema.core :as s]
-            [schema.macros :as macros])
+            [schema.macros :as macros]
+            [io.aviso.toolchest.metadata :refer [assoc-meta]])
   (:import [schema.core Maybe EnumSchema Both]))

 (defmacro schema
@@ -14,7 +15,7 @@
    `(-> ~form
         (vary-meta merge ~(-> &form second meta))
         ;; The second form is the name (the first is the 'schema symbol itself) and we want its metadata
-        (vary-meta assoc :name '~name :ns *ns* :doc ~docstring))))
+        (assoc-meta :name '~name :ns *ns* :doc ~docstring))))

 (defmacro defschema
   "Convenience macro to make it clear to reader that body is meant to be used as a schema, and to provide
@@ -77,7 +78,7 @@
     (recur description (IsInstance. schema))

     :else
-    (vary-meta schema assoc :description description)))
+    (assoc-meta schema :description description)))

 (defn description
   "A convienience for generating a description with no schema."


Improve fault tolerance checks to ensure messages go through the proper chain.

--- test/onyx/peer/fault_tolerance.clj
+++ test/onyx/peer/fault_tolerance.clj
@@ -14,7 +14,11 @@
                                           (:peer-config config))))
 (def batch-size 5)

-(def process-middle identity)
+(defn int-1 [segment]
+  (assoc segment :a 1))
+
+(defn int-2 [segment]
+  (assoc segment :b 1))

 (def batch-timeout 500)

@@ -29,13 +33,13 @@
     :onyx/doc "Reads segments from a core.async channel"}

    {:onyx/name :intermediate-1
-    :onyx/fn :onyx.peer.fault-tolerance/process-middle
+    :onyx/fn :onyx.peer.fault-tolerance/int-1
     :onyx/batch-timeout batch-timeout
     :onyx/type :function
     :onyx/batch-size batch-size}

    {:onyx/name :intermediate-2
-    :onyx/fn :onyx.peer.fault-tolerance/process-middle
+    :onyx/fn :onyx.peer.fault-tolerance/int-2
     :onyx/type :function
     :onyx/batch-timeout batch-timeout
     :onyx/batch-size batch-size}
@@ -67,6 +71,9 @@
 (def incomplete
   (atom #{}))

+(def bad-values
+  (atom #{}))
+
 (def n-messages-total 100000)

 (try
@@ -74,7 +81,7 @@
   (let [load-data-ch (thread
                        (loop [ls (repeatedly n-messages-total (fn [] {:id (java.util.UUID/randomUUID)}))]
                          (when-let [segment (first ls)]
-                           (swap! incomplete conj segment)
+                           (swap! incomplete conj (int-2 (int-1 segment)))
                            (>!! in-chan segment)
                            (recur (rest ls))))
                        (>!! in-chan :done)
@@ -103,13 +110,15 @@
                                      (let [v (<!! out-chan)]
                                        (when (and v (not= v :done))
                                          (swap! incomplete disj v)
+                                         (when (or (nil? (:a v))
+                                                   (nil? (:b v)))
+                                           (swap! bad-values conj v))
                                          (recur))))
         kill-ch (chan 1)
-        ; it can take 3 * batch-timeout to make it through a full circuit, however
-        ; there will be circumstances where the peers left alone, so lets try 2* for now
-        chaos-kill-ms (* 2 batch-timeout)
         mess-with-peers-ch (go-loop []
-                                    (let [[v ch] (alts!! [(timeout chaos-kill-ms) kill-ch])]
+                                    (let [; average the the full circuit worth of timeouts
+                                          chaos-kill-ms (rand-int (* 3 batch-timeout 2))
+                                          [v ch] (alts!! [(timeout chaos-kill-ms) kill-ch])]
                                       (when-not (= ch kill-ch)
                                         (try
                                           (when-let [non-input-peers (->> (get (:allocations @(:replica test-env)) job-id)
@@ -134,11 +143,9 @@
                          (if v
                            (recur (conj after-done v))
                            after-done)))]
-      (fact after-done => #{}))
-
+      (fact after-done => #{})
+      (fact @bad-values => #{}))
     (close! kill-ch)
-    (<!! mess-with-peers-ch)
-    (helper-env/remove-n-peers test-env 9))
-
+    #_(<!! mess-with-peers-ch))
   (finally
     (component/stop test-env)))


CMR-5118: Updated system-int-test to test with the latest UMM versions for variables/services.

--- system-int-test/src/cmr/system_int_test/utils/ingest_util.clj
+++ system-int-test/src/cmr/system_int_test/utils/ingest_util.clj
@@ -12,6 +12,7 @@
    [cmr.common.mime-types :as mt]
    [cmr.common.util :as util]
    [cmr.common.xml :as cx]
+   [cmr.ingest.config :as ingest-config]
    [cmr.mock-echo.client.echo-util :as echo-util]
    [cmr.system-int-test.data2.provider-holdings :as ph]
    [cmr.system-int-test.system :as s]
@@ -632,11 +633,15 @@

 ;;; fixture - each test to call this fixture
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defn set-collection-ingest-umm-version-to-current
-  "Set the collection ingest-accept-umm-version to current-collection-version."
+(defn set-ingest-umm-version-to-current
+  "Set the ingest-accept-umm-version to the latest UMM version defined in umm-spec-lib."
   []
   (side/eval-form `(common-config/set-collection-umm-version!
-                     umm-versioning/current-collection-version)))
+                     umm-versioning/current-collection-version))
+  (side/eval-form `(ingest-config/set-variable-umm-version!
+                     umm-versioning/current-variable-version))
+  (side/eval-form `(ingest-config/set-service-umm-version!
+                     umm-versioning/current-service-version)))

 (defn create-provider
   "Creates a provider along with ACLs to create and access the providers data.
@@ -709,9 +714,9 @@
           :grant-all-access-control? grant-all-access-control?})))))

 (defn reset-fixture
-  "Resets all the CMR systems then uses the `set-collection-ingest-umm-version-to-current`
-  function to set the accepted umm version for collection ingest to the umm-versioning/current-collection-version,
-  so that all the ingest tests are testing against the latest umm version.
+  "Resets all the CMR systems then uses the `set-ingest-umm-version-to-current`
+  function to set the accepted umm versions for ingest to the the latest UMM version defined in
+  umm-spec-lib, so that all the ingest tests are testing against the latest umm version.
   and uses the `setup-providers` function to create a testing fixture.

   For the format of the providers data structure, see `setup-providers`."
@@ -722,7 +727,7 @@
   ([providers options]
    (fn [f]
      (dev-sys-util/reset)
-     (set-collection-ingest-umm-version-to-current)
+     (set-ingest-umm-version-to-current)
      (when-not (empty? providers)
       (setup-providers providers options))
      (f))))


Doubled max points

Doubled max points

--- src/clojush/problems/integer_regression/tagged_tg8.clj
+++ src/clojush/problems/integer_regression/tagged_tg8.clj
@@ -51,7 +51,7 @@
    :genetic-operator-probabilities {:alternation 0.5
                                     :uniform-mutation 0.4
                                     :uniform-close-mutation 0.1}
-   :max-points 200
+   :max-points 400
    :max-genome-size-in-initial-program 100
    :population-size 5000
    })


set default environment to production

set default environment to production

--- src/yeller_clojure_client/ring.clj
+++ src/yeller_clojure_client/ring.clj
@@ -8,7 +8,7 @@
    {:params (merge (:query-params request) (:form-params request))
     :session (:session request)
     :context (:yeller/context request)}
-   :environment (:environment options "development")})
+   :environment (:environment options "production")})

 (defn wrap-ring
   [handler options]
@@ -17,7 +17,7 @@
    Required:
    {:token \"your api token here\"}
    Optional:
-   {:environment \"development\"} ; the name of the environment this ring app is running in
+   {:environment \"production\"} ; the name of the environment this ring app is running in

    if you attach a :yeller/context key in your request map (that contains a
    further map) in your ring request, then this middleware will send that off to


CMR-1168-3: Fixes merge conflict

CMR-1168-3: Fixes merge conflict

--- 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
@@ -83,6 +83,8 @@
           (let [concept (d/item->concept (dg/granule collection))]
             (assert-validation-success concept (d/item->concept collection :iso19115))
             (assert-validation-success concept (d/item->concept collection :dif))))
+
+

         (testing "invalid collection xml"
           (assert-validation-errors
@@ -209,62 +211,43 @@
                 [{:path ["CollectionRef"],
                   :errors ["Collection Reference should have at least Entry Title or Short Name and Version Id."]}]
                 (d/item->concept granule :iso-smap)
-                coll-concept))))))
-
-    (testing "with ingested collection"
-      (let [collection (d/ingest "PROV1" (dc/collection {}))]
-        (testing "successful validation of granule"
-          (let [granule-concept (d/item->concept (dg/granule collection))]
-            (assert-validation-success granule-concept)
-
-            (testing "with ingested parent collection"
-              (assert-validation-success granule-concept (d/item->concept collection)))))
-        (testing "invalid granule xml"
-          (assert-validation-errors
-            expected-errors
-            (-> collection
-                dg/granule
-                d/item->concept
-                (assoc :metadata invalid-granule-xml))))))))
-
-(defn polygon
-  "Creates a single ring polygon with the given ordinates. Points must be in counter clockwise order."
-  [& ords]
-  (poly/polygon [(apply umm-s/ords->ring ords)]))
-
-(defn assert-invalid
-  ([coll-attributes gran-attributes field-path errors]
-   (assert-invalid coll-attributes gran-attributes field-path errors :echo10))
-  ([coll-attributes gran-attributes field-path errors metadata-format]
-   (testing "through validation api"
-     (let [coll (dc/collection coll-attributes)
-           coll-concept (d/item->concept coll metadata-format)
-           granule (dg/granule coll gran-attributes)
-           gran-concept (d/item->concept granule)
-           response (ingest/validate-granule gran-concept coll-concept)]
-       (is (= {:status 400
-               :errors [{:path field-path
-                         :errors errors}]}
-              (select-keys response [:status :errors])))))
-
-   (testing "through ingest API"
-     (let [coll (d/ingest "PROV1" (dc/collection coll-attributes) metadata-format)
-           response (d/ingest "PROV1" (dg/granule coll gran-attributes) metadata-format)]
-       (is (= {:status 400
-               :errors [{:path field-path
-                         :errors errors}]}
-              (select-keys response [:status :errors])))))))
-
-(defn assert-valid
-  [coll-attributes gran-attributes]
-  (testing "through validation api"
-    (let [coll (dc/collection coll-attributes)
-          coll-concept (d/item->concept coll)
-          granule (dg/granule coll gran-attributes)
-          gran-concept (d/item->concept granule)
-          response (ingest/validate-granule gran-concept coll-concept)]
-      (is (= {:status 200}
-             (select-keys response [:status :errors])))))
+                coll-concept)))))
+
+      (testing "with ingested collection"
+        (let [collection (d/ingest "PROV1" (dc/collection {}))]
+          (testing "successful validation of granule"
+            (let [granule-concept (d/item->concept (dg/granule collection))]
+              (assert-validation-success granule-concept)
+
+              (testing "with ingested parent collection"
+                (assert-validation-success granule-concept (d/item->concept collection)))))
+          (testing "invalid granule xml"
+            (assert-validation-errors
+              expected-errors
+              (-> collection
+                  dg/granule
+                  d/item->concept
+                  (assoc :metadata invalid-granule-xml))))))))
+
+  (defn polygon
+    "Creates a single ring polygon with the given ordinates. Points must be in counter clockwise order."
+    [& ords]
+    (poly/polygon [(apply umm-s/ords->ring ords)]))
+
+  (defn assert-invalid
+    ([coll-attributes gran-attributes field-path errors]
+     (assert-invalid coll-attributes gran-attributes field-path errors :echo10))
+    ([coll-attributes gran-attributes field-path errors metadata-format]
+     (testing "through validation api"
+       (let [coll (dc/collection coll-attributes)
+             coll-concept (d/item->concept coll metadata-format)
+             granule (dg/granule coll gran-attributes)
+             gran-concept (d/item->concept granule)
+             response (ingest/validate-granule gran-concept coll-concept)]
+         (is (= {:status 400
+                 :errors [{:path field-path
+                           :errors errors}]}
+                (select-keys response [:status :errors])))))

   (testing "through ingest API"
     (let [provider-id (get gran-attributes :provider-id "PROV1")
@@ -355,3 +338,4 @@
       (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]."])))
+


(maint) Bump the version of jetty9 for ui changes in console-services

--- configs/pe-console-services/pe-console-services.clj
+++ configs/pe-console-services/pe-console-services.clj
@@ -7,7 +7,7 @@
                  [puppetlabs/rbac-ui "{{{pe-rbac-ui-version}}}"]
                  [puppetlabs/pe-activity-service "{{{pe-activity-service-version}}}"]
                  ;[puppetlabs/pe-trapperkeeper-proxy "{{{pe-trapperkeeper-proxy-version}}}"]
-                 [puppetlabs/trapperkeeper-webserver-jetty9 "0.7.0"]]
+                 [puppetlabs/trapperkeeper-webserver-jetty9 "0.7.1"]]

   :uberjar-name "console-services-release.jar"


add caching to find-ns

add caching to find-ns

--- src/main/cljs/cljs/core.cljs
+++ src/main/cljs/cljs/core.cljs
@@ -9894,22 +9894,35 @@
   (-hash [_]
     (hash name)))

+(def NS_CACHE nil)
+
+(defn- find-ns-obj* [ctxt xs]
+  (cond
+    (nil? ctxt) nil
+    (nil? xs) ctxt
+    :else (recur (gobject/get ctxt (first xs)) (next xs))))
+
 (defn find-ns-obj [ns]
-  (letfn [(find-ns* [ctxt xs]
-            (cond
-              (nil? ctxt) nil
-              (nil? xs) ctxt
-              :else (recur (gobject/get ctxt (first xs)) (next xs))))]
-    (if-not js/COMPILED
-      (let [segs (-> ns str (.split "."))]
-        (when (gobject/get (. goog/dependencies_ -nameToPath) (str ns))
-          (condp identical? *target*
-            "nodejs" (find-ns* js/global segs)
-            "default" (find-ns* js/window segs)
-            (throw (js/Error. (str "find-ns-obj not supported for target " *target*))))))
-      (throw
-        (js/Error.
-          "find-ns-obj not supported when Closure optimization applied")))))
+  (if-not js/COMPILED
+    (do
+      (when (nil? NS_CACHE)
+        (set! NS_CACHE (atom {})))
+      (let [the-ns (get @NS_CACHE ns)]
+        (if-not (nil? the-ns)
+          the-ns
+          (let [segs (-> ns str (.split "."))]
+            (when-not (nil? (gobject/get (. goog/dependencies_ -nameToPath) (str ns)))
+              (case *target*
+                "nodejs"  (let [ns-obj (find-ns-obj* js/global segs)]
+                            (swap! NS_CACHE assoc ns ns-obj)
+                            ns-obj)
+                "default" (let [ns-obj (find-ns-obj* js/window segs)]
+                            (swap! NS_CACHE assoc ns ns-obj)
+                            ns-obj)
+                (throw (js/Error. (str "find-ns-obj not supported for target " *target*)))))))))
+    (throw
+      (js/Error.
+        "find-ns-obj not supported when Closure optimization applied"))))

 (defn ns-interns* [sym]
   (let [ns-obj (find-ns-obj sym)


Allow top and bottom in EL normalization

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

--- src/conexp/contrib/dl/languages/description_graphs.clj
+++ src/conexp/contrib/dl/languages/description_graphs.clj
@@ -162,20 +162,25 @@
 (defn- normalize-term
   "Normalizes conjunctor term. New definitions go into the atom new-names."
   [term new-names]
-  (if (and (compound? term)
-           (= 'exists (operator term)))
-    (let [[r B] (arguments term),
-          norm  (normalize-for-goal B
-                                    #(and (atomic? %)
-                                          (not (tbox-target-pair? %))
-                                          (not (primitive? %)))
-                                    new-names)]
-      (make-dl-expression (expression-language term)
-                          (list 'exists r norm)))
-    (normalize-for-goal term
-                        #(and (atomic? %)
-                              (not (tbox-target-pair? %)))
-                        new-names)))
+  (cond
+   (and (compound? term)
+        (contains? #{'bottom 'top} (operator term)))
+   term,
+   (and (compound? term)
+        (= 'exists (operator term)))
+   (let [[r B] (arguments term),
+         norm  (normalize-for-goal B
+                                   #(and (atomic? %)
+                                         (not (tbox-target-pair? %))
+                                         (not (primitive? %)))
+                                   new-names)]
+     (make-dl-expression (expression-language term)
+                         (list 'exists r norm))),
+   :else
+   (normalize-for-goal term
+                       #(and (atomic? %)
+                             (not (tbox-target-pair? %)))
+                       new-names)))

 (defn- introduce-auxiliary-definitions
   "Introduces auxiliary definitions into the given tbox-map (as


Only act on alpha keys and space.

Only act on alpha keys and space.

--- src/mash_commander/core.cljs
+++ src/mash_commander/core.cljs
@@ -8,26 +8,34 @@

 (enable-console-print!)

+(defonce valid-words #{"hello" "world"})
+(defonce valid-keys (set (clojure.string/split "abcdefghijklmnopqrstuvwyz " "")))
+
 (defonce app-state
-  (atom {:line ["m" "a" "s" "h" "!" " "]}))
+  (atom {:line {:input-state-stack [:empty]
+                :letters ["m" "a" "s" "h" "!" " "]}}))

 (defn line []
   (om/ref-cursor (:line (om/root-cursor app-state))))
+
+(defn handle-keydown [owner e]
+  (let [l (om/observe owner (line))
+        key (.-key e)]
+    (cond
+      (contains? valid-keys key)
+      (om/transact! l :letters #(conj % (.-key e))))))

 (defn line-view [cursor]
   (reify
     om/IRender
     (render [_]
-      (dom/div nil (clojure.string/join "" (:line cursor))))))
+      (dom/div nil (clojure.string/join "" (:letters cursor))))))

 (defn app-view [cursor owner]
   (reify
     om/IDidMount
     (did-mount [this]
-      (set! (.-onkeydown js/document.body)
-            (fn [e]
-              (let [l (om/observe owner (line))]
-                (om/transact! l #(conj % (.-key e)))))))
+      (set! (.-onkeydown js/document.body) (partial handle-keydown owner)))
     om/IRender
     (render [_]
       (dom/div #js {:style #js {:height "100vh"
@@ -35,7 +43,7 @@
                                 :overflow "hidden"
                                 :padding "0"
                                 :margin "0"}}
-               (om/build line-view cursor)))))
+               (om/build line-view (:line cursor))))))

 (om/root app-view app-state
          {:target (. js/document (getElementById "app"))})


Handle changes in pop state,don't reload for no good reason

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -41,7 +41,8 @@
   (.pop (.split js/window.location.pathname "/")))

 (defn set-path! [code]
-  (.pushState js/window.history nil "" code))
+  (when-not (= code (get-path))
+    (.pushState js/window.history nil "" code)))

 (defn show-wishlist! [{:keys [wish title code] :as wishlist}]
   "Clears the areas used for displaying wishlists, uses given wishlist to
@@ -155,8 +156,12 @@

 ; START IT UP

-(let [code (get-path)]
-  (when-not (empty? code)
-    (read-wishlist-rem code)))
+(defn start-up []
+  (let [code (get-path)]
+    (when-not (empty? code)
+      (read-wishlist-rem code))))

+(set! js/window.onpopstate
+  (fn [e]
+    (start-up)))


(maint) Remove test cases that have bad behavior with mock JRubies

The tests for the (deprecated) whitelist access control for the admin
API were previously testing each of the various endpoints under
`puppet-admin-api`, even though the whitelist applies the same to each
of them. Moreover, two of the endpoints (to get thread dumps and flush
the JRuby pool) also do not behave correctly with mock JRubies.

Since the whitelist tests only need to show that the endpoint returns a
success code instead of 'access denied', this commit updates them to
only test one of the endpoints, the one that behaves correctly when
JRubies are mocked, as a representative case for testing the whitelist.
The other two endpoints are tested for their functionality elsewhere.

--- test/integration/puppetlabs/services/puppet_admin/puppet_admin_int_test.clj
+++ test/integration/puppetlabs/services/puppet_admin/puppet_admin_int_test.clj
@@ -30,73 +30,58 @@
   (testutils/with-puppet-conf (fs/file test-resources-dir "puppet.conf")))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Utilities
-
-(def endpoints
-  {"/environment-cache" http-client/delete
-   "/jruby-pool" http-client/delete
-   "/jruby-pool/thread-dump" http-client/get})
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Tests

-(deftest ^:integration admin-api-access-control-test
+;; These tests use the `DELETE /environment-cache` endpoint as representative for testing
+;; the whitelist functionality, since it interacts the best with mock JRubies,
+;; making the tests faster. The same behavior applies also to the `DELETE /jruby-pool`
+;; and the `GET /jruby-pool/thread-dump` endpoints.
+(deftest ^:integration admin-api-access-whitelist-control-test
   (testing "access denied when cert not on whitelist"
     (logutils/with-test-logging
       (bootstrap/with-puppetserver-running-with-mock-jrubies
-       "JRuby mocking is safe here because the admin endpoint is implemented
-       in Clojure."
+        "JRuby mocking is safe here because we do not care about the results of the API call."
         app
         {:jruby-puppet  {:gem-path gem-path}
          :puppet-admin  {:client-whitelist ["notlocalhost"]}
          :authorization {:version 1 :rules []}}
-        (doseq [[endpoint http-method] endpoints]
-          (testing (str "for " endpoint " endpoint")
-            (let [response (http-method
-                             (str "https://localhost:8140/puppet-admin-api/v1" endpoint)
-                             ssl-request-options)]
-              (is (= 403 (:status response))
-                  (ks/pprint-to-string response))))))))
+        (let [response (http-client/delete
+                        "https://localhost:8140/puppet-admin-api/v1/environment-cache"
+                         ssl-request-options)]
+          (is (= 403 (:status response))
+              (ks/pprint-to-string response))))))

   (testing "access allowed when cert on whitelist"
     (logutils/with-test-logging
       (bootstrap/with-puppetserver-running-with-mock-jrubies
-       "JRuby mocking is safe here because the admin endpoint is implemented
-       in Clojure."
+        "JRuby mocking is safe here because we do not care about the results of the API call."
         app
         {:jruby-puppet  {:gem-path gem-path}
          :puppet-admin  {:client-whitelist ["localhost"]}
          :authorization {:version 1 :rules []}}
-        (doseq [[endpoint http-method] endpoints]
-          (testing (str "for " endpoint " endpoint")
-            (let [response (http-method
-                             (str "https://localhost:8140/puppet-admin-api/v1" endpoint)
-                             ssl-request-options)]
-              (is (<= 200 (:status response) 299)
-                  (ks/pprint-to-string response))))))))
+        (let [response (http-client/delete
+                         "https://localhost:8140/puppet-admin-api/v1/environment-cache"
+                         ssl-request-options)]
+          (is (<= 200 (:status response) 299)
+              (ks/pprint-to-string response))))))

   (testing "access allowed when whitelist disabled and no cert provided"
     (logutils/with-test-logging
-     (bootstrap/with-puppetserver-running-with-mock-jrubies
-      "JRuby mocking is safe here because the admin endpoint is implemented
-       in Clojure."
-      app
-      {:jruby-puppet  {:gem-path gem-path}
-       :puppet-admin  {:authorization-required false}
-       :authorization {:version 1 :rules []}}
-      (doseq [[endpoint http-method] endpoints]
-        (testing (str "for " endpoint " endpoint")
-          (let [response (http-method
-                          (str "https://localhost:8140/puppet-admin-api/v1"
-                               endpoint)
-                          (select-keys ssl-request-options [:ssl-ca-cert]))]
-            (is (<= 200 (:status response) 299)
-                (ks/pprint-to-string response))))))))
+      (bootstrap/with-puppetserver-running-with-mock-jrubies
+        "JRuby mocking is safe here because we do not care about the results of the API call."
+        app
+        {:jruby-puppet  {:gem-path gem-path}
+         :puppet-admin  {:authorization-required false}
+         :authorization {:version 1 :rules []}}
+        (let [response (http-client/delete
+                        "https://localhost:8140/puppet-admin-api/v1/environment-cache"
+                        (select-keys ssl-request-options [:ssl-ca-cert]))]
+          (is (<= 200 (:status response) 299)
+              (ks/pprint-to-string response))))))

   (testing "access denied when cert denied by rule"
     (bootstrap/with-puppetserver-running-with-mock-jrubies
-     "JRuby mocking is safe here because the admin endpoint is implemented
-       in Clojure."
+      "JRuby mocking is safe here because we do not care about the results of the API call."
       app
       {:jruby-puppet {:gem-path gem-path}
        :puppet-admin  nil
@@ -109,13 +94,11 @@
                                 :name "admin api"}]}}
       (logutils/with-test-logging
        (testing "when no encoded characters in uri"
-         (doseq [[endpoint http-method] endpoints]
-           (testing (str "for " endpoint " endpoint")
-             (let [response (http-method
-                             (str "https://localhost:8140/puppet-admin-api/v1" endpoint)
-                             ssl-request-options)]
-               (is (= 403 (:status response))
-                   (ks/pprint-to-string response))))))
+         (let [response (http-client/delete
+                         "https://localhost:8140/puppet-admin-api/v1/environment-cache"
+                         ssl-request-options)]
+           (is (= 403 (:status response))
+               (ks/pprint-to-string response))))
        (testing "when encoded characters in uri"
          (let [response (http-client/delete
                          (str "https://localhost:8140/pu%70pet-admin-api/"
@@ -126,8 +109,7 @@

   (testing "when cert allowed by rule and whitelist not configured"
     (bootstrap/with-puppetserver-running-with-mock-jrubies
-     "JRuby mocking is safe here because the admin endpoint is implemented
-       in Clojure."
+      "JRuby mocking is safe here because we do not care about the results of the API call."
       app
       {:jruby-puppet {:gem-path gem-path}
        :puppet-admin  nil
@@ -139,13 +121,11 @@
                                 :sort-order 1
                                 :name "admin api"}]}}
       (testing "access allowed when no encoded characters in uri"
-        (doseq [[endpoint http-method] endpoints]
-          (testing (str "for " endpoint " endpoint")
-            (let [response (http-method
-                            (str "https://localhost:8140/puppet-admin-api/v1" endpoint)
-                            ssl-request-options)]
-              (is (<= 200 (:status response) 299)
-                  (ks/pprint-to-string response))))))
+        (let [response (http-client/delete
+                        "https://localhost:8140/puppet-admin-api/v1/environment-cache"
+                        ssl-request-options)]
+          (is (<= 200 (:status response) 299)
+              (ks/pprint-to-string response))))
       (testing "access allowed for appropriate encoded characters in uri"
         (let [response (http-client/delete
                         (str "https://localhost:8140/pu%70pet-admin-api/"
@@ -164,39 +144,33 @@
   (testing "access allowed when cert allowed by rule and whitelist empty"
     (logutils/with-test-logging
      (bootstrap/with-puppetserver-running-with-mock-jrubies
-      "JRuby mocking is safe here because the admin endpoint is implemented
-       in Clojure."
-      app
-      {:jruby-puppet {:gem-path gem-path}
-       :puppet-admin {:client-whitelist []}
-       :authorization {:version 1
-                       :rules [{:match-request
-                                {:path "/puppet-admin-api/v1"
-                                 :type "path"}
-                                :allow "localhost"
-                                :sort-order 1
-                                :name "admin api"}]}}
-      (doseq [[endpoint http-method] endpoints]
-        (testing (str "for " endpoint " endpoint")
-          (let [response (http-method
-                          (str "https://localhost:8140/puppet-admin-api/v1" endpoint)
-                          ssl-request-options)]
-            (is (<= 200 (:status response) 299)
-                (ks/pprint-to-string response))))))))
+       "JRuby mocking is safe here because we do not care about the results of the API call."
+       app
+       {:jruby-puppet {:gem-path gem-path}
+        :puppet-admin {:client-whitelist []}
+        :authorization {:version 1
+                        :rules [{:match-request
+                                 {:path "/puppet-admin-api/v1"
+                                  :type "path"}
+                                 :allow "localhost"
+                                 :sort-order 1
+                                 :name "admin api"}]}}
+       (let [response (http-client/delete
+                       "https://localhost:8140/puppet-admin-api/v1/environment-cache"
+                       ssl-request-options)]
+         (is (<= 200 (:status response) 299)
+             (ks/pprint-to-string response))))))

   (testing "server tolerates client specifying an 'Accept: */*' header"
     (bootstrap/with-puppetserver-running-with-mock-jrubies
-     "JRuby mocking is safe here because the admin endpoint is implemented
-       in Clojure."
-     app
-     {:jruby-puppet {:gem-path gem-path}}
-     (doseq [[endpoint http-method] endpoints]
-       (testing (str "for " endpoint " endpoint")
-         (let [response (http-method
-                         (str "https://localhost:8140/puppet-admin-api/v1" endpoint)
-                         (assoc ssl-request-options :headers {"Accept" "*/*"}))]
-           (is (<= 200 (:status response) 299)
-               (ks/pprint-to-string response))))))))
+      "JRuby mocking is safe here because we do not care about the results of the API call."
+      app
+      {:jruby-puppet {:gem-path gem-path}}
+      (let [response (http-client/delete
+                      "https://localhost:8140/puppet-admin-api/v1/environment-cache"
+                      (assoc ssl-request-options :headers {"Accept" "*/*"}))]
+        (is (<= 200 (:status response) 299)
+            (ks/pprint-to-string response))))))

 (deftest ^:integration admin-api-pool-timeout-test
   (testing "pool lock timeout results in 503"


Use default also in inbox query.

Use default also in inbox query.

--- src/oc/storage/db/common.clj
+++ src/oc/storage/db/common.clj
@@ -121,7 +121,9 @@
                                        (if (r/ge (r/get-field left "created-at") (r/get-field right "created-at"))
                                          left
                                          right)))
-                                     (r/default {"created-at" (r/get-field post-row "published-at")})
+                                     (r/default {"created-at" (r/default
+                                                               (r/get-field post-row "published-at")
+                                                               (r/get-field post-row "created-at"))})
                                      (r/do (r/fn [interaction-row]
                                        (r/get-field interaction-row "created-at"))))}))
             ;; Filter out:


Add timestamp to update SQS trigger.

Add timestamp to update SQS trigger.

--- src/oc/storage/lib/email.clj
+++ src/oc/storage/lib/email.clj
@@ -2,6 +2,7 @@
   (:require [amazonica.aws.sqs :as sqs]
             [taoensso.timbre :as timbre]
             [schema.core :as schema]
+            [oc.lib.schema :as lib-schema]
             [oc.storage.config :as config]
             [oc.storage.resources.common :as common-res]))

@@ -16,7 +17,8 @@
    :logo-url (schema/maybe schema/Str)
    :origin-url schema/Str
    :currency schema/Str
-   :entries [common-res/UpdateEntry]})
+   :entries [common-res/UpdateEntry]
+   :created-at lib-schema/ISO8601})

 (defn ->trigger [org-slug update origin-url user]
   {:to (vec (:to update))
@@ -29,7 +31,8 @@
    :org-name (:org-name update)
    :logo-url (:logo-url update)
    :currency (:currency update)
-   :entries (:entries update)})
+   :entries (:entries update)
+   :created-at (:created-at update)})

 (defn send-trigger! [trigger]
   (timbre/info "Email request to:" config/aws-sqs-email-queue "\n" (dissoc trigger :entries))


Default the back up idle strategy for peers to reduce CPU usage in test

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -41,12 +41,19 @@
 (defn consumer [limit]
   (proxy [Consumer] []
     (accept [subscription]
-      ;; TODO: evaluate different backoff strategy and timings
-      (let [idle-strategy (BackoffIdleStrategy.
-                           100
-                           10
-                           (.toNanos TimeUnit/MICROSECONDS 1)
-                           (.toNanos TimeUnit/MICROSECONDS 100))]
+      ;; TODO, evaluate different idle strategies.
+      (let [strategy :high-latency-restart
+            idle-strategy (case strategy
+                            :high-latency-restart (BackoffIdleStrategy.
+                                                    100
+                                                    10
+                                                    (.toNanos TimeUnit/MICROSECONDS 10000)
+                                                    (.toNanos TimeUnit/MICROSECONDS 100000))
+                            :low-latency-restart (BackoffIdleStrategy.
+                                                   100
+                                                   10
+                                                   (.toNanos TimeUnit/MICROSECONDS 1)
+                                                   (.toNanos TimeUnit/MICROSECONDS 100)))]
         (while true
           (let [fragments-read (.poll ^uk.co.real_logic.aeron.Subscription subscription limit)]
             (.idle idle-strategy fragments-read)))))))


Add an ISBN Verifier test case for short ISBN

--- exercises/isbn-verifier/test/isbn_verifier_test.clj
+++ exercises/isbn-verifier/test/isbn_verifier_test.clj
@@ -32,6 +32,9 @@
 (deftest too-long-isbn-and-no-dashes
   (is (= false (isbn? "3598215078X"))))

+(deftest too-short-isbn
+  (is (= false (isbn? "00"))))
+
 (deftest isbn-without-check-digit
   (is (= false (isbn? "3-598-21507"))))


Some minor changes for October

Some minor changes for October

--- scrape-n-mail/src/scrape_n_mail/core.cljs
+++ scrape-n-mail/src/scrape_n_mail/core.cljs
@@ -185,8 +185,8 @@
       [:br]
       [:p "Dear " (::submitter-name (first name-records)) ","]

-      [:p "Our call for names for Wellbeing for August 2018 is out: "
-          "http://newdharma.transformativechange.org/2018/08/wellbeing-september-2018/"]
+      [:p "Our call for names for Wellbeing for October 2018 is out: "
+          "http://newdharma.transformativechange.org/2018/09/wellbeing-october-2018/"]

       [:p "Currently, the community is holding the following names on the altar "
           "in support of their wellbeing at your request. You can click "


feat(model.db): should set current database as test database

--- test/busa_server/model/db_test.clj
+++ test/busa_server/model/db_test.clj
@@ -6,3 +6,7 @@
 (fact "should set current database"
   (db/set-db!)
   @db/current-db => (db/config :db))
+
+(fact "should set current database as test database"
+  (db/set-test-db!)
+  @db/current-db => (db/config :db-test))


Returned `seen` check to pull v2

Returned `seen` check to pull v2

--- src/datascript/pull_api_v3.cljc
+++ src/datascript/pull_api_v3.cljc
@@ -53,13 +53,13 @@
 (defrecord MultivalRefAttrFrame [acc pattern ^PullAttr attr datoms]
   IFrame
   (-merge [this result]
-    (MultivalRefAttrFrame. (conj acc (.-value ^ResultFrame result)) pattern attr (next-seq datoms)))
+    (MultivalRefAttrFrame. (conj! acc (.-value ^ResultFrame result)) pattern attr (next-seq datoms)))
   (-run [this db seen]
     (cond+
       :let [^Datom datom (first-seq datoms)]

       (or (nil? datom) (not= (.-a datom) (.-name attr)))
-      [(ResultFrame. acc (or datoms ()))]
+      [(ResultFrame. (persistent! acc) (or datoms ()))]

       :let [child-pattern (if (.-recursive? attr) pattern (.-pattern attr))
             id            (if (.-reverse? attr) (.-e datom) (.-v datom))]
@@ -110,7 +110,7 @@
         ;; matching attr
         (and (.-multival? attr) (.-ref? attr))
         [(AttrsFrame. acc pattern attr attrs datoms id)
-         (MultivalRefAttrFrame. [] pattern attr datoms)]
+         (MultivalRefAttrFrame. (transient []) pattern attr datoms)]

         (.-multival? attr)
         [(AttrsFrame. acc pattern attr attrs datoms id)
@@ -144,7 +144,7 @@
       [this (ref-frame db seen pattern attr (.-e ^Datom (first-seq datoms)))]

       :else
-      [this (MultivalRefAttrFrame. [] pattern attr datoms)])))
+      [this (MultivalRefAttrFrame. (transient []) pattern attr datoms)])))

 (defn ref-frame [db seen pattern ^PullAttr attr id]
   (attrs-frame db seen (if (.-recursive? attr) pattern (.-pattern attr)) id))
@@ -153,7 +153,7 @@
   (if (contains-set? seen id)
     (ResultFrame. {:db/id id} nil)
     (do
-      ; (conj-set seen id)
+      (conj-set seen id)
       (AttrsFrame.
         (transient {})
         pattern


add pacing sleep

add pacing sleep

--- src/datomic/dodc/composites.clj
+++ src/datomic/dodc/composites.clj
@@ -22,4 +22,5 @@
                    (completing (fn [x ids] (inc x)))
                    0
                    (:tx-data result))]
-        (println {:batch-size batch-size :first-e (:e (first batch)) :added added})))))
+        (println {:batch-size batch-size :first-e (:e (first batch)) :added added})
+        (Thread/sleep (* 1000 pacing-sec))))))


Refactor code

Refactor code

--- solutions/uri/1015/1015.clj
+++ solutions/uri/1015/1015.clj
@@ -1,10 +1,20 @@
 (ns main
   (:require [clojure.string :as str]))

+(defn str->double
+  [sequence]
+  (map #(Double/parseDouble %) sequence))
+
+(defn read-line->double []
+  (-> (read-line)
+    (str/split #" ")
+    (str->double)))
+
 (defn main []
-  (let [[x1 y1] (-> (read-line) (str/split #" "))
-        [x2 y2] (-> (read-line) (str/split #" "))
-        [x1' y1' x2' y2'] (map #(Double/parseDouble %) [x1 y1 x2 y2])]
-    (printf "%.4f%n" (Math/sqrt (+ (Math/pow (- x2' x1') 2) (Math/pow (- y2' y1') 2))))))
+  (let [[x1 y1] (read-line->double)
+        [x2 y2] (read-line->double)]
+    (printf
+      "%.4f%n"
+      (Math/sqrt (+ (Math/pow (- x2 x1) 2) (Math/pow (- y2 y1) 2))))))

 (main)


Fix comment.

Fix comment.

--- src/fcms/resources/taxonomy.clj
+++ src/fcms/resources/taxonomy.clj
@@ -17,7 +17,7 @@
   ^{:no-doc true}
   category-media-type "application/vnd.fcms.category+json;version=1")

-;; ----- taxonomy lifecycle functions -----
+;; ----- Taxonomy lifecycle functions -----

 (defn get-taxonomy
   "Given the slug of the collection containing the taxonomy and the slug of the taxonomy,


Fix for data location.

Fix for data location.

--- src/forces_assemble/handler.clj
+++ src/forces_assemble/handler.clj
@@ -122,9 +122,9 @@
   [event client]
   {:to client
    :priority "high"
+   :data (or (:data event) {})
    :notification {:title (or (:title event) "")
                   :body (or (:body event) "")
-                  :data (or (:data event) {})
                   :sound "default"}})

 (defn add-event-to-channel


refetch issues if relevant issue closes

refetch issues if relevant issue closes

--- src/gh_waiting_room/service.clj
+++ src/gh_waiting_room/service.clj
@@ -108,22 +108,25 @@
            (:position issue)
            (full-url-for (str "/#" (:id issue))))))

-(defn- update-issues-and-create-comment [full-name issue-num]
+(defn- update-issues-and-create-comment [issue-id issue-num]
   (fetch-gh-issues)
   (let [issue (or
-               (some #(and (= (:id %) (format "%s#%s" full-name issue-num)) %) (viewable-issues))
-               (throw (ex-info "No issue found for webhook" {:full-name full-name :issue-num issue-num})))
+               (some #(and (= (:id %) issue-id) %) (viewable-issues))
+               (throw (ex-info "No issue found for webhook" {:issue-id issue-id})))
         body (comment-body issue)]
     (create-comment (:user issue) (:name issue) issue-num body (gh-auth))))

 (defn webhook-page
   [request]
   (let [params (-> request :json-params)
-        action (get! params "action")]
+        action (get! params "action")
+        full-name (get-in! params ["repository" "full_name"])
+        issue-num (get-in! params ["issue" "number"])
+        issue-id (format "%s#%s" full-name issue-num)]
     (when (some #{action} ["created" "reopened"])
-      (let [full-name (get-in! params ["repository" "full_name"])
-            issue-num (get-in! params ["issue" "number"])]
-        (update-issues-and-create-comment full-name issue-num))))
+      (update-issues-and-create-comment issue-id issue-num))
+    (when (and (= action "closed") (some #(= (:id %) issue-id) (viewable-issues)))
+      (fetch-gh-issues)))
   {:status 200})

 (defon-response html-content-type


More debug

More debug

--- integration-tests/apps/caching/counter/test/counter/test/locking.clj
+++ integration-tests/apps/caching/counter/test/counter/test/locking.clj
@@ -13,9 +13,9 @@
 (defn work
   [{:keys [name key]}]
   (let [cache (get caches name)]
-    (println "JC: work start" cache)
+    (println "JC: work start" name cache)
     (loop [v (get cache key)]
-      (println "JC: v=" v)
+      (println "JC: v=" name v)
       (if (csh/put-if-replace cache key v (inc v))
         (msg/publish "/queue/done" name)
         (recur (get cache key))))))


NS cleanup

NS cleanup

--- src/aeolian/composer.clj
+++ src/aeolian/composer.clj
@@ -3,8 +3,7 @@
 						[aeolian.tempo :as t]
 						[aeolian.midi.drums :as d]
 						[aeolian.abc.notes :as n]
-						[aeolian.abc.header :as h]
-						[clojure.java.io :as io]))
+						[aeolian.abc.header :as h]))

 (def output-header (str h/header d/beat t/abc-template t/default-tempo "\n"))
 (def notes-per-measure 4)
@@ -16,8 +15,6 @@
 	; (println metric)
 	(let [complexity (parser/complexity-from-metric metric)
 				note (nth n/major-notes (metric-to-note-index metric))
-				; _ (println complexity)
-				; _ (println note)
 				]
 		(cond (> complexity 1)
 			(str "\n" (t/as-abc complexity) "\n" note)
@@ -26,10 +23,8 @@

 (defn- map-metrics [metrics]
 	(let [
-		mapped-notes (map #(metric-to-note %1) metrics)
-		; _ (println mapped-notes)
-		notes-in-measures (apply str (flatten (interpose (str "|\n" n/major-root) (partition notes-per-measure mapped-notes))))
-		; _ (println notes-in-measures)
+			mapped-notes (map #(metric-to-note %1) metrics)
+			notes-in-measures (apply str (flatten (interpose (str "|\n" n/major-root) (partition notes-per-measure mapped-notes))))
 		]
 		(str output-header "|" n/major-root notes-in-measures "|")))


more entity ids for the demo

more entity ids for the demo

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -317,11 +317,11 @@

 (defn setup-entity-id-fetcher [state]
   (let [api-ch (-> state deref :comms :api)]
-    (fetch-entity-ids api-ch 40)
+    (fetch-entity-ids api-ch 200)
     (add-watch state :entity-id-fetcher (fn [key ref old new]
-                                          (when (> 20 (-> new :entity-ids count))
+                                          (when (> 190 (-> new :entity-ids count))
                                             (println "fetching more entity ids")
-                                            (fetch-entity-ids api-ch 40))))))
+                                            (fetch-entity-ids api-ch 200))))))

 (defn ^:export setup! []
   (apply-app-id-hack)


Store vars and calls

Store vars and calls

--- src/aurora/compiler.cljs
+++ src/aurora/compiler.cljs
@@ -157,8 +157,18 @@
   (check (= :page (:type x)))
   `(fn ~(id->value id) ~(vec (interleave (map! id->value (:args x)) (map! id->cursor (:args x))))
      (do
+       (let! stack notebook.stack)
+       (let! frame {})
+       (set! frame.calls [])
+       (set! frame.vars {})
+       (stack.push frame)
+       (set! notebook.stack frame.calls)
        ~@(for! [step-id (:steps x)]
-               (step->jsth index (get index step-id) step-id)))
+               `(do
+                  ~(step->jsth index (get index step-id) step-id)
+                  (set! (.. frame.vars ~(id->value step-id)) ~(id->value step-id))
+                  (set! (.. frame.vars ~(id->cursor step-id)) ~(id->cursor step-id))))
+       (set! notebook.stack stack))
      [~(-> x :steps last id->value) ~(-> x :steps last id->cursor)]))

 (deftraced notebook->jsth [index x] [x]
@@ -181,11 +191,14 @@
         _ (println "###################")
         _ (println jsth)
         _ (println source)
-        notebook (js/eval (str "(" source "());"))]
+        notebook (js/eval (str "(" source "());"))
+        stack #js []]
     (aset notebook "next_state" state)
+    (aset notebook "stack" stack)
     (try
-      [(.value_root notebook state []) (.-next_state notebook)]
-      (catch :default e e))))
+      [(.value_root notebook state []) (.-next_state notebook) stack]
+      (catch :default e
+        [e (.-next_state notebook) stack]))))

 (defn tick-example [index id state]
   (second (run-index index id state)))


Test reset

Test reset

--- src/aurora/language.cljs
+++ src/aurora/language.cljs
@@ -68,10 +68,10 @@
 ;; COMPILER

 (let [next (atom 0)]
-   (defn new-id []
-     (if js/window.uuid
-       (.replace (js/uuid) (js/RegExp. "-" "gi") "_")
-       (str "id-" (swap! next inc)))))
+  (defn new-id []
+    (if js/window.uuid
+      (.replace (js/uuid) (js/RegExp. "-" "gi") "_")
+      (str "id-" (swap! next inc)))))

 ;; NOTE can't handle missing keys yet - requires a schema
 (defn compile [kn]
@@ -195,33 +195,38 @@
                                                                                #js ["single-edge" "know" "output-connected" "connected"]])

 (.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable" "key" "val"] #js [#js ["get-edges" "variable" "x" "xx"]
-                                                                                #js ["get-edges" "variable" "y" "yy"]
-                                                                                #js ["output-connected" "variable" "x" "xx"]
-                                                                                #js ["output-connected" "variable" "y" "yy"]])
-
-  (.add-facts kn "know" "clauses" #js ["rule-id" "when|know|remember|forget" "clause-id" "name"] #js [#js ["transitive-edge" "when" "get-left-edge" "edge"]
-                                                                                #js ["transitive-edge" "when" "get-right-connected" "connected"]
-                                                                                #js ["transitive-edge" "know" "output-transitive-connected" "connected"]])
-
-  (.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable" "key" "val"] #js [#js ["get-left-edge" "variable" "x" "xx"]
-                                                                                #js ["get-left-edge" "variable" "y" "yy"]
-                                                                                #js ["get-right-connected" "variable" "x" "yy"]
-                                                                                #js ["get-right-connected" "variable" "y" "zz"]
-                                                                                #js ["output-transitive-connected" "variable" "x" "xx"]
-                                                                                #js ["output-transitive-connected" "variable" "y" "zz"]])
-
-  (compile kn)
-
-  (.run (first (compile kn)) kn)
-
-  (.get-or-create-index kn "know" "connected" #js ["x" "y"])
-
-  (.run (second (compile kn)) kn)
-
-  (.get-or-create-index kn "know" "connected" #js ["x" "y"])
- (.run (second (compile kn)) kn)
-
-  (.get-or-create-index kn "know" "connected" #js ["x" "y"])
- (.run (second (compile kn)) kn)
-
-  (.get-or-create-index kn "know" "connected" #js ["x" "y"])
+                                                                                #js ["get-edges" "variable" "y" "yy"]
+                                                                                #js ["output-connected" "variable" "x" "xx"]
+                                                                                #js ["output-connected" "variable" "y" "yy"]])
+
+(.add-facts kn "know" "clauses" #js ["rule-id" "when|know|remember|forget" "clause-id" "name"] #js [#js ["transitive-edge" "when" "get-left-edge" "edge"]
+                                                                                #js ["transitive-edge" "when" "get-right-connected" "connected"]
+                                                                                #js ["transitive-edge" "know" "output-transitive-connected" "connected"]])
+
+(.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable" "key" "val"] #js [#js ["get-left-edge" "variable" "x" "xx"]
+                                                                                #js ["get-left-edge" "variable" "y" "yy"]
+                                                                                #js ["get-right-connected" "variable" "x" "yy"]
+                                                                                #js ["get-right-connected" "variable" "y" "zz"]
+                                                                                #js ["output-transitive-connected" "variable" "x" "xx"]
+                                                                                #js ["output-transitive-connected" "variable" "y" "zz"]])
+
+(compile kn)
+
+(.run (first (compile kn)) kn)
+
+(.get-or-create-index kn "know" "connected" #js ["x" "y"])
+
+(def f2 (second (compile kn)))
+
+(.run f2 kn)
+
+(.get-or-create-index kn "know" "connected" #js ["x" "y"])
+
+(.run f2 kn)
+
+(.get-or-create-index kn "know" "connected" #js ["x" "y"])
+
+(.run f2 kn)
+
+(.get-or-create-index kn "know" "connected" #js ["x" "y"])
+


+(defn remove-vals)

+(defn remove-vals)

--- src/babel/lexiconfn.cljc
+++ src/babel/lexiconfn.cljc
@@ -713,6 +713,10 @@
                [k (filter filter-fn (get lexicon k))])
              (keys lexicon))))

+(defn remove-vals [lexicon remove-fn]
+  (into {}
+        (map (fn [k]
+               [k (remove remove-fn (get lexicon k))])
              (keys lexicon))))

 (defn rewrite-keys [lexicon rewrite-fn]


[core] Nix fns 'choose-news, 'get-peer, 'distract-self

--- src/birdie_tell/core.clj
+++ src/birdie_tell/core.clj
@@ -253,56 +253,6 @@
                      ffirst)]
     (swap! state assoc-in [:peers :identified uuid :alive?] alive?)))

-(defn choose-news
-  "Choose all the latest hot news that I have in my little bird-brain.
-
-  Returns a news-map with this shape:
-
-  {host-port :status
-   host-port2 :status}
-
-  For example: {\"127.0.0.1:1234\": \"alive\"
-                \"127.0.0.1:1235\": \"dead\"}
-  "
-  [peers]
-  (->> peers
-       :hotness
-       (map first)
-       (select-keys (:states peers))
-       (map (fn [[[host port] v]] [(join-hostport host port) v]))
-       (into {})))
-
-(defn- get-peer
-  "Select a random :alive peer if possible, else a :dead one.
-
-  If there are no peers, return nil.
-
-  Returns a peer vector in this shape:
-  [host port]"
-  [live-percentage peers]
-  (let [peers (reduce (fn [r [k v]] (merge-with concat r {v [k]}))
-                      {}
-                      (:states peers))
-        ;; sometimes contact a dead one on purpose
-        [primary-state secondary-state] (if (< (rand-int 100) live-percentage)
-                                          [:alive :dead]
-                                          [:dead :alive])
-        peer (if (seq (primary-state peers))
-               (rand-nth (primary-state peers))
-               (rand-nth (secondary-state peers)))]
-    peer))
-
-(defn- distract-self
-  "Decrease the hotness of all current news, eliminating entirely any
-  news that reaches a hotness level of zero."
-  [peers]
-  (swap! peers assoc :hotness
-         (->> @peers
-              :hotness
-              (filter (fn [[host-port hotness]] (< 1 hotness)))
-              (map (fn [[host-port hotness]] [host-port (dec hotness)]))
-              (into {}))))
-
 (defn mingle [live-percentage max-hotness min-rest-time max-rest-time my-ip-addr my-port]
   (let [wait-range (- max-rest-time min-rest-time)]
     (while true


Check for closed cmd-ch in world-cmd-loop.

--- src/cbfg/world/base.cljs
+++ src/cbfg/world/base.cljs
@@ -87,23 +87,23 @@
     (act-loop cmd-loop actx [num-requests 0 num-responses 0]
               (let [[v ch] (aalts cmd-loop [cmd-ch res-ch])
                     ts (+ num-requests num-responses)]
-                (cond
-                 (= ch cmd-ch)
-                 (if (= (:op v) "replay")
-                   (world-replay req-ch vis-chs world-vis-init el-prefix
-                                 @client-hist (:replay-to v))
-                   (let [cmd (assoc-in v [:opaque] ts)
-                         cmd-rq ((get cmd-handlers (:op cmd)) cmd)]
-                     (render-client-hist (swap! client-hist
-                                                #(assoc % ts [cmd nil])))
-                     (aput cmd-loop req-ch cmd-rq)
-                     (recur (inc num-requests) num-responses)))
-                 (= ch res-ch)
-                 (when v
-                   (render-client-hist (swap! client-hist
-                                              #(update-in % [(:opaque v) 1]
-                                                          conj [ts v])))
-                   (recur num-requests (inc num-responses))))))))
+                (when v
+                  (cond
+                   (= ch cmd-ch)
+                   (if (= (:op v) "replay")
+                     (world-replay req-ch vis-chs world-vis-init el-prefix
+                                   @client-hist (:replay-to v))
+                     (let [cmd (assoc-in v [:opaque] ts)
+                           cmd-rq ((get cmd-handlers (:op cmd)) cmd)]
+                       (render-client-hist (swap! client-hist
+                                                  #(assoc % ts [cmd nil])))
+                       (aput cmd-loop req-ch cmd-rq)
+                       (recur (inc num-requests) num-responses)))
+                   (= ch res-ch)
+                   (do (render-client-hist (swap! client-hist
+                                                  #(update-in % [(:opaque v) 1]
+                                                              conj [ts v])))
+                       (recur num-requests (inc num-responses)))))))))

 ;; ------------------------------------------------


not using hooke anymore

not using hooke anymore

--- src/celestial/launch.clj
+++ src/celestial/launch.clj
@@ -13,7 +13,6 @@
   "celestial lanching ground aka main"
   (:gen-class true)
   (:use
-    [robert.hooke :only (add-hook)]
     [clojure.core.strint :only (<<)]
     [clojure.tools.nrepl.server :only (start-server stop-server)]
     [celestial.persistency :as p]


* src/clj/cljs/closure.clj: CLJS-153: fix broken Node.js support

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -164,7 +164,7 @@
         load-js (fn [ext]
                   (map #(js-source-file (.getFile %) (slurp %)) ext))]
     (let [js-sources (-> externs filter-js add-target load-js)
-          ups-sources (-> ups-externs filter-cp-js add-target load-js)
+          ups-sources (-> ups-externs filter-cp-js load-js)
           all-sources (concat js-sources ups-sources)]
       (if use-only-custom-externs
         all-sources


revert CLJS-994, approach incompatible with cljsbiuld

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -206,13 +206,11 @@
                      us))
         filter-cp-js (fn [paths]
                        (for [p paths
-                             u (validate p
-                                 (deps/find-js-classpath p))]
+                             u (deps/find-js-classpath p)]
                          u))
         filter-js (fn [paths]
                     (for [p paths
-                          u (validate p
-                              (deps/find-js-resources p))]
+                          u (deps/find-js-resources p)]
                       u))
         add-target (fn [ext]
                      (cons (io/resource "cljs/externs.js")


add news magazines

add news magazines

--- src/cljs/ceres/core.cljs
+++ src/cljs/ceres/core.cljs
@@ -19,7 +19,7 @@

 (println "Greetings commander")

-(def news-sources #{"FAZ_NET" "dpa" "tagesschau" "SPIEGELONLINE" "SZ" "BILD" "DerWesten" "ntvde" "tazgezwitscher" "welt" "ZDFheute" "N24_de"})
+(def news-sources #{"FAZ_NET" "dpa" "tagesschau" "SPIEGELONLINE" "SZ" "BILD" "DerWesten" "ntvde" "tazgezwitscher" "welt" "ZDFheute" "N24_de" "sternde" "focus_de"})

 (strokes/bootstrap)


Explict list of the libs we provide.

Explict list of the libs we provide.

--- src/cljs/go/compiler.clj
+++ src/cljs/go/compiler.clj
@@ -812,9 +812,10 @@
             (emitln " return " return)
             (emits "}()")))))))

-(def provided-libs '#{goog goog.string goog.array goog.object
-                      cljs.core cljs.reder
-                      clojure.data clojure.set clojure.walk clojure.zip})
+(def provided-lib? '#{goog goog.string goog.array goog.object
+                      js js/Math
+                      cljs.core cljs.reader
+                      clojure.data clojure.set clojure.string clojure.walk clojure.zip})

 (defmethod emit* :ns
   [{:keys [name requires uses imports require-macros env]}]
@@ -831,7 +832,7 @@
                                         (vals (apply dissoc requires (keys imports))) (vals uses))))]
     (emitln "\t" (string/replace (munge lib) "." "_") " "
             (wrap-in-double-quotes
-             (str (when (some #(re-find % (str lib)) [#"^goog\." #"^clojure\." #"^cljs\." ])
+             (str (when (provided-lib? lib)
                     *go-import-prefix*)
                   (string/replace lib #"[._]" "/")))))
   (emitln ")")


Colision detection when falling is now working!

--- src/cljs/kenny/core.cljs
+++ src/cljs/kenny/core.cljs
@@ -180,17 +180,11 @@
   )

 (defn on-ground? [original-hero hero]
-  (if (on-block? (get-in hero [:position]) 1)
-    (update-in hero [:dy] + 0.75)
-    (if (> 0 (get-in hero [:dy]))
-      (if (in-block? (get-in hero [:position]) 1)
-        (let [new-hero (update-in hero [:dy] + 0.75)]
+  (if (in-block? (get-in hero [:position]) 1)
+    (let [new-hero (update-in hero [:dy] + 0.75)]
           (update-in new-hero [:position :bottom] (fn [_] (nearest-vertical-border (get-in original-hero [:position :bottom]))))
           )
-        hero
-        )
-      hero
-      )
+    hero
     ))

 (defn spike-damage [hero]


intensity distribution function

intensity distribution function

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

--- plugins/SlideExplorer2/src/slide_explorer/image.clj
+++ plugins/SlideExplorer2/src/slide_explorer/image.clj
@@ -82,7 +82,10 @@
   [^ImageProcessor proc]
   (.createImage proc))

-(defn convert-to-type-like [proc template-proc]
+(defn convert-to-type-like
+  "Converts proc to a processor of the same type
+   as template-proc."
+  [proc template-proc]
   (condp = (type template-proc)
     ByteProcessor (.convertToByte proc false)
     ShortProcessor (.convertToShort proc false)
@@ -145,6 +148,17 @@
     (let [min-maxes (map intensity-range (cons processor processors))]
       {:min (apply min (map :min min-maxes))
        :max (apply max (map :max min-maxes))})))
+
+(defn intensity-distribution
+  "Get the intensity distribution for a processor,
+   suitable for a histogram."
+  [processor]
+  (let [stat (ImageStatistics/getStatistics
+               processor ImageStatistics/MIN_MAX nil)]
+    {:data (.getHistogram stat)
+     :min (.histMin stat)
+     :max (.histMax stat)}))
+

 ;; Channels/LUTs


src for samples listed

src for samples listed

--- src/codemash/samples.clj
+++ src/codemash/samples.clj
@@ -1,4 +1,6 @@
 (ns codemash.samples
+  "Samples lurk here:
+   https://github.com/stars-my-destination/samples"
   (:use overtone.live))

 ;;Samples by devism http://monome.org/community/discussion/736/x&page=1#Item_22


GAWB-1791: Fix grant edge case bug (#774)

* do not attempt to set grant permissions when accessLevel < owner

--- src/cljs/main/broadfcui/page/workspace/summary/acl_editor.cljs
+++ src/cljs/main/broadfcui/page/workspace/summary/acl_editor.cljs
@@ -129,6 +129,9 @@
                              (map #(dissoc % :read-only?))
                              (map #(update-in % [:email] clojure.string/trim))
                              (filter #(not (empty? (:email %)))))
+           grant-filtered-acl (if (common/access-greater-than-equal-to? (:user-access-level props) "OWNER")
+                                filtered-acl
+                                (map #(dissoc % :canShare) filtered-acl))
            fails (apply input/validate refs (filter
                                              #(contains? @refs %)
                                              (map #(str "acl-key" %) (range (count (:non-project-owner-acl-vec @state))))))]
@@ -139,7 +142,7 @@
            (endpoints/call-ajax-orch
             {:endpoint (endpoints/update-workspace-acl (:workspace-id props) invite-new?)
              :headers utils/content-type=json
-             :payload filtered-acl
+             :payload grant-filtered-acl
              :on-done (fn [{:keys [success? get-parsed-response]}]
                         (swap! state dissoc :saving?)
                         (if (seq (:usersNotFound (get-parsed-response)))


Add comment.

Add comment.

--- src/circle/backend/build/run.clj
+++ src/circle/backend/build/run.clj
@@ -77,6 +77,7 @@
       (dosync
        (alter b assoc :failed true)
        (alter b assoc :infrastructure_fail true))
+      ;; TODO: make this a normal fail
       (email/send-build-error-email b e)
       (throw e))
     (finally