Schedule against the current number of jobs, not in the replica.

--- src/onyx/scheduling/common_job_scheduler.clj
+++ src/onyx/scheduling/common_job_scheduler.clj
@@ -293,8 +293,8 @@
   (let [allocations (reduce-kv #(update-in %1 %3 (comp vec conj) %2) {} peer->task)]
     (assoc replica :allocations allocations)))

-(defn btr-place-scheduling [replica job-utilization capacities]
-  (if (seq (:jobs replica))
+(defn btr-place-scheduling [replica jobs job-utilization capacities]
+  (if (seq jobs)
     (let [model (DefaultModel.)
           ;; Hard code the random seed to make it deterministic
           ;; across peers.
@@ -332,7 +332,7 @@
             spare-peers (apply + (vals (merge-with - job-offers job-claims)))
             max-utilization (claim-spare-peers current-replica job-claims spare-peers)
             planned-capacities (job->planned-task-capacity current-replica jobs max-utilization)
-            updated-replica (btr-place-scheduling current-replica max-utilization planned-capacities)]
+            updated-replica (btr-place-scheduling current-replica jobs max-utilization planned-capacities)]
         (if updated-replica
           (let [acker-replica (choose-ackers updated-replica jobs)]
             (if (full-allocation? acker-replica max-utilization planned-capacities)


dissoc http-code and add message for 500

--- src/org/zalando/stups/friboo/system/http.clj
+++ src/org/zalando/stups/friboo/system/http.clj
@@ -47,17 +47,24 @@
       {}
       (handler request))))

+(def default-error
+  (json/write-str
+    {:message "Internal Server Error"}))
+
 (defn- format-undefined-error [^Exception e]
-  (-> (r/response nil)
+  (-> (r/response default-error)
       (ring/content-type-json)
       (r/status 500)))

 (defn- format-defined-error [^ExceptionInfo e]
-  (let [data (assoc (ex-data e) :title (.getMessage e))]
+  (let [data (-> (ex-data e)
+                 (assoc :message (.getMessage e)))]
     (if-let [http-code (:http-code data)]
-      (-> (r/response (json/write-str data))
-          (ring/content-type-json)
-          (r/status http-code))
+      (let [data (-> data
+                     (dissoc :http-code))]
+        (-> (r/response (json/write-str data))
+            (ring/content-type-json)
+            (r/status http-code)))
       (format-undefined-error e))))

 (defn exceptions-to-json [handler]


(maint) package-inventory-query: fix broken :alias and missing fields

--- src/puppetlabs/puppetdb/query_eng/engine.clj
+++ src/puppetlabs/puppetdb/query_eng/engine.clj
@@ -1272,9 +1272,9 @@

                :relationships certname-relations

-               :alias "package_inventory
+               :alias "package_inventory"
                :subquery? false
-               :source-table packages"}))
+               :source-table "packages"}))

 (def factsets-query-base
   {::which-query :factsets


add date and fix ffilter

add date and fix ffilter

--- dada-core/src/main/clojure/org/dada/dsl.clj
+++ dada-core/src/main/clojure/org/dada/dsl.clj
@@ -31,7 +31,9 @@
 	   Transformer$StatelessStrategy
 	   Update
 	   View
-	   ])
+	   ]
+	  [org.joda.time
+	   LocalDate])
  )

 ;;--------------------------------------------------------------------------------
@@ -627,7 +629,7 @@

 (defn ffilter
   ([key predicate required]
-   (let [yes (list value) no '()]
+   (let [yes (list required) no '()]
      (split key (fn [candidate] (if (predicate candidate required) yes no)))))
   ([key required]
    (ffilter key = required)))
@@ -680,3 +682,6 @@
 	       [tgt-metamodel (str prefix ".union()") extra-pairs]))])
       ))

+;; types
+
+(defn date [#^Integer y #^Integer m #^Integer d] (LocalDate. y m d))


make time-ago take a duration

make time-ago take a duration

--- frontend/datetime.cljs
+++ frontend/datetime.cljs
@@ -114,10 +114,10 @@
 (def year
   (* month 12))

-(defn time-ago [time]
-  (let [now (.getTime (js/Date.))
-        ago (.floor js/Math (/ (- now time) 1000))
-        interval (cond (< ago hour)  {:divisor minute :unit "minute" }
+(defn time-ago [duration-ms]
+  (let [ago (.floor js/Math (/ duration-ms 1000))
+        interval (cond (< ago minute){:divisor 1      :unit "second" }
+                       (< ago hour)  {:divisor minute :unit "minute" }
                        (< ago day)   {:divisor hour   :unit "hour"   }
                        (< ago month) {:divisor day    :unit "day"    }
                        (< ago year)  {:divisor month  :unit "month"  }


Issue 10: Add RAILS_GROUP=test.

Issue 10: Add RAILS_GROUP=test.

--- src/circle/backend/build/inference/rails.clj
+++ src/circle/backend/build/inference/rails.clj
@@ -62,7 +62,7 @@
     (bash (sh/q (rake test)))))

 (defn bundle-install []
-  (bash (sh/q (bundle install))
+  (bash (sh/q (bundle install) :environment {:RAILS_GROUP :test})
         :name "bundle install"))

 (defn actions


don't include lots where zero shares are owned

--- src/clj_money/models/storage/sql_storage.clj
+++ src/clj_money/models/storage/sql_storage.clj
@@ -418,7 +418,8 @@
                   :explanation explanation}))))
     (query db-spec (-> (h/select :*)
                        (h/from :lots)
-                       (h/where (map->where criteria)))))
+                       (h/where (map->where criteria))
+                       (h/merge-where [:!= :shares_owned 0]))))

   (delete-lot
     [_ id]


terms and conditions

terms and conditions

--- src/cljs/salava/extra/passport/ui/block.cljs
+++ src/cljs/salava/extra/passport/ui/block.cljs
@@ -6,10 +6,10 @@
   [:footer.footer
    [:div.footer-container
     [:p.text-muted
-    "Copyright © 2015-2017 Discendum Oy | "
+     "Copyright © 2015-2017 Discendum Oy | "
      [:a {:class "bottom-link" :href "/terms" }
       "Terms of Use"]
-    " | "
+     " | "
      [:a {:class "bottom-link" :href "/privacy"}
       "Privacy Policy"]
      " | "
@@ -17,6 +17,7 @@
       "contact@openbadgefactory.com"]]
     [:p.text-muted
      "Open Badge Factory ® and Open Badge Passport ® are registered trademarks"]]])
+

 (defn ^:export terms-fr []
   [:div {:style {:padding "30px"}}
@@ -87,7 +88,6 @@
          [:p "Kiviharjunlenkki 1 E, 90220 Oulu"]
          [:p "Numéro de téléphone: 020 718 1850"]
          [:p [:a {:href "mailto:dataprotection@openbadgefactory.com"} "dataprotection@openbadgefactory.com"]]]]
-
        [:li  [:h3 "Nom du registre"]
         [:div
          [:p "REGISTRE DES CLIENTS ET DE PROSPECTION DU SERVICE OPEN BADGE PASSPORT" ]]]
@@ -155,6 +155,7 @@
       ]
      ]
     ]])
+

 (defn ^:export terms []
   [:div {:style {:padding "30px"}}


fix: in gs-proj check for non empy update attribs

--- src/main/clojure/pdok/featured/geoserver.clj
+++ src/main/clojure/pdok/featured/geoserver.clj
@@ -96,7 +96,7 @@
      (cond-> (transient [])
        (f/valid-geometry? geometry)
        (conj!-coll :_geometry_point :_geometry_line :_geometry_polygon :_geo_group)
-       attributes (conj!-coll (keys attributes))
+       (seq attributes) (conj!-coll (keys attributes))
        true (persistent!))))

  (defn- feature-to-update-record [proj-fn feature]
@@ -110,7 +110,7 @@
         (when (= :line geo-group) (proj-fn (f/as-jts geometry)))
         (when (= :polygon geo-group)  (proj-fn (f/as-jts geometry)))
         geo-group)
-       attributes (conj!-coll (vals attributes))
+       (seq attributes) (conj!-coll (vals attributes))
        true (conj! (:id feature))
        true (conj! (:current-version feature))
        true (persistent!))))


Add color? test function.

Add color? test function.

--- src/org/playasophy/wonderdome/util/color.clj
+++ src/org/playasophy/wonderdome/util/color.clj
@@ -3,6 +3,14 @@
   See: http://en.wikipedia.org/wiki/HSL_and_HSV"
   (import
     java.awt.Color))
+
+
+(defn color?
+  "Tests whether the given value is a valid color."
+  [value]
+  (and (integer? value)
+       (< Integer/MIN_VALUE value Integer/MAX_VALUE)))
+

 ;;;;; RGB COLOR SPACE ;;;;;
@@ -31,6 +39,7 @@
   "Takes a color value and returns a vector containing the red, green, and blue
   component channels as floating-point numbers."
   [color]
+  {:pre [(color? color)]}
   (vec (.getRGBColorComponents (Color. (unchecked-int color)) nil)))

@@ -40,9 +49,11 @@
 (defn hsv
   "Creates a color value from a hue, saturation, and value. The fractional
   portion of the hue determines the angle in the HSV space; saturation and
-  value should be numbers from [0.0, 1.0]."
+  value should be numbers from [0.0, 1.0].
+
+  The primary red, green, and blue hues are found at 0/3, 1/3, and 2/3,
+  respectively."
   [h s v]
-  ; TODO: document hue angles for pure red/green/blue
   (Color/HSBtoRGB (float h) (float s) (float v)))

@@ -50,6 +61,7 @@
   "Takes a color value and returns a vector containing the hue, saturation, and
   value components as floating-point numbers."
   [color]
+  {:pre [(color? color)]}
   (let [c (Color. (unchecked-int color))]
     (vec (Color/RGBtoHSB (.getRed c) (.getBlue c) (.getGreen c) nil))))

@@ -96,7 +108,7 @@
         t0 (int t)
         t1 (if (>= (inc t0) s) 0 (inc t0))
         p  (- t t0)]
-    (blend t (nth colors t0) (nth colors t1))))
+    (blend-hsv t (nth colors t0) (nth colors t1))))

 ; TODO: less-angry rainbow!


delaney.clj: refactored the (minimal) function

--- clojure/org/gavrog/clojure/delaney.clj
+++ clojure/org/gavrog/clojure/delaney.clj
@@ -435,16 +435,15 @@
       (let [emap (zipmap reps (range 1 (inc (count reps))))
             idcs (indices ds)
             imap (zipmap idcs (range (inc (dim ds))))
-            set-op (fn [ops [D i]] (assoc-in ops [(imap i) (emap D)]
-                                             (emap (pfind p (s ds i D)))))
-            ops (reduce set-op {} (for [i idcs, D reps] [D i]))
-            d-set (DSymbol. (dim ds) (count reps) ops {})
-            set-v (fn [vs [D i j]]
-                    (let [this-r (r d-set (imap i) (imap j) (emap D))]
-                      (assoc-in vs [(imap i) (emap D)]
-                                (/ (m ds i j D) this-r))))
-            vs (reduce set-v {} (for [[i j] (zipmap idcs (rest idcs)), D reps]
-                                  [D i j]))]
+            img (fn [i D] (emap (pfind p (s ds i D))))
+            ops (into {} (for [i idcs]
+                           [(imap i),
+                            (into {} (for [D reps] [(emap D) (img i D)]))]))
+            t (DSymbol. (dim ds) (count reps) ops {})
+            spin (fn [i j D] (/ (m ds i j D) (r t (imap i) (imap j) (emap D))))
+            vs (into {} (for [[i j] (zipmap idcs (rest idcs))]
+                          [(imap i)
+                           (into {} (for [D reps] [(emap D) (spin i j D)]))]))]
         (DSymbol. (dim ds) (count reps) ops vs)))))

 ;; === Wrapped Java methods


[clojure] bump plugins

[clojure] bump plugins

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -3,6 +3,6 @@
                   [lein-ancient                      "0.6.10"]
                   [lein-pprint                       "1.1.2"]
                   [lein-figwheel                     "0.5.4-7"]
-                  [cider/cider-nrepl                 "0.13.0"]
+                  [cider/cider-nrepl                 "0.14.0"]
                   [venantius/ultra                   "0.5.0"]]
         :signing {:gpg-key "E5B26621"}}}


Inc debugger version.

Inc debugger version.

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -1,6 +1,6 @@
 {:user {:dependencies [[clj-stacktrace "0.2.8"]
                        [spyscope "0.1.5"]
-                       [debugger "0.1.4"]
+                       [debugger "0.1.7"]
                        [bolth "0.1.0"]
                        [com.aphyr/prism "0.1.2"]
                        [slamhound "1.5.5"]]


upping sleep to 1 second

upping sleep to 1 second

--- test/lcmap/clownfish/specifications_test.clj
+++ test/lcmap/clownfish/specifications_test.clj
@@ -221,7 +221,7 @@
                     {:content-type "application/json" :persistent true})
         ;; sleep this for just a bit so the server has time to consume and
         ;; persist the message we just sent.
-        (Thread/sleep 10)))
+        (Thread/sleep 1000)))

     (testing "retrieve algorithm results once available"
       (let [body     {:algorithm "test-alg" :x 123 :y 456}


Never timeout sessions out-of-container, by default

Instead, use https://github.com/ring-clojure/ring-session-timeout

--- web/src/immutant/web/internal/wunderboss.clj
+++ web/src/immutant/web/internal/wunderboss.clj
@@ -30,7 +30,8 @@
 (def ^:internal create-defaults (opts->defaults-map Web$CreateOption))

 (def ^:internal session-manager
-  (InMemorySessionManager. "thismayneedabettername", -1))
+  (doto (InMemorySessionManager. "thismayneedabettername", -1)
+    (.setDefaultSessionTimeout -1)))

 (def ^:internal server-name
   (partial u/hash-based-component-name create-defaults))


Change login icon

Change login icon

--- frontend/src/cruncher/utils/views.cljs
+++ frontend/src/cruncher/utils/views.cljs
@@ -90,7 +90,7 @@
       (dom/div nil
                (dom/a #js {:href    "javascript:void(0)"
                            :onClick #(lib/change-view! :login)}
-                      (fa-icon "fa-sign-out")
+                      (fa-icon "fa-sign-in")
                       " Login")))))
 (def login-indicator (om/factory LoggedIn))


:lipstick: Show icons sorted on the debug view.

--- frontend/src/uxbox/builtins/icons.cljs
+++ frontend/src/uxbox/builtins/icons.cljs
@@ -104,7 +104,7 @@
   {::mf/wrap-props false}
   [props]
   [:section.debug-icons-preview
-   (for [[key val] (ns-publics 'uxbox.builtins.icons)]
+   (for [[key val] (sort-by first (ns-publics 'uxbox.builtins.icons))]
      (when (not= key 'debug-icons-preview)
        [:div.icon-item {:key key}
         (deref val)


routing: fix infinite loop bug caused by reagent alpha version

--- examples/_common/middleware/routing.cljs
+++ examples/_common/middleware/routing.cljs
@@ -74,6 +74,10 @@

                (let [token (reaction (::token @model))]
                  (run!
+                   ; hack: assertion prevents the infinite loop which can occur on schema validation in debugger middleware
+                   ; see https://github.com/reagent-project/reagent/issues/223 for the origin of the problem
+                   ; also see https://github.com/reagent-project/reagent/issues/222 on why this assert will not be logged
+                   (assert @token)
                    (replace-token history @token))))

              :on-stop


Track intercom interactions

Track intercom interactions

--- src-cljs/frontend/analytics.cljs
+++ src-cljs/frontend/analytics.cljs
@@ -8,6 +8,7 @@
             [frontend.analytics.twitter :as twitter]
             [frontend.analytics.facebook :as facebook]
             [frontend.models.build :as build-model]
+            [frontend.state :as state]
             [frontend.utils :as utils :include-macros true]
             [frontend.intercom :as intercom]
             [frontend.utils.vcs-url :as vcs-url]
@@ -118,6 +119,17 @@
     (mixpanel/track (name message)
                     (tracking-properties message state))))

+(defn page-properties []
+  {:url  js/location.href
+   :title js/document.title})
+
+(defmethod tracking-properties :intercom-dialog-raised [_ state]
+  (page-properties))
+
+(defmethod tracking-properties :report-build-clicked [_ state]
+  (merge (page-properties)
+         (build-properties (get-in @state state/build-path))))
+
 (deftrack track-view-page [zone]
   (mixpanel/track "View Page" {:zone zone :title js/document.title :url js/location.href}))


delay starting the replay by 2 seconds

delay starting the replay by 2 seconds

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -936,7 +936,8 @@
 (defmethod post-handle-cmd-chat "replay"
   [state cmd body]
   (@frontend.careful/om-setup-debug)
-  (sente/send-msg (:sente state) [:frontend/replay-transactions {:document/id (:document/id state)}])
+  (js/setTimeout #(sente/send-msg (:sente state) [:frontend/replay-transactions {:document/id (:document/id state)}])
+                 2000)
   ::stop-save)

 (defmethod post-control-event! :chat-submitted


improve mentioning

improve mentioning

--- src/ceres_collector/pipeline.clj
+++ src/ceres_collector/pipeline.clj
@@ -102,13 +102,14 @@
         aid (get-author-id user)
         hids (doall (map (fn [{:keys [text]}] (get-hashtag-id text)) (:hashtags entities)))
         url-ids (doall (map #(get-url-id (:expanded_url %) news?) (:urls entities)))
-        me-ids (doall (map #(get-author-id %) (:mentions entities)))
+        me-ids (doall (map #(get-author-id %) (:user_mentions entities)))
         type (get-type tweet)]
     (when news?
       (doall (map #(d/store-reference % mid "source") url-ids)))
     (d/store-reference aid mid "pub")
-    (map #(d/store-reference mid % "url") url-ids)
-    (map #(d/store-hashtag mid % "tag") hids)
+    (doall (map #(d/store-reference mid (assoc % :mention true) "mention") me-ids))
+    (doall (map #(d/store-reference mid % "url") url-ids))
+    (doall (map #(d/store-hashtag mid % "tag") hids))
     (case type
       :reply (let [sid (mc/find-one-as-map @db "messages" {:tid (:in_reply_to_status_id tweet)})]
                (d/store-reference mid sid "reply"))


Remove screenshot slider. Change slogan. Remove "addenum".

--- src/circleci/web/views/index.clj
+++ src/circleci/web/views/index.clj
@@ -9,30 +9,12 @@
    [:div#pitch_wrap
     [:div#pitch
      [:div#intro
-      [:h1 "Continuous Integration for AWS and Heroku"]
-      ;;[:p "CircleCI runs automated tests, manages integration branches and deploys to production, all with ease"]
-      [:a.call_to_action {:href "/signup"} "Get started now"]]
-     [:div#slider
-      [:div.slider_images
-       (for [img ["img/screenshot_01.jpg"
-                  "img/screenshot_02.jpg"
-                  "img/screenshot_03.jpg"
-                  "img/screenshot_04.jpg"]]
-         (image {:width 420
-                 :height 280} img))]]
+      [:h1 "Really Easy Continuous Integration"]
+     ]
+     [:div#slider ]
      [:div.ie7_sliderFix]
      [:div.clear]]]
-   [:div#addendum_wrap
-    [:div#addendum
-     [:div#callout.box_wide.separator_r
-      [:a {:href "img/screeshot_large_01.jpg"
-           :rel "lightbox"}]
-      [:img {:src "img/screenshot_small_01.jpg"
-             :width 190
-             :height 60}]
-      [:h3 "No more build breaks!"]
-      [:p "CircleCI runs automated tests, builds artifacts, manages integration branches and deploys to production, with ease"]]
-     [:div.clear]]]
+
    [:div#content_wrap
     [:div#content
      [:div#main_content_wide.left
@@ -53,7 +35,7 @@
               :width 60
               :height 55}]
        [:h3 "No more build breaks"]
-       [:p "Each developer commits to their own integration branch, CircleCI automatically merges their changes " [:b "only"] " when the tests pass"]]
+       [:p "CircleCI runs automated tests, builds artifacts, manages integration branches and deploys to production, with ease" ]]
       [:div.box_medium.feature
        [:img {:src "img/icon_feature_04.png"
               :width 60


allow facedown install of a second console

--- src/clj/game/core-installing.clj
+++ src/clj/game/core-installing.clj
@@ -167,7 +167,7 @@
    Checks uniqueness of card and installed console"
   [state side {:keys [uniqueness] :as card} facedown]
   (and (or (not uniqueness) (not (in-play? state card)) facedown) ; checks uniqueness
-       (or (not (has-subtype? card "Console"))
+       (or (not (and (has-subtype? card "Console") (not facedown)))
            (not (some #(has-subtype? % "Console") (all-installed state :runner)))) ; console check
        (if-let [req (:req (card-def card))]
          (or facedown (req state side card nil)) ; checks req for install


ENH: chapter 6, exercise 1: make attr function

--- src/clj_prj03/ch6_additional.clj
+++ src/clj_prj03/ch6_additional.clj
@@ -36,3 +36,9 @@
   (fn [& args]
     (f (apply g args))))

+(defn attr
+  [attr-name]
+  (fn [x] (attr-name (:attributes x))))
+
+((attr :intelligence) character)
+((attr :strength) character)


Removed superfluous parenthesis

Removed superfluous parenthesis

--- src/cljs/db_quiz/components.cljs
+++ src/cljs/db_quiz/components.cljs
@@ -67,7 +67,7 @@
                      "en" :en
                      "cs" :cs
                      :cs))]
-    (swap! app-state assoc :language language))))
+    (swap! app-state assoc :language language)))

 (defn set-defaults!
   "Set default options on load."


Fix clear completed

Fix clear completed

--- src/cljs/libx/todomvc/views.cljs
+++ src/cljs/libx/todomvc/views.cljs
@@ -83,7 +83,7 @@
       [:li (a-fn :active "Active")]
       [:li (a-fn :done   "Completed")]]
      (when (pos? done-count)
-       [:button#clear-completed {:on-click #(then [(guid) :clear-completed :tag])}
+       [:button#clear-completed {:on-click #(then [(guid) :ui/clear-completed :tag])}
         "Clear completed"])]))


Add by search and easier/harder re-implemented

--- src/cljs/movement/generator.cljs
+++ src/cljs/movement/generator.cljs
@@ -57,9 +57,8 @@
          movements (session/get-in [:movement-session :parts position-in-parts :movements])
          part (session/get-in [:movement-session :parts position-in-parts])
          part (apply dissoc part (for [[k v] part :when (nil? v)] k))
-         part (dissoc part :title :movements)
-         difficulty (case new-difficulty "easier" :movement/easier "harder" :movement/harder nil)]
-     (when-let [id (:db/id (first (shuffle (difficulty m))))]
+         part (dissoc part :title :movements)]
+     (when-let [id (:db/id (first (shuffle (new-difficulty m))))]
        (GET "movement-by-id"
             {:params        {:id id
                              :part part}
@@ -130,25 +129,6 @@
   (create-session-from-template (:db/id (first (shuffle (session/get :templates))))))

 ;;;;;; Components ;;;;;;
-(defn buttons-component [m title]
-  [:div.pure-g
-   [:div.pure-u-1-12]
-   [:div.pure-u-1-6.refresh
-    [:i.fa.fa-random {:on-click #(refresh-movement m title) :title "Swap with another movement"}]]
-   [:div.pure-u-1-12]
-   (if (:movement/easier m)
-     [:div.pure-u-1-6.refresh
-      [:i.fa.fa-minus {:on-click #(refresh-movement m title "easier") :title "Swap with easier movement"}]]
-     [:div.pure-u-1-6])
-   [:div.pure-u-1-12]
-   (if (:movement/harder m)
-     [:div.pure-u-1-6.refresh
-      [:i.fa.fa-plus {:on-click #(refresh-movement m title "harder") :title "Swap with harder movement"}]]
-     [:div.pure-u-1-6])
-   [:div.pure-u-1-12]
-   [:div.pure-u-1-6.destroy
-    [:i.fa.fa-remove {:on-click #(remove-movement m title) :title "Remove movement"}]]])
-
 (defn slider-component []
   (let [data (atom 0)]
     (fn [position-in-parts id r min max step]
@@ -178,7 +158,23 @@
         rest-clicked? (atom false)]
     (fn []
       [:div.pure-u.movement.center {:id (str "m-" id)}
-       (buttons-component m title)
+       [:div.pure-g
+        [:div.pure-u-1-12]
+        [:div.pure-u-1-6.refresh
+         [:i.fa.fa-random {:on-click #(refresh-movement m title) :title "Swap with another movement"}]]
+        [:div.pure-u-1-12]
+        (if easier
+          [:div.pure-u-1-6.refresh
+           [:i.fa.fa-minus {:on-click #(refresh-movement m title :easier) :title "Swap with easier movement"}]]
+          [:div.pure-u-1-6])
+        [:div.pure-u-1-12]
+        (if harder
+          [:div.pure-u-1-6.refresh
+           [:i.fa.fa-plus {:on-click #(refresh-movement m title :harder) :title "Swap with harder movement"}]]
+          [:div.pure-u-1-6])
+        [:div.pure-u-1-12]
+        [:div.pure-u-1-6.destroy
+         [:i.fa.fa-remove {:on-click #(remove-movement m title) :title "Remove movement"}]]]
        [:div.pure-g
         [:div.pure-u-1-12]
         [:h3.pure-u.title name]


Clean up console logs

Clean up console logs

--- src/cljs/whatishistory/core.cljs
+++ src/cljs/whatishistory/core.cljs
@@ -35,8 +35,7 @@
   (let [curr-user (js/Parse.User.current)]
     (if (nil? curr-user)
       (save-anonymous-user)
-      (swap! app-atom assoc :curr-user curr-user))
-    (js/console.log "user: " (get @app-atom :curr-user))))
+      (swap! app-atom assoc :curr-user curr-user))))

 (defn login-user [app-atom]
@@ -118,10 +117,8 @@
       (do
          (def new-defn-promise (.save new-defn (clj->js defn-data)))
          (.then new-defn-promise (fn [defn]
-                              (js/console.log "definition saved: " defn)
-                              (swap! app-atom assoc :defn-obj defn)))
+                                   (swap! app-atom assoc :defn-obj defn)))
          (.fail new-defn-promise (fn [err]
-                                   (js/console.error err.message)
                                    (js/alert "Something went wrong :/. Please try again.")))))))

@@ -140,10 +137,9 @@
         (.set defn-obj "authorCountry" country)
         (def save-defn-promise (.save defn-obj))
         (.then save-defn-promise (fn [evt]
-                                   (js/console.log "saved xtra data")
                                    (set! js/window.location.href "/thankyou")))
         (.fail save-defn-promise (fn [err]
-                                 (js/console.error err)))))))
+                                 (js/console.error "Something went wrong: " err)))))))

 (defn get-defn [idx]
   (js/Parse.Cloud.run
@@ -308,7 +304,6 @@
              :max-length 4
              :placeholder "Enter Year (YYYY)"
              :on-change (fn [evt]
-                          (js/console.log (@app-atom :year))
                           (swap! app-atom assoc :year (js/parseInt evt.target.value)))}]
     [:a {:class "button formToggle"
          :on-click #(swap! app-atom assoc :defn-form-mode "default")} "Add Your Own Definition"]


better logs

better logs

--- src/clj/algorithms_clj/macro_initiation.clj
+++ src/clj/algorithms_clj/macro_initiation.clj
@@ -223,11 +223,10 @@

 (defmacro defn-log
   [name bindings body]
-  (let [log-stmt (compile-log-expression &form bindings)]
-    `(defn ~name
-       ~bindings
-       ~log-stmt
-       ~body)))
+  `(defn ~name
+     ~bindings
+     ~(compile-log-expression &form bindings)
+     ~body))

 (defn-log add-with-log
   [a b]
@@ -235,6 +234,9 @@

 (defn test-add-with-log
   []
+  (println
+    (walk/macroexpand-all
+      '(defn-log add-with-log [a b] (+ a b))))
   (add-with-log 1 2))

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


fix receive buffer logic

fix receive buffer logic

--- src/clj/backtype/storm/messaging/loader.clj
+++ src/clj/backtype/storm/messaging/loader.clj
@@ -26,20 +26,16 @@
                    (let [batched (ArrayList.)
                          init (msg/recv socket)]
                      (loop [[task msg :as packet] init]
-                       (cond (nil? packet)
-                                (do (transfer-local-fn batched)
-                                    0)
-                             (= task -1)
-                                (do
-                                 (log-message "Receiving-thread:[" storm-id ", " port "] received shutdown notice")
-                                 (.close socket)
-                                 nil )
-                             :else (do (.add batched packet)
-                                       (if (< (.size batched) max-buffer-size)
-                                        (recur (msg/recv-with-flags socket 1)) ;; 1 is ZMQ/NOBLOCK
-                                        0
-                                        ))
-                             ))))
+                       (if (= task -1)
+                         (do (log-message "Receiving-thread:[" storm-id ", " port "] received shutdown notice")
+                             (.close socket)
+                             nil )
+                         (do
+                           (when packet (.add batched packet))
+                           (if (and packet (< (.size batched) max-buffer-size))
+                             (recur (msg/recv-with-flags socket 1))
+                             (do (transfer-local-fn batched)
+                                 0 )))))))
                  :args-fn (fn [] [(msg/bind context storm-id port)])
                  :daemon daemon
                  :kill-fn kill-fn


cleanup stackfile only if exist

cleanup stackfile only if exist

--- src/clj/swarmpit/event/rules/processing.clj
+++ src/clj/swarmpit/event/rules/processing.clj
@@ -14,8 +14,9 @@
       (and (= "service" (:Type event))
            (= "remove" (:Action event))))
     (process [_ event]
-      (doseq [stackfile (api/stackfiles)]
-        (when (nil? (api/stack (:name stackfile)))
-          (api/delete-stackfile (:name stackfile)))))))
+      (doseq [{:keys [name]} (api/stackfiles)]
+        (when (and (nil? (api/stack name))
+                   (some? (api/stackfile name)))
+          (api/delete-stackfile name))))))

 (def list [cleanup-stackfiles])


Save log blob to file.

Save log blob to file.

--- src/cljs/onyx_dashboard/components/log.cljs
+++ src/cljs/onyx_dashboard/components/log.cljs
@@ -68,9 +68,10 @@
           (dom/a {:on-click (fn [_]
                               (js/window.open
                                 (blob/object-url!
-                                  (blob/blob [(pr-str (vec (sort-by :message-id (vals entries))))] "text/plain"))
-                                "_blank"))}
-                 "View raw log file - please include with Onyx bug reports")))
+                                  (blob/blob [(pr-str (vec (sort-by :message-id (vals entries))))]
+                                             "application/octet-stream"))
+                                "download"))}
+                 "Save raw log file - please submit with Onyx bug reports where possible.")))

 (defcomponent log-entries-pager [{:keys [job-filter entries] :as log} owner]
   (init-state [_]


4clojure:: WIP generate valid pair-parans by a given number

--- src/clojure_learning/4clojure-exercises.clj
+++ src/clojure_learning/4clojure-exercises.clj
@@ -1491,15 +1491,80 @@
 ;; we only have two possible combinations: "()()" and "(())".
 ;; Any other combination of length 4 is ill-formed.
 ;; (= #{"((()))" "()()()" "()(())" "(())()" "(()())"} (__ 3))
+(require 'clojure.string)
 (defn generate-parans
-  ([x] (generate-parans x []))
-  ([x buffer]
-   (letfn [(max-parans? [] (= (* x x) (count buffer)))]
-     (if (max-parans?)
-       buffer
-       (if (and (= (last buffer) "(") (= (count buffer) x))
-         (conj buffer ")")
-         (conj buffer "("))))))
-
-;; TODO: WIP
-(generate-parans 2)
+  ([x]
+   (letfn [(to-binary
+              [x]
+              (Integer/toBinaryString x))
+           (left-padding
+              [bin-num]
+              (apply str (conj (repeat (inc (count bin-num)) 0) bin-num)))
+           (pow [x n] (reduce #(* % %2) (repeat n x)))]
+
+  (let [raw-mapped-bins (map #(left-padding (to-binary %)) (range (pow 2 x)))
+        mapped-bins raw-mapped-bins]
+    mapped-bins ))))
+
+;; WIP: not ready
+(generate-parans 3)
+(class (Integer. 2))
+(Integer/toBinaryString 3)
+
+;; here's the working solution:
+(defn gen-parans [x]
+  (letfn [(pow [x n]
+              (reduce * (repeat n x)))
+          (to-binary [x]
+              (Integer/toBinaryString x))
+          (left-padding [bin-num]
+             (apply str (conj (vec (repeat (- x (count bin-num)) 0) ) bin-num)))
+          (binary-nums-padded [exp]
+              (map (comp left-padding to-binary) (range 0 (pow 2 exp))))
+          (nest-op [acc]
+              (str "(" acc ")" ))
+          (nest-op? [each-exp]
+              (= 1 (Integer. (str each-exp))))
+          (append-op [acc]
+              (str acc "()"))
+          (gen-parans-recur
+             [binary-seq]
+             (loop [[head & tail] binary-seq
+                     acc ""]
+                 (if (nil? head)
+                    acc
+                   (if (nest-op? head)
+                     (recur tail (nest-op acc))
+                     (recur tail (append-op acc))))))]
+
+    (apply hash-set (map gen-parans-recur (binary-nums-padded x)))))
+
+;; 010
+(gen-parans 3)
+
+;; "(()())" "((()))" "()()()" "(())()"
+
+;; binary-nums-padded:
+;; "000"
+;; "001"
+;; "010"
+;; "100"
+;; "110"
+;; "011"
+;; "101"
+;; "111"
+
+;; work:
+(defn append-op [each-exp]
+    (format "%1s()" (clojure.string/replace each-exp #"0|1" "()")))
+(append-op \0);  ()()
+
+(let [[head & tail] "010"] [head tail]) ; [\0 \1 \0]
+(let [[head & tail] "010"] (clojure.string/replace head "0" "()")) ; "()"
+
+(map #(Integer. (str %)) (vec "123")) ; (1 2 3)
+
+(defn wrap-op [str-token]
+    (format "(%1s)" (clojure.string/replace str-token #"0|1" "()")))
+(wrap-op (str \0)) ; (())
+(clojure.string/replace "0" #"0|1" "()") ; "()"


Remove run next check on add branch node

--- src/com/wsscode/pathom/connect/planner.cljc
+++ src/com/wsscode/pathom/connect/planner.cljc
@@ -404,17 +404,12 @@
             (set-root-node node-id))

         (and (get next-node branch-type)
-             #_(= (::run-next next-node) (::run-next root-node))
              root-sym)
         (add-branch-node (assoc graph ::root node-id) env root-node)

         (and (get root-node branch-type)
-             #_(= (::run-next next-node) (::run-next root-node))
              next-sym)
         (add-branch-node graph env next-node)
-
-        #_(and (get next-node ::run-and) (get root-node ::run-and))
-

         :else
         (create-branch-node graph env next-node (branch-node-factory))))


Add to existing request :context, if any

--- src/io/aviso/rook/dispatcher.clj
+++ src/io/aviso/rook/dispatcher.clj
@@ -429,7 +429,7 @@
                             (update-in [:rook :metadata]
                               merge (dissoc metadata :arg-resolvers))
                             ;; FIXME
-                            (assoc-in [:context] location))))
+                            (update-in [:context] str location))))

                   pathvec' (mapv #(if (variable? %) ::param-next %) pathvec)


Fix Marginalia crashing on a keyword with semicolon inside

Seems like it considers :android:name as two separate keywords.

--- src/leiningen/droid/manifest.clj
+++ src/leiningen/droid/manifest.clj
@@ -16,7 +16,7 @@
 ;; XML tag of the Internet permission.
 (def ^{:private true} internet-permission-tag
   {:tag :uses-permission
-   :attrs {:android:name internet-permission}})
+   :attrs {(keyword :android:name) internet-permission}})

 ;; ### Local functions


A slightly different take

A slightly different take

--- scheduling/src/immutant/scheduling.clj
+++ scheduling/src/immutant/scheduling.clj
@@ -24,46 +24,47 @@
             Scheduling Scheduling$CreateOption Scheduling$ScheduleOption]))

 (defn schedule
-  "Schedules a function to run according to a specification map
-  comprised of any of the following keys:
+  "Schedules a function to run according to a specification composed from any of the following:

-  * :in - a period after which f will be called
-  * :at - a time after which f will be called
-  * :every - the period between calls
-  * :until - stops the calls at a specific time
-  * :limit - limits the calls to a specific count
-  * :cron - calls f according to a [Quartz-style](http://quartz-scheduler.org/documentation/quartz-2.2.x/tutorials/tutorial-lesson-06) cron spec
+  * {{in}} - a period after which f will be called
+  * {{at}} - a time after which f will be called
+  * {{every}} - the period between calls
+  * {{until}} - stops the calls at a specific time
+  * {{limit}} - limits the calls to a specific count
+  * {{cron}} - calls f according to a [Quartz-style](http://quartz-scheduler.org/documentation/quartz-2.2.x/tutorials/tutorial-lesson-06) cron spec

-  Units for periods (:in and :every) are milliseconds, but can
-  also be represented as a keyword or a vector of number/keyword
-  pairs, e.g. `[1 :week, 4 :days, 2 :hours, 30 :minutes, 59 :seconds]`.
+  Units for periods are milliseconds, but can also be represented as a
+  keyword or a sequence of multiplier/keyword pairs,
+  e.g. `[1 :week, 4 :days, 2 :hours, 30 :minutes, 59 :seconds]`.

-  Date/Time values (:at and :until) can be a `java.util.Date`,
-  millis-since-epoch, or a String in `HH:mm` format.
+  Time values can be a `java.util.Date`, a long denoting
+  milliseconds-since-epoch, or a String in `HH:mm` format, interpreted
+  as the next occurence of \"HH:mm:00\" in the currently active
+  timezone.

-  Some syntactic sugar functions corresponding to the above keywords
-  can be composed to create the schedule spec:
+  For example:
+
   ```
-  (schedule #(println \"I'm running!\")
+  (schedule #(prn 'fire!)
     (-> (in 5 :minutes)
       (every 2 :hours, 30 :minutes)
       (until \"1730\")))
+
+  (schedule #(prn 'fire!)
+    (-> (at some-date)
+      (every :second)
+      (limit 60)))
   ```

-  Which is equivalent to this:
+  Ultimately, the spec is just a map, and the syntactic sugar
+  functions are just assoc'ing keys corresponding to their names. The
+  map can be passed either explicitly or via keyword arguments. All of
+  the following are equivalent:
+
   ```
-  (schedule #(println \"I'm running!\")
-    {:in [5 :minutes]
-     :every [2 :hours, 30 :minutes]
-     :until \"17:30\"})
-  ```
-
-  If you prefer, you can pass the spec as keyword arguments:
-  ```
-  (schedule #(println \"I'm running!\")
-    :at \"08:00\"
-    :every :day
-    :limit 10)
+  (schedule #(prn 'fire!) (-> (in 5 :minutes) (every :day)))
+  (schedule #(prn 'fire!) {:in [5 :minutes], :every :day})
+  (schedule #(prn 'fire!) :in [5 :minutes], :every :day)
   ```

   Two additional options may be passed in the spec:
@@ -134,16 +135,17 @@
   `(every 1 :hour 20 :minutes)`. See {{schedule}}.")

 (defoption ^{:arglists '([date] [ms] [HHmm])} until
-  "When {{every}} is specified, this limits the invocations by
-  time; can be a `java.util.Date`, millis-since-epoch, or a String in
-  `HH:mm` format, e.g. `(-> (every :hour) (until \"17:00\"))`. See
-  {{schedule}}.")
+  "When {{every}} is specified, this limits the invocations by time;
+  can be a `java.util.Date`, millis-since-epoch, or a String in
+  `HH:mm` format, e.g. `(-> (every :hour) (until \"17:00\"))`. When
+  combined with {{limit}}, whichever triggers first ends the
+  iteration. See {{schedule}}.")

 (defoption ^{:arglists '([n])} limit
-  "When {{every}} is specified, this limits the invocations by
-  count, including the first one, e.g. `(-> (every :hour) (limit 10))`.
-  When {{until}} and `limit` are combined, whichever triggers
-  first ends the iteration. See {{schedule}}.")
+  "When {{every}} is specified, this limits the invocations by count,
+  including the first one, e.g. `(-> (every :hour) (limit 10))`. When
+  combined with {{until}}, whichever triggers first ends the
+  iteration. See {{schedule}}.")

 (defoption ^{:arglists '([str])} cron
   "Takes a Quartz-style cron spec, e.g. `(cron \"0 0 12 ? * WED\")`,


new smart-contract addesses mainnet

new smart-contract addesses mainnet

--- src/name_bazaar/shared/smart_contracts.cljs
+++ src/name_bazaar/shared/smart_contracts.cljs
@@ -1,23 +1,14 @@
 (ns name-bazaar.shared.smart-contracts)
     (def smart-contracts
-      ;; Ropsten ENSRegistry
-      ;; https://docs.ens.domains/ens-deployments
-      ;; https://ropsten.etherscan.io/address/0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e
       {:ens {:name "ENSRegistry" :address "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"}
-       ;; Ropsten BaseRegistrarImplementation
-       ;; https://ropsten.etherscan.io/address/0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85
-       :eth-registrar {:name "NameBazaarDevRegistrar" :address "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85"}
-       :offering-registry {:name "OfferingRegistry" :address "0xa3634fE2E2973d5d0cB7f2a1b2b0327A0B6e2d0D"}
-       :buy-now-offering {:name "BuyNowOffering" :address "0xfF58F3De9319f37BF9b6F355694fe4431b58E6a4"}
-       :buy-now-offering-factory {:name "BuyNowOfferingFactory" :address "0x8dD4F32663771D73b387A983D1c40BdB431241fd"}
-       :auction-offering {:name "AuctionOffering" :address "0xa9c221236b9c16Ef08bccd84F89cE5b525B817A9"}
-       :auction-offering-factory {:name "AuctionOfferingFactory" :address "0x18eF935Cd12b962739538B35F94B0E9fE0e19D59"}
-       :district0x-emails {:name "District0xEmails" :address "0x31BF9DB8b432b0d108491e2bc9423d6C6d419E20"}
-       :reverse-name-resolver {:name "NamebazaarDevNameResolver" :address "0x0000000000000000000000000000000000000000"}
-       ;; Ropsten PublicResolver
-       ;; https://ropsten.etherscan.io/address/0x42d63ae25990889e35f215bc95884039ba354115
-       :public-resolver {:name "NamebazaarDevPublicResolver" :address "0x42D63ae25990889E35F215bC95884039Ba354115"}
-       ;; Ropsten ReverseRegistrar
-       ;; https://ropsten.etherscan.io/address/0x6F628b68b30Dc3c17f345c9dbBb1E483c2b7aE5c
-       :reverse-registrar {:name "NamebazaarDevReverseRegistrar" :address "0x6F628b68b30Dc3c17f345c9dbBb1E483c2b7aE5c"}
+       :eth-registrar {:name "NameBazaarDevRegistrar" :address "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85"}
+       :offering-registry {:name "OfferingRegistry" :address "0x5B5B2B386a84546Fa75E9472e3096C26576B6d24"}
+       :buy-now-offering {:name "BuyNowOffering" :address "0x45141Ef2E09412eAd94793617507A0F487249fB0"}
+       :buy-now-offering-factory {:name "BuyNowOfferingFactory" :address "0xF9Bc1b1bBC9C91864e68D861038282ebdcf2449A"}
+       :auction-offering {:name "AuctionOffering" :address "0x9cf308c1d04AeD7eEA994f029cA2E39517C6372f"}
+       :auction-offering-factory {:name "AuctionOfferingFactory" :address "0xF787200012f8d3EA6Ee686577aA73Ed4a3e3ee0C"}
+       :district0x-emails {:name "District0xEmails" :address "0x02441d5dd828CccB3F81ae702eeEccc2142a192e"}
+       :reverse-name-resolver {:name "NamebazaarDevNameResolver" :address "0xA2C122BE93b0074270ebeE7f6b7292C7deB45047"}
+       :public-resolver {:name "NamebazaarDevPublicResolver" :address "0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41"}
+       :reverse-registrar {:name "NamebazaarDevReverseRegistrar" :address "0x084b1c3C81545d370f3634392De611CaaBFf8148"}
        })


Only close if there is a pipeline. An exception can make this nil.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -429,20 +429,20 @@
               task-lifecycle-ch (thread (run-task-lifecycle pipeline-data seal-resp-ch kill-ch ex-f))
               listen-for-sealer-ch (listen-for-sealer job-id task-id pipeline-data seal-resp-ch outbox-ch)]
           (assoc component
-                 :pipeline-data pipeline-data
-                 :seal-ch seal-resp-ch
-                 :release-messages-ch release-messages-ch
-                 :retry-messages-ch retry-messages-ch
-                 :forward-completion-ch forward-completion-ch
-                 :task-lifecycle-ch task-lifecycle-ch
-                 :listen-for-sealer-ch listen-for-sealer-ch)))
+            :pipeline-data pipeline-data
+            :seal-ch seal-resp-ch
+            :release-messages-ch release-messages-ch
+            :retry-messages-ch retry-messages-ch
+            :forward-completion-ch forward-completion-ch
+            :task-lifecycle-ch task-lifecycle-ch
+            :listen-for-sealer-ch listen-for-sealer-ch)))
       (catch Exception e
         (handle-exception e restart-ch outbox-ch job-id)
         component)))

   (stop [component]
     (taoensso.timbre/info (format "[%s] Stopping Task LifeCycle for %s" id (:onyx.core/task (:pipeline-data component))))
-    (let [event (:pipeline-data component)]
+    (when-let [event (:pipeline-data component)]
       (l-ext/close-lifecycle-resources* event)

       (close! (:seal-ch component))
@@ -461,14 +461,14 @@
         (doseq [[_ link] (:links state)]
           (extensions/close-peer-connection (:onyx.core/messenger event) event link))))

-    (assoc component
-           :pipeline-data nil
-           :seal-ch nil
-           :release-messages-ch nil
-           :retry-messages-ch nil
-           :forward-completion-ch nil
-           :task-lifecycle-ch nil
-           :listen-for-sealer-ch nil)))
+    (assoc component
+      :pipeline-data nil
+      :seal-ch nil
+      :release-messages-ch nil
+      :retry-messages-ch nil
+      :forward-completion-ch nil
+      :task-lifecycle-ch nil
+      :listen-for-sealer-ch nil)))

 (defn task-lifecycle [args {:keys [id log messenger-buffer messenger job task replica
                                    restart-ch kill-ch outbox-ch seal-ch completion-ch opts]}]


Fix signature.

Fix signature.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -179,7 +179,7 @@
     (loop []
       (when-let [{:keys [id peer-id]} (<!! completion-ch)]
         (let [peer-link (operation/peer-link event peer-id :completion-peer-site)]
-          (extensions/internal-complete-message (:onyx.core/messenger event) id peer-link)
+          (extensions/internal-complete-message (:onyx.core/messenger event) event id peer-link)
           (recur))))
     (catch Exception e
       (timbre/fatal e))))


Fixes #274.

Fixes #274.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -74,7 +74,9 @@
 (defn route-data
   [event result message flow-conditions downstream]
   (if (nil? flow-conditions)
-    (->Route downstream nil nil nil)
+    (if (operation/exception? message)
+      (throw (:exception (ex-data message)))
+      (->Route downstream nil nil nil))
     (let [compiled-ex-fcs (:onyx.core/compiled-ex-fcs event)]
       (if (operation/exception? message)
         (if (seq compiled-ex-fcs)


Pull some functions out of read-batch and tag-messages

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -194,24 +194,32 @@
                                    (:onyx.core/id rets) (:onyx.core/lifecycle-id rets)))
     rets))

+(defn handle-backoff! [event]
+  (let [batch (:onyx.core/batch event)]
+    (when (and (= (count batch) 1)
+               (= (:message (first batch)) :done))
+      (Thread/sleep (:onyx.core/drained-back-off event)))))
+
 (defn read-batch [task-type replica job-id pipeline event]
   (if (and (= task-type :input)
+           ;; rename backpressuring?
+           ;; add note about how it'll be slow with big clusters
            (common/job-backpressuring? @replica job-id))
-    event
-    (let [rets (p-ext/read-batch pipeline event)
-          batch (:onyx.core/batch rets)]
-      (when (and (= (count batch) 1)
-                 (= (:message (first batch)) :done))
-        (Thread/sleep (:onyx.core/drained-back-off event)))
+    (assoc event :onyx.core/batch [])
+    (let [rets (p-ext/read-batch pipeline event)]
+      (handle-backoff! event)
       (merge event rets))))
+
+(defn validate-ackable! [peers event]
+  (when-not (seq peers)
+    (do (warn (format "[%s] This job no longer has peers capable of acking. This job will now pause execution." (:onyx.core/id event)))
+        (throw (ex-info "Not enough acker peers" {:peers peers})))))

 (defn tag-messages [task-type replica id job-id max-acker-links event]
   (if (= task-type :input)
     (let [peers (get (:ackers @replica) job-id)
+          _ (validate-ackable! peers event)
           candidates (operation/select-n-peers id peers max-acker-links)]
-      (when-not (seq peers)
-        (do (warn (format "[%s] This job no longer has peers capable of acking. This job will now pause execution." (:onyx.core/id event)))
-            (throw (ex-info "Not enough acker peers" {:peers peers}))))
       (update-in
         event
         [:onyx.core/batch]
@@ -219,7 +227,6 @@
           (map (comp (partial add-completion-id id)
                      (partial add-acker-id candidates))
                batch))))
-
     event))

 (defn add-messages-to-timeout-pool [task-type state event]


Inc default buffer size to reduce dropped msgs

--- src/onyx/static/default_vals.clj
+++ src/onyx/static/default_vals.clj
@@ -27,7 +27,7 @@
    :onyx.messaging.netty/thread-pool-sizes 1
    :onyx.messaging.netty/connect-timeout-millis 1000
    :onyx.messaging.netty/pending-buffer-size 10000
-   :onyx.messaging/inbound-buffer-size 20000
+   :onyx.messaging/inbound-buffer-size 200000
    :onyx.messaging/completion-buffer-size 50000
    :onyx.messaging/release-ch-buffer-size 10000
    :onyx.messaging/retry-ch-buffer-size 10000


Change remote call errors to :system-error

This change is made because the developer is very likely to use :error
for their own error messages

--- src/webapp/framework/client/coreclient.cljs
+++ src/webapp/framework/client/coreclient.cljs
@@ -220,7 +220,7 @@

 (defn ok [response]
-  (not (:error response)))
+  (not (:system-error response)))

@@ -274,7 +274,7 @@
                        :result      (str "ERROR IN RESPONSE, HTTP : " status)
                        )]
                  (go
-                   (>! ch  {:error "true"})
+                   (>! ch  {:system-error "true"})
                    (close! ch))
                  (remove-debug-event  debug-id)
                  )


fix 404 bug on the project-settings#env-var page

We currently use the org-settings endpoint to get a list of projects for an org
for the bulk import var feature on env-vars. However, you can have read and write
access to projects which belong to orgs you are not a member of (not sure how but
I did confirm that a thing).

--- src-cljs/frontend/controllers/api.cljs
+++ src-cljs/frontend/controllers/api.cljs
@@ -885,9 +885,9 @@
     (if (org/same? (org/get-from-map context)
                    org)
       (-> state
-          (assoc-in state/add-projects-selected-org-path org) ;; Remove when top-bar-ui-v-1 applied
-          ;; universally. Point all references to
-          ;; state/selected-org-path
+          ;; Remove when top-bar-ui-v-1 applied
+          ;; universally. Point all references to state/selected-org-path
+          (assoc-in state/add-projects-selected-org-path org)
           (state-utils/change-selected-org org))
       state)))

@@ -1232,7 +1232,12 @@

 (defmethod post-api-event! [:org-settings-normalized :failed]
   [target message status {:keys [context] :as args} previous-state current-state comms]
-  (put! (:nav comms) [:error {:status (:status-code args)}]))
+  ;; We currently use the org-settings endpoint to get a list of projects for that org
+  ;; for the Import Variables feature on env-vars. However, you can have read and write
+  ;; access to projects which belong to orgs you are not a member of (not sure how but
+  ;; I did confirm that a thing).
+  (when-not (= (get-in current-state state/current-view-path) :project-settings)
+    (put! (:nav comms) [:error {:status (:status-code args)}])))

 (defmethod api-event [:enterprise-site-status :success]
   [target message status {:keys [resp]} state]


Encode redirect and delegate in OAuth state

--- src-cljs/frontend/utils/bitbucket.cljs
+++ src-cljs/frontend/utils/bitbucket.cljs
@@ -9,23 +9,13 @@
   )

 (defn auth-url []
-  (let [;; auth-host and auth-protocol indicate the circle host that
-        ;; will handle the oauth redirect
-        auth-host (aget js/window "renderContext" "auth_host")
-        auth-protocol (aget js/window "renderContext" "auth_protocol")
-        redirect (-> (str auth-protocol "://" auth-host)
-                     (url  "auth/bitbucket")
-                     (assoc :query (merge {"return-to" (str js/window.location.pathname
-                                                            js/window.location.hash)}
-                                          (when (not= auth-host js/window.location.host)
-                                            ;; window.location.protocol includes the colon
-                                            {"delegate" (str js/window.location.protocol "//" js/window.location.host)})))
-                     (assoc :protocol (or (aget js/window "renderContext" "auth_protocol")
-                                          "https"))
-                     str)]
+  (let [state {"return-to" (str js/window.location.pathname
+                                js/window.location.hash)
+               "token" (utils/oauth-csrf-token)
+               "delegate" (str js/window.location.protocol "//" js/window.location.host)}
+        state-str (.stringify js/JSON (clj->js state))]
     (-> (url (http-endpoint) "site/oauth2/authorize")
-        (assoc :query {"redirect_uri" redirect
-                       "state" (utils/oauth-csrf-token)
+        (assoc :query {"state"        state-str
                        "response_type" "code"
                        "client_id" (aget js/window "renderContext" "bitbucketClientId")})
         str)))


Teach the applet how to correctly deal with keyRelease, mousePress and mouseRelease events

--- src/rosado/processing/applet.clj
+++ src/rosado/processing/applet.clj
@@ -18,10 +18,16 @@
   "Define an applet. Takes an app-name and a map of options."
   [app-name & opts]
   (let [options (assoc (apply hash-map opts) :name (str app-name))
-        fns (dissoc options :name :title :size :key-pressed)
+        fns (dissoc options :name :title :size :key-pressed :key-released :mouse-pressed :mouse-released)
         fns (merge {:draw (fn [] nil)} fns)
         key-pressed-fn (or (:key-pressed options)
                            (fn [] nil))
+        key-released-fn (or (:key-released options)
+                           (fn [] nil))
+        mouse-pressed-fn (or (:mouse-pressed options)
+                              (fn [] nil))
+        mouse-released-fn (or (:mouse-released options)
+                              (fn [] nil))
         methods (into {} (map fix-mname fns))]
     `(def ~app-name
        (let [frame# (atom nil)
@@ -34,7 +40,25 @@
                                     *state* state#]
                             (~key-pressed-fn)))
                       ([e#]
-                         (proxy-super keyPressed e#))))
+                         (proxy-super keyPressed e#)))
+                    (keyReleased
+                      ([] (binding [*applet* ~'this
+                                    *state* state#]
+                            (~key-released-fn)))
+                      ([e#]
+                         (proxy-super keyReleased e#)))
+                    (mousePressed
+                      ([] (binding [*applet* ~'this
+                                    *state* state#]
+                            (~mouse-pressed-fn)))
+                      ([e#]
+                         (proxy-super mousePressed e#)))
+                    (mouseReleased
+                      ([] (binding [*applet* ~'this
+                                    *state* state#]
+                            (~mouse-released-fn)))
+                      ([e#]
+                         (proxy-super mouseReleased e#))))

              bound-meths# (reduce (fn [methods# [method-name# f#]]
                                     (assoc methods# (name method-name#)


allow animations to specify state path instead of function, and simplify slide action list

--- src/solar_system_of_js/core.cljs
+++ src/solar_system_of_js/core.cljs
@@ -234,11 +234,19 @@
   (cond-> tween
     (keyword? tween) tweens))

+(defn resolve-callback
+  "If the callback is a state path, create the callback to set that path."
+  [callback]
+  (if-let [path (when (vector? callback) callback)]
+    #(swap! state assoc-in path %)
+    callback))
+
 (defn animate!
   "Pass given animation values to the given callback.
    Returns a channel that closes when done."
   [{:keys [a b duration tween] :or {tween :swing} :as opts} callback]
   (let [tween (resolve-tween tween)
+        callback (resolve-callback callback)
         c (chan)
         dv (- b a)]
     (tap tick-tap c)
@@ -268,47 +276,32 @@
 ;; Slide Animations
 ;;--------------------------------------------------------------------------------

-(defn go-go-slide1!
-  []
-  (go
-    (<! (multi-animate!
-          {:a 900 :b 0 :duration 1}
-           #(swap! state assoc-in [:js-face :x] %)
-           {:a 1 :b 0 :duration 0.4}
-           #(swap! state assoc-in [:title :alpha] %)
-           ))))
-
-(defn go-go-slide2!
-  []
-  (go
-    (<! (multi-animate!
-          {:a 0 :b -600 :duration 2}
-          #(swap! state assoc-in [:js-face :y] %)
-          {:a 0 :b 600 :duration 2}
-          #(swap! state assoc-in [:js-face :x] %)
-          {:a 0 :b (* 2 PI) :duration 2}
-          #(swap! state assoc-in [:js-face :angle] %)
-          {:a 1 :b 0 :duration 2}
-          #(swap! state assoc-in [:js-face :alpha] %)
-          {:a 0 :b 1 :duration 1}
-          #(swap! state assoc-in [:js-core :alpha] %)
-          {:a 1 :b 2 :duration 2}
-          #(swap! state assoc-in [:cam :zoom] %)
-          ))))
-
-;;--------------------------------------------------------------------------------
-;; Slide Control
-;;--------------------------------------------------------------------------------
-
 (def slide-actions
   "Actions to take for each slide."
-  [nil
-   go-go-slide1!
-   go-go-slide2!
+  [nil ;; no action for first slide
+   #(go
+      (<! (multi-animate!
+            {:a 900 :b 0 :duration 1} [:js-face :x]
+            {:a 1 :b 0 :duration 0.4} [:title :alpha]
+            )))
+   #(go
+      (<! (multi-animate!
+            {:a 0 :b 400 :duration 2} [:cam :x]
+            {:a 0 :b -600 :duration 2} [:js-face :y]
+            {:a 0 :b 600 :duration 2} [:js-face :x]
+            {:a 0 :b (* 2 PI) :duration 2} [:js-face :angle]
+            {:a 1 :b 0 :duration 2} [:js-face :alpha]
+            {:a 0 :b 1 :duration 1} [:js-core :alpha]
+            {:a 1 :b 2 :duration 2} [:cam :zoom]
+            )))
    ])

 (def num-slides
   (count slide-actions))
+
+;;--------------------------------------------------------------------------------
+;; Slide Control
+;;--------------------------------------------------------------------------------

 ;; Saved slide states, so we can revisit previous slides.
 (defonce slide-states


Move def'd atoms into component

Move def'd atoms into component

--- src/clj/onyx_dashboard/http/server.clj
+++ src/clj/onyx_dashboard/http/server.clj
@@ -28,10 +28,6 @@
   (assoc-in ring.middleware.defaults/site-defaults
             [:security :anti-forgery]
             {:read-token (fn [req] (-> req :params :csrf-token))}))
-
-; TODO: Move into component
-(def deployments (atom {}))
-(def tracking (atom {}))

 ; TODO:  Improve fn name
 (defn job-peer-allocated-task [job-allocations job-id peer-id]
@@ -159,7 +155,7 @@
                                 :user-id user-id
                                 :tracking-id tracking-id}))

-(defn stop-tracking! [user-id]
+(defn stop-tracking! [tracking user-id]
   (swap! tracking
          (fn [tr]
            (if-let [manager (tr user-id)]
@@ -167,9 +163,9 @@
                  (dissoc tr user-id))
              tr))))

-(defn start-tracking! [send-fn! peer-config {:keys [deployment-id tracking-id]} user-id]
+(defn start-tracking! [send-fn! peer-config tracking {:keys [deployment-id tracking-id]} user-id]
   (println deployment-id " tracking id " tracking-id peer-config)
-  (stop-tracking! user-id)
+  (stop-tracking! tracking user-id)
   (swap! tracking
          assoc
          user-id
@@ -178,16 +174,16 @@
                                                         user-id
                                                         tracking-id))))

-(defn stop-all-tracking! []
+(defn stop-all-tracking! [tracking]
   (map stop-tracking! (keys @tracking)))

 (defn zk-deployment-entry-stat [client entry]
   (:stat (zk/data client (zk-onyx/prefix-path entry))))

-(defn distribute-deployments [send-all-fn! deployments]
-  (send-all-fn! [:deployment/listing deployments]))
-
-(defn refresh-deployments-watch [send-all-fn! zk-client]
+(defn distribute-deployment-listing [send-all-fn! listing]
+  (send-all-fn! [:deployment/listing listing]))
+
+(defn refresh-deployments-watch [send-all-fn! zk-client deployments]
   (if-let [children (zk/children zk-client zk-onyx/root-path :watcher (fn [_] (refresh-deployments-watch send-all-fn! zk-client)))]
     (->> children
          (map (juxt identity
@@ -198,16 +194,16 @@
                          :modified-at (java.util.Date. (:mtime stat))})))
          (into {})
          (reset! deployments)
-         (distribute-deployments send-all-fn!))
+         (distribute-deployment-listing send-all-fn!))
     (do
       (println (format "Could not find deployments at %s. Retrying in 1s." zk-onyx/root-path))
       (Thread/sleep 1000)
-      (recur send-all-fn! zk-client))))
+      (recur send-all-fn! zk-client deployments))))

 (defn event->uid [event]
   (get-in event [:ring-req :cookies "ring-session" :value]))

-(defn start-event-handler [sente peer-config]
+(defn start-event-handler [sente peer-config deployments tracking]
   (future
     (loop []
       (when-let [event (<!! (:ch-chsk sente))]
@@ -220,6 +216,7 @@
           (case (:id event)
             :deployment/track (start-tracking! (:chsk-send! sente)
                                                peer-config
+                                               tracking
                                                (:?data event)
                                                user-id)
             :deployment/get-listing ((:chsk-send! sente) user-id [:deployment/listing @deployments])
@@ -235,14 +232,8 @@
 (defrecord HttpServer [peer-config]
   component/Lifecycle
   (start [{:keys [sente] :as component}]
-
-    ; Just reset atoms for now. Atoms should be created and reset in here
-    (reset! tracking {})
-    (reset! deployments {})
-
     (println "Starting HTTP Server")
-
-    (defroutes my-routes
+    (defroutes routes
       (GET  "/" [] (page))
       (GET  "/chsk" req ((:ring-ajax-get-or-ws-handshake sente) req))
       (POST "/chsk" req ((:ring-ajax-post sente) req))
@@ -252,24 +243,30 @@
       (resources "/react" {:root "react"})
       (route/not-found "Page not found"))

-    (let [event-handler-fut (start-event-handler sente peer-config)
+    (let [deployments (atom {})
+          tracking (atom {})
+          event-handler-fut (start-event-handler sente peer-config deployments tracking)
           ; TODO: no way to currently stop this watch
           _ (refresh-deployments-watch (partial send-mult-fn
                                                 (:chsk-send! sente)
                                                 (:connected-uids sente))
-                                       (zk/connect (:zookeeper/address peer-config)))
-          my-ring-handler (ring.middleware.defaults/wrap-defaults my-routes ring-defaults-config)
-          server (http-kit-server/run-server my-ring-handler {:port 3000})
+                                       (zk/connect (:zookeeper/address peer-config))
+                                       deployments)
+          handler (ring.middleware.defaults/wrap-defaults routes ring-defaults-config)
+          server (http-kit-server/run-server handler {:port 3000})
           uri (format "http://localhost:%s/" (:local-port (meta server)))]
       (println "Http-kit server is running at" uri)
-      (assoc component :server server :event-handler-fut event-handler-fut)))
-  (stop [{:keys [server] :as component}]
+      (assoc component
+             :server server
+             :event-handler-fut event-handler-fut
+             :deployments deployments
+             :tracking tracking)))
+  (stop [{:keys [server tracking deployments] :as component}]
     (println "Stopping HTTP Server")
-    (stop-all-tracking!)
+    (stop-all-tracking! tracking)
     (future-cancel (:event-handler-fut component))
     (server :timeout 100)
-    (assoc component :server nil :event-handler-fut nil)))
+    (assoc component :server nil :event-handler-fut nil :deployments nil :tracking nil)))

 (defn new-http-server [peer-config]
   (map->HttpServer {:peer-config peer-config}))
-


tweet oauth 설정 추가.

tweet oauth 설정 추가.

--- src/tweetbook/models/_config.clj
+++ src/tweetbook/models/_config.clj
@@ -1,3 +1,11 @@
 (ns tweetbook.models.config)

 (def db-uri "mongodb-uri")
+
+(def oauth-settings
+  {:consumer-key "consumer-key"
+   :consumer-secret "consumer-secret"
+   :access-token "access-token"
+   :access-token-secret "access-token-secret"})
+
+(def tweet-interval (* 1000 60 60 2))


Use reset! instead of swap!.

Use reset! instead of swap!.

--- test/dsbdp/test/experiment_helper_tests.clj
+++ test/dsbdp/test/experiment_helper_tests.clj
@@ -107,24 +107,24 @@
         end-time (atom nil)
         in-data [100000 200000 300000 400000]]
     (is (= 4 (count proc-fns)))
-    (swap! start-time (fn [_] (System/nanoTime)))
+    (reset! start-time (System/nanoTime))
     ((proc-fns 0) in-data nil)
-    (swap! end-time (fn [_] (System/nanoTime)))
+    (reset! end-time (System/nanoTime))
     (is (> (- @end-time @start-time) 100000))
     (is (< (- @end-time @start-time) 250000))
-    (swap! start-time (fn [_] (System/nanoTime)))
+    (reset! start-time (System/nanoTime))
     ((proc-fns 1) in-data nil)
-    (swap! end-time (fn [_] (System/nanoTime)))
+    (reset! end-time (System/nanoTime))
     (is (> (- @end-time @start-time) 200000))
     (is (< (- @end-time @start-time) 350000))
-    (swap! start-time (fn [_] (System/nanoTime)))
+    (reset! start-time (System/nanoTime))
     ((proc-fns 2) in-data nil)
-    (swap! end-time (fn [_] (System/nanoTime)))
+    (reset! end-time (System/nanoTime))
     (is (> (- @end-time @start-time) 300000))
     (is (< (- @end-time @start-time) 450000))
-    (swap! start-time (fn [_] (System/nanoTime)))
+    (reset! start-time (System/nanoTime))
     ((proc-fns 3) in-data nil)
-    (swap! end-time (fn [_] (System/nanoTime)))
+    (reset! end-time (System/nanoTime))
     (is (> (- @end-time @start-time) 400000))
     (is (< (- @end-time @start-time) 550000))))


New test test-parse-boolean

New test test-parse-boolean

--- test/emender_jenkins/config_loader_test.clj
+++ test/emender_jenkins/config_loader_test.clj
@@ -65,6 +65,17 @@
 ;
 ; Test for function behaviours
 ;
+
+(deftest test-parse-boolean
+    "Check the behaviour of function emender-jenkins.config/parse-boolean."
+    (are [x y] (= x y)
+        true (parse-boolean "true")
+        true (parse-boolean "True")
+        false (parse-boolean "false")
+        false (parse-boolean "False")
+        false (parse-boolean "")
+        false (parse-boolean "unknown")
+        false (parse-boolean nil)))

 (deftest test-parse-int-zero
     "Check the behaviour of function emender-jenkins.config/parse-int."


improve map-vals benchmark

improve map-vals benchmark

--- scripts/benchmarks.clj
+++ scripts/benchmarks.clj
@@ -88,6 +88,7 @@
   (run-benchmark "transform values of a small map" 1000000
     (into {} (for [[k v] data] [k (inc v)]))
     (reduce-kv (fn [m k v] (assoc m k (inc v))) {} data)
+    (persistent! (reduce-kv (fn [m k v] (assoc! m k (inc v))) (transient {}) data))
     (reduce-kv (fn [m k v] (assoc m k (inc v))) (empty data) data)
     (transform [ALL LAST] inc data)
     (transform MAP-VALS inc data)
@@ -98,6 +99,7 @@
   (run-benchmark "transform values of large map" 1000
     (into {} (for [[k v] data] [k (inc v)]))
     (reduce-kv (fn [m k v] (assoc m k (inc v))) {} data)
+    (persistent! (reduce-kv (fn [m k v] (assoc! m k (inc v))) (transient {}) data))
     (reduce-kv (fn [m k v] (assoc m k (inc v))) (empty data) data)
     (transform [ALL LAST] inc data)
     (transform MAP-VALS inc data)


Streamline card editor code a tiny bit

Streamline card editor code a tiny bit

--- src/kanban/components/card_editor.cljs
+++ src/kanban/components/card_editor.cljs
@@ -13,9 +13,7 @@
     [:id :text {:assignees (om/get-query Assignee)}])
   Object
   (toggle-assignee [this ref]
-    (println "toggle assignee" ref)
     (let [{:keys [assignees update-fn]} (om/props this)]
-      (println "assignees" assignees)
       (letfn [(add-or-remove* [x xs]
                 (if (some #{x} xs)
                   (remove #{x} xs)
@@ -26,6 +24,10 @@
             (into [])
             (assoc {} :assignees)
             (update-fn (om/get-ident this))))))
+
+  (update-text [this text]
+    (let [{:keys [update-fn]} (om/props this)]
+      (update-fn (om/get-ident this) {:text text})))

   (render [this]
     (let [{:keys [id text assignees users close-fn update-fn]} (om/props this)]
@@ -51,9 +53,7 @@
               (dom/textarea
                 #js {:value text
                      :placeholder "Enter a card description here..."
-                     :onChange
-                     #(update-fn (om/get-ident this)
-                                 {:text (.. % -target -value)})})))
+                     :onChange #(.update-text this (.. % -target -value))})))
           (dom/p #js {:className "buttons"}
             (dom/button #js {:onClick close-fn} "Close")))))))


CMR-5848 Fix mime-type references.

CMR-5848 Fix mime-type references.

--- virtual-product-app/src/cmr/virtual_product/services/virtual_product_service.clj
+++ virtual-product-app/src/cmr/virtual_product/services/virtual_product_service.clj
@@ -5,7 +5,6 @@
    [cmr.common.concepts :as concepts]
    [cmr.common.log :refer (debug info warn error)]
    [cmr.common.mime-types :as mime-types]
-   [cmr.common.mime-types :as mt]
    [cmr.common.services.errors :as errors]
    [cmr.common.util :as u :refer [defn-timed]]
    [cmr.message-queue.config :as queue-config]
@@ -122,9 +121,9 @@
   (let [provider-id (svm/provider-alias->provider-id provider-id)
         orig-concept (mdb/get-concept context concept-id revision-id)
         format (-> (:format orig-concept)
-                   mt/base-mime-type-of)
+                   mime-types/base-mime-type-of)
         ;; If the format is umm-json, we need to use umm-spec to parse the metadata into UMM.
-        orig-umm (if (= format mt/umm-json)
+        orig-umm (if (= format mime-types/umm-json)
                    (umm-spec/parse-metadata context (:concept-type orig-concept) format (:metadata orig-concept))
                    (umm/parse-concept orig-concept))
         vp-config (svm/source-to-virtual-product-mapping [provider-id entry-title])
@@ -135,7 +134,7 @@
       (let [new-umm (svm/generate-virtual-granule-umm provider-id source-short-name
                                                       orig-umm virtual-coll)
             new-granule-ur (:granule-ur new-umm)
-            new-metadata (if (= format mt/umm-json)
+            new-metadata (if (= format mime-types/umm-json)
                            (umm-spec/generate-metadata context new-umm (mime-types/mime-type->format
                                                                          (:format orig-concept)))
                            (umm/umm->xml new-umm (mime-types/mime-type->format


fix faulty relay ping logic

fix faulty relay ping logic

ends up kicking us on active connections that don't ping for a
while since it only pings after 5sec idle.

--- src/main/shadow/remote/relay/local.clj
+++ src/main/shadow/remote/relay/local.clj
@@ -183,6 +183,11 @@
             from-client
             ([msg]
              (when (some? msg)
+               ;; each message is effectively a pong as well
+               ;; prevents the timeout logic from kicking us if it didn't actually send
+               ;; a ping for a while
+               (swap! state-ref assoc-in [:clients client-id :last-pong] (System/currentTimeMillis))
+
                (relay-client-receive relay client-data msg)

                (try
@@ -230,8 +235,9 @@
       (async/close! to))))

 (defmethod handle-sys-msg :pong
-  [{:keys [state-ref] :as relay} {:keys [client-id] :as origin} msg]
-  (swap! state-ref assoc-in [:clients client-id :last-pong] (System/currentTimeMillis)))
+  [relay origin msg]
+  ;; already handled when the message was received
+  )

 (defmethod handle-sys-msg :hello
   [{:keys [state-ref] :as relay}


Re-use buffer for barrier messages.

Re-use buffer for barrier messages.

--- src/onyx/messaging/aeron/messenger.clj
+++ src/onyx/messaging/aeron/messenger.clj
@@ -55,6 +55,7 @@
                          monitoring
                          id
                          ticket-counters
+                         control-message-buf
                          ^:unsynchronized-mutable replica-version
                          ^:unsynchronized-mutable epoch
                          ^:unsynchronized-mutable publishers
@@ -153,13 +154,13 @@

   (offer-barrier [messenger publisher barrier-opts]
     (let [barrier (merge (t/barrier replica-version epoch (pub/short-id publisher)) barrier-opts)
-          buf (UnsafeBuffer. (byte-array 500))
-          len (sz/serialize buf 0 barrier)]
-      (let [ret (pub/offer! publisher buf len (dec epoch))]
+          len (sz/serialize control-message-buf 0 barrier)]
+      (let [ret (pub/offer! publisher control-message-buf len (dec epoch))]
         (debug "Offer barrier:" [:ret ret :message barrier :pub (pub/info publisher)])
         ret))))

 (defmethod m/build-messenger :aeron [peer-config messenger-group monitoring id]
   (->AeronMessenger messenger-group monitoring id
                     (:ticket-counters messenger-group)
+                    (UnsafeBuffer. (byte-array onyx.types/max-control-message-size))
                     nil nil nil nil nil))


give the g an invalid

give the g an invalid

--- src-cljs/frontend/components/canvas.cljs
+++ src-cljs/frontend/components/canvas.cljs
@@ -75,73 +75,76 @@
     "crosshair"))

 (defn layer-group [layer {:keys [tool selected-eids selected-eid cast! db live?]}]
-  (dom/g #js {:className (str "layer " (when (= :select tool) "selectable-group "))
-              :key (str (:db/id layer) live?)}
-         (svg-element selected-eids
-                      (assoc layer
-                        :onMouseDown
-                        #(do
-                           (.stopPropagation %)
-                           (let [group? (and (< 1 (count selected-eids))
-                                             (contains? selected-eids (:db/id layer)))]
-
-                             (cond
-                              (not= :select tool) nil
-
-                              (or (= (.-button %) 2)
-                                  (and (= (.-button %) 0) (.-ctrlKey %)))
-                              (cast! :layer-properties-opened {:layer layer
-                                                               :x (first (cameras/screen-event-coords %))
-                                                               :y (second (cameras/screen-event-coords %))})
-
-
-                              (and (.-altKey %) group?)
-                              (cast! :group-duplicated
-                                     {:group-eid selected-eid
-                                      :layer-eids (disj selected-eids selected-eid)
-                                      :x (first (cameras/screen-event-coords %))
-                                      :y (second (cameras/screen-event-coords %))})
-
-                              (and (.-altKey %) (not group?))
-                              (cast! :layer-duplicated
-                                     {:layer layer
-                                      :x (first (cameras/screen-event-coords %))
-                                      :y (second (cameras/screen-event-coords %))})
-
-                              group?
-                              (cast! :group-selected {:x (first (cameras/screen-event-coords %))
-                                                      :y (second (cameras/screen-event-coords %))
-                                                      :group-eid selected-eid
-                                                      :layer-eids (disj selected-eids selected-eid)})
-
-                              :else
-                              (cast! :layer-selected {:layer layer
-                                                      :x (first (cameras/screen-event-coords %))
-                                                      :y (second (cameras/screen-event-coords %))}))))
-                        :className "selectable-layer layer-handle"
-                        :key (str "selectable-" (:db/id layer))))
-         (svg-element selected-eids (assoc layer
-                                      :onMouseDown (cond
-                                                    (and (= :text tool)
-                                                         (= :layer.type/text (:layer/type layer)))
-                                                    #(do
-                                                       (.stopPropagation %)
-                                                       (cast! :text-layer-re-edited layer))
-
-                                                    :else nil)
-                                      :onMouseUp (when (and (= :text tool)
-                                                            (= :layer.type/text (:layer/type layer)))
-                                                   #(.stopPropagation %))
-                                      :className (str "layer-outline "
-                                                      (when (= :text tool) "editable"))
-                                      :key (:db/id layer)))
-         (when (:layer/ui-target layer)
-           (let [invalid? (not (pos? (layer-model/count-by-ui-id @db (:layer/ui-target layer))))]
-             ;; TODO: figure out what to do with this title
-             ;; (when invalid?
-             ;;   (dom/title nil
-             ;;              (str "This action links to \""  (:layer/ui-target layer) "\", but no shapes have that name."
-             ;;                   " Right-click on a shape's border to name it " (:layer/ui-target layer))))
+  (let [invalid? (and (:layer/ui-target layer)
+                      (not (pos? (layer-model/count-by-ui-id @db (:layer/ui-target layer)))))]
+    (dom/g #js {:className (str "layer "
+                                (when (= :select tool) "selectable-group ")
+                                (when invalid? "invalid "))
+                :key (str (:db/id layer) live?)}
+           (svg-element selected-eids
+                        (assoc layer
+                          :onMouseDown
+                          #(do
+                             (.stopPropagation %)
+                             (let [group? (and (< 1 (count selected-eids))
+                                               (contains? selected-eids (:db/id layer)))]
+
+                               (cond
+                                (not= :select tool) nil
+
+                                (or (= (.-button %) 2)
+                                    (and (= (.-button %) 0) (.-ctrlKey %)))
+                                (cast! :layer-properties-opened {:layer layer
+                                                                 :x (first (cameras/screen-event-coords %))
+                                                                 :y (second (cameras/screen-event-coords %))})
+
+
+                                (and (.-altKey %) group?)
+                                (cast! :group-duplicated
+                                       {:group-eid selected-eid
+                                        :layer-eids (disj selected-eids selected-eid)
+                                        :x (first (cameras/screen-event-coords %))
+                                        :y (second (cameras/screen-event-coords %))})
+
+                                (and (.-altKey %) (not group?))
+                                (cast! :layer-duplicated
+                                       {:layer layer
+                                        :x (first (cameras/screen-event-coords %))
+                                        :y (second (cameras/screen-event-coords %))})
+
+                                group?
+                                (cast! :group-selected {:x (first (cameras/screen-event-coords %))
+                                                        :y (second (cameras/screen-event-coords %))
+                                                        :group-eid selected-eid
+                                                        :layer-eids (disj selected-eids selected-eid)})
+
+                                :else
+                                (cast! :layer-selected {:layer layer
+                                                        :x (first (cameras/screen-event-coords %))
+                                                        :y (second (cameras/screen-event-coords %))}))))
+                          :className "selectable-layer layer-handle"
+                          :key (str "selectable-" (:db/id layer))))
+           (svg-element selected-eids (assoc layer
+                                        :onMouseDown (cond
+                                                      (and (= :text tool)
+                                                           (= :layer.type/text (:layer/type layer)))
+                                                      #(do
+                                                         (.stopPropagation %)
+                                                         (cast! :text-layer-re-edited layer))
+
+                                                      :else nil)
+                                        :onMouseUp (when (and (= :text tool)
+                                                              (= :layer.type/text (:layer/type layer)))
+                                                     #(.stopPropagation %))
+                                        :className (str "layer-outline "
+                                                        (when (= :text tool) "editable"))
+                                        :key (:db/id layer)))
+           ;; TODO: figure out what to do with this title
+           ;; (when invalid?
+           ;;   (dom/title nil
+           ;;              (str "This action links to \""  (:layer/ui-target layer) "\", but no shapes have that name."
+           ;;                   " Right-click on a shape's border to name it " (:layer/ui-target layer))))
+           (when (:layer/ui-target layer)
              (svg-element selected-eids
                           (assoc layer
                             :padding 4 ;; only works for rects right now


Angle bracket fixes.

Angle bracket fixes.


Mihir | Assigning strings rather than keywords

--- src/aggregatequeryservice/runqueries.clj
+++ src/aggregatequeryservice/runqueries.clj
@@ -72,4 +72,4 @@
                       (let [results (run-queries-and-get-results config-file connection-provider query-params-map)]
                         (do-with-connection (partial dblog/update task-id "DONE" (generate-string results)) connection-provider)
                         (generate-string results)))]
-    {:results task-future :task_id task-id}))+    {"results" task-future "task-future" task-id}))


make rules easier to read: just use (.*) for wildcards since we're parsing tokens at this point, not entire phrases


setup basic streams for transactional components

--- src/clj/backtype/storm/daemon/common.clj
+++ src/clj/backtype/storm/daemon/common.clj
@@ -136,6 +136,12 @@
   ;; TODO: validate that all subscriptions are to valid component/streams
   )

+(defn all-bolts [^StormTopology topology]
+  (merge {}  (.get_bolts topology) (.get_transactional_bolts topology)))
+
+(defn all-tuple-spouts [^StormTopology topology]
+  (merge {}  (.get_spouts topology) (.get_transactional_spouts topology)))
+
 (defn acker-inputs [^StormTopology topology]
   (let [bolt-ids (.. topology get_bolts keySet)
         spout-ids (.. topology get_spouts keySet)
@@ -151,23 +157,20 @@
                              ))]
     (merge spout-inputs bolt-inputs)))

-
-(defn system-topology! [storm-conf ^StormTopology topology]
-  (validate-basic! topology)
-  (let [ret (.deepCopy topology)
-        acker-bolt (thrift/mk-bolt-spec* (acker-inputs ret)
+(defn add-acker! [num-tasks ^StormTopology ret]
+  (let [acker-bolt (thrift/mk-bolt-spec* (acker-inputs ret)
                                          (new backtype.storm.daemon.acker)
                                          {ACKER-ACK-STREAM-ID (thrift/direct-output-fields ["id"])
                                           ACKER-FAIL-STREAM-ID (thrift/direct-output-fields ["id"])
                                           }
-                                         :p (storm-conf TOPOLOGY-ACKERS))]
-    (dofor [[_ bolt] (.get_bolts ret)
+                                         :p num-tasks)]
+    (dofor [[_ bolt] (all-bolts ret)
             :let [common (.get_common bolt)]]
-      (do
-        (.put_to_streams common ACKER-ACK-STREAM-ID (thrift/output-fields ["id" "ack-val"]))
-        (.put_to_streams common ACKER-FAIL-STREAM-ID (thrift/output-fields ["id"]))
-        ))
-    (dofor [[_ spout] (.get_spouts ret)
+           (do
+             (.put_to_streams common ACKER-ACK-STREAM-ID (thrift/output-fields ["id" "ack-val"]))
+             (.put_to_streams common ACKER-FAIL-STREAM-ID (thrift/output-fields ["id"]))
+             ))
+    (dofor [[_ spout] (all-tuple-spouts ret)
             :let [common (.get_common spout)]]
       (do
         (.put_to_streams common ACKER-INIT-STREAM-ID (thrift/output-fields ["id" "spout-task"]))
@@ -179,9 +182,20 @@
                         (GlobalStreamId. ACKER-COMPONENT-ID ACKER-FAIL-STREAM-ID)
                         (thrift/mk-direct-grouping))
         ))
+    (.put_to_bolts ret "__acker" acker-bolt)
+    ))
+
+(defn add-system-streams! [^StormTopology topology]
+  )
+
+(defn system-topology! [storm-conf ^StormTopology topology]
+  (validate-basic! topology)
+  (let [ret (.deepCopy topology)]
+    (add-acker! (storm-conf TOPOLOGY-ACKERS) ret)
+    (add-system-streams! ret)
     ;; TODO: need to set up streams/inputs for transactional spout
     ;; TODO: need to set up streams/inputs for transactional bolts
-    (.put_to_bolts ret "__acker" acker-bolt)
+
     (validate-structure! ret)
     ret
     ))


fix conf reference

fix conf reference

--- src/clj/backtype/storm/daemon/nimbus.clj
+++ src/clj/backtype/storm/daemon/nimbus.clj
@@ -659,7 +659,7 @@
     ;; Schedule Nimbus inbox cleaner
     (schedule-recurring (:timer nimbus)
                         0
-                        (conf NIMBUS-CLEANUP-FREQ-SECS)
+                        (conf NIMBUS-CLEANUP-INBOX-FREQ-SECS)
                         (fn []
                           (clean-inbox (inbox nimbus) (conf NIMBUS-INBOX-JAR-EXPIRATION-SECS))
                           ))


Add :symbolic-three-way-reproductive-change-changes-differently diversification test

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -1541,6 +1541,42 @@
            (distinct? (- mbsim-c-gc mbsim-gc-ggc)
                       (- mbsim-c2-gc2 mbsim-gc2-ggc2))))))

+(defn symbolic-three-way-reproductive-change-changes-differently-diversifying?
+  [ind argmap]
+  (let [symbolic #(filter (comp not number?) %)
+        g (:genome ind)
+        c (produce-child-genome-by-autoconstruction g g argmap)
+        c2 (produce-child-genome-by-autoconstruction g g argmap)
+        c3 (produce-child-genome-by-autoconstruction g g argmap)
+        c-made-by (symbolic (flatten (:made-by (meta c))))
+        c2-made-by (symbolic (flatten (:made-by (meta c2))))
+        c3-made-by (symbolic (flatten (:made-by (meta c3))))
+        gc (produce-child-genome-by-autoconstruction c g g argmap)
+        gc2 (produce-child-genome-by-autoconstruction c2 g g argmap)
+        gc3 (produce-child-genome-by-autoconstruction c3 g g argmap)
+        gc-made-by (symbolic (flatten (:made-by (meta gc))))
+        gc2-made-by (symbolic (flatten (:made-by (meta gc2))))
+        gc3-made-by (symbolic (flatten (:made-by (meta gc3))))
+        ggc (produce-child-genome-by-autoconstruction gc g g argmap)
+        ggc2 (produce-child-genome-by-autoconstruction gc2 g g argmap)
+        ggc3 (produce-child-genome-by-autoconstruction gc3 g g argmap)
+        ggc-made-by (symbolic (flatten (:made-by (meta ggc))))
+        ggc2-made-by (symbolic (flatten (:made-by (meta ggc2))))
+        ggc3-made-by (symbolic (flatten (:made-by (meta ggc3))))
+        mbsim-c-gc (sequence-similarity c-made-by gc-made-by)
+        mbsim-c2-gc2 (sequence-similarity c2-made-by gc2-made-by)
+        mbsim-c3-gc3 (sequence-similarity c3-made-by gc3-made-by)
+        mbsim-gc-ggc (sequence-similarity gc-made-by ggc-made-by)
+        mbsim-gc2-ggc2 (sequence-similarity gc2-made-by ggc2-made-by)
+        mbsim-gc3-ggc3 (sequence-similarity gc3-made-by ggc3-made-by)]
+    (assoc ind :diversifying
+      (and (distinct? 1 mbsim-c-gc mbsim-gc-ggc)
+           (distinct? 1 mbsim-c2-gc2 mbsim-gc2-ggc2)
+           (distinct? 1 mbsim-c3-gc3 mbsim-gc3-ggc3)
+           (distinct? (- mbsim-c-gc mbsim-gc-ggc)
+                      (- mbsim-c2-gc2 mbsim-gc2-ggc2)
+                      (- mbsim-c3-gc3 mbsim-gc3-ggc3))))))
+
 (defn use-mate-diversifying?
   [ind argmap]
   (let [g (:genome ind)
@@ -1707,6 +1743,7 @@
                 :symbolic-three-children-make-children-differently symbolic-three-children-make-children-differently-diversifying?
                 :symbolic-reproductive-change-changes symbolic-reproductive-change-changes-diversifying?
                 :symbolic-reproductive-change-changes-differently symbolic-reproductive-change-changes-differently-diversifying?
+                :symbolic-three-way-reproductive-change-changes-differently symbolic-three-way-reproductive-change-changes-differently-diversifying?
                 :symbolic-reproductive-change symbolic-reproductive-change-diversifying?
                 :reproductive-change reproductive-change-diversifying?
                 :symbolic-reproductive-divergence symbolic-reproductive-divergence-diversifying?


test: replace price should not change text without price

--- test-cljs/complico/test/dom.cljs
+++ test-cljs/complico/test/dom.cljs
@@ -47,6 +47,9 @@
 (defn replace-price-case-2 []
   (assert (= (complico/replace-price "£300") "£XXX")))

+(defn replace-price-should-not-change-text-without-price []
+  (assert (= (complico/replace-price "text without price") "text without price")))
+
 (defn run []
   (correctly-finds-the-elems)
   (setting-text-on-elem-changes-text)


removed some of the type-casting BS that was added trying to get :integer type-safe

--- test/acceptance/stress_tests.clj
+++ test/acceptance/stress_tests.clj
@@ -118,7 +118,7 @@
   [i len]
   (let [some-junk (into [] (remove nil? (bunch-a-junk (make-everything-interpreter) i)))
         interpreter (overloaded-interpreter
-                      :config {:step-limit 50000}
+                      :config {:step-limit 50000 :lenient? true}
                       :bindings some-junk)]
     (assoc interpreter :program (into [] (bunch-a-junk interpreter len)))))


Added tests for schema selection.

Added tests for schema selection.

--- test/blutwurst/database_test.clj
+++ test/blutwurst/database_test.clj
@@ -8,11 +8,7 @@

 (use-fixtures :each db-fixture logging-fixture)

-(deftest table-graph-tests
-  (testing "Connects to an in-memory database and returns basic table list."
-     (let [spec {:connection-string connection-string}
-           table-graph (retrieve-table-graph spec)
-           expected {:tables
+(def full-expected-graph {:tables
                        [{:name "PURCHASETYPE" :schema "DBO"
                          :columns [
                           {:name "CATEGORY" :type "VARCHAR" :length 50 :nullable true}
@@ -56,6 +52,21 @@
                          [{:name "NAME", :type "VARCHAR", :length 100, :nullable true}
                           {:name "ID", :type "INTEGER", :length 10, :nullable true}]}
                         ]
-                       }]
-       (is (= expected table-graph)))
+                       })
+
+(deftest table-graph-tests
+  (testing "Connects to an in-memory database and returns basic table list."
+     (let [spec {:connection-string connection-string}
+           table-graph (retrieve-table-graph spec)]
+       (is (= full-expected-graph table-graph))))
+
+   (testing "Table scans exclude schemas when at least one is provided."
+     (let [spec {:connection-string connection-string :included-schemas '("FOOBAR")}
+           table-graph (retrieve-table-graph spec)]
+       (is (= {:tables []} table-graph))))
+
+   (testing "Table scans include schemas when at least one is provided."
+     (let [spec {:connection-string connection-string :included-schemas '("DBO")}
+           table-graph (retrieve-table-graph spec)]
+       (is (= full-expected-graph table-graph)))
    ))


Extra test case

Extra test case

--- test/grafter/rdf/sparql_test.clj
+++ test/grafter/rdf/sparql_test.clj
@@ -67,6 +67,13 @@
                "?s ?p ?o . "
                "}")
           (#'sparql/rewrite-values-clauses q3 {:o ["val"]})))
+
+    (is (same-query?
+         (str "SELECT * WHERE {"
+               "{ VALUES ?o { \"val\" } }"
+               "?s ?p ?o . "
+               "}")
+         (#'sparql/rewrite-values-clauses q3 {:s (URI. "http://foo/") :o ["val"]})))

     (is (same-query?
           (str "SELECT * WHERE {"
@@ -161,4 +168,4 @@
     (let [q1 (sparql-query "grafter/rdf/sparql/select-values-1.sparql")]
       (is (same-query?
             (str "SELECT * WHERE { VALUES ?s { <http://s1> <http://s2> } ?s ?p ?o . }")
-            (#'sparql/pre-process-query q1 {:s [(URI. "http://s1") (URI. "http://s2")]}))))))+            (#'sparql/pre-process-query q1 {:s [(URI. "http://s1") (URI. "http://s2")]}))))))


Test submission review columns are added when submission-review is enabled

Signed-off-by: ivermac <cd640042a8f3b0ff08bacdf4feae34fdd495051d@gmail.com>

--- test/hatti/views/table_test.cljs
+++ test/hatti/views/table_test.cljs
@@ -4,10 +4,12 @@
   (:require [chimera.core :refer [not-nil?]]
             [chimera.om.state :refer [merge-into-app-state!]]
             [chimera.urls :refer [last-url-param url]]
+            [chimera.seq :refer [not-empty?]]
             [cljs.core.async :refer [<! chan sliding-buffer put! close!]]
             [cljs.test :as t]
             [dommy.core :as dommy]
             [clojure.string :as string]
+            [hatti.ona.forms :refer [review-comment-field review-status-field]]
             [hatti.shared :as shared]
             [hatti.views :refer [table-page]]
             [hatti.views.table :as tv]
@@ -25,6 +27,11 @@
   (let [flat-form (-> fat-form)
         slickgrid-cols (-> flat-form tv/all-fields tv/flat-form->sg-columns
                            (js->clj :keywordize-keys true))
+        slickgrid-cols-with-submission-review-enabled
+        (-> flat-form
+            tv/all-fields
+            (tv/flat-form->sg-columns :submission-review? true)
+            (js->clj :keywordize-keys true))
         first-col (first slickgrid-cols)]

     (testing "slickgrid columns have the right types"
@@ -40,6 +47,19 @@
                       :headerCssClass :minWidth :cssClass :hxl}
                     (set (keys col))))
         (not-nil? (re-matches (re-pattern (str (:hxl col))) (:name col)))))
+
+    (testing "Submission review status and comment columns visible if
+              submission review is enabled"
+      (is (not-empty?
+           (filterv
+            (fn [col]
+              (string/includes? (:name col) (:label review-comment-field)))
+            slickgrid-cols-with-submission-review-enabled)))
+      (is (not-empty?
+           (filterv
+            (fn [col]
+              (string/includes? (:name col) (:label review-status-field)))
+            slickgrid-cols-with-submission-review-enabled))))

     (testing "slickgrid action column has the right types"
       (is (every? #{:id :name :field :sortable :toolTip :type :formatter


Fix typo

Fix typo

--- test/lambdajam/jobs/test_2_3.clj
+++ test/lambdajam/jobs/test_2_3.clj
@@ -9,8 +9,8 @@

 ;; We're starting to get used to using the catalog as a point of
 ;; knob-tuning on functions. What else can we use the catalog for?
-;; Here's we'll explore grouping of segments driven by
-;; catalog-entry parameters.
+;; Here we'll explore grouping of segments driven by catalog-entry
+;; parameters.
 ;;
 ;; In a grouped task, we apply a function to every segment. This
 ;; function returns some value. All segments that return that same value


Don't escape query string.

Don't escape query string.

It stops wildcards and other things from working.

--- src/kixi/hecuba/data/entities/search.clj
+++ src/kixi/hecuba/data/entities/search.clj
@@ -120,7 +120,7 @@
      (let [query {:query {:filtered
                           {:query
                            {:query_string
-                            {:query (esc/escape-query-string-characters query-string)}}
+                            {:query query-string}}
                            :filter filter-map}}}]
        (search/search search-session "entities" "entity" (assoc query :size size :from from))))
   ([query-string from size search-session]
@@ -128,7 +128,7 @@
                     "entities"
                     "entity"
                     :query {:query_string
-                            {:query (esc/escape-query-string-characters query-string)}}
+                            {:query query-string}}
                     :size size
                     :from from))
   ([query-string filter-map search-session]