register urls through the sound cache aswell

--- src/cljs/infinitelives/pixi/resources.cljs
+++ src/cljs/infinitelives/pixi/resources.cljs
@@ -2,6 +2,7 @@
   (:require [PIXI]
             [infinitelives.pixi.sprite :as sprite]
             [infinitelives.utils.string :as string]
+            [infinitelives.utils.sound :as sound]
             [infinitelives.utils.events :as events]
             [infinitelives.utils.console :refer [log]]
             [cljs.core.async :refer [chan put! <! timeout close!]])
@@ -95,6 +96,11 @@
             (PIXI/Texture.fromImage
              (str url "#") true (aget PIXI/scaleModes "NEAREST"))})))

+(defn register
+  [url obj]
+  (register-texture url obj)
+  (sound/register-sound url))
+
 (defn load-urls
   "loads each url in the passed in list as an image. Updates the progress
 as it goes with
@@ -120,7 +126,7 @@
               (<! (timeout (* (:debug-delay options) 1000)))) ;; artificial random delay (up to 1 ec)

             ;; setup a pixi texture keyed by the tail of its filename
-            (register-texture url img)
+            (register url img)

             ;; update progress bar and add image
             (.setTexture progress-bar


when its not an Image, return nil for the object in channel

--- src/cljs/infinitelives/pixi/resources.cljs
+++ src/cljs/infinitelives/pixi/resources.cljs
@@ -108,7 +108,7 @@
                   (map (fn [src]
                          (let [i (js/Image.)]
                            (set! (.-onload i) #(put! finished [src i]))
-                           (set! (.-onerror i) #(put! finished [src i]))
+                           (set! (.-onerror i) #(put! finished [src nil]))
                            (set! (.-onabort i) #(js/alert "abort"))
                            (set! (.-src i) src)
                            i))


Remove client.initiate's packet-management ref

It wasn't actually using it

--- src/clojure/frereth_cp/client/initiate.clj
+++ src/clojure/frereth_cp/client/initiate.clj
@@ -31,7 +31,6 @@
 ;;; These pieces are about the innermost nonce
 (s/def ::vouch-building-params (s/keys :req [::log/logger
                                              ::shared/my-keys
-                                             ::shared/packet-management
                                              ::state/shared-secrets]))
 (s/def ::vouch-built (s/keys :req [::specs/inner-i-nonce
                                    ::log/state


WIP - Evolution du bot CSB en Clojure avec l'objectif d'améliorer le classement en ligue argent

--- clojure/codingame/competition/coders-strike-back/src/coders_strike_back/Player.clj
+++ clojure/codingame/competition/coders-strike-back/src/coders_strike_back/Player.clj
@@ -38,25 +38,6 @@
   (let [d (distance x1 y1 x2 y2) dx (/ (- x2 x1) d) dy (/ (- y2 y1) d) angle (convert-radian-to-degree (Math/acos dx))]
     (if (< dy 0) (- 360.0 angle) angle)))

-(defn after [val1 val2] (if (< (- val2 val1) 0) true false))
-(defn before [val1 val2] (if (> (- val2 val1) 0) true false))
-
-(defn compute-x [x next-checkpoint-x next-checkpoint-angle next-checkpoint-distance]
-  (if (> next-checkpoint-distance 800)
-    (cond
-      (> next-checkpoint-x x) (- next-checkpoint-x checkpoint-core-size)
-      (< next-checkpoint-x x) (+ next-checkpoint-x checkpoint-core-size)
-      true next-checkpoint-x)
-    next-checkpoint-x))
-
-(defn compute-y [y next-checkpoint-y next-checkpoint-angle next-checkpoint-distance]
-  (if (> next-checkpoint-distance 800)
-    (cond
-      (> next-checkpoint-y y) (- next-checkpoint-y checkpoint-core-size)
-      (< next-checkpoint-y y) (+ next-checkpoint-y checkpoint-core-size)
-      true next-checkpoint-y)
-    next-checkpoint-y))
-
 (defn compute-x-y [x y next-checkpoint-x next-checkpoint-y next-checkpoint-angle next-checkpoint-distance]
   (cond
     (and (< x next-checkpoint-x) (< y next-checkpoint-y)) (str (- next-checkpoint-x checkpoint-core-size) " " (- next-checkpoint-y checkpoint-core-size))
@@ -71,9 +52,9 @@
 ;;Compute a boost value between 0 and 100
 (defn compute-boost [next-checkpoint-distance next-checkpoint-angle]
   (cond
-    (>= (Math/abs next-checkpoint-angle) 90) "40"
+    ;(>= (Math/abs next-checkpoint-angle) 90) "40"
     (<= next-checkpoint-distance 1000) "40"
-    (<= next-checkpoint-distance 800) "20"
+    ;(<= next-checkpoint-distance 800) "20"
     (<= (Math/abs next-checkpoint-angle) 36) "100"
     true (compute-boost-from-angle (Math/abs next-checkpoint-angle))))


Options may be nil

Options may be nil

--- modules/messaging/src/main/clojure/immutant/messaging.clj
+++ modules/messaging/src/main/clojure/immutant/messaging.clj
@@ -45,7 +45,7 @@
                   (let [destination (destination session dest-name)
                         producer (.createProducer session destination)
                         encoded (set-properties! (codecs/encode session message opts)
-                                                 (opts :properties))
+                                                 (:properties opts))
                         {:keys [delivery priority ttl]} (wash-publish-options opts producer)]
                     (.send producer encoded delivery priority ttl)))))


Formatting

Formatting

--- src/onyx/state/filter/rocksdb.clj
+++ src/onyx/state/filter/rocksdb.clj
@@ -106,9 +106,8 @@
   (.close ^RocksDB (:db rocks-db))
   (FileUtils/deleteDirectory (java.io.File. ^String (:dir rocks-db))))

-(defmethod state-extensions/restore-filter onyx.state.filter.rocksdb.RocksDbInstance [{:keys [db bucket id-counter] :as rocks-db}
-                                                                                event
-                                                                                snapshot]
+(defmethod state-extensions/restore-filter onyx.state.filter.rocksdb.RocksDbInstance
+  [{:keys [db bucket id-counter] :as rocks-db} event snapshot]
   (reset! id-counter (:id-counter snapshot))
   (reset! bucket (:bucket snapshot))
   (run! (fn [[k v]]
@@ -116,7 +115,8 @@
         (:kvs snapshot))
   rocks-db)

-(defmethod state-extensions/snapshot-filter onyx.state.filter.rocksdb.RocksDbInstance [filter-state _]
+(defmethod state-extensions/snapshot-filter onyx.state.filter.rocksdb.RocksDbInstance
+  [filter-state _]
   (let [db ^RocksDB (:db filter-state)
         snapshot ^Snapshot (.getSnapshot db)
         bucket @(:bucket filter-state)


jruby.clj: remove singleton, add doc strings

--- src/main/clojure/org/altlaw/util/jruby.clj
+++ src/main/clojure/org/altlaw/util/jruby.clj
@@ -1,13 +1,13 @@
 (ns org.altlaw.util.jruby
-  (:require [clojure.contrib.singleton :as sing]
-            [clojure.contrib.java-utils :as j])
+  (:require [clojure.contrib.java-utils :as j])
   (:import (javax.script SimpleBindings ScriptContext
                          ScriptEngine ScriptEngineManager)))

-(def #^{:private true} jruby
-     (sing/per-thread-singleton
-      (fn []
-        (.getEngineByName (ScriptEngineManager.) "jruby"))))
+(def #^{:private true} *jruby*
+     (delay (.getEngineByName (ScriptEngineManager.) "jruby")))
+
+(defn- jruby []
+  (force *jruby*))

 (defn- make-bindings [m]
   (let [bindings (SimpleBindings.)]
@@ -16,6 +16,8 @@
    bindings))

 (defn eval-jruby
+  "Evaluates script, a string of Ruby code.  Optional bindings is a
+  keyword=>value map for global bindings."
   ([script]
      (.eval (jruby) script))
   ([script bindings]
@@ -26,7 +28,9 @@
 (derive java.lang.Number ::java-object)
 (derive java.lang.Boolean ::java-object)

-(defmulti convert-jruby class)
+(defmulti
+  #^{:doc "Converts a JRuby object to a compatible Clojure type."}
+  convert-jruby class)

 (defmethod convert-jruby org.jruby.RubySymbol [x]
   (keyword (str x)))


fix: reflection warning on toJTS

fix: reflection warning on toJTS

--- src/main/clojure/pdok/featured/feature.clj
+++ src/main/clojure/pdok/featured/feature.clj
@@ -64,7 +64,7 @@

 (defn gml3-as-jts [gml]
   (try
-    (.toJTSGeometry ^GMLMultiVersionParserImpl gml3-parser gml)
+    (.toJTSGeometry ^GMLMultiVersionParserImpl gml3-parser ^String gml)
     (catch nl.pdok.gml3.exceptions.GML3ParseException e
       (log/error "Could not transform GML to JTS:" (.getMessage  e))
       nil)))


Generate '_ link IDs for global links, not ''_

The latter breaks Om Next.

--- src/main/workflo/macros/query/om_next.cljc
+++ src/main/workflo/macros/query/om_next.cljc
@@ -45,7 +45,7 @@
     (-> (case (:type prop)
           :property kw-name
           :link     [kw-name (if (= '_ (:link-id prop))
-                               ''_
+                               '_
                                (:link-id prop))]
           :join     (let [target (:join-target prop)]
                       {kw-name


Added missing arglists entries.

Added missing arglists entries.

--- src/midje/checking/checkers/collection.clj
+++ src/midje/checking/checkers/collection.clj
@@ -114,7 +114,8 @@
   [1 2 3] => (has-prefix   [2 1]) ; false - order matters
   [1 2 3] => (has-prefix   [2 1] :in-any-order) ; true
   [1 2 3] => (has-prefix  #{2 1}) ; true "
-        :arglists '([expected-prefix looseness?])}
+        :arglists '([expected-prefix]
+                    [expected-prefix looseness?])}
     has-prefix
     (container-checker-maker 'has-prefix
       (has-xfix "prefix" #(re-pattern (str "^" %)) take)))
@@ -126,7 +127,8 @@
   [1 2 3] => (has-suffix   [3 2]) ; false - order matters
   [1 2 3] => (has-suffix   [3 2] :in-any-order) ; true
   [1 2 3] => (has-suffix  #{3 2}) ; true "
-         :arglists '([expected-suffix looseness?])}
+         :arglists '([expected-suffix]
+                     [expected-suffix looseness?])}
     has-suffix
     (container-checker-maker 'has-suffix
       (has-xfix "suffix" #(re-pattern (str % "$")) take-last)))
@@ -165,7 +167,8 @@
    [700 4 5] => (contains #{4 5 700})

 :gaps-ok can be used with a set. (So can :in-any-order, but it has no effect.)"
-    :arglists '([expected looseness])}
+    :arglists '([expected]
+                [expected looseness])}
     contains (container-checker-maker 'contains
                (fn [actual expected looseness]
                  (let [[actual expected looseness] (standardized-arguments actual expected looseness)]
@@ -193,7 +196,8 @@

   [1 3 2] => (just   [1 2 3] :in-any-order)
   [1 3 2] => (just  #{1 2 3})"
-         :arglists '([expected looseness])}
+         :arglists '([expected]
+                     [expected looseness])}
     just (container-checker-maker 'just
            (fn [actual expected looseness]
              (let [[actual expected looseness] (standardized-arguments actual expected looseness)]


Copy paste bug

Copy paste bug

--- src/onyx/log/commands/backpressure_off.clj
+++ src/onyx/log/commands/backpressure_off.clj
@@ -10,9 +10,7 @@
   [{:keys [args]} replica]
   (if (= :backpressure (get-in replica [:peer-state (:peer args)]))
     (assoc-in replica [:peer-state (:peer args)] :active)
-    replica)
-
-  (assoc-in replica [:peer-state (:peer args)] :active))
+    replica))

 (defmethod extensions/replica-diff :backpressure-off
   [{:keys [args]} old new]


Add syntax comment to multimethods example

--- src/test/clojure/examples/multimethods.clj
+++ src/test/clojure/examples/multimethods.clj
@@ -119,6 +119,7 @@
     (it "...but not its superclasses!"
       (not (isa? h java.util.Collection ::map)))))

+;; This syntax still needs some work.
 (describe "The global hierarchy"
   (using-once [_ (global-stub #'clojure.core/global-hierarchy (make-hierarchy))]
     (is-valid-hierarchy @#'clojure.core/global-hierarchy)


added been able

added been able

--- src/babel/english/lexicon-verbcoach.clj
+++ src/babel/english/lexicon-verbcoach.clj
@@ -236,7 +236,8 @@
                                             :3sing "was able"
                                             :1plur "were able"
                                             :2plur "were able"
-                                            :3plur "were able"}}}]
+                                            :3plur "were able"}
+                                            :past-participle "been able"}}}]
                [(unify common
                        {:modal-with :infinitive
                         :synsem {:cat :verb


Cleanup in handlers

Cleanup in handlers

--- src/cljs/haunting_refrain/handlers.cljs
+++ src/cljs/haunting_refrain/handlers.cljs
@@ -38,12 +38,6 @@
 (defn- url-to-page [[page-name {:keys [url]}]]
   [url page-name])

-(defn save-foursquare-token [db token]
-  ; save the token to local storage
-  (local-storage/save-foursquare-token! token)
-  ; Redirect the user and replace the URL
-  (redirect-home! (assoc-in db [:foursquare :token] token)))
-
 (defn url-route-handler [db _]
   "This handler gets called when the page first loads. It is intended to look at the URL
   the user is on and restore them to the proper state if necessary. This handler will be
@@ -56,7 +50,10 @@
     ;(inspect urlmap "urlmap")
     (cond
       (= (count foursquare-match) 2)
-        (save-foursquare-token db (second foursquare-match))
+        (let [token (second foursquare-match)]
+          ; save the token to local storage
+          (local-storage/save-foursquare-token! token)
+          (redirect-home! (assoc-in db [:foursquare :token] token)))
       selected-page
         (assoc-in db [:navigation :current-page] selected-page)
       (= path "")
@@ -85,12 +82,8 @@

 (defn foursquare-logout-handler [db [_]]
   "Called when the page starts on a foursquare callback URL."
+  (local-storage/save-foursquare-token! nil)
   (assoc-in db [:foursquare :token] nil))
-
-(defn localstorage-get-foursquare
-  "Called when a value for the foursquare toekn is found in localstorage"
-  [db [_ token]]
-  (assoc-in db [:foursquare :token] token))

 ;; Set up all event handlers and fire off initial events
 (defn init! [initial-state local-storage-keys]
@@ -110,19 +103,9 @@
     url-route-handler)

   (register-handler
-    :open-login-window
-    debug
-    open-login-handler)
-
-  (register-handler
     :redirect-to-foursquare
     debug
     redirect-to-foursquare)
-
-  (register-handler
-    :foursquare-got-token
-    debug
-    foursquare-token-handler)

   (register-handler
     :foursquare-logout
@@ -132,6 +115,4 @@
   ; Fire off the first event
   (dispatch [:initialize initial-state local-storage-keys])
   ; Set page state from URL
-  (dispatch [:route])
-
-)
+  (dispatch [:route]))


more clojuresque tuple handling

more clojuresque tuple handling

--- src/clojure/sparkling/destructuring.clj
+++ src/clojure/sparkling/destructuring.clj
@@ -1,12 +1,17 @@
 (ns sparkling.destructuring
   "Contains wrapper-functions to destructure scala/spark data structures"
-  (:refer-clojure :exclude [key])
+  (:refer-clojure :exclude [key first second])
   (:import [scala Tuple2 Tuple3]
            [com.google.common.base Optional]))

+(defn tuple [key value]
+  (Tuple2. key value))

 (defn key [^Tuple2 tuple] (._1 tuple))
 (defn value [^Tuple2 tuple] (._2 tuple))
+(def first key)
+(def second value)
+

 (defn first-value-fn [f]
   "Wraps a function f so that when the wrapped function is called on a tuple2, f is called with the second element from that tuple."


added set-title! method to launch and updated partial and event listeners

--- src/app/cljs/one/sample/view/editor.cljs
+++ src/app/cljs/one/sample/view/editor.cljs
@@ -12,6 +12,7 @@

 (def CHANGE goog.editor.Field.EventType.DELAYEDCHANGE)
 (def CLICK  goog.events.EventType.CLICK)
+(def BLUR   goog.events.EventType.BLUR)

 (defn- strip-html [s]
   (-> s
@@ -47,30 +48,33 @@
 (declare list-documents)

 (defn launch [element doc-session]
-  (let [field     (spawn-editor element)
-        content   (doc-session :get :content)
-        new       ($ "button#new")
-        title     ($ "#star-title span#title")
-        set-title! (fn [t]
-                     (doc-session :set! :title))
-        set-html! (fn [content] (.setHtml field false (or content "") true))]
+  (let [field      (spawn-editor element)
+        content    (doc-session :get :content)
+        title      (doc-session :get :title)
+        $new       ($ "button#new")
+        $title     ($ "#star-title span#title")
+        set-title! (fn [t] (set! (.-innerHTML $title) t))
+        set-html!  (fn [content] (.setHtml field false (or content "") true))]
     (do
+      (set-title! (or title (excerpt content 20)))
       (set-html! content)
+      (list-documents @docs)
       (.makeEditable field)
       (.focus element))
     (event/listen field
                   CHANGE
                   (fn [e] (doc-session :set! :content (.getCleanContents field))))
-    (event/listen new
+    (event/listen $new
                   CLICK
                   (fn [e]
                     (append! ($ "#content") (detach! ($ "#workspace")))
                     (dispatch/fire :document-requested)))
-    (event/listen title
-                  CLICK
-                  (fn [e] (.setAttribute title "contenteditable" true)))))
+    (event/listen $title
+                  BLUR
+                  (fn [e]
+                    (doc-session :set! :title (.-innerHTML $title))))))

-(defn- add-item-listeners []
+(defn- add-item-listeners! []
   (let [items (nodes ($ "#sidebar-documents > ol > li"))]
     (doseq [item items]
       (event/listen ($ "a.bookmark" item)
@@ -82,10 +86,10 @@
                       (dispatch/fire :document-requested
                                      (.getAttribute item "docid")))))))

-(defpartial document-list-item [{:keys [id content ts]}]
+(defpartial document-list-item [{:keys [id content ts title]}]
   [:li {:docid (name id)}
    [:div.excerpt
-    [:span (excerpt content 20)]]
+    [:span (or title (excerpt content 20))]]
    [:div.document-id
     [:span [:a.bookmark {:href (str \# (name id))}
             (.toString (js/Date. ts))]]]])


handle application exit using new ScriptInterface call

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

--- plugins/DataBrowser/src/org/micromanager/browser/core.clj
+++ plugins/DataBrowser/src/org/micromanager/browser/core.clj
@@ -520,6 +520,12 @@
             "New..." (create-new-collection)
             (awt-event (apply-data-and-settings item (load-data-and-settings item))))
           (save-data-and-settings item (get-current-data-and-settings)))))))
+
+(defn handle-exit []
+  (println "Shutting down Data Browser.")
+  (close-window (@browser :frame))
+  (close-window (@settings-window :frame))
+  true)

 (defn create-browser []
   (let [frame (JFrame.)
@@ -580,6 +586,7 @@
   (read-collection-map)
   (reset! settings-window (create-settings-window))
   (reset! browser (create-browser))
+  (.addExitHandler gui handle-exit)
   (set-browser-status "Idle")
   (start-scanning-thread)
   (start-reading-thread)


cleanup

cleanup

--- src/clj/rksm/cloxp_cljs/ns/internals.clj
+++ src/clj/rksm/cloxp_cljs/ns/internals.clj
@@ -122,6 +122,11 @@
     (assoc base :ns ns :name name)))

 ; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+(defn symbol-info-for-macro
+  [ns-name name]
+  (some-> (ns-interns ns-name) (get name) meta))
+
 (defn symbol-info-for-sym
   "find what we know about symbol in a given namespace. This is *not* asking
   for the meta data of a var, rather looking up what symbol is bound to what
@@ -150,38 +155,12 @@
             (symbol-info-for-macro macro-ns sym-name)
             (analyzed-data-of-def qname file)))))))

-(defn symbol-info-for-sym
-  "find what we know about symbol in a given namespace. This is *not* asking
-  for the meta data of a var, rather looking up what symbol is bound to what
-  thing in a given namespaces"
-  [ns-name sym & [file]]
-  (let [cenv (:compiler-env (ensure-default-cljs-env))
-        lenv (assoc (ana/empty-env) :ns ns-name)
-        sym-name (symbol (name sym))]
-    (if-let [ns-data (some-> cenv deref :cljs.analyzer/namespaces)]
-      (if-let [source-ns-data (get ns-data ns-name)]
-        (let [sym-ns (or
-                      (some-> sym namespace symbol)
-                      (if (cljs.env/with-compiler-env cenv
-                            (ana/core-name? lenv sym-name)) 'cljs.core))
-              macro-ns (or
-                        (some-> source-ns-data :require-macros (get sym-ns))
-                        (some-> source-ns-data :use-macros (get sym-name)))
-              full-sym-ns (or (some-> source-ns-data :requires (get sym-ns))
-                              (some-> source-ns-data :uses (get sym-name))
-                              sym-ns)
-              qname (if full-sym-ns
-                      (symbol (str (or full-sym-ns sym-ns)) (str sym-name))
-                      sym-name)]
-          (if macro-ns
-            (symbol-info-for-macro macro-ns sym-name)
-            (analyzed-data-of-def qname file)))))))
-
 ; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

 (defn namespace-info
   [ns-name & [file]]
   (let [file (or file (fm/find-file-for-ns-on-cp ns-name))]
+    (class (:compiler-env (ensure-default-cljs-env)))
     (if-let [data (env/with-compiler-env (:compiler-env (ensure-default-cljs-env))
                                          (do
                                            (if file


bugfix

bugfix

--- src/cljs/re_form/inputs/select_impl.cljs
+++ src/cljs/re_form/inputs/select_impl.cljs
@@ -61,18 +61,18 @@
      :position :relative
      :z-index 1000
      :left (u/px 0)
-     :bottom (u/px- 1) #_(u/px+ 10 (+ 16 (* h 1.5)))
+     :bottom (u/px- 2) #_(u/px+ 10 (+ 16 (* h 1.5)))
      :padding [[0 (u/px w)]]
      :border-radius (u/px radius)
      :line-height (u/px* h3)}
     [:&.re-invisible
      {:display :none :position :absolute}]]
    [:.options
-    {:position :relative
+    {:position :absolute
      :background-color "white"
      :z-index 1000
      :left (u/px 0)
-     :bottom (u/px- 1) #_(u/px+ 10 (* 2 (+ 16 (* h 1.5))))
+     :top (u/px 72) #_(u/px+ 10 (* 2 (+ 16 (* h 1.5))))
      :width "100%"
      :display "inline-block"
      :box-shadow "1px 1px 2px #ccc"
@@ -80,7 +80,8 @@
      :overflow-y :auto
      :border "1px solid #ddd"}
     [:&.no-input
-     {:top (u/px+ 10 (+ 16 (* h 1.5)))}]
+     {:top (u/px+ 10 (+ 16 (* h 1.5)))
+      :bottom :unset}]
     [:.no-results
      {:text-align :center
       :padding (u/px 10)
@@ -192,7 +193,8 @@
      {:component-did-mount
       (fn [this]
         (swap! nodes assoc :root-node (r/dom-node this))
-        (.addEventListener (:input @nodes) "keydown" arrow-handler)
+        (when-let [i (:input @nodes)]
+          (.addEventListener i "keydown" arrow-handler))
         (.addEventListener (:focus-node @nodes) "keydown" outer-key-handler)
         (.addEventListener js/document "click" doc-click-listener)
         (when-let [focus-node (and (:auto-focus props) (:focus-node @nodes))]
@@ -200,7 +202,8 @@

       :component-will-unmount
       (fn [this]
-        (.removeEventListener (:input @nodes) "keydown" arrow-handler)
+        (when-let [i (:input @nodes)]
+          (.removeEventListener i "keydown" arrow-handler))
         (.removeEventListener (:focus-node @nodes) "keydown" outer-key-handler)
         (.removeEventListener js/document "click" doc-click-listener))


Added :none option for :autoconstructive-diversification-test

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -1,3 +1,6 @@
+;; gorilla-repl.fileformat = 1
+
+;; @@
 (ns clojush.pushgp.genetic-operators
   (:use [clojush util random individual globals interpreter translate pushstate]
         clojush.instructions.tag
@@ -632,7 +635,8 @@
      :size-and-instruction size-and-instruction-diversifying?
      :three-gens-size-and-instruction three-gens-size-and-instruction-diversifying?
      :diffmeans diffmeans-diversifying?
-     :no-clones no-clones-diversifying?)
+     :no-clones no-clones-diversifying?
+     :none (fn [genome argmap] true))
     g
     argmap))

@@ -744,3 +748,5 @@

+
+;; @@


fix non-map arg indentation

fix non-map arg indentation

--- src/com/billpiel/sayid/string_output.clj
+++ src/com/billpiel/sayid/string_output.clj
@@ -178,18 +178,17 @@
 (defn args-map-str
   [tree]
   (binding [*truncate-lines-count* *max-arg-lines*]
-    (when-let [arg-map-ref (:arg-map tree)]
-      (let [arg-map arg-map-ref]
-        (indent-map tree arg-map)))))
+    (when-let [arg-map (:arg-map tree)]
+      (indent-map tree arg-map))))

 (defn args-str
   [tree]
   (when-let [args (:args tree)]
-    (indent-line-breaks (clojure.string/join "\n"
-                                             (map pprint-str
-                                                  args))
-                        (:depth tree)
-                        :end "   ")))
+    (->> args
+         (map #(multi-line-indent-MZ :value %
+                                     :indent-base (:depth tree)
+                                     :indent-offset 3))
+         vec)))

 (defn args*-str
   [tree]


Fix rules with zoom (#4)

Fix rules with zoom (#4)

--- src/uxbox/ui/workspace/rules.cljs
+++ src/uxbox/ui/workspace/rules.cljs
@@ -33,7 +33,7 @@
   [zoom acc value]
   (let [big-ticks-mod (big-ticks-mod zoom)
         mid-ticks-mod (mid-ticks-mod zoom)
-        pos (+ value
+        pos (+ (* value zoom)
                rule-padding
                (* wb/canvas-start-x zoom)
                wb/canvas-scroll-padding)]
@@ -51,7 +51,7 @@
   [zoom acc value]
   (let [big-ticks-mod (big-ticks-mod zoom)
         mid-ticks-mod (mid-ticks-mod zoom)
-        pos (+ value
+        pos (+ (* value zoom)
                (* wb/canvas-start-x zoom)
                wb/canvas-scroll-padding)]
     (cond
@@ -69,7 +69,7 @@
 (defn- horizontal-text-label
   [zoom value]
   (let [big-ticks-mod (big-ticks-mod zoom)
-        pos (+ value
+        pos (+ (* value zoom)
                rule-padding
                (* wb/canvas-start-x zoom)
                wb/canvas-scroll-padding)]
@@ -87,7 +87,7 @@
 (defn- vertical-text-label
   [zoom value]
   (let [big-ticks-mod (big-ticks-mod zoom)
-        pos (+ value
+        pos (+ (* value zoom)
                (* wb/canvas-start-x zoom)
                ;; wb/canvas-start-x
                wb/canvas-scroll-padding)]


Better output on failed test cases

Better output on failed test cases

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

--- src/conexp/contrib/tests/algorithms.clj
+++ src/conexp/contrib/tests/algorithms.clj
@@ -48,6 +48,8 @@
           base-2 (cm/canonical-base ctx)]
       (if-not (= base-1 base-2)
         (do (println "canonical-base returned different result for\n" ctx)
+            (println base-1)
+            (println base-2)
             (is false))
         (is true)))))


Removed another bottleneck in `scale-mv-context'

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

--- src/conexp/fca/many_valued_contexts.clj
+++ src/conexp/fca/many_valued_contexts.clj
@@ -171,18 +171,19 @@
      (scale-mv-context mv-ctx scales #(illegal-argument "No scale given for attribute " % ".")))
   ([mv-ctx scales default]
      (assert (map? scales))
-     (let [scales (into scales (for [m (difference (attributes mv-ctx)
-                                                   (set (keys scales)))]
-                                 [m (default m)])),
+     (let [scale  (fn [m]
+                    (if (contains? scales m)
+                      (scales m)
+                      (default m)))
            inz    (incidence mv-ctx),
            objs   (objects mv-ctx),
            atts   (set-of [m n] [m (attributes mv-ctx)
-                                 n (attributes (scales m))])]
+                                 n (attributes (scale m))])]
        (make-context-nc objs
                         atts
                         (fn [[g [m n]]]
                           (let [w (inz [g m])]
-                            ((incidence (scales m)) [w n])))))))
+                            ((incidence (scale m)) [w n])))))))

 (defn nominal-scale
   "Returns the nominal scale on the set base."


Reformat day8.re-frame-10x.utils.re-com ns

--- src/day8/re_frame_10x/utils/re_com.cljs
+++ src/day8/re_frame_10x/utils/re_com.cljs
@@ -84,17 +84,17 @@
    Regex101 testing: ^(initial|auto|none)|(\\d+)(px|%|em)|(\\d+)\\w(\\d+)\\w(.*) - remove double backslashes"
   [size]
   ;; TODO: Could make initial/auto/none into keywords???
-  (let [split-size      (string/split (string/trim size) #"\s+")                  ;; Split into words separated by whitespace
+  (let [split-size      (string/split (string/trim size) #"\s+") ;; Split into words separated by whitespace
         split-count     (count split-size)
         _               (assert (contains? #{1 3} split-count) "Must pass either 1 or 3 words to flex-child-style")
-        size-only       (when (= split-count 1) (first split-size))         ;; Contains value when only one word passed (e.g. auto, 60px)
+        size-only       (when (= split-count 1) (first split-size)) ;; Contains value when only one word passed (e.g. auto, 60px)
         split-size-only (when size-only (string/split size-only #"(\d+)(.*)")) ;; Split into number + string
-        [_ num units] (when size-only split-size-only)                    ;; grab number and units
-        pass-through?   (nil? num)                                          ;; If we can't split, then we'll pass this straign through
-        grow-ratio?     (or (= units "%") (= units "") (nil? units))        ;; Determine case for using grow ratio
-        grow            (if grow-ratio? num "0")                            ;; Set grow based on percent or integer, otherwise no grow
-        shrink          (if grow-ratio? "1" "0")                            ;; If grow set, then set shrink to even shrinkage as well
-        basis           (if grow-ratio? "0px" size)                         ;; If grow set, then even growing, otherwise set basis size to the passed in size (e.g. 100px, 5em)
+        [_ num units] (when size-only split-size-only)      ;; grab number and units
+        pass-through?   (nil? num)                          ;; If we can't split, then we'll pass this straign through
+        grow-ratio?     (or (= units "%") (= units "") (nil? units)) ;; Determine case for using grow ratio
+        grow            (if grow-ratio? num "0")            ;; Set grow based on percent or integer, otherwise no grow
+        shrink          (if grow-ratio? "1" "0")            ;; If grow set, then set shrink to even shrinkage as well
+        basis           (if grow-ratio? "0px" size)         ;; If grow set, then even growing, otherwise set basis size to the passed in size (e.g. 100px, 5em)
         flex            (if (and size-only (not pass-through?))
                           (str grow " " shrink " " basis)
                           size)]
@@ -306,7 +306,7 @@
 (defn- input-text-base
   "Returns markup for a basic text input label"
   [& {:keys [model input-type] :as args}]
-  (let [external-model (reagent/atom (deref-or-value model))  ;; Holds the last known external value of model, to detect external model changes
+  (let [external-model (reagent/atom (deref-or-value model)) ;; Holds the last known external value of model, to detect external model changes
         internal-model (reagent/atom (if (nil? @external-model) "" @external-model))] ;; Create a new atom from the model to be used internally (avoid nil)
     (fn
       [& {:keys [model on-change on-submit status status-icon? status-tooltip placeholder width height rows change-on-blur? validation-regex disabled? class style attr]
@@ -515,16 +515,16 @@
 (defn hyperlink-info
   [url]
   [hyperlink-href
-   :label  [box
-            :class   "container--info-button"
-            :justify :center
-            :align   :center
-            :child [:span {:style {:font-size   "11px"
-                                   :font-weight "bold"}}
-                    "?"]]
-   :attr   {:rel "noopener noreferrer"}
+   :label [box
+           :class "container--info-button"
+           :justify :center
+           :align :center
+           :child [:span {:style {:font-size   "11px"
+                                  :font-weight "bold"}}
+                   "?"]]
+   :attr {:rel "noopener noreferrer"}
    :target "_blank"
-   :href   url])
+   :href url])

 (defn link [{:keys [label href style]}]
@@ -578,26 +578,26 @@
           :or   {div-size 16 font-size 16 color "#ccc" hover-color "#999"}}]
       [box
        :class "rc-close-button noselect"
-       :style {:display          "inline-block"
-               :position         "relative"
-               :width            (px div-size)
-               :height           (px div-size)}
+       :style {:display  "inline-block"
+               :position "relative"
+               :width    (px div-size)
+               :height   (px div-size)}
        :child [box
                :style (merge
                         {:position  "absolute"
                          :cursor    "pointer"
                          :font-size (px font-size)
                          :color     (if @over? hover-color color)
-                         :top       (px (- (/ (- font-size div-size) 2) top-offset)  :negative)
+                         :top       (px (- (/ (- font-size div-size) 2) top-offset) :negative)
                          :left      (px (- (/ (- font-size div-size) 2) left-offset) :negative)}
                         style)
-               :attr  (merge
-                        {:title          tooltip
-                         :on-click       (handler-fn (on-click)
-                                                     (.stopPropagation event))
-                         :on-mouse-enter (handler-fn (reset! over? true))
-                         :on-mouse-leave (handler-fn (reset! over? false))}
-                        attr)
+               :attr (merge
+                       {:title          tooltip
+                        :on-click       (handler-fn (on-click)
+                                                    (.stopPropagation event))
+                        :on-mouse-enter (handler-fn (reset! over? true))
+                        :on-mouse-leave (handler-fn (reset! over? false))}
+                       attr)
                ;:child [:i {:class "zmdi zmdi-hc-fw-rc zmdi zmdi-close"}]
                :child [:span "×"]]])))


break tree formation and calculation into separate methods

--- src/bracketolojy/tournament.clj
+++ src/bracketolojy/tournament.clj
@@ -49,6 +49,28 @@
   [bracket tournament-teams]
   (walk/postwalk-replace
     tournament-teams
+    bracket))
+
+(defn- treeify-dispatch [node]
+  (cond
+    (and (coll? node) (= (count node) 2) (map? (first node)) (map? (last node)))
+    :branch
+
+    (and (map? node) (not (contains? node :upper)) (not (contains? node :lower)))
+    :leaf))
+
+(defmulti #^{:private true} treeify
+  treeify-dispatch)
+(defmethod treeify :default [node]
+  node)
+(defmethod treeify :branch [[upper lower]]
+  {:upper upper :lower lower})
+(defmethod treeify :leaf [node]
+  {:data {:teams (list node)} :upper nil :lower nil})
+
+(defn ->tournament-tree [bracket]
+  (walk/postwalk
+    treeify
     bracket))

 (defmulti #^{:private true} compute-matchup
@@ -152,7 +174,4 @@
     (->tournament-bracket
       bracket
       (->tournament-teams team-data))
-    (tournament-probabilities
-      pick-scoring
-      upset-scoring)
-    compute-expected-value))+    ->tournament-tree))


Made data-folder default path logic Windows compatible

--- taxi-rides-clj/src/taxi_rides_clj/core.clj
+++ taxi-rides-clj/src/taxi_rides_clj/core.clj
@@ -17,14 +17,19 @@
 (defmacro my-println-f [& forms]
   `(my-println ~'file ": " ~@forms))

-(def data-folder (str (u/getenv "TAXI_DATA_FOLDER" "/home/wrecked/projects/taxi-rides/data") "/"))
-(defn find-files [re] (->> data-folder io/file file-seq (filter #(re-find re (.getName ^java.io.File %))) sort))
+(let [default (if (-> "os.name" System/getProperty (subs 0 7) (= "Windows"))
+                "C:/nikon/projects/clojure/nyc-taxi-data/data"
+                "/home/wrecked/projects/taxi-rides/data")]
+  (defn data-folder
+    ([]  (data-folder ""))
+    ([f] (str (u/getenv "TAXI_DATA_FOLDER" default) "/" f))))
+
+(defn find-files [re] (->> (data-folder) io/file file-seq (filter #(re-find re (.getName ^java.io.File %))) sort))

 (let [mapping (into {"date" :keyword} (zipmap ["prcp" "snwd" "snow" "tmax" "tmin" "awnd"] (repeat :float)))
       mapping (into {} (for [[k v] mapping] [(keyword k) [v (keyword (str "weather-" k))]]))
-      fname   (str data-folder "central_park_weather.csv")
       avg-wind-fix (fn [row] (update row :weather-awnd #(if-not (neg? %) %)))]
-  (u/read-csv-with-mapping :csv fname mapping
+  (u/read-csv-with-mapping :csv "central_park_weather.csv" mapping
     (def weather
       (->> (for [row rows]
                [(:weather-date row)
@@ -147,12 +152,12 @@
             drop-extra-fields))))

 (comment
-  (let [file (->> "yellow_tripdata_2010-02.csv.gz" (str data-folder))]
+  (let [file (data-folder "yellow_tripdata_2010-02.csv.gz")]
     (with-open [in (-> file clojure.java.io/input-stream java.util.zip.GZIPInputStream.)]
       (->> in io/reader line-seq (take 4)))))

 (comment
-  (let [file (->> "yellow_tripdata_2010-02.csv.gz" (str data-folder))]
+  (let [file (data-folder "yellow_tripdata_2010-02.csv.gz")]
     (u/read-csv-with-mapping :gz file csv-mapping
       (->> (rows->docs file rows) (take 3) clojure.pprint/pprint))))

@@ -183,7 +188,7 @@
           (my-println-f (str "finished, " @n-docs " rows"))
           {:generated @n-docs})))))

-;(extract-to-csv (str data-folder "green_tripdata_2013-08.csv.gz"))
+;(extract-to-csv (data-folder "green_tripdata_2013-08.csv.gz"))
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (def es-types
@@ -258,7 +263,7 @@
     (u/my-println "Started!")
     (create-taxicab-template)
     (do (->> (string/replace file #".+/" "")
-             (str data-folder)
+             (data-folder)
              ((main-funs f-name))
              (cp/upfor (Integer. ^String n-parallel) [file files])
              doall


removed benchmark

removed benchmark

--- src/clj/forma/trends/filter.clj
+++ src/clj/forma/trends/filter.clj
@@ -23,12 +23,7 @@
   the data in the supplied time series `ts`

   Example:
-    (deseasonalize 23 ndvi)
-
-  Benchmark:
-    (let [v (s/sample-normal 200)]
-      (time (dotimes [_ 150] (deseasonalize 23 v))))
-    ;;=> Elapsed time: 281.299262 msecs"
+    (deseasonalize 23 ndvi)"
   [freq ts]
   (let [x (dummy-mat freq (i/nrow ts))
         xt (i/trans x)


Split rendering of cards in 2

Split rendering of cards in 2

--- src/cljs/clojure_rest/core.cljs
+++ src/cljs/clojure_rest/core.cljs
@@ -110,44 +110,48 @@

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(def-multi-reducer app-reducer
-  ; TODO - Try to use multi-methods instead
-  {:on-add-card (fn [store _] (js/alert "TODO") store)
-   :on-toggle-all (fn [store _] (toggle-all-cards store))
-   :on-toggle-card (fn [store card-id]
-                     (update-in store [card-id :show-details] not))
-   :on-remove-task (fn [store card-id task-id]
-                     (update-in store [card-id] api/remove-task-at task-id))
-   :on-check-task (fn [store card-id task-id]
+(def-multi-reducer
+  app-reducer
+ {; TODO - Add method for initialize
+  :on-add-card (fn [store _] (js/alert "TODO") store)
+  :on-toggle-all (fn [store _] (toggle-all-cards store))
+  :on-toggle-card (fn [store card-id]
+                    (update-in store [card-id :show-details] not))
+  :on-remove-task (fn [store card-id task-id]
+                    (update-in store [card-id] api/remove-task-at task-id))
+  :on-check-task (fn [store card-id task-id]
                     (update-in store [card-id :tasks task-id :done] not))
-   :on-add-task (fn [store card-id task]
-                  (update-in store [card-id] api/add-task task))
-   :on-card-drop (fn [cards card-id status]
-                   (assoc-in cards [card-id :status] status))
-   })
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+  :on-add-task (fn [store card-id task]
+                 (update-in store [card-id] api/add-task task))
+  :on-card-drop (fn [cards card-id status]
+                  (assoc-in cards [card-id :status] status))
+  })
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn render-card-detail
+  "[Pure] Render the details of a card (description and tasks)"
+  [dispatch {:keys [card-id description show-details tasks]}]
+  [:div.card__details
+   (when-not show-details {:style {:display "none"}})
+   description
+   [render-tasks tasks #(dispatch :on-remove-task card-id %)
+                       #(dispatch :on-check-task card-id %)]
+   [render-add-task #(dispatch :on-add-task card-id %)]
+  ])

 (defn render-card
-  "[Pure] Render a card"
+  "[Pure] Render a card"
   [dispatch]
-  (fn [{:keys [card-id title description show-details tasks]
-        :as card}]
+  (fn [{:keys [card-id title show-details] :as card}]
     (let [title-style (if show-details :div.card__title--is-open :div.card__title)]
       [:div.card
-       {:draggable true
-        :onDragStart #(utils/set-transfer-data % :card-id card-id)}
+       {:draggable true :onDragStart #(utils/set-transfer-data % :card-id card-id)}
        [:div {:style (card-side-color card)}]
        [title-style {:on-click #(dispatch :on-toggle-card card-id)} title]
-       [:div.card__details
-        (when-not show-details {:style {:display "none"}})
-        description
-        [render-tasks tasks
-         #(dispatch :on-remove-task card-id %)
-         #(dispatch :on-check-task card-id %)]
-        [render-add-task #(dispatch :on-add-task card-id %)]
-      ]]
-  )))
+       [render-card-detail dispatch card]
+      ])
+    ))

 (defn render-column
   "[Pure] Render a column holding a set of cards"


Add support for some default attributes for View

--- src/clojure/neko/ui/mapping.clj
+++ src/clojure/neko/ui/mapping.clj
@@ -17,14 +17,18 @@
   (:use [neko.-utils :only [keyword->static-field reflect-field]])
   (:import [android.widget LinearLayout Button EditText ListView]
            android.app.ProgressDialog
-           [android.view ViewGroup$LayoutParams]))
+           [android.view View ViewGroup$LayoutParams]))

 ;; This atom keeps all the relations inside the map.
 (def ^{:private true} keyword-mapping
   (atom
    ;; UI widgets
    {:view {:traits [:def :layout-params :text :on-click :on-long-click :on-touch
-                    :on-create-context-menu :on-key :id :padding]}
+                    :on-create-context-menu :on-key :id :padding]
+           :value-namespaces
+           {:text-alignment View
+            :text-direction View
+            :visibility View}}
     :view-group {:inherits :view
                  :traits [:container :id-holder]}
     :button {:classname android.widget.Button


Working with lazy seqs, timing code execution

--- Clojure-Core/clojure_core.clj
+++ Clojure-Core/clojure_core.clj
@@ -400,7 +400,7 @@

 (defn metal-fan-details
   [social-security-number]
-  (Thread/sleep 1000)
+  ;; (Thread/sleep 1000)
   (get concert-audience social-security-number))

 (defn polka-enthusiast?
@@ -419,4 +419,44 @@
 ; => "Elapsed time: 1005.303124 msecs"
 ; => {:has-tattoos? false, :plays-accordian? false, :name "Angus Lars Anthrax"}

+;; Here, we haven't technically accessed the mapped element, so this
+;; should almost immediately return a value:
+(time (def mapped-metal-fan-details (map metal-fan-details (range 0 1000000))))
+; => "Elapsed time: 0.09592 msecs"
+; => #'user/mapped-metal-fan-details
+
+;; What just happened?
+;; Well, 'range returns a lazy seq consisting of the integers from 0 to 999,999.
+;; Then, map returns a lazy seq that is associated with the name
+;; mapped-metal-fan-details. Because map didn't actually apply metal-fan-details
+;; to any of the elements returned by range' the operation is near instant.
+
+;; This illustrates a truth about lazy seqs, that they are made up of two parts:
+;; (1) - the 'recipe' for how to realize the elements of a sequence, and
+;; (2) - the elements that have been realized so far
+
+;; In our example above, mapped-metal-fan-details is unrealized. Now, let's
+;; realize mapped-metal-fan-details by accessing one of its members.
+
+(time (first mapped-metal-fan-details))
+; => "Elapsed time: 32131.590707 msecs"
+; => {:has-tattoos? false, :plays-accordian? false, :name "Angus Lars Anthrax"}
+
+;; Why did it take 32 seconds, rather than 1 second?
+;; 'Clojure chunks its lazy sequences, which just means that whenever
+;; Clojure has to realize an element, it preemptively realizes some of the next
+;; elements as well. In this example, you wanted only the very first element
+;; of mapped-metal-fan-details, but Clojure went ahead and prepared the next 31
+;; as well. Clojure does this because it almost always results in better
+;; performance.'
+
+
+;; Now, let's call it again:
+(time (first mapped-metal-fan-details))
+; => "Elapsed time: 0.174635 msecs"
+; => {:has-tattoos? false, :plays-accordian? false, :name "Angus Lars Anthrax"}
+
+;; Wow! The second time we access the first element of mapped-metal-fan-details
+;; it's almost immediate.
+
 (time (identify-polka-enthusiast (range 0 1000000)))


use most recent boot-cljs

use most recent boot-cljs

--- resources/leiningen/new/tenzing/build.boot
+++ resources/leiningen/new/tenzing/build.boot
@@ -1,7 +1,7 @@
 (set-env!
  :source-paths    {{{source-paths}}}
  :resource-paths  #{"resources"}
- :dependencies '[[adzerk/boot-cljs      "0.0-2411-5" :scope "test"]
+ :dependencies '[[adzerk/boot-cljs      "0.0-2411-7" :scope "test"]
                  [adzerk/boot-cljs-repl "0.1.7"      :scope "test"]
                  [adzerk/boot-reload    "0.2.0"      :scope "test"]{{{deps}}}])


Turns down iterations for apply fn tests.

--- test/onyx/generative/apply_fn_gen_test.clj
+++ test/onyx/generative/apply_fn_gen_test.clj
@@ -21,7 +21,7 @@
 (deftest singe-segment-return
   (checking
    "A single returned segment attaches to its root"
-   (times 50)
+   (times 30)
    [input (gen-segment)
     output (segment-map)]
    (let [f (fn [segment] output)
@@ -34,7 +34,7 @@
 (deftest multi-segment-return
   (checking
    "Multiple segments can be returned, attached to their root"
-   (times 50)
+   (times 30)
    [input (gen-segment)
     output (gen/vector (segment-map))]
    (let [f (fn [segment] output)
@@ -47,7 +47,7 @@
 (deftest multi-batch-size-single-rets
   (checking
    "It generalizes with a bigger batch size for single returns"
-   (times 50)
+   (times 30)
    ;; Uses a unique mapping of keys to values to look up an
    ;; input for an output with no collisions.
    [input (gen/vector (gen/hash-map
@@ -69,7 +69,7 @@
 (deftest parameterized-functions
   (checking
    "Functions can be parameterized via the event map"
-   (times 50)
+   (times 30)
    [input (gen/vector (gen-segment))
     params (gen/vector (gen/resize 10 gen/any))]
    (let [f (fn [& args] {:result (or (butlast args) [])})
@@ -81,7 +81,7 @@
 (deftest throws-exception
   (checking
    "Functions that throw exceptions pass the exception object back"
-   (times 50)
+   (times 30)
    [input (gen/vector (gen-segment))]
    (let [f (fn [segment] (throw (ex-info "exception" {:val 42})))
          event {:onyx.core/batch input}
@@ -95,7 +95,7 @@
 (deftest bulk-functions
   (checking
    "Bulk functions call the function, but always return their inputs"
-   (times 50)
+   (times 30)
    [input (gen/not-empty (gen/vector (gen-segment)))
     output (gen/resize 10 gen/any)]
    (let [called? (atom false)


CMR-4369 - Fixed test for latest revision and added new one.

--- system-int-test/test/cmr/system_int_test/search/variable/concept_retrieval_test.clj
+++ system-int-test/test/cmr/system_int_test/search/variable/concept_retrieval_test.clj
@@ -30,7 +30,7 @@
 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(deftest retrieve-variable-by-concept-id
+(deftest retrieve-variable-by-concept-id-any-accept-header
   (let [var1-name "variable1"
         var1-v1 (variable/ingest-variable-with-attrs {:Name var1-name})
         del-var (variable/ingest-variable-with-attrs {:Name "deleted-variable"})
@@ -53,14 +53,6 @@
         (is (= [(format "Concept with concept-id [%s] could not be found."
                         (:concept-id del-var))]
                errors))))
-    (testing "retrieval by variable concept-id returns the latest revision."
-      (let [response (search/retrieve-concept
-                       (:concept-id var1-v1)
-                       nil
-                       {:accept mt/any
-                        :headers {transmit-config/token-header user1-token}})]
-        (is (= var1-name
-               (:Name (json/parse-string (:body response) true))))))
     (let [var1-name-new "variable1-new"
           var1-v2 (variable/ingest-variable-with-attrs
                    {:Name var1-name-new
@@ -70,22 +62,30 @@
         (is (= 2
                (inc (:revision-id var1-v1))
                (:revision-id var1-v2))))
-      (testing (str "retrieval by variable concept-id and revision-id returns "
+      (let [response (search/retrieve-concept
+                     (:concept-id var1-v1)
+                     nil
+                     {:accept mt/any
+                      :headers {transmit-config/token-header user1-token}})
+            response-v1 (search/retrieve-concept
+                         (:concept-id var1-v1)
+                         1
+                         {:accept mt/any
+                          :headers {transmit-config/token-header user1-token}})
+            response-v2 (search/retrieve-concept
+                         (:concept-id var1-v1)
+                         2
+                         {:accept mt/any
+                          :headers {transmit-config/token-header user1-token}})]
+          (testing "retrieval by variable concept-id returns the latest revision."
+            (is (= var1-name-new
+                   (:Name (json/parse-string (:body response) true)))))
+          (testing (str "retrieval by variable concept-id and revision-id returns "
                     "the specified variable")
-        (let [response-v1 (search/retrieve-concept
-                           (:concept-id var1-v1)
-                           1
-                           {:accept mt/any
-                            :headers {transmit-config/token-header user1-token}})
-              response-v2 (search/retrieve-concept
-                           (:concept-id var1-v1)
-                           2
-                           {:accept mt/any
-                            :headers {transmit-config/token-header user1-token}})]
-          (is (= var1-name
-                 (:Name (json/parse-string (:body response-v1) true))))
-          (is (= var1-name-new
-                 (:Name (json/parse-string (:body response-v2) true)))))))
+            (is (= var1-name
+                   (:Name (json/parse-string (:body response-v1) true))))
+            (is (= var1-name-new
+                   (:Name (json/parse-string (:body response-v2) true)))))))
     (testing "retrieval by variable concept-id and incorrect revision-id returns error"
       (let [no-rev 10000
             {:keys [status errors]} (search/get-search-failure-xml-data
@@ -100,4 +100,20 @@
                              "does not exist.")
                         (:concept-id var1-v1)
                         no-rev)]
+               errors))))
+    (testing "retrieval by non-existent variable and revision returns error"
+      (let [no-var "V404404404-PROV1"
+            no-rev 10000
+            {:keys [status errors]} (search/get-search-failure-xml-data
+                                     (search/retrieve-concept
+                                      no-var
+                                      no-rev
+                                      {:accept mt/any
+                                       :throw-exceptions true
+                                       :headers {transmit-config/token-header user1-token}}))]
+        (is (= 404 status))
+        (is (= [(format (str "Concept with concept-id [%s] and revision-id [%s] "
+                             "does not exist.")
+                        no-var
+                        no-rev)]
                errors))))))


updating copyright

updating copyright

--- src/anyviz/views.clj
+++ src/anyviz/views.clj
@@ -31,7 +31,7 @@

 (defn common-footer []
   [:div#footer.footer
-    [:div.text-muted "Copyright © 2014 " @g/company-name ". All Rights Reserved"]])
+    [:div.text-muted "Copyright © 2015 " @g/company-name ". All Rights Reserved"]])

 (def match-operators ["=","!=","<","<=",">",">="])
 (def group-times ["year","month","day","hour","minute"])


修复bug

修复bug

--- src/learnclojure/pop_lib/korma_mysql.clj
+++ src/learnclojure/pop_lib/korma_mysql.clj
@@ -6,7 +6,7 @@
        (mysql {:db "test?useSSL=false" :host "localhost" :port "3306" :user "root" :password "123456"}))
 (defentity user
            (table :user)
-           (database test))
+           (database mysql-db))
 (defn save-user! []
   (insert user
           (values {:age 28, :name "jjzi", :sex 1})))


move log/warn to where it can be more informative

--- src/babel/parse.cljc
+++ src/babel/parse.cljc
@@ -144,7 +144,13 @@
            (string? input)
            (do
              (log/info (str "parsing input: '" input "'"))
-             (parse (filter #(not (empty? %)) (string/split input tokenizer)) model original-input))
+             ;; tokenize input (more than one tokenization is possible), and parse each tokenization.
+             (let [tokenizations (filter #(not (empty? %)) (string/split input tokenizer))
+                   result (parse tokenizations model original-input)]
+               (if (empty? result)
+                 (log/warn (str "could not parse: \"" input "\". Tokenizations attempted: " (string/join ";" tokenizations)))
+                 (log/info (str "parsed input:    \"" input "\"")))
+               result))

            (or (seq? input) (vector? input))
            ;; assume input is a list of tokens.
@@ -165,9 +171,6 @@
                     (filter map? (get all-parses
                                       [0 token-count]))
                     :all-parses all-parses}]
-               (if (empty? (:complete-parses result))
-                 (log/warn (str "could not parse: '" original-input "'"))
-                 (log/info (str "successfully parsed input: '" original-input "'")))
                (:complete-parses result)))

            true


fix typo

fix typo

--- src/babel/writer.clj
+++ src/babel/writer.clj
@@ -102,6 +102,10 @@

         semantics (strip-refs (get-in target-language-sentence [:synsem :sem] :top))

+        target-language-surface (target-fo target-language-sentence)
+        debug (log/debug (str "target surface  : " target-language-surface))
+        debug (log/debug (str "target-semantics:" semantics))
+
         ;; 2. generate sentence in source language using semantics of sentence in target language.
         ;; resolve future
         source-language-model (if (future? source-language-model)
@@ -110,14 +114,12 @@
         debug (log/debug (str "semantics of resulting expression: " semantics))
         debug (log/trace (str "entire expression: " target-language-sentence))

-        target-language-surface (target-fo target-language-sentence)
-        debug (log/debug (str "target surface: " target-language-surface))

         source-language (:language source-language-model)
         error (if (or (nil? target-language-surface)
                       (= target-language-surface ""))
-                (let [message (str "Could not generate a sentence in source language '"
-                                   (:language source-language-model)
+                (let [message (str "Could not generate a sentence in target language '"
+                                   (:language target-language-model)
                                    "' for this spec: " spec)]
                   (if (= true mask-populate-errors)
                     (log/warn message)


scheduler: Make millis->second conversion more explicit.

--- scheduler/src/cook/mesos/scheduler.clj
+++ scheduler/src/cook/mesos/scheduler.clj
@@ -943,7 +943,7 @@
   [driver offer-incubate-time-ms]
   (.. (com.netflix.fenzo.TaskScheduler$Builder.)
       (disableShortfallEvaluation) ;; We're not using the autoscaling features
-      (withLeaseOfferExpirySecs (max (quot offer-incubate-time-ms 1000) 1)) ;; Must convert from the ms, should be at least 1 second
+      (withLeaseOfferExpirySecs (max (-> offer-incubate-time-ms time/millis time/in-seconds) 1)) ;; should be at least 1 second
       (withRejectAllExpiredOffers)
       (withDebugEnabled)
       (withLeaseRejectAction (reify com.netflix.fenzo.functions.Action1


Fix Kubernetes Node Watch (#1260)

Fix Kubernetes Node Watch (#1260)

--- scheduler/src/cook/kubernetes/api.clj
+++ scheduler/src/cook/kubernetes/api.clj
@@ -171,7 +171,8 @@
       (.submit kubernetes-executor ^Callable
       (fn []
         (try
-          (handle-watch-updates current-nodes-atom watch (fn [n] (-> n .getMetadata .getName)) [])
+          (handle-watch-updates current-nodes-atom watch (fn [n] (-> n .getMetadata .getName))
+                                [(make-atom-updater current-nodes-atom)]) ; Update the set of all nodes.
           (catch Exception e
             (log/warn e "Error during node watch")
             (initialize-node-watch api-client current-nodes-atom))


Fix cache mapping (#1921)

Fix cache mapping (#1921)

Co-authored-by: Caleb Harris <f19fc8a1d658da7a12d02007b679d7521088e20f@twosigma.com>

--- scheduler/src/cook/kubernetes/api.clj
+++ scheduler/src/cook/kubernetes/api.clj
@@ -88,12 +88,12 @@
   (let [instance-uuid (pod-name->instance-uuid pod-name)
         job-uuid (or (pod-name->job-uuid pod-name)
                      (cached-queries/instance-uuid->job-uuid-cache-lookup instance-uuid))
-        {job-name :job/name user :job/user {pool-name :pool/name} :job/pool} (cached-queries/job-uuid->job-map-cache-lookup job-uuid)]
+        {:keys [job/name job/user] :as job} (cached-queries/job-uuid->job-map-cache-lookup job-uuid)]
     (cond->
-          {:job-name job-name
+          {:job-name name
            :job-uuid job-uuid
            :pod-name pod-name
-           :pool pool-name
+           :pool (cached-queries/job->pool-name job)
            :user user}
           instance-uuid (assoc :instance-uuid instance-uuid))))


Used nil? instead of truthy check.

Used nil? instead of truthy check.

--- src/validation_benchmark/lib/schema.clj
+++ src/validation_benchmark/lib/schema.clj
@@ -66,5 +66,4 @@

 (defn wrapper [f valid?]
   (fn [v]
-    (= (not (f v))
-       valid?)))
+    (= (nil? (f v)) valid?)))


ready to present!

ready to present!

--- src-cljs/qcon/main.cljs
+++ src-cljs/qcon/main.cljs
@@ -492,10 +492,9 @@

             {:subtitle "Communicating Sequential Processes?"
-             :bullets ["Started with a paper in 1978 by Anthony Hoare"
-                       "Then a book a few years later"
+             :bullets ["Started with a paper in 1978 by Anthony Hoare, then a book a few years later"
                        "Sound mathematical basis for concurrency"
-                       "Allows programs to be proven against deadlock - show such a proof"]}
+                       "Allows programs to be proven against deadlock"]}

             {:background "/static/cspdiag.jpg"}

@@ -521,7 +520,7 @@

             {:subtitle "channels"
              :bullets ["Form a one-way communcation path way between processes"
-                       "Supported by buffers"
+                       "Supported by buffers (fixed buffers, dropping buffers, sliding buffers)"
                        ]
              }

@@ -660,6 +659,8 @@
              :author "Malcolm Sparks"}

             {:background "/static/webcam.jpg"}
+
+            {:title "But use values!"}

             {:title "Example projects"
              :text "Some free software projects using core.async"}


Исправления

Исправления

--- radiolamp-6P3S/src/ixinfestor/omut.cljs
+++ radiolamp-6P3S/src/ixinfestor/omut.cljs
@@ -2954,7 +2954,7 @@

                       :one
                       (dom/div
-                       #js {:className "col-sm-9 col-md-10 col-lg-11" :style #js {:padding 0}}
+                       #js {:className "col-sm-9 col-md-10 col-lg-11" :style #js {}}
                        (dom/div #js {:className "input-group"}
                                 (dom/input #js {:value (let [r (get-in @app [:sel 0])]
                                                          (if one--row-to-text-fn
@@ -2971,7 +2971,7 @@

                       :multi
                       (dom/div
-                       #js {:className "col-sm-9 col-md-10 col-lg-11" :style #js {:padding 0}}
+                       #js {:className "col-sm-9 col-md-10 col-lg-11" :style #js {}}
                        (dom/div
                         #js {:className (str "panel "
                                              ({:muted   "panel-muted"


Move resolvers into context

Move resolvers into context

We almost always do want to inherit them.

--- test-cljs/frontend/test_send.cljs
+++ test-cljs/frontend/test_send.cljs
@@ -316,10 +316,11 @@
        (doto to (put! v) (close!)))))
   to)

-(defn resolve [channel context resolvers query-or-ast]
+(defn resolve [channel context query-or-ast]
   (let [ast (if (vector? query-or-ast)
               (om/query->ast query-or-ast)
               query-or-ast)
+        resolvers (:resolvers context)
         children (:children ast)]
     (async/pipe
      (async/merge
@@ -353,7 +354,6 @@
    (fn [context ast]
      (resolve (chan)
               (assoc context :user/name (:user/name (:params ast)))
-              resolvers
               ast))

    :user/name
@@ -390,7 +390,6 @@
               user (p/await (get-user {:name (:user/name context)}))]
        (resolve (chan)
                 (assoc context :user/name (:favorite-fellow-user-name user))
-                resolvers
                 ast)))})

 (deftest new-thing-works
@@ -437,21 +436,22 @@
                                      (fn [params]
                                        (p/do*
                                         (swap! api-calls conj [:do-something params])
-                                        "Did something."))}}
-                             resolvers '[(do/something {:very "important"})
-                                         {(:root/user {:user/name "nipponfarm"})
-                                          [:user/name
-                                           :user/favorite-color
-                                           :user/favorite-number
-                                           {:user/vehicle [:vehicle/make
-                                                           (:the-model {:< :vehicle/model})]}
-                                           {:user/pets [:pet/name]}
-                                           {:user/favorite-fellow-user [:user/name
-                                                                        :user/favorite-color
-                                                                        :user/favorite-number]}]}
-                                         {(:jamie {:< :root/user :user/name "jburnford"})
-                                          [:user/name
-                                           :user/favorite-color]}])]
+                                        "Did something."))}
+                              :resolvers resolvers}
+                             '[(do/something {:very "important"})
+                               {(:root/user {:user/name "nipponfarm"})
+                                [:user/name
+                                 :user/favorite-color
+                                 :user/favorite-number
+                                 {:user/vehicle [:vehicle/make
+                                                 (:the-model {:< :vehicle/model})]}
+                                 {:user/pets [:pet/name]}
+                                 {:user/favorite-fellow-user [:user/name
+                                                              :user/favorite-color
+                                                              :user/favorite-number]}]}
+                               {(:jamie {:< :root/user :user/name "jburnford"})
+                                [:user/name
+                                 :user/favorite-color]}])]
       (take!
        (async/into #{} data-chan)
        (fn [v]


fix: set default schema to `doc`

fix: set default schema to `doc`

--- test/metabase/test/data/crate.clj
+++ test/metabase/test/data/crate.clj
@@ -67,5 +67,6 @@
           :load-data!                (make-load-data-fn generic/load-data-add-ids)})
   i/IDatasetLoader
   (merge generic/IDatasetLoaderMixin
-         {:database->connection-details database->connection-details
-          :engine                     (constantly :crate)}))
+         {:database->connection-details   database->connection-details
+          :engine                         (constantly :crate)
+          :default-schema                 (constantly "doc")}))


Update instructions for setting up Druid test instance for CI

--- test/metabase/test/data/druid.clj
+++ test/metabase/test/data/druid.clj
@@ -27,38 +27,10 @@

 ;;; Setting Up a Server w/ Druid Test Data

-;; Unfortunately the process of loading test data onto an external server for CI purposes is a little involved. Before testing against Druid, you'll need to perform the following steps:
-;; For EC2 instances, make sure to expose ports `8082` & `8090` for Druid while loading data. Once data has finished loading, you only need to expose port `8082`.
-;;
-;; 1.  Setup Zookeeper
-;;     1A.  Download & extract Zookeeper from `http://zookeeper.apache.org/releases.html#download`
-;;     1B.  Create `zookeeper/conf/zoo.cfg` -- see the Getting Started Guide: `http://zookeeper.apache.org/doc/r3.4.6/zookeeperStarted.html`
-;;     1C.  `zookeeper/bin/zkServer.sh start`
-;;     1D.  `zookeeper/bin/zkServer.sh status` (to make sure it started correctly)
-;; 2.  Setup Druid
-;;     2A.  Download & extract Druid from `http://druid.io/downloads.html`
-;;     2B.  `cp druid/run_druid_server.sh druid/run_historical.sh` and bump the `-Xmx` setting to `6g` or so
-;;     2C.  `cd druid && ./run_druid_server.sh coordinator`
-;;     2D.  `cd druid && ./run_druid_server.sh broker`
-;;     2E.  `cd druid && ./run_historical.sh historical`
-;;     2E.  `cd druid && ./run_druid_server.sh overlord`
-;; 3.  Generate flattened test data file. Optionally pick a <filename>
-;;     3A.  From this namespace in the REPL, run `(generate-json-for-batch-ingestion <filename>)`
-;;     3B.  `scp` or otherwise upload this file to the box running druid (if applicable)
-;; 4.  Launch Druid Indexing Task
-;;     4A.  Run the indexing task on the remote instance.
-;;
-;;            (run-indexing-task <remote-host> :base-dir <dir-where-you-uploaded-file>, :filename <file>)
-;;            e.g.
-;;            (run-indexing-task "http://ec2-52-90-109-199.compute-1.amazonaws.com", :base-dir "/home/ec2-user", :filename "checkins.json")
-;;
-;;          The task will keep you apprised of its progress until it completes (takes 1-2 minutes)
-;;     4B.  Keep an eye on `<host>:8082/druid/v2/datasources`. (e.g. "http://ec2-52-90-109-199.compute-1.amazonaws.com:8082/druid/v2/datasources")
-;;          This endpoint will return an empty array until the broker knows about the newly ingested segments. When it returns an array with the string `"checkins"` you're ready to
-;;          run the tests.
-;;     4C.  Kill the `overlord` process once the data has finished loading.
-;; 5.  Running Tests
-;;     5A.  You can run tests like `ENGINES=druid MB_DRUID_PORT=8082 MB_DRUID_HOST=http://ec2-52-90-109-199.compute-1.amazonaws.com lein test`
+;; Unfortunately the process of loading test data onto an external server for CI purposes is a little involved.
+;; A complete step-by-step guide is available on the wiki at `https://github.com/metabase/metabase/wiki/Setting-up-Druid-for-CI-on-EC2`
+;; Refer to that page for more information.
+

 (def ^:private ^:const default-filename "Default filename for batched ingestion data file."
   "checkins.json")
@@ -126,7 +98,7 @@

 (def ^:private ^:const indexer-timeout-seconds
   "Maximum number of seconds we should wait for the indexing task to finish before deciding it's failed."
-  180)
+  300) ; five minutes

 (resolve-private-vars metabase.driver.druid GET POST)


Updated unit tests.

Updated unit tests.


Use ClojureCL's Contextual in TypedCLAccessor.

--- src/clojure/uncomplicate/neanderthal/opencl/clblock.clj
+++ src/clojure/uncomplicate/neanderthal/opencl/clblock.clj
@@ -66,11 +66,16 @@
   CLAccessor
   (get-queue [_]
     queue)
+  Contextual
+  (cl-context [_]
+    ctx)
   MemoryContext
-  (compatible [_ a]
-    (and (instance? TypedCLAccessor a)
-         (= et (.et ^TypedCLAccessor a))
-         (= ctx (.ctx ^TypedCLAccessor a))))
+  (compatible [_ o]
+    (or
+     (and (instance? TypedCLAccessor o)
+          (= et (.et ^TypedCLAccessor o)) (= ctx (.ctx ^TypedCLAccessor o)))
+     (= ctx o)
+     (= et o)))
   FactoryProvider
   (native-factory [_]
     host-fact)


Add tests for lifecycle methods

Add tests for lifecycle methods

--- test/reagenttest/testreagent.cljs
+++ test/reagenttest/testreagent.cljs
@@ -614,3 +614,70 @@
                 (swap! n3 inc))))]
     (is (= (rstr [c]) (rstr [:div 1])))
     (is (= [1 1 1] [@n1 @n2 @n3]))))
+
+(deftest lifecycle
+  (let [n1 (atom 0)
+        t (atom 0)
+        res (atom {})
+        add-args (fn [key args]
+                   (swap! res assoc key
+                          {:at (swap! n1 inc)
+                           :args (vec args)}))
+        render (fn [& args]
+                 (add-args :render args)
+                 [:div (first args)])
+        ls {:get-initial-state
+            (fn [& args]
+              (reset! t (first args))
+              (add-args :initial-state args)
+              {:foo "bar"})
+            :component-will-mount
+            (fn [& args] (add-args :will-mount args))
+            :component-did-mount
+            (fn [& args] (add-args :did-mount args))
+            :should-component-update
+            (fn [& args] (add-args :should-update args) true)
+            :component-will-update
+            (fn [& args] (add-args :will-update args))
+            :component-did-update
+            (fn [& args] (add-args :did-update args))
+            :component-will-unmount
+            (fn [& args] (add-args :will-unmount args))}
+        c1 (r/create-class
+            (assoc ls :reagent-render render))
+        defarg ["a" "b"]
+        arg (r/atom defarg)
+        comp (atom c1)
+        c2 (fn []
+             (apply vector @comp @arg))
+        check (fn []
+                (is (= (:initial-state @res)
+                       {:at 1 :args [@t]}))
+                (is (= (:will-mount @res)
+                       {:at 2 :args [@t]}))
+                (is (= (:render @res)
+                       {:at 3 :args ["a" "b"]}))
+                (is (= (:did-mount @res)
+                       {:at 4 :args [@t]}))
+
+                (reset! arg ["a" "c"])
+                (r/flush)
+                (is (= (:should-update @res)
+                       {:at 5 :args [@t [@comp "a" "b"] [@comp "a" "c"]]}))
+                (is (= (:will-update @res)
+                       {:at 6 :args [@t [@comp "a" "c"]]}))
+                (is (= (:render @res)
+                       {:at 7 :args ["a" "c"]}))
+                (is (= (:did-update @res)
+                       {:at 8 :args [@t [@comp "a" "b"]]})))]
+    (when isClient
+      (with-mounted-component [c2] check)
+      (is (= (:will-unmount @res)
+             {:at 9 :args [@t]}))
+
+      (reset! comp (with-meta render ls))
+      (reset! arg defarg)
+      (reset! n1 0)
+      (with-mounted-component [c2] check)
+      (is (= (:will-unmount @res)
+             {:at 9 :args [@t]})))))


Make sure to add reactions and comments links on entry secure access.

--- src/oc/storage/representations/entry.clj
+++ src/oc/storage/representations/entry.clj
@@ -42,7 +42,7 @@
   (filter :reaction interactions))

 (defun- board-of
-  ([boards :guard map? entry]
+  ([boards :guard map? entry]
     (boards (:board-uuid entry)))
   ([board _entry] board))

@@ -228,8 +228,8 @@
   Given an entry and all the metadata about it, render an access level appropriate rendition of the entry
   for use in an API response.
   "
-  ([org board entry comments reactions access-level user-id]
-  (entry-and-links org board entry comments reactions access-level user-id false))
+  ([org board entry comments reactions access-map user-id]
+   (entry-and-links org board entry comments reactions access-map user-id false))

   ([org board entry comments reactions {:keys [access-level role]} user-id secure-access?]
   (let [entry-uuid (:uuid entry)
@@ -278,7 +278,7 @@
                                (unfollow-link org-slug board-slug entry-uuid))
         home-pin-link (pin-link "home-pin" org-slug board-slug entry-uuid config/seen-home-container-id)
         board-pin-link (pin-link "board-pin" org-slug board-slug entry-uuid board-uuid)
-        member? (#{:author :viewer} access-level)
+        member? (or (= role :member) (#{:author :viewer} access-level))
         links (cond-> []
                ;; secure UUID access
                secure-access?
@@ -294,7 +294,8 @@
                         bookmarks-link
                         user-visibility-link])
                ;; Add home and board pin links if user is a member (clients will limit home pins from private boards)
-               member?
+               (and (not secure-access?)
+                    member?)
                (concat [home-pin-link board-pin-link])
                ;; Only admins and the owner can edit or delete the entry
                (and (not secure-access?)
@@ -310,13 +311,14 @@
                     (not secure-access?)
                     (= access-level :author))
                (conj (secure-link org-slug secure-uuid))
-               ;; Accessing their drafts, or access by an author, both get interaction links
-               (or (and draft?
-                        (not secure-access?))
-                   member?)
+               ;; Team members always get links to read and add comments
+               member?
                (concat [(content/comment-link org-uuid board-uuid entry-uuid)
-                        (content/comments-link org-uuid board-uuid entry-uuid comments)
-                        (content/mark-unread-link entry-uuid)])
+                        (content/comments-link org-uuid board-uuid entry-uuid comments)])
+               ;; Team members always get the mark unread except on secure access
+               (and member?
+                    (not secure-access?))
+               (conj (content/mark-unread-link entry-uuid))
                ;; All memebers can react but only if there are less than x reactions
                (and member?
                     (< (count reaction-list) config/max-reaction-count))
@@ -340,20 +342,20 @@

 (defn render-entry-for-collection
   "Create a map of the entry for use in a collection in the API"
-  ([org board entry comments reactions access-level user-id]
-  (render-entry-for-collection org board entry comments reactions access-level user-id false))
-
-  ([org board entry comments reactions access-level user-id secure-access?]
-  (entry-and-links org board entry comments reactions access-level user-id secure-access?)))
+  ([org board entry comments reactions access-map user-id]
+  (render-entry-for-collection org board entry comments reactions access-map user-id false))
+
+  ([org board entry comments reactions access-map user-id secure-access?]
+  (entry-and-links org board entry comments reactions access-map user-id secure-access?)))

 (defn render-entry
   "Create a JSON representation of the entry for the API"
-  ([org board entry comments reactions access-level user-id]
-  (render-entry org board entry comments reactions access-level user-id false))
-
-  ([org board entry comments reactions access-level user-id secure-access?]
+  ([org board entry comments reactions access-map user-id]
+  (render-entry org board entry comments reactions access-map user-id false))
+
+  ([org board entry comments reactions access-map user-id secure-access?]
   (json/generate-string
-    (render-entry-for-collection org board entry comments reactions access-level user-id secure-access?)
+    (render-entry-for-collection org board entry comments reactions access-map user-id secure-access?)
     {:pretty config/pretty?})))

 (defn render-entry-list


Add 'put!'.

Add 'put!'.

--- src/org/spootnik/cyanite/store_mware.clj
+++ src/org/spootnik/cyanite/store_mware.clj
@@ -42,13 +42,18 @@
         (cache/put! store-cache tenant period rollup (rollup-to time) path data
                     ttl agg-avg fn-store)))))

+(defn- put!
+  [min-rollup store-cache fn-store tenant period rollup time path metric ttl]
+  (let [fn-agg (partial aggregate-with :avg)]
+    (when (= min-rollup rollup)
+      (cache/put! store-cache tenant (int period) (int rollup) time
+                  path metric (int ttl) fn-agg fn-store))))
+
 (defn store-middleware-cache
   [{:keys [store store-cache chan_size rollups] :or {chan_size 10000}}]
   (info "creating caching metric store middleware")
-  (let [schan (store/channel-for store)
-        min-rollup (get-min-rollup rollups)
-        fn-store (store-agg-fn store-cache schan rollups)
-        agg-avg (partial aggregate-with :avg)]
+  (let [fn-store (store-agg-fn store-cache (store/channel-for store) rollups)
+        fn-put! (partial put! (get-min-rollup rollups) store-cache fn-store)]
     (reify
       store/Metricstore
       (channel-for [this]
@@ -56,12 +61,9 @@
           (go-forever
            (let [data (<! ch)
                  {:keys [metric tenant path time rollup period ttl]} data]
-             (when (= min-rollup rollup)
-               (cache/put! store-cache tenant (int period) (int rollup) time
-                           path metric (int ttl) agg-avg fn-store))))
+             (fn-put! tenant period rollup time path data ttl)))
           ch))
       (insert [this ttl data tenant rollup period path time]
-        (cache/put! store-cache tenant period rollup time path data ttl
-                    (partial aggregate-with :avg) fn-store))
+        (fn-put! tenant period rollup time path data ttl))
       (fetch [this agg paths tenant rollup period from to]
         (store/fetch store agg paths tenant rollup period from to)))))


extracting map-key

extracting map-key

--- src/aws/provider.clj
+++ src/aws/provider.clj
@@ -22,7 +22,7 @@
     [flatland.useful.utils :refer (defm)]
     [flatland.useful.map :refer (dissoc-in*)]
     [slingshot.slingshot :refer  [throw+ try+]]
-    [celestial.provider :refer (wait-for wait-for-ssh)]
+    [celestial.provider :refer (wait-for wait-for-ssh map-key)]
     [celestial.core :refer (Vm)]
     [taoensso.timbre :as timbre]
     [celestial.persistency.systems :as s]
@@ -116,9 +116,6 @@

 (def defaults {:aws {:min-count 1 :max-count 1}})

-(defn map-key [m from to]
-  (dissoc-in* (assoc-in m to (get-in m from)) from))
-
 (defn find-groups
    [endpoint names vpc-id]
    (map :group-id


check for count of expressions in target language before generating new ones.

--- src/babel/writer.clj
+++ src/babel/writer.clj
@@ -203,24 +203,28 @@
     (throw (Exception. "No source language model was supplied.")))
   (if (nil? target-model)
     (throw (Exception. "No target language model was supplied.")))
-  (let [json-spec (json/write-str spec)
+  (let [target-language (:language @target-model)
+        json-spec (json/write-str spec)
         current-target-count
         (:count
          (first
           (k/exec-raw ["SELECT count(*) FROM expression
                          WHERE structure @> ?::jsonb
                            AND language=?"
-                       [(json/write-str spec) (:language target-model)]]
+                       [(json/write-str spec) target-language]]
                       :results)))]
     (log/debug (str "current-target-count for spec: " spec "=" current-target-count))
     (let [count (- count current-target-count)]
       (if (> current-target-count 0)
-        (log/warn (str "There are already: " current-target-count " expressions for spec: " spec)))
-      (log/info (str "Generating: " count " target expressions."))
-      (populate count
-                source-model
-                target-model
-                spec table))))
+        (log/warn (str "There are already " current-target-count " expressions for this spec.")))
+      (if (> count 0)
+        (do
+          (log/info (str "Generating " count " target expressions."))
+          (populate count
+                    source-model
+                    target-model
+                    spec table))
+        (log/warn (str " not generating any new expressions for this spec."))))))

 (defn fill-verb [verb count source-model target-model & [spec table]] ;; spec is for additional constraints on generation.
   (let [spec (if spec spec :top)


Clean scratch directory before running tests.

--- src/circle/proto.clj
+++ src/circle/proto.clj
@@ -191,9 +191,13 @@
   (map run-handlers (vals configurations)))

+(defn clean-scratch-directory
+  []
+  (shell-out "rm" "-Rf" "scratch/"))

 (defn init [& argv]
   (circle.repl/init)
+  (clean-scratch-directory)
   (def configuration (-> argv
                           first
                           io/reader


Change core method name for running an action

--- src/beehive/core.clj
+++ src/beehive/core.clj
@@ -41,5 +41,5 @@
 (defn submit-action [service f time-out-ms]
   (s/submit-action service f time-out-ms))

-(defn perform-action [service f]
+(defn run-action [service f]
   (s/run-action service f))


Fix no-op test fns.

Fix no-op test fns.

--- src/dsbdp/experiment_helper.clj
+++ src/dsbdp/experiment_helper.clj
@@ -43,8 +43,8 @@
 (defn create-no-op-proc-fns
   [n]
   (create-proc-fns
-    '(fn [_ _])
-    '(fn [_ _])
+    '(fn [_ _] 0)
+    '(fn [_ _] 1)
     n))

 (defn create-inc-proc-fns


Added 'Nothing to report' for empty (print-status)

--- src/clj_git/core.clj
+++ src/clj_git/core.clj
@@ -28,6 +28,8 @@
       (println "\nUntracked Files:")
       (doseq [x untracked]
         (println (str "  " x)))))
+  (if (every? empty? [staged modified untracked])
+    (println "Nothing to report, working directory clean"))
 ))

 (defn -main [& args] (print-status))


fix new jdbc

fix new jdbc

--- src/clj_pg/honey.clj
+++ src/clj_pg/honey.clj
@@ -166,12 +166,12 @@
 (defn create-database [db db-name & [template]]
   (let [sql (str "CREATE DATABASE " (name db-name) (when template (str " TEMPLATE = " template)))]
     (log/info sql)
-    (jdbc/execute! db [sql] :transaction? false)))
+    (jdbc/execute! db [sql] {:transaction? false})))

 (defn drop-database [db db-name]
   (let [sql (str "DROP DATABASE IF EXISTS " (name db-name))]
     (log/info sql)
-    (jdbc/execute! db [sql] :transaction? false)))
+    (jdbc/execute! db [sql] {:transaction? false})))

 (defn create [db {tbl :table :as spec} data]


use clojure.core/assoc-in

use clojure.core/assoc-in

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -1,13 +1,12 @@
 (ns babel.generate
-  (:refer-clojure :exclude [assoc-in get-in deref resolve find parents])
+  (:refer-clojure :exclude [get-in deref resolve find parents])
   (:require
    [babel.index :refer [intersection-with-identity]]
    #?(:clj [clojure.tools.logging :as log])
    #?(:cljs [babel.logjs :as log])
    [clojure.math.combinatorics :as combo]
    [clojure.string :as string]
-   [dag_unify.core :refer [assoc-in assoc-in! copy create-path-in
-                           dissoc-paths fail-path get-in fail? strip-refs unify unify!]]))
+   [dag_unify.core :refer [copy dissoc-paths fail-path get-in fail? strip-refs unify unify!]]))

 ;; during generation, will not decend deeper than this when creating a tree:
 ;; TODO: should also be possible to override per-language.


improve logging

improve logging

--- src/babel/lexiconfn.clj
+++ src/babel/lexiconfn.clj
@@ -76,17 +76,13 @@
   (let [retval (apply unifyc args)]
     (if (not (fail? retval))
       retval
+      ;; TODO: log message is too long to read.
       (let [message (str "Failed to unify args:" (string/join " , " (map strip-refs (get-in args [:synsem])))
                          (if (= 2 (.size args))
                            (let [fail-path (get-fail-path (first args) (second args))]
                              (str "; failed path: " fail-path
                                   "; arg1(" fail-path ")=" (get-in (first args) fail-path)
-                                  "; arg2(" fail-path ")=" (get-in (second args) fail-path)
-                                  "; arg1 empty(" fail-path ")=" (if (seq? (get-in (first args) fail-path))
-                                                                   (empty? (get-in (first args) fail-path)))
-                                  "; arg1 empty(" fail-path ")=" (if (seq? (get-in (second args) fail-path))
-                                                                   (empty? (get-in (second args) fail-path)))))
-
+                                  "; arg2(" fail-path ")=" (get-in (second args) fail-path)))
                            ""))]
         (do (log/error message)
             (throw (Exception. message)))))))


scheduler: don't NullPointerException on nil values when rebalancing

--- scheduler/src/cook/mesos/rebalancer.clj
+++ scheduler/src/cook/mesos/rebalancer.clj
@@ -325,8 +325,8 @@
                                                          (conj (:task aggregation) task)
                                                          (:task aggregation))
                                                  :gpus (+ (:gpus aggregation) (or gpus 0.0))
-                                                 :mem (+ (:mem aggregation) mem)
-                                                 :cpus (+ (:cpus aggregation) cpus)})
+                                                 :mem (+ (:mem aggregation) (or mem 0))
+                                                 :cpus (+ (:cpus aggregation) (or cpus 0))})
                                               {:hostname host :task nil :mem 0.0 :cpus 0.0 :gpus 0.0}
                                               scored-tasks))))
                                   (filter (fn has-enough-resource [resource-sum]


[cortex/util] Fix `EMPTY-VECTOR` implementation to be correct cross platform version.

--- src/cortex/util.cljc
+++ src/cortex/util.cljc
@@ -15,7 +15,7 @@
 #?(:clj (defn timestamp [] (System/nanoTime))
    :cljs (defn timestamp [] (.getTime (js/Date.))))

-(def EMPTY-VECTOR (m/new-array []))
+(def EMPTY-VECTOR (m/new-array [0]))

 #?(:clj
     (do


modify fo-ps: show :pred of each argument

--- src/babel/parse.cljc
+++ src/babel/parse.cljc
@@ -287,11 +287,11 @@
       (and (= :none (get-in tree [:head] :none))
            (= :none (get-in tree [:comp] :none))
            (not (= :none (get-in tree [:rule] :none))))
-      (str "[" (get-in tree [:rule]) "/" (get-in tree [:synsem :cat]) " "
+      (str "[" (get-in tree [:rule]) "/" (get-in tree [:synsem :cat]) " pred(" (get-in tree [:synsem :sem :pred]) ") "
            "'" (fo tree) "']")

       (= head-first? :none)
-      (str "'" (fo tree) "'/" (get-in tree [:synsem :cat] ""))
+      (str "'" (fo tree) "'/" (get-in tree [:synsem :cat]) " pred(" (get-in tree [:synsem :sem :pred]) ") ")

       (= head-first? :comp)
       (str "[" (get-in tree [:rule]) " "


style fix

style fix

--- src-cljs/frontend/components/chat.cljs
+++ src-cljs/frontend/components/chat.cljs
@@ -27,7 +27,7 @@
         parts (or (seq (str/split text url-regex)) [""])]
     (reduce (fn [acc [pre url]]
               (conj acc
-                    (when (< 0 (count pre)) [:span pre])
+                    (when (seq pre) [:span pre])
                     (when url [:a {:href url :target "_blank"} url])))
             [:span] (partition-all 2 (concat (interleave parts
                                                          matches)


fix stripe-cents logic

fix stripe-cents logic

--- src-cljs/frontend/components/plan.cljs
+++ src-cljs/frontend/components/plan.cljs
@@ -128,9 +128,9 @@
   [cents]
   (let [pennies (mod cents 100)
         dollars (/ (- cents pennies) 100)]
-    (when (pos? pennies)
+    (if (pos? pennies)
       (gstring/format "$%d.%02d" dollars pennies)
-      (gstring/format "$%d" dollars))))
+      (gstring/format "$%d" (utils/inspect dollars)))))

 (defn invoice-component [{:keys [invoice-id]} owner]
   (reify


Store count&scroll in url.

Store count&scroll in url.

--- src-cljs/pepa/workflows/dashboard.cljs
+++ src-cljs/pepa/workflows/dashboard.cljs
@@ -53,24 +53,27 @@
       ;; Default to all documents
       (keys (:documents state))))

-(defn ^:private parse-page
-  "Returns the current page (according to the page query-param
-  of :navigation) or 1, if none given."
-  [state]
+(def +initial-elements+ 50)
+(def +to-load+ 50)
+
+(defn ^:private parse-query-number [state name & [default]]
   (or
    (try
-     (let [n (some-> state
-                     :navigation :query-params :page
+     (let [n (some-> (get-in state [:navigation :query-params name])
                      (js/parseInt 10))]
        (and (integer? n) n))
      (catch js/Error e nil))
-   1))
+   default
+   0))

-(def +per-page+ 20)
+(defn ^:private parse-count-scroll
+  [state]
+  [(parse-query-number state :count +initial-elements+)
+   (parse-query-number state :scroll 0)])

 (defn ^:private page-ids [state]
-  (let [page (parse-page state)]
-    (take (* +per-page+ page) (document-ids state))))
+  (let [[n _] (parse-count-scroll state)]
+    (take n (document-ids state))))

 (defn ^:private fetch-missing-documents!
   "Fetches all missing documents which will be visible in the
@@ -109,17 +112,23 @@
         scroll-height (.-scrollHeight container)
         outer-height (.-clientHeight container)
         bottom-distance (Math/abs (- scroll-height
-                                     (+ scroll-top outer-height)))]
-    (when (< bottom-distance +scroll-margin+)
-      (let [state @state
-            page (or (parse-page state) 0)]
-        (-> (:navigation state)
-            (assoc-in [:query-params :page] (str (inc page)))
-            (nav/nav->route)
-            (nav/navigate! :ignore-history))))))
+                                     (+ scroll-top outer-height)))
+        progress (/ scroll-top scroll-height)]
+    (let [state @state
+          [num scroll] (parse-count-scroll state)
+          scroll (Math/floor (* progress num))
+          num (if (< bottom-distance +scroll-margin+)
+                (+ num +to-load+)
+                num)]
+      (-> (:navigation state)
+          (assoc-in [:query-params :count] (str num))
+          (assoc-in [:query-params :scroll] (str scroll))
+          (nav/nav->route)
+          (nav/navigate! :ignore-history)))))

 (defn dashboard [state owner]
   (reify
+    om/ICheckState
     om/IWillMount
     (will-mount [_]
       (go


Fixing some LISPy confusion

Fixing some LISPy confusion

--- scrape-n-mail/src/scrape_n_mail/core.cljs
+++ scrape-n-mail/src/scrape_n_mail/core.cljs
@@ -129,28 +129,22 @@

 (rum/defc hello-world < rum/reactive []
-  [:div
-    [:h2 "Wellness Scraper"]
-    [:p "First, we authenticate you to Google, then get some data from the Wellenss spreadsheet"]
-    (let [curr-data (rum/react app-data)]
-      (if (:initialized curr-data)
-        (if-not (:signed-in? curr-data)
-          [:button {:id "authorize-button" :on-click #(.. js/gapi.auth2 getAuthInstance signIn)} "Authorize"]
-          [:button {:id "sign-out-button" :on-click #(.. js/gapi.auth2 getAuthInstance signOut)} "Sign Out"]
-          ) )
-      (when-let [records (:sheet-data curr-data)]
-        [:ul {:id "content"}
-         ; (->> (:sheet-data curr-data)
-              ; We currently assume all visible data is "current"
-              ; (filter #(s/includes? (aget % 0) "2017"))
-              ; Each line is a list, this joins them in to one string
-              (map #(vector :li (::held-name-altar %)) records)
-              ; (map #(join "\t" (vals %)))
-              ; (map #(str (::held-name-altar curr-data)
-              ; Then we join the lines
-              ;(join "\n")
-              ]))
-  ])
+  (let [curr-data (rum/react app-data)]
+    [:div
+      [:h2 "Wellness Scraper"]
+      [:p "First, we authenticate you to Google, then get some data from the Wellenss spreadsheet"]
+        (if (:initialized curr-data)
+          (if-not (:signed-in? curr-data)
+            [:button {:id "authorize-button" :on-click #(.. js/gapi.auth2 getAuthInstance signIn)} "Authorize"]
+            [:button {:id "sign-out-button" :on-click #(.. js/gapi.auth2 getAuthInstance signOut)} "Sign Out"])
+          [:p "Initializing Google API"])
+
+        (when-let [records (:sheet-data curr-data)]
+          (into [:ul {:id "content"}]
+            ; We currently assume all visible data is "current"
+            ; (filter #(s/includes? (aget % 0) "2017"))
+            ; Each line is a list, this joins them in to one string
+            (map #(vector :li (::held-name-altar %)) records))) ]))

 (rum/mount (hello-world)
            (. js/document (getElementById "app")))


Fix use declaration for old concept approximation code

should not be included here anyway anymore

--- src/main/clojure/conexp/contrib/concept_approximation.clj
+++ src/main/clojure/conexp/contrib/concept_approximation.clj
@@ -10,7 +10,8 @@
   "Concept Approximation as described by C. Meschke."
   (:use conexp.base
         conexp.fca.contexts
-        [conexp.fca.exploration :only (default-handler-for-complete-counterexamples)]
+        [conexp.fca.exploration :only [default-handler-for-complete-counterexamples
+                                       explore-attributes]]
         [conexp.fca.misc :only (smallest-bond)]))

 ;;;


Check tags for feed are in the group

Check tags for feed are in the group

--- src/braid/rss/core.cljc
+++ src/braid/rss/core.cljc
@@ -16,6 +16,7 @@
   #?(:clj
      (do
        (core/register-db-schema! db/schema)
+
        (core/register-server-message-handlers!
          {:braid.server.rss/load-feeds
           (fn [{user-id :user-id group-id :?data}]
@@ -25,7 +26,9 @@

           :braid.server.rss/add-feed
           (fn [{user-id :user-id {:keys [tag-ids feed-url group-id] :as new-feed} :?data}]
-            (if (group-db/user-is-group-admin? user-id group-id)
+            (if (and (group-db/user-is-group-admin? user-id group-id)
+                     (let [group-tags (into #{} (map :id) (group-db/group-tags group-id))]
+                       (every? group-tags tag-ids)))
               (let [new-feed (assoc new-feed
                                     :id (java.util.UUID/randomUUID)
                                     :user-id user-id)]
@@ -40,6 +43,7 @@
                 {:db-run-txns! (db/remove-feed-txn feed-id)
                  :reply! :braid/ok}
                 {})))})
+
        (core/register-daily-job!
          (fn []
            (timbre/debugf "Running RSS job")


remove +defaults+; fixes #16

remove +defaults+; fixes #16

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -7,9 +7,6 @@

 (def ^:private global-deps
   '[[clj-time "0.9.0"]])
-
-(def ^:private
-  +defaults+ {})

 (defn- create-pod [deps]
   (-> (boot/get-env)
@@ -26,8 +23,7 @@
     [circleci/clj-yaml "0.5.3"]])

 (def ^:private +markdown-defaults+
-  (merge +defaults+
-         {:create-filename "io.perun.markdown/generate-filename"}))
+  {:create-filename "io.perun.markdown/generate-filename"})

 (defn- commit [fileset tmp]
   (-> fileset
@@ -88,21 +84,19 @@
 (deftask permalink
   "Make files permalinked. E.x. about.html will become about/index.html"
   []
-  (let [options (merge +defaults+ *opts*)]
-    (boot/with-pre-wrap fileset
-      (let [files (:metadata (meta fileset))
-            updated-files (perun/map-vals #(create-filepath % options) files)
-            fs-with-meta (with-meta fileset {:metadata updated-files})]
-        (u/info "Added permalinks to %s files\n" (count updated-files))
-        fs-with-meta))))
+  (boot/with-pre-wrap fileset
+    (let [files (:metadata (meta fileset))
+          updated-files (perun/map-vals #(create-filepath % *opts*) files)
+          fs-with-meta (with-meta fileset {:metadata updated-files})]
+      (u/info "Added permalinks to %s files\n" (count updated-files))
+      fs-with-meta)))

 (def ^:private sitemap-deps
   '[[sitemap "0.2.4"]])

 (def ^:private +sitemap-defaults+
-  (merge +defaults+
-         {:filename "sitemap.xml"
-          :target "public"}))
+  {:filename "sitemap.xml"
+   :target "public"})

 (deftask sitemap
   "Generate sitemap"
@@ -125,9 +119,8 @@
   '[[clj-rss "0.1.9"]])

 (def ^:private +rss-defaults+
-  (merge +defaults+
-         {:filename "feed.rss"
-          :target "public"}))
+  {:filename "feed.rss"
+   :target "public"})

 (deftask rss
   "Generate RSS feed"
@@ -149,8 +142,7 @@
         (commit fileset tmp)))))

 (def ^:private +render-defaults+
-  (merge +defaults+
-         {:target "public"}))
+  {:target "public"})

 (deftask render
   "Render pages"
@@ -171,11 +163,10 @@
         (commit fileset tmp)))))

 (def ^:private +collection-defaults+
-  (merge +defaults+
-         {:target "public"
-          :filterer identity
-          :sortby (fn [file] (:date-published file))
-          :comparator (fn [i1 i2] (compare i1 i2))}))
+  {:target "public"
+   :filterer identity
+   :sortby (fn [file] (:date-published file))
+   :comparator (fn [i1 i2] (compare i1 i2))})

 (deftask collection
   "Render collection files"