Remove unused looked up values

Remove unused looked up values

--- src/onyx/peer/function.clj
+++ src/onyx/peer/function.clj
@@ -16,7 +16,7 @@
    {:onyx.core/batch (onyx.extensions/receive-messages messenger event)}))

 (defn write-batch
-  ([event replica peer-replica-view state id messenger job-id egress-tasks]
+  ([event replica peer-replica-view state messenger egress-tasks]
    (let [segments (:segments (:onyx.core/results event))]
      (when-not (empty? segments)
        (let [replica-val @replica
@@ -28,13 +28,11 @@
                (let [link (operation/peer-link replica-val state event target)]
                  (onyx.extensions/send-messages messenger event link segs)))))))))

-  ([{:keys [onyx.core/id onyx.core/results
-            onyx.core/messenger onyx.core/job-id
-            onyx.core/state onyx.core/replica
-            onyx.core/peer-replica-view onyx.core/serialized-task] :as event}]
-   (write-batch event replica peer-replica-view state id messenger job-id (:egress-ids serialized-task))))
+  ([{:keys [onyx.core/results onyx.core/messenger onyx.core/state
+            onyx.core/replica onyx.core/peer-replica-view onyx.core/serialized-task] :as event}]
+   (write-batch event replica peer-replica-view state messenger (:egress-ids serialized-task))))

-(defrecord Function [replica peer-replica-view state id messenger job-id egress-tasks]
+(defrecord Function [replica peer-replica-view state messenger egress-tasks]
   p-ext/Pipeline
   (read-batch
     [_ event]
@@ -42,7 +40,7 @@

   (write-batch
     [_ event]
-    (write-batch event replica peer-replica-view state id messenger job-id egress-tasks))
+    (write-batch event replica peer-replica-view state messenger egress-tasks))

   (seal-resource [_ _]
     nil))
@@ -50,14 +48,10 @@
 (defn function [{:keys [onyx.core/replica
                         onyx.core/peer-replica-view
                         onyx.core/state
-                        onyx.core/id
                         onyx.core/messenger
-                        onyx.core/job-id
                         onyx.core/serialized-task] :as pipeline-data}]
   (->Function replica
               peer-replica-view
               state
-              id
               messenger
-              job-id
               (:egress-ids serialized-task)))


Fix for db/fetch-album-composers.

Fix for db/fetch-album-composers.

Prevent potential duplicate results.

--- src/org/ocremix/api/db.clj
+++ src/org/ocremix/api/db.clj
@@ -283,6 +283,7 @@
                 {:cs.song_id :s.id})
           (join [:album_game :ag]
                 {:ag.game_id :s.game})
+          (group :a.id :a.name)
           (where {:ag.album_id album-id})))

 (defn fetch-album-remixes


Only kill nonterminal tasks instead of only not killing lost tasks

--- scheduler/src/cook/mesos/scheduler.clj
+++ scheduler/src/cook/mesos/scheduler.clj
@@ -210,10 +210,14 @@
                                           job-resources
                                           instance-runtime))
              ;; This code kills any task that "shouldn't" be running
-             (when (or (nil? instance) ; We could know nothing about the task, meaning a DB error happened and it's a waste to finish
-                       (not= task-state :task-lost) ; killing an unknown task causes a TASK_LOST message. Break the cycle!
-                       (= prior-job-state :job.state/completed) ; The task is attached to a failed job, possibly due to instances running on multiple hosts
-                       (= prior-instance-status :instance.status/failed)) ; The kill-task message could've been glitched on the network
+             (when (and
+                     (or (nil? instance) ; We could know nothing about the task, meaning a DB error happened and it's a waste to finish
+                         (= prior-job-state :job.state/completed) ; The task is attached to a failed job, possibly due to instances running on multiple hosts
+                         (= prior-instance-status :instance.status/failed)) ; The kill-task message could've been glitched on the network
+                     (contains? #{:task-running
+                                  :task-staging
+                                  :task-starting}
+                                task-state)) ; killing an unknown task causes a TASK_LOST message. Break the cycle! Only kill non-terminal tasks
                (log/warn "Attempting to kill task" task-id
                          "as instance" instance "with" prior-job-state "and" prior-instance-status
                          "should've been put down already")


Don't need a future here.

Don't need a future here.

--- test/clj_http/test/core.clj
+++ test/clj_http/test/core.clj
@@ -64,7 +64,7 @@
 (defn run-server
   []
   (defonce server
-    (future (ring/run-jetty handler {:port 18080}))))
+    (ring/run-jetty handler {:port 18080 :join? false})))

 (defn localhost [path]
   (str "http://localhost:18080" path))


Added new test: test-get-port-negative

Added new test: test-get-port-negative

--- test/clouseau/test_core.clj
+++ test/clouseau/test_core.clj
@@ -98,9 +98,18 @@
 (deftest test-get-port
     "Check the function clouseau.core/get-port."
     (testing "the function clouseau.core/get-port."
-        (is (= (get-port nil)    "3000"))
-        (is (= (get-port "")     "3000"))
-        (is (= (get-port "1")    "1"))
-        (is (= (get-port 1)      "3000"))
-        (is (= (get-port "3000") "3000"))))
+        (is (= (get-port nil)     "3000"))
+        (is (= (get-port "")      "3000"))
+        (is (= (get-port "1")     "1"))
+        (is (= (get-port 1)       "3000"))
+        (is (= (get-port "3000")  "3000"))
+        (is (= (get-port "65535") "65535"))))

+(deftest test-get-port-negative
+    "Check the function clouseau.core/get-port."
+    (testing "the function clouseau.core/get-port."
+        (is (thrown? AssertionError (get-port "0")))
+        (is (thrown? AssertionError (get-port "-1")))
+        (is (thrown? AssertionError (get-port "65536")))
+        (is (thrown? AssertionError (get-port "1000000")))))
+


staged command content

staged command content

Former-commit-id: fe8ef287aab19af92bc01cda54382f8605a66949

--- src/status_im/chat/handlers.cljs
+++ src/status_im/chat/handlers.cljs
@@ -107,10 +107,11 @@
   (after invoke-command-preview!)
   (fn [{:keys [current-chat-id] :as db} _]
     (let [db (update-input-text db nil)
-          {:keys [command content]}
-          (get-in db [:chats current-chat-id :command-input])
-          command-info {:command command
-                        :content content}]
+          {:keys [command content]} (get-in db [:chats current-chat-id :command-input])
+          content' (if (= :command (:type command))
+                       (subs content 2)
+                       content)
+          command-info {:command command :content content'}]
       (-> db
           ;(assoc-in [:chats current-chat-id :command-input :command] nil)
           (commands/stage-command command-info)


Add sig functions

Add sig functions

--- common/clojure/nightweb/crypto.clj
+++ common/clojure/nightweb/crypto.clj
@@ -1,18 +1,32 @@
 (ns nightweb.crypto
   (:use [clojure.java.io :only [file writer]]))

-(def signing-key nil)
+(def private-key nil)
+(def public-key nil)

 (defn create-key-if-not-exists
   [key-file-path]
-  (let [key-file (file key-file-path)]
-    (if (.exists key-file)
-      (let [file-contents (slurp key-file-path)]
-        (def signing-key (net.i2p.data.SigningPrivateKey. file-contents)))
-      (let [context (net.i2p.I2PAppContext/getGlobalContext)
-            key-gen (.keyGenerator context)
-            signing-keys (.generateSigningKeypair key-gen)
-            priv-key (aget signing-keys 1)]
-        (def signing-key priv-key)
-        (with-open [wrtr (writer key-file-path)]
-          (.write wrtr (.toBase64 priv-key)))))))
+  (if (.exists (file key-file-path))
+    (let [file-contents (slurp key-file-path)]
+      (def private-key (net.i2p.data.SigningPrivateKey. file-contents))
+      (def public-key (.toPublic private-key)))
+    (let [context (net.i2p.I2PAppContext/getGlobalContext)
+          key-gen (.keyGenerator context)
+          signing-keys (.generateSigningKeypair key-gen)]
+      (def private-key (aget signing-keys 1))
+      (def public-key (aget signing-keys 0))
+      (with-open [wrtr (writer key-file-path)]
+        (.write wrtr (.toBase64 private-key))))))
+
+(defn create-sig
+  [message]
+  (.getData (.sign (net.i2p.crypto.DSAEngine/getInstance) message private-key)))
+
+(defn verify-sig
+  [sig message]
+  (.verifySignature (net.i2p.crypto.DSAEngine/getInstance)
+                    (net.i2p.data.Signature. sig)
+                    message
+                    0
+                    (alength message)
+                    public-key))


une proposition de solution à l'exercice ETL de exercism dans la track Clojure

--- exercism/clojure/etl/src/etl.clj
+++ exercism/clojure/etl/src/etl.clj
@@ -3,6 +3,5 @@
 (defn keys-list-to-hash [value keys-list]
   (map #(hash-map % value) keys-list))

-(defn transform [source]
-  (reduce merge {} (flatten (map #(etl/keys-list-to-hash % (map clojure.string/lower-case (get source %))) (keys source))))
-  )+(defn transform [source]
+  (reduce merge {} (flatten (map #(etl/keys-list-to-hash % (map clojure.string/lower-case (get source %))) (keys source)))))


[#1381] Handle blank spec in bar aggregation

--- backend/src/akvo/lumen/lib/aggregation/bar.clj
+++ backend/src/akvo/lumen/lib/aggregation/bar.clj
@@ -36,7 +36,7 @@
                                       "asc" "ORDER BY sort_value ASC NULLS FIRST"
                                       "dsc" "ORDER BY sort_value DESC NULLS LAST")
         sql-aggregation-subquery (case aggregation-method
-                                   nil ""
+                                   nil "NULL"
                                    ("min" "max" "count" "sum") (str aggregation-method  "(%2$s)")
                                    "mean" "avg(%2$s)"
                                    "median" "percentile_cont(0.5) WITHIN GROUP (ORDER BY %2$s)"
@@ -75,7 +75,8 @@
             sort_table.include_value IS NOT NULL
           " sql-sort-subbucket-subquery)

-        sql-text (if column-subbucket sql-text-with-subbucket sql-text-without-subbucket)
+        valid-spec (boolean (and column-x column-y))
+        sql-text (if valid-spec (if column-subbucket sql-text-with-subbucket sql-text-without-subbucket) "SELECT NULL")
         sql-response (run-query tenant-conn table-name sql-text column-x-name column-y-name filter-sql aggregation-method max-buckets column-subbucket-name)
         bucket-values (distinct
                        (mapv


assoc-ing onto an array map was causing it to reorder itself after it grew to about 10 entries


Increase pending timeout for dag test (slow CI)

--- test/onyx/peer/dag_test.clj
+++ test/onyx/peer/dag_test.clj
@@ -75,6 +75,7 @@
   [{:onyx/name :A
     :onyx/ident :core.async/read-from-chan
     :onyx/type :input
+    :onyx/pending-timeout 200000
     :onyx/medium :core.async
     :onyx/batch-size batch-size
     :onyx/max-peers 1
@@ -83,6 +84,7 @@
    {:onyx/name :B
     :onyx/ident :core.async/read-from-chan
     :onyx/type :input
+    :onyx/pending-timeout 200000
     :onyx/medium :core.async
     :onyx/batch-size batch-size
     :onyx/max-peers 1
@@ -91,6 +93,7 @@
    {:onyx/name :C
     :onyx/ident :core.async/read-from-chan
     :onyx/type :input
+    :onyx/pending-timeout 200000
     :onyx/medium :core.async
     :onyx/batch-size batch-size
     :onyx/max-peers 1


Remove a useless comment.

Remove a useless comment.

--- test/picard/test/server.clj
+++ test/picard/test/server.clj
@@ -601,5 +601,3 @@
               "Host: localhost\r\n\r\n")

   (is (received-response "")))
-
-;; TODO: :abort sent downstream after request is finished


Formatting

Formatting


fix subpage for plan on links in account/plans

--- frontend/components/account.cljs
+++ frontend/components/account.cljs
@@ -39,7 +39,7 @@
             (map
              (fn [org]
                (let [org-url    (routes/v1-org-settings-subpage {:org     (:login org)
-                                                                 :subpage "plans"})
+                                                                 :subpage "plan"})
                      avatar-url (if-let [avatar-url (:avatar_url org)]
                                   (str avatar-url "25")
                                   (gh-utils/gravatar-url {:gravatar_id (:gravatar_id org)


fix nil namespace in bake.compile

fix nil namespace in bake.compile

--- bake/bake/compile.clj
+++ bake/bake/compile.clj
@@ -18,9 +18,8 @@
                   (contains? aot ns)))))]
     (filter compile?
       (reduce (fn [stale sourcefile]
-                (let [namespace (second (read-file-ns-decl sourcefile))
-                      classfile (classfile namespace)]
-                  (if (and (> (.lastModified sourcefile) (.lastModified classfile)))
+                (when-let [namespace (second (read-file-ns-decl sourcefile))]
+                  (if (and (> (.lastModified sourcefile) (.lastModified (classfile namespace))))
                     (union stale (conj (dependents @dep-graph namespace)
                                        namespace))
                     stale)))


Remove dummy counter

Remove dummy counter

--- frontend/src/crunsher/views.cljs
+++ frontend/src/crunsher/views.cljs
@@ -12,8 +12,6 @@
   Object
   (render [this]
     (dom/div nil
-             (bs/button-primary #(com/route :init) "Initialize")
-             " "
              (bs/button-primary #(com/route :get-all-pokemon) "Get all Pokemon"))))
 (def controls (om/factory Controls))

@@ -48,29 +46,12 @@
                                (map #(poketable-entry (lib/merge-react-key %)) (lib/inventory-pokemon)))))))
 (def poketable (om/factory PokeTable {}))

-(defui Counter
-  static om/IQuery
-  (query [this]
-    [:count])
-  Object
-  (render [this]
-    (let [{:keys [count]} (om/props this)]
-      (dom/div nil
-               (dom/span nil (str "Count: " count))
-               (dom/button
-                 #js {:onClick
-                      (fn [e] (om/transact! this '[(increment)]))}
-                 "Click me!")))))
-(def counter (om/factory Counter))
-
-
 (defui Main
   Object
   (render [this]
     (dom/div nil
              (dom/h1 nil "Poké-Crunsher")
-             (dom/div nil (controls))
              (dom/div nil (poketable (om/props this)))
-             (dom/div nil (counter (om/props this))))))
+             (dom/div nil (controls)))))


Using maps for database func params instead

--- src/wishlistd/models/queries.clj
+++ src/wishlistd/models/queries.clj
@@ -20,7 +20,7 @@
 ;[:wishlist :int]
 ;["constraint fk_wish_wishlist foreign key(wishlist) references Wishlist(id)"])))

-(defn get-wishlist [code]
+(defn get-wishlist [{:keys [code]}]
   (sql/with-connection db
 	(sql/with-query-results results
       ["select * from wishlist where code=?" code]
@@ -34,6 +34,12 @@
   (sql/with-connection db
     (sql/delete-rows :wishlist ["code=?" code])))

-(defn insert-wish [wish code]
+(defn get-wishes-for-wishlist [id]; untested
   (sql/with-connection db
-    (sql/insert-records :wish (assoc wish :code code))))+    (sql/with-query-results results
+	  ["select * from wish where wishlist=?" id]
+	  (into [] results))))
+
+(defn insert-wish [wish id]; untested
+  (sql/with-connection db
+    (sql/insert-records :wish (assoc wish :wishlist id))))


remove stray inspect

remove stray inspect

--- frontend/components/landing.cljs
+++ frontend/components/landing.cljs
@@ -449,7 +449,7 @@
               epilog-visible? (< (.-top (.getBoundingClientRect epilog)) nav-height)
               header-overlap-px (.-top (.getBoundingClientRect epilog))
               ;; normalize the overlap
-              header-overlap-px (utils/inspect (min nav-height (max 0 header-overlap-px)))]
+              header-overlap-px (min nav-height (max 0 header-overlap-px))]
           (when-not (= cta-visible? @(om/get-state owner :cta-visible?))
             (reset! (om/get-state owner :cta-visible?) cta-visible?)
             (cta-visibility-callback cta-visible?))


fix wrong headers

fix wrong headers

--- frontend/src/cruncher/views.cljs
+++ frontend/src/cruncher/views.cljs
@@ -88,9 +88,9 @@
                         (dom/thead nil
                                    (dom/tr nil
                                            (dom/th nil "")
+                                           (vlib/sortable-table-header :favorite "Fav.")
                                            (vlib/sortable-table-header :pokemon_id "#")
                                            (vlib/sortable-table-header :name "Name")
-                                           (vlib/sortable-table-header :favorite "Favorite")
                                            (vlib/sortable-table-header :nickname "Nickname")
                                            (vlib/sortable-table-header :cp "CP")
                                            (vlib/sortable-table-header :health "Health")


add date pickers in search boxes

add date pickers in search boxes

--- src_cljs/rrms/corecljs.cljs
+++ src_cljs/rrms/corecljs.cljs
@@ -8,7 +8,8 @@
             [goog.structs :as structs]
             [cljs-time.format :as f]
             [cljs-time.core :as tt]
-            [cljsjs.react-bootstrap])
+            [cljsjs.react-bootstrap]
+            [clojure.string :as st])
   (:import goog.History
            goog.json.Serializer))

@@ -93,11 +94,17 @@
 (declare render-documents)

 (defn search [event]
-  (let [stext (.-value (.getElementById js/document "sText"))
+  (let [dt1 (.-value (.getElementById js/document "dt1"))
+        dt2 (.-value (.getElementById js/document "dt2"))
+        dt  (.-value (.getElementById js/document "dt"))
         onres (fn [json]
-                (r/render [render-documents (getdata json)]
-                          (.getElementById js/document "app1")))]
-    (http-get (str "http://localhost:8193/documents/title/" stext) onres)))
+                ((set-key-value :documents (getdata json))
+                 (r/render [render-documents (get-new-page-data (get-value! :documents)
+                                                                (get-value! :current-page))]
+                           (.getElementById js/document "app1"))))]
+    (http-get (str "http://localhost:8193/documents/date/" (if (st/blank? dt1) "0000-00-00" dt1)
+                   "/"(if (st/blank? dt2) "0000-00-00" dt2)
+                   "/"(if(st/blank? dt) "0" dt)) onres)))

 (defn row [label input]
   [:div.row
@@ -193,10 +200,12 @@
     [:div {:class "row"}
      [:div {:class "col-xs-12"}
       [:div.form-group
-       [:div.col-sm-2 [:input.form-control {:id "sText" :type "text"
-                                            :placeholder "Search By Title" :on-change search}]]
-       ;; [:input {:type "button" :value "Search"
-       ;;          :class "btn btn-primary" :on-click search}]
+       [:div.col-sm-2 [:input.form-control {:id "dt1" :type "date"}]]
+       [:div.col-sm-2 [:input.form-control {:id "dt2" :type "date"}]]
+       [:div.col-sm-2 [:input.form-control {:id "dt" :type "text"
+                                            :placeholder "Search By Title"}]]
+       [:input {:type "button" :value "Search"
+                :class "btn btn-primary" :on-click search}]
        (url-format "#/documents/add" "Document")]
       [:div {:class "box-body"}


Separate spec for circles. Basics of converting back and forth.

--- spec/freefrog/governance_circles_spec.clj
+++ spec/freefrog/governance_circles_spec.clj
@@ -53,6 +53,8 @@
                                (g/convert-to-circle sample-role-name)
                                (g/convert-to-role sample-role-name))))

+  (it "refuses to convert a non-empty circle into a role")
+
   (it "refuses to convert a role that isn't a circle into a role"
     (should-throw IllegalArgumentException
       (format "Role %s is not a circle!" sample-role-name)


always defer to the super-location

always defer to the super-location

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

--- plugins/DataBrowser/src/org/micromanager/browser/core.clj
+++ plugins/DataBrowser/src/org/micromanager/browser/core.clj
@@ -142,14 +142,20 @@
   (nth row (.indexOf tags "Path")))

 (defn refresh-row [rows new-row]
-  (let [changed (atom false)
+  (let [location-col (.indexOf tags "Location")
+        new-loc (new-row location-col)
+        changed (atom false)
         new-path (get-row-path new-row)
         data
           (vec
-            (for [row rows]
-              (if (= (get-row-path row) new-path)
-                (do (reset! changed true) new-row)
-                row)))]
+            (for [old-row rows]
+              (if (= (get-row-path old-row) new-path)
+                (do (reset! changed true)
+                    (let [old-loc (old-row location-col)]
+                      (if (super-location? new-loc old-loc)
+                        (assoc new-row location-col old-loc)
+                        new-row)))
+                old-row)))]
     (if @changed
       data
       (conj data new-row))))
@@ -251,7 +257,7 @@
                 (when (empty? pending-data-sets) (set-browser-status "Idle"))
                 (try
                   (let [data-set (.take pending-data-sets)]
-                    (println @current-locations (second data-set) (contains? @current-locations (second data-set)))
+                   ; (println @current-locations (second data-set) (contains? @current-locations (second data-set)))
                     (if (not= data-set pending-data-sets) ;; poison
                       (do (when (contains? @current-locations (second data-set))
                             (let [m (apply get-summary-map data-set)]
@@ -261,8 +267,27 @@
                   (catch Exception e nil)))))
           "data browser reading thread") .start))

+(defn super-location? [loc1 loc2]
+  (loop [loc loc1]
+    (let [f1 (File. loc)
+          f2 (File. loc2)]
+     ; (println f1 f2)
+      (if (= f1 f2)
+        true
+        (let [parent-loc (.getParent f1)]
+          (if (nil? parent-loc)
+            false
+            (recur parent-loc)))))))
+
 (defn add-location [location]
-  (dosync (alter current-locations conj location))
+  (dosync
+    (if (some #{true}
+              (map #(super-location? location %) @current-locations))
+      nil
+      (do (doseq [old-loc @current-locations]
+            (if (super-location? old-loc location)
+              (remove-location old-loc)))
+            (alter current-locations conj location))))
   (.put pending-locations location)
   (set-browser-status "Scanning")
   (awt-event (-> @settings-window :locations :table .getModel .fireTableDataChanged)))


simplify

simplify

--- pigpen-cascading/src/main/clojure/pigpen/cascading.clj
+++ pigpen-cascading/src/main/clojure/pigpen/cascading.clj
@@ -65,7 +65,10 @@
 (defmethod command->flowdef :load
            [{:keys [id location storage fields opts]} flowdef]
   {:pre [id location storage fields]}
-  (update-in flowdef [:sources] (partial merge {id ((get-tap-fn storage) location)})))
+  (let [pipe (Pipe. (str id))]
+    (-> flowdef
+        (update-in [:sources] (partial merge {id ((get-tap-fn storage) location)}))
+        (update-in [:pipes] (partial merge {id pipe})))))

 (defmethod command->flowdef :store
            [{:keys [id ancestors location storage opts]} flowdef]
@@ -112,13 +115,9 @@
            [{:keys [id ancestors projections field-projections opts]} flowdef]
   {:pre [id (= 1 (count ancestors)) (not-empty projections)]}
   (let [ancestor (first ancestors)
-        new-flowdef (cond (contains? (:sources flowdef) ancestor) (let [pipe (Pipe. (str id))]
-                                                                (-> flowdef
-                                                                    (update-in [:pipe-to-source] (partial merge {id ancestor}))
-                                                                    (update-in [:pipes] (partial merge {id pipe}))))
-                          (contains? (:pipes flowdef) ancestor) (let [pipe ((:pipes flowdef) ancestor)]
-                                                              (-> flowdef
-                                                                  (update-in [:pipes] (partial merge {id (Pipe. (str id) pipe)}))))
+        new-flowdef (cond (contains? (:pipes flowdef) ancestor) (let [pipe ((:pipes flowdef) ancestor)]
+                                                                  (-> flowdef
+                                                                      (update-in [:pipes] (partial merge {id (Pipe. (str id) pipe)}))))
                           :else (do
                                   (println "flowdef" flowdef)
                                   (println "id" id)
@@ -154,8 +153,8 @@
   "Transforms a series of commands into a Cascading flow"
   [commands]
   (let [flowdef (reduce (fn [def cmd] (command->flowdef cmd def)) {} (preprocess-commands commands))
-        {:keys [pipe-to-source sources pipe-to-sink sinks pipes]} flowdef
-        sources-map (into {} (map (fn [[p s]] [(str p) (sources s)]) pipe-to-source))
+        {:keys [sources pipe-to-sink sinks pipes]} flowdef
+        sources-map (into {} (map (fn [s] [(str s) (sources s)]) (keys sources)))
         sinks-map (into {} (map (fn [[p s]] [(str p) (sinks s)]) pipe-to-sink))
         tail-pipes (into-array Pipe (map #(pipes %) (keys pipe-to-sink)))]
     (println "\n\nflowdef" flowdef)


Fix final failing midje test - commit-details

--- test/circle/backend/test_git.clj
+++ test/circle/backend/test_git.clj
@@ -26,16 +26,16 @@

 (fact "commit-details works"
   (commit-details "." known-commit) =>
-  {:subject "Use the test-yml repo, commits from it, and the correct url."
-   :committer_date "1329447089"
-   :author_name "Paul Biggar"
-   :parents ["4b0389fa94e50cb4b112fd2daec99cf3e6f526e8"]
-   :author_email "paul.biggar@gmail.com"
-   :author_date "1329447089"
-   :committer_name "Paul Biggar"
-   :body ""
-   :branch #"master~\d+"
-   :committer_email "paul.biggar@gmail.com"})
+  (contains {:subject "Use the test-yml repo, commits from it, and the correct url."
+             :committer_date "1329447089"
+             :author_name "Paul Biggar"
+             :parents ["4b0389fa94e50cb4b112fd2daec99cf3e6f526e8"]
+             :author_email "paul.biggar@gmail.com"
+             :author_date "1329447089"
+             :committer_name "Paul Biggar"
+             :body ""
+             :branch #"remotes/origin/(HEAD|master)~\d+"
+             :committer_email "paul.biggar@gmail.com"}))

 (fact "committer-email works"
   (committer-email "." known-commit) => "paul.biggar@gmail.com")


Add more explanation in "Puzzle #3 -- Twenty-one arguments"

--- test/com/nomistech/clojure_the_language/c_300_language_lawyer_stuff/s_800_reborg_puzzlers_test.clj
+++ test/com/nomistech/clojure_the_language/c_300_language_lawyer_stuff/s_800_reborg_puzzlers_test.clj
@@ -72,7 +72,10 @@
                     x11 x12 x13 x14 x15 x16 x17 x18 x19 x20
                     x21]
                  42))
-        => (throws #"Syntax error"))))
+        => (throws RuntimeException
+                   #"Syntax error"
+                   #(= (-> % ex-cause ex-message)
+                       "Can't specify more than 20 params")))))

   ;; You can have more than 20 args in ClojureScript.
   )


remove core.clj

remove core.clj

--- src/sushi_machine/core.clj
+++ src/sushi_machine/core.clj
@@ -1,6 +0,0 @@
-(ns sushi-machine.core)
-
-(defn foo
-  "I don't do a whole lot."
-  [x]
-  (println x "Hello, World!"))


Fix typo.

Fix typo.

--- test/lambdajam/jobs/test_2_2.clj
+++ test/lambdajam/jobs/test_2_2.clj
@@ -11,7 +11,7 @@
 ;; are getting pretty specific. Can we write generic versions
 ;; of these catalog entries and supply parameters at runtime? Yes!
 ;;
-;; Now we're going to build in the previous challenge and implement
+;; Now we're going to build on the previous challenge and implement
 ;; the same job, except we'll use generic "plus" and "times" catalog entries.
 ;; There are a few ways that you can supply parameters to a function, but
 ;; the most direct for supplying Clojure values is a catalog parameter called


Banka, Mihir | Removing async method

Banka, Mihir | Removing async method

--- src/aggregatequeryservice/postservice.clj
+++ src/aggregatequeryservice/postservice.clj
@@ -6,8 +6,7 @@
             [http.async.client :refer :all :as h])
   (:gen-class
   :name aggregatequeryservice.postservice
-  :methods [#^{:static true} [executeQueriesAndPostResultsAsync [String javax.sql.DataSource java.util.HashMap java.util.HashMap java.util.HashMap] Long]]
-            [#^{:static true} [executeQueriesAndPostResultsSync [String javax.sql.DataSource java.util.HashMap java.util.HashMap java.util.HashMap] String]]))
+  :methods [#^{:static true} [executeQueriesAndPostResultsSync [String javax.sql.DataSource java.util.HashMap java.util.HashMap java.util.HashMap] String]]))

 (defn post-template [http-post-uri http-post-headers payload]
   (with-open [client (h/create-client)]
@@ -24,17 +23,6 @@
          (rt/render-templates template-list extra-params-map)
          (pmap (partial post-template http-post-uri http-post-headers)))))

-(defn -executeQueriesAndPostResultsAsync
-  "Java exposed async API"
-  [aqs-config-path data-source query-params-map extra-params-map http-post-headers]
-  (let [query-params-map (into {} query-params-map)
-        extra-params-map (into {} extra-params-map)
-        http-post-headers (into {} http-post-headers)
-        task-id (dblog/insert-task aqs-config-path data-source "In Progress")]
-    (future (run-queries-render-templates-post aqs-config-path data-source query-params-map extra-params-map http-post-headers)
-            (dblog/update-task task-id data-source "Done"))
-    task-id))
-
 (defn -executeQueriesAndPostResultsSync
   "Java exposed sync API"
   [aqs-config-path data-source query-params-map extra-params-map http-post-headers]


process exceptions in lexicon's orthographic order for ease of diagnosis

--- src/babel/english/morphology.cljc
+++ src/babel/english/morphology.cljc
@@ -894,18 +894,21 @@
                                      :subcat {:1 {:agr {:number :plur
                                                         :person :3rd}}}}}]))))))))

-(defn exception-generator [lexicon]
+(defn exception-generator
+  "lexicon is a map where each key is a root form string mapped to a set of lexical entries for that root form.
+  For each such lexical entry, generate all possible exceptions, where the exception-generation rules are given below as 'path-and-merge-fn' tuples."
+  [lexicon]
   (->>
-   lexicon
+   (sort (keys lexicon))
    (mapcat
-    (fn [lexeme-kv]
-      (let [lexemes (second lexeme-kv)]
+    (fn [root-form]
+      (let [lexemes (get lexicon root-form)]
+        (log/debug (str "exception generator: " root-form))
         (mapcat (fn [path-and-merge-fn]
                   (let [path (:path path-and-merge-fn)
                         merge-fn (:merge-fn path-and-merge-fn)]
                     ;; a lexeme-kv is a pair of a key and value. The key is a string (the word's surface form)
                     ;; and the value is a list of lexemes for that string.
-                    (log/trace (str "'" (first lexeme-kv) "' looking at path: " path))
                     (->> lexemes
                          (mapcat (fn [lexeme]
                                    ;; this is where a unify/dissoc that supported


use dissoc-paths for [:english :english]

--- src/babel/english/morphology.cljc
+++ src/babel/english/morphology.cljc
@@ -881,8 +881,9 @@
                                            (if (and (string? (get-in lexeme path :none))
                                                     (not (fail? synsem-check)))
                                              (list {(get-in lexeme path)
-                                                    (dag_unify.core/merge
-                                                     lexeme
+                                                    (dag_unify.core/unifyc
+                                                     (dissoc-paths lexeme [path
+                                                                           [:english :english]])
                                                      (unifyc
                                                       (merge-fn lexeme)
                                                       {:synsem synsem-check}


improve logging

improve logging

--- src/babel/italiano/benchmark.cljc
+++ src/babel/italiano/benchmark.cljc
@@ -22,8 +22,9 @@
 (defn run-benchmark [times]
   (count (take (Integer/parseInt times)
                (repeatedly #(let [debug (println "starting generation..")
-                                  expr (time (generate :top))]
-                              (println (str "generated expression: " (fo expr)))
+                                  expr (time (generate {:comp {:synsem {:agr {:person :3rd}}}
+                                                        :synsem {:cat :verb}}))]
+                              (println (str "generated: " (fo expr)))
                               (println (str "starting parsing.."))
                               (let [parsed (time (take 1 (parse (fo expr))))]
                                 (if (empty? parsed)


lazy read

lazy read

--- test/celestial/fixtures.clj
+++ test/celestial/fixtures.clj
@@ -24,7 +24,9 @@

 (def clustered-prox (slurp-edn "fixtures/celestial-cluster.edn"))

-(def local-conf (slurp-edn (me.raynes.fs/expand-home "~/.celestial.edn")))
+(def local-conf
+  (let [path (me.raynes.fs/expand-home "~/.celestial.edn")]
+    (when (me.raynes.fs/exists? path) (slurp-edn path))))

 (def redis-actions (slurp-edn "fixtures/redis-actions.edn"))


Updated Find Pair to use more inputs/constants

--- src/clojush/problems/software/benchmarks_v2/find_pair.clj
+++ src/clojush/problems/software/benchmarks_v2/find_pair.clj
@@ -11,21 +11,20 @@

 ; Atom generators
 (def atom-generators
-  (concat (list
-           0
-           1
-           2
-           -1
-            ;;; end constants
-           (fn [] (- (lrand-int 2001) 1000)) ;Integer ERC
-           (tag-instruction-erc [:exec :integer :boolean :vector_integer] 1000)
-           (tagged-instruction-erc 1000)
-             ;;; end ERCs
-           'in1
-           'in2
-             ;;; end input instructions
-           )
-          (registered-for-stacks [:integer :vector_integer :boolean :exec])))
+  (make-proportional-atom-generators
+   (concat
+    (registered-for-stacks [:integer :vector_integer :boolean :exec])
+    (list (tag-instruction-erc [:integer :vector_integer :boolean :exec] 1000) ; tags
+          (tagged-instruction-erc 1000)))
+   (list 'in1 'in2) ; inputs
+   (list 0
+         1
+         2
+         -1
+         (fn [] (- (lrand-int 2001) 1000)) ;Integer ERC
+         ) ; constants
+   {:proportion-inputs 0.15
+    :proportion-constants 0.05}))

 (defn all-pairs-sum-to-target
   "Finds all pairs of numbers in list that sum to target and returns them"
@@ -52,23 +51,6 @@
             (> (count (all-pairs-sum-to-target numbers target)) 2))
       (recur vector-length) ; if bad vector, just make another
       [numbers target])))
-
-(comment
-  (- (lrand-int 3) 1)
-
-  (all-pairs-sum-to-target [1 2 3] 5)
-  (all-pairs-sum-to-target [1 2 3 4 5 6 0] 5)
-
-  (find-pair-input 15)
-  (find-pair-input 2)
-
-  (sort (repeatedly 1000 #(count (first (find-pair-input 15)))))
-
-  (all-pairs-sum-to-target [-60 9527 3954 -5540 -1563 4719 -378 6767 3961 -288 -8128 -6122 -7797 -8900 -9381] -9278)
-
-  max-number-magnitude
-
-  )

 ;; A list of data domains. Each domain is a vector containing
 ;; a "set" of inputs and two integers representing how many cases from the set
@@ -106,15 +88,7 @@
    [(fn [] (find-pair-input (+ 2 (lrand-int 19)))) 125 2000] ; random vectors, length [2, 20]
    ])

-(comment
-  (+ 410 -777)
-
-  (apply min (repeatedly 1000 #(+ 2 (lrand-int 19))))
-
-  (test-and-train-data-from-domains data-domains)
-  )
-
-;;Can make bouncing-balls test data like this:
+;;Can make test data like this:
 ;(test-and-train-data-from-domains data-domains)

 ; Helper function for error function


Added defbufferop to aggregate on minimum period per map tile.

--- src/clj/forma/hadoop/jobs/cdm.clj
+++ src/clj/forma/hadoop/jobs/cdm.clj
@@ -14,13 +14,6 @@
   "Returns the minimum value in tuples."
   [tuples]
   [(reduce min (map first tuples))])
-
-(defn yomama []
-  (let [src [[1 1 16 2] [1 1 16 1]]]
-  (??<- [?x ?y ?z ?p]
-        (src ?x ?y ?z ?p)
-        ;; (min-period ?p :> ?minp)
-        )))

 (defn first-hit
   "Returns the first value in a vector of numbers that is greater than or equal
@@ -64,6 +57,7 @@
         (+ ts-start-period ?first-hit-idx :> ?period)
         (date/convert-period-res t-res out-t-res ?period :> ?period-new-res)
         (- ?period-new-res epoch-period :> ?relative-period)
+        (min-period ?relative-period :> ?min-relative-period)
         (r/modis->latlon ?s-res ?mod-h ?mod-v ?s ?l :> ?lat ?lon)
         (latlon->google-tile ?lat ?lon z :> ?tx ?ty)
         (identity z :> ?z))))


make Sub Boost apply Barrier to targeted ice

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -379,7 +379,12 @@

    "Sub Boost"
    {:choices {:req #(and (= (:type %) "ICE") (:rezzed %))}
-    :effect (effect (host target (assoc card :zone [:discard] :seen true)))}
+    :effect (effect (update! (assoc target :subtype
+                                           (->> (vec (.split (:subtype target) " - "))
+                                                (concat ["Barrier"])
+                                                distinct
+                                                (join " - "))))
+                    (host (get-card state target) (assoc card :zone [:discard] :seen true)))}

    "Subliminal Messaging"
    {:effect (effect (gain :credit 1)


update 24/7 test

update 24/7 test

--- src/clj/test/cards-operations.clj
+++ src/clj/test/cards-operations.clj
@@ -41,5 +41,5 @@
       (play-from-hand state :corp "24/7 News Cycle")
       (prompt-card :corp (find-card "Breaking News" (:scored (get-corp))))
       (is (= 1 (:agenda-point (get-corp))) "Forfeited Breaking News")
-      (prompt-card :corp (find-card "Breaking News" (:scored (get-corp))))
+      (prompt-select :corp (find-card "Breaking News" (:scored (get-corp))))
       (is (= 2 (:tag (get-runner))) "Runner given 2 tags"))))


Keep a history of request/responses

Keep a history of request/responses

--- src/cljs/gc_api_browser/core.cljs
+++ src/cljs/gc_api_browser/core.cljs
@@ -10,7 +10,8 @@
                       "Content-Type"       "application/json"})

 (defonce app-state
-  (atom {:request {:text "Select a JSON schema..."
+  (atom {:history []
+         :request {:text "Select a JSON schema..."
                    :selected-resource nil
                    :selected-action nil
                    :url nil
@@ -21,7 +22,10 @@
 (enable-console-print!)

 (defn handle-new-response [app resp]
-  (om/update! app :response resp))
+  (om/transact! app (fn [m]
+                      (-> m
+                          (assoc :response resp)
+                          (update :history #(conj % (select-keys m [:request :response])))))))

 (defn main []
   (om/root


handle selection

handle selection

--- src/cljs/github_omnibar/core.cljs
+++ src/cljs/github_omnibar/core.cljs
@@ -9,28 +9,63 @@
   ;; (.toArray (.map (js/$ "[data-hotkey]") #({:label (.getAttribute %2 "aria-label") :hotkey (.getAttribute %2 "data-hotkey")}))))
   ;; )
 (defonce omni-data
-  (r/atom {:actions [{:label "Homepage"
-                    :hotkey "g h"}
-                   {:label "Search"
-                    :hotkey "s"}]
-         :search ""
-         }))
+  (r/atom {:actions [{:type :hot-key
+                      :label "Homepage"
+                      :hotkey "g h"}
+                     {:type :hot-key
+                      :label "Search"
+                      :hotkey "s"}]
+           :search ""
+           :highlighted 0
+           }))
+(defn- mod-actions [idx] (mod idx (count (:actions @omni-data))))
+(defn godown []
+  (swap! omni-data update-in [:highlighted] (comp mod-actions inc)))
+
+(defn goup []
+  (swap! omni-data update-in [:highlighted] (comp mod-actions dec)))
+
+(defn reset []
+  (swap! omni-data update-in [:highlighted] #(identity 0)))
+
+(defmulti action
+  (fn [current-action]
+    (:type current-action)))
+
+(defmethod action :hot-key [current]
+  (let [el (js/$ (str "[data-hotkey='" (:hotkey current) "']"))]
+    (if (.is el "input, textarea")
+      (.focus el)
+      (.click el))))
+
+(defmethod action :repo [current]
+  (println "search"))
+
 ;; -------------------------
 ;; Views

 (defn home-page []
-  (let [actions (cursor omni-data [:actions])]
+  (let [actions (cursor omni-data [:actions])
+        highlighted (:highlighted @omni-data)
+        current-action (nth (:actions @omni-data) (:highlighted @omni-data))]
     [:div.github-omnibar
      [:div.filter-repos.filter-bar
       [:input.filter-input {:type "text"
                             :placeholder "Find ..."
-                            :autofocus "true"}]]
-
+                            :auto-focus "true"
+                            :on-key-down #(case (.-which %)
+                                            40 (godown)
+                                            38 (goup)
+                                            13 (action current-action)
+                                            (reset))
+                                      }]]
      [:ul.mini-repo-list
-      (for [action @actions]
-        [:li.source>a.mini-repo-list-item.css-truncate
-         [:span.repo-and-owner>span.repo (:label action)]
-         [:span.stars>kbd (:hotkey action)]])]])
+      (map-indexed (fn [idx action]
+                     [:li.source {:key idx :class (if (= idx highlighted) "highlighted")}
+                      [:a.mini-repo-list-item.css-truncate
+                       [:span.repo-and-owner>span.repo (:label action)]
+                       [:span.stars>kbd (:hotkey action)]]])
+           @actions)]])
    )

 (defn about-page []


add constants

add constants

--- src/cljs/triboard/view/board.cljs
+++ src/cljs/triboard/view/board.cljs
@@ -9,16 +9,18 @@
 ;; Private
 ;; ----------------------------------------------------------------------------

-;; TODO - Constants
 ;; TODO - Square SVG Board utils
+
+(def relative-size 0.9)
+(def border-size (/ (- 1 relative-size) 2))

 (defn- rect-cell
   [[x y] player options]
   [:rect.cell
    (merge
      {:class (str "cell--" (name player))
-      :x (+ 0.05 x) :width 0.9
-      :y (+ 0.05 y) :height 0.9}
+      :x (+ border-size x) :width relative-size
+      :y (+ border-size y) :height relative-size}
      options)])

 (defn- empty-cell


Three years later, still putting docstrings in the wrong place.

--- src/clojure/parkour/mapreduce.clj
+++ src/clojure/parkour/mapreduce.clj
@@ -251,23 +251,22 @@
     (Class/forName (format "parkour.hadoop.Reducers$_%d" i))))

 (defn reducer!
-  [^Job job var & args]
   "Allocate and return a new parkour reducer class for `job` as
 invoking `var`.  The `var` will be called during task-setup with the
 job Configuration and any provided `args` (which must be
 EDN-serializable).  It should return a function of one argument, which
 will be invoked with the task context, and should perform the desired
 content of the reduce task."
+  [^Job job var & args]
   (apply reducer!* :reduce job var args))

 (defn combiner!
-  [^Job job var & args]
   "As per `reducer!`, but allocate and configure for the Hadoop
 combine step, which may impact e.g. output types."
+  [^Job job var & args]
   (apply reducer!* :combine job var args))

 (defn partitioner!
-  [^Job job var & args]
   "Allocate and return a new parkour partitioner class for `job` as
 invoking `var`.  The `var` will be called during task-setup with the
 job Configuration and any provided `args` (which must be
@@ -276,6 +275,7 @@
 That function will called for each map-output tuple, and should return
 an integral value mod the reduce-task count.  Should be
 primitive-hinted as OOLL."
+  [^Job job var & args]
   (doto (conf/ig job)
     (conf/set! "parkour.partitioner.var" (pr-str var))
     (conf/set! "parkour.partitioner.args" (pr-str args)))


test default retry policy

test default retry policy

--- src/clojure/tcp_driver/driver.clj
+++ src/clojure/tcp_driver/driver.clj
@@ -43,16 +43,19 @@
 ;;;;;;;;;;;;;;
 ;;;;;; Private functions

-(defn routing-hosts
-  "Extract and deref the routing hosts"
-  [ctx]
-  @(get-in ctx [:rounting-env :hosts]))

-(defn select-host [{:keys [routing-policy rounting-env]}]
-  (routing-policy rounting-env))

-(defn select-send [ctx io-f timeout-ms]
-  (let []))
+(defn select-send
+  "ctx - DriverRetSchema
+   io-f - function that takes a connection and on error throws an exception
+   timeout-ms - connection timeout"
+  [ctx io-f timeout-ms]
+  (if [host (routing/-select-host (:routing-policy ctx))]
+    (do
+      ;;we have a host
+      ;; do send retry here
+      )
+    (throw (RuntimeException. "No connection is available to perform the send"))))

 ;;;;;;;;;;;;;;;;
 ;;;;;; Public API


Show example of mounting a whole rig at once.

--- src/afterglow/examples.clj
+++ src/afterglow/examples.clj
@@ -36,6 +36,92 @@
   sample-show
   (atom nil))

+(defn patch-lighting-rig
+  "An example of how to patch a whole group of lights with a
+  parameterized location. We mount our lights on our lighting rig in
+  standard positions, so knowing the position of the rig and the
+  height to which it has been adjusted allows us to figure out where
+  all the lights are on it.
+
+  The origin of the rig is the center of the lower bar on the
+  horizontal truss, and the default orientation is, as usual, facing
+  towards the audience.
+
+We try to hang blades 1-4 at an angle of 72.5 degrees leaning towards
+  the audience, and blade 5 sags to about 101 degrees but if any angle
+  ends up being off and difficult to correct, it can be passed in with
+  `:blade-1-angle` through `:blade-5-angle` The actual mounting height
+  of blade 5, if it differs from 4 inches can be passed with
+  `:blade-5-height`."
+  [& {:keys [universe x y z x-rotation y-rotation z-rotation
+             blade-1-angle blade-2-angle blade-3-angle blade-4-angle blade-5-angle blade-5-height]
+      :or {universe 1 x 0 y (tf/inches 62.5) z 0
+           x-rotation 0 y-rotation 0 z-rotation 0
+           blade-1-angle (tf/degrees 72.5) blade-2-angle (tf/degrees 72.5)
+           blade-3-angle (tf/degrees 72.5) blade-4-angle (tf/degrees 72.5)
+           blade-5-angle (tf/degrees 101) blade-5-height (tf/inches 4)}}]
+
+  ;; Torrent F3 moving head effect spots
+  (show/patch-fixture! :torrent-1 (blizzard/torrent-f3) universe 1
+                       :x (+ x (tf/inches 50)) :y (+ y (tf/inches -14)) :z z
+                       :x-rotation (+ x-rotation (tf/degrees 180))
+                       :y-rotation (+ y-rotation (tf/degrees 90))
+                       :z-rotation z-rotation)
+  (show/patch-fixture! :torrent-2 (blizzard/torrent-f3) universe 17
+                       :x (+ x (tf/inches -50)) :y (+ y (tf/inches -14)) :z z
+                       :x-rotation (+ x-rotation (tf/degrees 180))
+                       :y-rotation (+ y-rotation (tf/degrees 90))
+                       :z-rotation z-rotation)
+
+  ;; Hex IRC mini RGBAW+UV pars
+  (show/patch-fixture! :hex-1 (chauvet/slimpar-hex3-irc) universe 129
+                       :x (+ x (tf/inches 51.5)) :y (+ y (tf/inches 15)) :z z)
+  (show/patch-fixture! :hex-2 (chauvet/slimpar-hex3-irc) universe 145
+                       :x (tf/inches -51.5) :y (tf/inches 15) :z z)
+
+  ;; Blade moving-head RGBA pinspots
+  (show/patch-fixture! :blade-1 (blizzard/blade-rgbw) universe 225
+                       :x (+ x (tf/inches -21)) :y (+ y (tf/inches 9)) :z z
+                       :x-rotation (+ x-rotation blade-1-angle)
+                       :y-rotation (+ y-rotation (tf/degrees 90))
+                       :z-rotation z-rotation)
+  (show/patch-fixture! :blade-2 (blizzard/blade-rgbw) universe 240
+                       :x (+ x (tf/inches 20.5)) :y (+ y (tf/inches 9)) :z z
+                       :x-rotation (+ x-rotation blade-2-angle)
+                       :y-rotation (+ y-rotation (tf/degrees 90))
+                       :z-rotation z-rotation)
+  (show/patch-fixture! :blade-3 (blizzard/blade-rgbw) universe 255
+                       :x (+ x (tf/inches -37)) :y y :z z
+                       :x-rotation (+ x-rotation blade-3-angle)
+                       :y-rotation (+ y-rotation (tf/degrees 90))
+                       :z-rotation z-rotation)
+  (show/patch-fixture! :blade-4 (blizzard/blade-rgbw) universe 270
+                       :x (+ x (tf/inches 37)) :y y :z z
+                       :x-rotation (+ x-rotation blade-4-angle)
+                       :y-rotation (+ y-rotation (tf/degrees 90))
+                       :z-rotation z-rotation)
+  (show/patch-fixture! :blade-5 (blizzard/blade-rgbw :15-channel :tilt-center 25 :tilt-half-circle -230) universe 285
+                       :x x :y (+ y blade-5-height) :z z
+                       :x-rotation (+ x-rotation blade-5-angle)
+                       :y-rotation (+ y-rotation (tf/degrees 90))
+                       :z-rotation z-rotation)
+
+  ;; Snowball RGBA moonflower effect
+  (show/patch-fixture! :snowball (blizzard/snowball) universe 33
+                       :x (+ x (tf/inches 6.5)) :y (+ y (tf/inches 15)) :z z)
+
+  ;; Hypnotic RGB web effect diffraction pattern laser
+  (show/patch-fixture! :hyp-rgb (adj/hypnotic-rgb) universe 45
+                       :x x :y (+ y (tf/inches -5)) :z z)
+
+  ;; These last two can be patched as generic switches instead if you don't want them to respond to dimmer cues:
+
+  ;; LED UV bar
+  (show/patch-fixture! :eco-uv (afterglow.fixtures/generic-dimmmer) universe 61)
+
+  ;; LED colored water effect
+  (show/patch-fixture! :h2o-led (afterglow.fixtures/generic-dimmmer) universe 62))
+
 (defn use-sample-show
   "Set up a sample show for experimenting with Afterglow. By default
   it will create the show to use universe 1, but if you want to use a
@@ -58,41 +144,13 @@

   ;; Throw a couple of fixtures in there to play with. For better fun, use
   ;; fixtures and addresses that correspond to your actual hardware.
-  (show/patch-fixture! :torrent-1 (blizzard/torrent-f3) universe 1
-                       :x (tf/inches 44) :y (tf/inches 51.75) :z (tf/inches -4.75)
-                       :y-rotation (tf/degrees 0))
-  (show/patch-fixture! :torrent-2 (blizzard/torrent-f3) universe 17
-                       :x (tf/inches -44) :y (tf/inches 51.75) :z (tf/inches -4.75)
-                       :y-rotation (tf/degrees 0))
-  (show/patch-fixture! :hex-1 (chauvet/slimpar-hex3-irc) universe 129 :x (tf/inches 14) :y (tf/inches 44)
-                       :z (tf/inches -4.75)
-                       :x-rotation (tf/degrees 90))
-  (show/patch-fixture! :hex-2 (chauvet/slimpar-hex3-irc) universe 145 :x (tf/inches -14) :y (tf/inches 44)
-                       :z (tf/inches -4.75)
-                       :x-rotation (tf/degrees 90))
-  (show/patch-fixture! :blade-1 (blizzard/blade-rgbw) universe 225
-                       :x (tf/inches 16) :y (tf/inches 12) :z (tf/inches 0)
-                       :y-rotation (tf/degrees 0))
-  (show/patch-fixture! :blade-2 (blizzard/blade-rgbw) universe 240
-                       :x (tf/inches -26.5) :y (tf/inches 48.5) :z (tf/inches -4.75)
-                       :y-rotation (tf/degrees 45))
-  (show/patch-fixture! :blade-3 (blizzard/blade-rgbw :15-channel :tilt-center 25 :tilt-half-circle -230)
-                       universe 255 :x (tf/inches 0) :y (tf/inches 12) :z (tf/inches 0)
-                       :y-rotation (tf/degrees 0))
-  (show/patch-fixture! :blade-4 (blizzard/blade-rgbw) universe 270 :y (tf/inches 48.5) :z (tf/inches -4.75))
-  (show/patch-fixture! :ws-1 (blizzard/weather-system) universe 161
+  (patch-lighting-rig :universe universe :blade-3-angle (tf/degrees 71.2))
+  #_(show/patch-fixture! :ws-1 (blizzard/weather-system) universe 161
                        :x (tf/inches 55) :y (tf/inches 71) :z (tf/inches 261) :y-rotation (tf/degrees 225))
-  (show/patch-fixture! :ws-2 (blizzard/weather-system) universe 187
+  #_(show/patch-fixture! :ws-2 (blizzard/weather-system) universe 187
                        :x (tf/inches -55) :y (tf/inches 71) :z (tf/inches 261) :y-rotation (tf/degrees 135))
-  (show/patch-fixture! :puck-1 (blizzard/puck-fab5) universe 97 :x (tf/inches -76) :y (tf/inches 8) :z (tf/inches 52))
-  (show/patch-fixture! :puck-2 (blizzard/puck-fab5) universe 113 :x (tf/inches -76) :y (tf/inches 8) :z (tf/inches 40))
-  (show/patch-fixture! :snowball (blizzard/snowball) universe 33 :x (tf/inches -76) :y (tf/inches 32)
-                       :z (tf/inches 164.5))
-  (show/patch-fixture! :hyp-rgb (adj/hypnotic-rgb) universe 45)
-
-  ;; These two can be patched as generic switches instead if you don't want them to respond to dimmer cues.
-  (show/patch-fixture! :eco-uv (afterglow.fixtures/generic-dimmmer) universe 61)
-  (show/patch-fixture! :h2o-led (afterglow.fixtures/generic-dimmmer) universe 62)
+  #_(show/patch-fixture! :puck-1 (blizzard/puck-fab5) universe 97 :x (tf/inches -76) :y (tf/inches 8) :z (tf/inches 52))
+  #_(show/patch-fixture! :puck-2 (blizzard/puck-fab5) universe 113 :x (tf/inches -76) :y (tf/inches 8) :z (tf/inches 40))

   (reset! var-binder (var-fx/create-for-show *show*))
   '*show*)


Updated deps.

Updated deps.

--- ubuntu/gis-clj/profiles.clj
+++ ubuntu/gis-clj/profiles.clj
@@ -1,16 +1,15 @@
-{:user {:plugins [[lein-pprint "1.1.1"]
+{:user {:plugins [[lein-pprint "1.1.2"]
                   [lein-kibit "0.1.2"]
-                  [lein-codox "0.9.1"]
+                  [lein-codox "0.9.5"]
                   [lein-simpleton "1.3.0"]]
         :dependencies [[org.clojure/clojure "1.8.0"]
                        [org.clojure/data.json "0.2.6"]
                        [org.clojure/data.xml "0.0.8"]
-                       [org.clojure/tools.logging "0.3.1"]
                        [org.clojure/tools.namespace "0.2.11"]
-                       [com.stuartsierra/component "0.3.0"]
+                       [com.stuartsierra/component "0.3.1"]
                        [org.clojars.hozumi/clj-commons-exec "1.2.0"]
-                       [ch.qos.logback/logback-classic "1.1.3"]
-                       [dire "0.5.3"]
-                       [clj-time "0.11.0"]
+                       [dire "0.5.4"]
+                       [clj-time "0.12.0"]
+                       [clojusc/twig "0.2.1"]
                        [slamhound "1.5.5"]
-                       [element84/clj-gdal "0.3.2"]]}}
+                       [clj-gdal "0.4.0-ALPHA"]]}}


Fix alignment

Fix alignment

--- src/clj/org/openforis/ceo/db/projects.clj
+++ src/clj/org/openforis/ceo/db/projects.clj
@@ -680,10 +680,10 @@
                                                                  sample-file-base64
                                                                  write-dir
                                                                  (str "project-" project-id "-samples"))))]
-           (try-catch-throw  #(call-sql "update_project_sample_table"
-                                        project-id
-                                        (check-load-ext sample-distribution project-id samples-file "samples" ["PLOTID" "SAMPLEID"]))
-                             "SQL Error: cannot update project table.")
+           (try-catch-throw #(call-sql "update_project_sample_table"
+                                       project-id
+                                       (check-load-ext sample-distribution project-id samples-file "samples" ["PLOTID" "SAMPLEID"]))
+                            "SQL Error: cannot update project table.")
            (try-catch-throw #(call-sql "samples_from_plots_with_files" project-id)
                             "Error importing samples file."))
          (doseq [{:keys [plot_id lon lat]} (call-sql "get_plot_centers_by_project" project-id)]


explicit namespace in tunneled? kw

explicit namespace in tunneled? kw

--- src/cljc/ow/starbuck/impl/core_async.cljc
+++ src/cljc/ow/starbuck/impl/core_async.cljc
@@ -83,13 +83,13 @@
                               :or {name "router"}}]
   (component* name in-ch
               (fn [{:keys [config] :as this} msg]
-                (if-not (::tunneled? msg)
+                (if-not (:ow.starbuck.routing/tunneled? msg)
                   (r/advance config msg)
-                  [(dissoc msg ::tunneled?)]))
+                  [(dissoc msg :ow.starbuck.routing/tunneled?)]))
               (fn [{:keys [config] :as this} resmsgs]
                 (doseq [rm resmsgs]
-                  (-> (r/get-next-component config rm)
-                      (p/deliver rm))))
+                  (let [nc (r/get-next-component config rm)]
+                    (p/deliver nc rm))))
               :config config
               :result-pub result-pub
               :timeout timeout))
@@ -98,7 +98,7 @@
                         :or {name "tunnel"}}]
   (component* name (a/chan)
               (fn [this msg]
-                (assoc msg ::tunneled? true))
+                (assoc msg :ow.starbuck.routing/tunneled? true))
               (fn [this resmsg]
                 (a/put! out-ch resmsg))))


Convert lesson 08 to function-first-api

Convert lesson 08 to function-first-api

--- src/cljs/gampg/learn_gamma/lesson_08.cljs
+++ src/cljs/gampg/learn_gamma/lesson_08.cljs
@@ -1,14 +1,10 @@
 (ns gampg.learn-gamma.lesson-08
-    (:require [clojure.string :as s]
-            [gamma.api :as g]
+  (:require [gamma.api :as g]
             [gamma.program :as p]
-            [gamma.tools :as gt]
+            [gamma-driver.api :as gd]
             [gamma-driver.drivers.basic :as driver]
-            [gamma-driver.protocols :as dp]
-            [goog.webgl :as ggl]
             [thi.ng.geom.core :as geom]
-            [thi.ng.geom.core.matrix :as mat :refer [M44]]
-            [thi.ng.geom.webgl.arrays :as arrays]))
+            [thi.ng.geom.core.matrix :as mat :refer [M44]]))

 (def title
   "8. The depth buffer, transparency, and blending")
@@ -251,13 +247,13 @@
                    (geom/translate [x 0 -7])
                    (geom/rotate-around-axis [1 0 0] cube-rotation)
                    (geom/rotate-around-axis [0 -1 0] cube-rotation))]
-        (driver/draw-elements driver program
-                          (assoc (get-data p mv cube-vertices cube-normals texture cube-texture-coords)
-                            {:tag :element-index} cube-indices)
+        (gd/draw-elements driver (gd/bind driver program
+                                          (assoc (get-data p mv cube-vertices cube-normals texture cube-texture-coords)
+                                                 {:tag :element-index} cube-indices))
                           {:draw-mode :triangles
-                           :first 0
+                           :first     0
                            ;; Hard-coded
-                           :count 36})))))
+                           :count     36})))))

 (defn animate [draw-fn step-fn current-value]
   (js/requestAnimationFrame
@@ -283,7 +279,7 @@
   (let [width   (.-clientWidth node)
         height  (.-clientHeight node)
         driver  (driver/basic-driver gl)
-        program (dp/program driver program-source)
+        program program-source
         state   (app-state width height)]
     (reset-gl-canvas! node)
     ;; Set the blending function
@@ -294,10 +290,10 @@
     (.clear gl (bit-or (.-COLOR_BUFFER_BIT gl) (.-DEPTH_BUFFER_BIT gl)))
     (let [image (js/Image.)]
       (aset image "onload"
-            (fn [] (let [texture {:data {:data       image
-                                        :filter     {:min :linear
-                                                     :mag :nearest}
-                                        :flip-y     true
-                                        :texture-id 0}}]
+            (fn [] (let [texture {:data       image
+                                 :filter     {:min :linear
+                                              :mag :nearest}
+                                 :flip-y     true
+                                 :texture-id 0}]
                     (animate (draw-fn gl driver program) tick (assoc-in state [:scene :texture] texture)))))
       (aset image "src" "/images/glass.gif"))))


Closing the SSE channel on exception

Closing the SSE channel on exception

--- src/elefant_server/domain/sse_service.clj
+++ src/elefant_server/domain/sse_service.clj
@@ -11,13 +11,12 @@
 (defn broadcast-message! [trumpeteer-id message]
   {:pre [trumpeteer-id]}
   (log/info "Sending message" (:message message) "with id" (:id message) "to trumpeteer" trumpeteer-id)
-  (if-let [subscriber (@subscribers trumpeteer-id)
-           stream (:sse-stream subscriber)]
+  (if-let [subscriber (@subscribers trumpeteer-id)]
     (do (reset! (:last-accessed subscriber) (time/now))
         (try
-          (go (>! stream (with-meta message {:event-type "trumpet"})))
+          (go (>! (:sse-stream subscriber) (with-meta message {:event-type "trumpet"})))
           (catch Exception e (do
-                               (close! stream)
+                               (close! (:sse-stream subscriber))
                                (log/warn "Couldn't send" (:message message) "with id" (:id message) "to trumpeteer" trumpeteer-id "because:\n" (.printStackTrace e) "\nWill remove subscriber.")
                                (swap! subscribers dissoc trumpeteer-id)))))
     (log/warn "Failed to send message with id" (:id message) "because trumpetee " trumpeteer-id " is not a subscriber.")))
@@ -52,5 +51,5 @@
   ; TODO Implement remove-vals instead of using lib
   (swap! subscribers #(remove-vals % stale?)))

-#_(def stale-subscribers-evictor
+(def stale-subscribers-evictor
   (schedule {:min (range 0 60 5)} evict-stale-subscribers!))


Remove break

Remove break

--- src-cljs/frontend/components/account.cljs
+++ src-cljs/frontend/components/account.cljs
@@ -107,9 +107,7 @@
               [:div
                [:div.api-item
                 [:p
-                 "Tokens you have generated that can be used to access the CircleCI API."
-                 [:br]
-                 "Apps using these tokens can act as you and have full read- and write-permissions!"]
+                 "Tokens you have generated that can be used to access the CircleCI API. Apps using these tokens can act as you and have full read- and write-permissions!"]
                 [:div.api-item
                  (when (seq tokens)
                    (om/build table/table


prolog copy refinements

prolog copy refinements

--- src-cljs/frontend/components/landing.cljs
+++ src-cljs/frontend/components/landing.cljs
@@ -69,8 +69,19 @@
               (common/google-login :small)]]
             [:div.our-philosphy-wrap.content
              [:div.our-philosphy
-              [:h1 "Sharing prototypes with your team should be easy."]
-              [:p "Productive prototyping without all the nonsense."]
+              ; [:h1 "Sharing prototypes with your team should be easy."]
+              ; [:h1 "Prototyping with your team should be easy."]
+              ; [:h1 "Brainstorming should be easier."]
+              ; [:h1 "Brainstorming should be easier from anywhere."]
+              ; [:h1 "Brainstorming with your team should be easy from anywhere."]
+              [:h1 "Collaborating with your team should be easy from anywhere."]
+              ; [:p "Prototype just your ideas without all the nonsense."]
+              ; [:p "Prototype just your ideas without all the nonsense, anytime and on any device."]
+              ; [:p "Prototype your ideas anywhere, with any device, and without all the nonsense."]
+              ; [:p "Prototype your ideas anywhere, with any device, and without the nonsense."]
+              ; [:p "Prototype ideas anywhere, with any device, and without nonsense."]
+              ; [:p "Prototype ideas anywhere without all the nonsense, and on any device."]
+              [:p "Prototype ideas anywhere, with anyone, and on any device. No nonsense, it's just what you need, when you need it."]
               [:div.call-to-action
                [:button {:on-click #(cast! :landing-closed)} "Jump in and make a ________."]]]]]
            [:div.our-proof


show a signup button if the user isn't logged in

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -114,19 +114,30 @@
            [:article
             [:h2 "Share this with your team."]
             [:p "Send your teammates invites to come collaborate with you in this doc."]
-            [:form.menu-invite-form {:on-submit #(do (cast! :invite-submitted)
-                                                     false)
-                                     :on-key-down #(when (= "Enter" (.-key %))
-                                                     (cast! :email-invite-submitted)
-                                                     false)}
-             [:input {:type "text"
-                      :required "true"
-                      :data-adaptive ""
-                      :value (or invite-email "")
-                      :on-change #(cast! :invite-email-changed {:value (.. % -target -value)})}]
-             [:label {:data-placeholder "Teammate's Email"
-                      :data-placeholder-nil "What's your teammate's email?"
-                      :data-placeholder-forgot "Don't forget to submit."}]]
+            (if-not (:cust app)
+              [:a.menu-button {:href (auth/auth-url)
+                               :on-click #(do
+                                            (.preventDefault %)
+                                            (cast! :track-external-link-clicked
+                                                   {:path (auth/auth-url)
+                                                    :event "Signup Clicked"
+                                                    :properties {:source "username-overlay"}}))
+                               :role "button"}
+               "Sign Up"]
+
+              [:form.menu-invite-form {:on-submit #(do (cast! :invite-submitted)
+                                                       false)
+                                       :on-key-down #(when (= "Enter" (.-key %))
+                                                       (cast! :email-invite-submitted)
+                                                       false)}
+               [:input {:type "text"
+                        :required "true"
+                        :data-adaptive ""
+                        :value (or invite-email "")
+                        :on-change #(cast! :invite-email-changed {:value (.. % -target -value)})}]
+               [:label {:data-placeholder "Teammate's Email"
+                        :data-placeholder-nil "What's your teammate's email?"
+                        :data-placeholder-forgot "Don't forget to submit."}]])
             (when-let [response (first (get-in app (state/invite-responses-path (:document/id app))))]
               [:div response])
             ;; TODO: keep track of invites


projects-div wip

projects-div wip

--- src-cljs/kixi/hecuba/tabs/programmes.cljs
+++ src-cljs/kixi/hecuba/tabs/programmes.cljs
@@ -286,13 +286,14 @@
       (let [{:keys [programmes projects active-components]} data
             history (om/get-shared owner :history)]
         (html
-         [:div {:id "projects-div" :class (if (:programme-id projects) "" "hidden")}
-          [:h2 "Projects"]
-          [:ul {:class "breadcrumb"}
-           [:li [:a
-                 {:onClick (back-to-programmes history)}
-                 (title-for programmes)]]]
-          (om/build projects-table projects {:opts {:histkey :projects}})])))))
+         [:div {:id "projects-div"}
+          [:div {:class (if (:programme-id projects) "" "hidden")}
+           [:h2 "Projects"]
+           [:ul {:class "breadcrumb"}
+            [:li [:a
+                  {:onClick (back-to-programmes history)}
+                  (title-for programmes)]]]
+           (om/build projects-table projects {:opts {:histkey :projects}})]])))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; properties


Reorg requrie in quickref ns

Reorg requrie in quickref ns

--- src/clj/clojuredocs/pages/quickref.clj
+++ src/clj/clojuredocs/pages/quickref.clj
@@ -1,8 +1,8 @@
 (ns clojuredocs.pages.quickref
   (:require [clojure.string :as str]
             [clojuredocs.util :as util]
+            [clojuredocs.search :as search]
             [clojuredocs.pages.common :as common]
-            [clojuredocs.search :as search]
             [clojuredocs.pages.quickref.static :as static]))

 (defn title->id [k]


Fix indent.

Fix indent.

--- src/clj/com/draines/postal/message.clj
+++ src/clj/com/draines/postal/message.clj
@@ -24,7 +24,8 @@
   (doto jmsg (.addRecipient rtype (InternetAddress. addr))))

 (defn add-recipients!* [jmsg rtype addrs]
-  (doto jmsg (.addRecipients rtype (into-array (map #(InternetAddress. %) addrs)))))
+  (doto jmsg
+    (.addRecipients rtype (into-array (map #(InternetAddress. %) addrs)))))

 (defn add-recipients! [jmsg rtype addrs]
   (when addrs
@@ -39,10 +40,11 @@
                   (if (instance? java.io.File x) x (java.io.File. x)))]
     (doseq [part parts]
       (condp (fn [test type] (some #(= % type) test)) (:type part)
-        [:inline :attachment] (.addBodyPart mp
-                                            (doto (javax.mail.internet.MimeBodyPart.)
-                                              (.attachFile (fileize (:content part)))
-                                              (.setDisposition (name (:type part)))))
+        [:inline :attachment]
+        (.addBodyPart mp
+                      (doto (javax.mail.internet.MimeBodyPart.)
+                        (.attachFile (fileize (:content part)))
+                        (.setDisposition (name (:type part)))))
         (.addBodyPart mp
                       (doto (javax.mail.internet.MimeBodyPart.)
                         (.setContent (:content part) (:type part))))))
@@ -92,12 +94,14 @@
            :body [{:type "text/html"
                    :content "<b>some html</b>"}]}]
     (is (= "multipart/mixed" (re-find #"multipart/mixed" (message->str m))))
-    (is (= "Content-Type: text/html" (re-find #"Content-Type: text/html" (message->str m))))
+    (is (= "Content-Type: text/html"
+           (re-find #"Content-Type: text/html" (message->str m))))
     (is (= "some html" (re-find #"some html" (message->str m))))))

 (deftest test-inline
   (let [f (doto (java.io.File/createTempFile "_postal-" ".txt"))
-        _ (doto (java.io.PrintWriter. f) (.println "tempfile contents") (.close))
+        _ (doto (java.io.PrintWriter. f)
+            (.println "tempfile contents") (.close))
         m {:from "foo@bar.dom"
            :to "baz@bar.dom"
            :subject "Test"
@@ -108,7 +112,8 @@

 (deftest test-attachment
   (let [f1 (doto (java.io.File/createTempFile "_postal-" ".txt"))
-        _ (doto (java.io.PrintWriter. f1) (.println "tempfile contents") (.close))
+        _ (doto (java.io.PrintWriter. f1)
+            (.println "tempfile contents") (.close))
         f2 "/etc/resolv.conf"
         m {:from "foo@bar.dom"
            :to "baz@bar.dom"


Add clear-text-input

Add clear-text-input

--- src/clj_chrome_devtools/automation.clj
+++ src/clj_chrome_devtools/automation.clj
@@ -50,7 +50,7 @@
           (if-not selected
             (throw (ex-info "Unable to find element by selector"
                             {:selector node-like}))
-            selected)))))))
+            selected))))))

 ;; Automation context wraps a low-level CDP connection with state handling
 (defrecord Automation [connection root])
@@ -308,3 +308,10 @@
                                   :text ch
                                   :key ch
                                   :unmodified-text ch}))))
+
+(defn clear-text-input
+  "Clear a text input value."
+  ([node] (clear-text-input @current-automation node))
+  ([{c :connection :as ctx} node]
+   (let [node (to-node-ref ctx node)]
+     (eval-node ctx node "function() { this.value = ''; }"))))


small entitiy ui tweak

small entitiy ui tweak

--- src/cljs/flow_editor/views/entity.cljs
+++ src/cljs/flow_editor/views/entity.cljs
@@ -99,8 +99,8 @@

 (defn value-tabs
   [entity]
-  [{:id ::current :label (if (:isEvent entity) "Latest value" "Current value")}
-   {:id ::initial :label "Initial value"}])
+  [{:id ::current :label (if (:isEvent entity) "latest" "current")}
+   {:id ::initial :label "initial"}])

 (defn json-value-editor


Allow close-chan to be passed into fb->chan

--- src/cljs/hacker_agent/hacker-base.cljs
+++ src/cljs/hacker_agent/hacker-base.cljs
@@ -47,25 +47,30 @@

 (defn- fb->chan
   ([fbref]
+   (fb->chan fbref (chan)))
+  ([fbref close-chan]
    (let [events [:child_added :child_changed :child_removed]
-         chans (map (fn [event]
-                      (fb->chan fbref event))
-                    events)
-         event-chans (map first chans)
-         close-chans (map second chans)]
-     [(merge event-chans) (merge close-chans)]))
-  ([fbref event]
+         event-chans (map (fn [event]
+                            (fb->chan fbref close-chan event))
+                          events)]
+     (merge event-chans)))
+  ([fbref close-chan event]
    (let [event-chan (chan)
-         close-chan (chan)]
-     (.on fbref (clojure.core/name event)
-          (fn [snapshot]
-            (put! event-chan [event
-                              (keyword (.key snapshot))
-                              (js->clj (.val snapshot))])))
-     [event-chan close-chan])))
+         close-chan (chan)
+         handle-event (fn [snapshot]
+                        (put! event-chan
+                              [event
+                               (keyword (.key snapshot))
+                               (js->clj (.val snapshot))]))]
+     (.on fbref (clojure.core/name event) handle-event)
+     (go
+       (let [msg (<! close-chan)]
+         (.off fbref (clojure.core/name event)
+               handle-event)))
+     event-chan)))

 (defn- id->fb-chan [id]
-  (first (fb->chan (id->fbref id))))
+  (fb->chan (id->fbref id)))

 (defn id->atom
   ([id] (id->atom (atom {}) id))


Add peer-processed-segments, peer-batch-latency to monitoring

--- src/onyx/monitoring/custom_monitoring.clj
+++ src/onyx/monitoring/custom_monitoring.clj
@@ -42,6 +42,8 @@
    messenger-queue-count-unregister
    messenger-queue-wait
    monitoring-config
+   peer-processed-segments
+   peer-batch-latency
    peer-ack-segments
    peer-ack-segment
    peer-complete-segment


Send back sensible responses to cue var changes.

We were not forming a response object, so sometimes the AJAX request was
coming back as an error even when things worked.

--- src/afterglow/web/routes/show_control.clj
+++ src/afterglow/web/routes/show_control.clj
@@ -706,7 +706,8 @@
                       :boolean (Boolean/valueOf value)
                       :integer (Integer/valueOf value)
                       (Float/valueOf value))]
-          (cues/set-cue-variable! cue var-spec value :when-id (Integer/valueOf effect-id)))))))
+          (cues/set-cue-variable! cue var-spec value :when-id (Integer/valueOf effect-id))))
+      {:set effect-key})))

 (defn- handle-save-effect-event
   "Process a request to save the current state of an effect's cue
@@ -718,7 +719,8 @@
           cue (:cue effect)]
       (when (some? cue)
         (controllers/save-cue-vars! (:cue-grid (:show page-info)) (:x effect) (:y effect)
-                                    (cues/snapshot-cue-variables cue (Integer/valueOf effect-id)))))))
+                                    (cues/snapshot-cue-variables cue (Integer/valueOf effect-id))))
+      {:saved effect-key})))

 (defn- handle-clear-effect-event
   "Process a request to clear an effect's saved cue variables."
@@ -728,7 +730,8 @@
           effect (show/find-effect effect-key)
           cue (:cue effect)]
       (when (and (= (Integer/valueOf effect-id) (:id effect)) (some? cue))
-        (controllers/clear-saved-cue-vars! (:cue-grid (:show page-info)) (:x effect) (:y effect))))))
+        (controllers/clear-saved-cue-vars! (:cue-grid (:show page-info)) (:x effect) (:y effect)))
+      {:cleared effect-key})))

 (defn- move-view
   "Updates the origin of our view rectangle, and if it actually


rework show-account with fewer global vars

--- src/cljs/clj_money/views/accounts.cljs
+++ src/cljs/clj_money/views/accounts.cljs
@@ -30,9 +30,6 @@

 (def ^:private *accounts* (r/atom []))
 (def ^:private *commodities* (r/atom []))
-(def ^:private working-transaction (r/atom nil))
-(def ^:private account (r/atom nil))
-(def ^:private transaction-items (r/atom nil))

 (defn- delete
   [account]
@@ -246,12 +243,13 @@
                        :title "Click here to return to the list of accounts."
                        :icon :ban-circle})]])))

-(defn- account-header []
+(defn- account-header
+  [{:keys [transaction account]}]
   [:section
    [:div.pull-right
     (util/button "New"
                  (fn []
-                   (reset! working-transaction {:account-id (:id @account)
+                   (reset! transaction {:account-id (:id @account)
                                                 :entity-id (:id @state/current-entity)
                                                 :transaction-date (f/unparse (f/formatter "M/d/yyyy") (t/today))})
                    (with-retry
@@ -276,7 +274,8 @@
    [:td.text-right (currency-format (:polarized-value item))]
    [:td.text-right (currency-format (:balance item))]])

-(defn- items-table []
+(defn- items-table
+  [{:keys [items]}]
   [:table.table.table-striped.table-hover
    [:thead
     [:tr
@@ -285,7 +284,7 @@
      [:th.col-sm-2.text-right "Amount"]
      [:th.col-sm-2.text-right "Balance"]]]
    [:tbody
-    (if-let [items @transaction-items]
+    (if-let [items @items]
       (map item-row items)
       [:tr [:td {:colSpan 4} [:span.inline-status "Loading..."]]])]])

@@ -295,7 +294,7 @@
        (not= 0 (-> items last :index))))

 (defn- next-query-range
-  [[prev-start]]
+  [{:keys [account]} [prev-start]]
   (let [latest (:latest-transaction-date account)
         start (if prev-start
                 (t/minus prev-start (t/months 3))
@@ -304,18 +303,18 @@
     [start (-> start (t/plus (t/months 2)) t/last-day-of-the-month)]))

 (defn- get-items
-  ([] (get-items nil))
-  ([prev-date-range]
-   (let [[start end :as date-range] (next-query-range prev-date-range)]
+  ([context] (get-items context nil))
+  ([{:keys [account items] :as context} prev-date-range]
+   (let [[start end :as date-range] (next-query-range context prev-date-range)]
      (transaction-items/search
        {:account-id (:id @account)
         :transaction-date [:between start end]}
        (fn [result]
-         (swap! transaction-items
+         (swap! items
                 (fnil concat [])
                 (map #(polarize-item % @account) result))
-         (when (query-again? @transaction-items)
-           (get-items date-range)))
+         (when (query-again? @items)
+           (get-items context date-range)))
        notify/danger))))

 (def ^:private trx-form
@@ -347,11 +346,13 @@
 (defn- transform-transaction
   [{:keys [quantity
            other-account-id]
-    :as quick-entry-trx}]
-  (let [rename-map (if (or (and (> quantity 0)
-                                (left-side? @account))
+    :as quick-entry-trx}
+   context]
+  (let [account @(:account context)
+        rename-map (if (or (and (> quantity 0)
+                                (left-side? account))
                            (and (< quantity 0)
-                                (not (left-side? @account))))
+                                (not (left-side? account))))
                      {:account-id :debit-account-id
                       :other-account-id :credit-account-id}
                      {:account-id :credit-account-id
@@ -363,58 +364,62 @@
         (rename-keys rename-map))))

 (defn- handle-saved-transaction
-  [transaction]
-  (reset! working-transaction nil)
-  (reset! transaction-items nil)
-  (get-items))
-
-(defn- save-transaction []
-  (-> @working-transaction
-      transform-transaction
-      (transactions/create handle-saved-transaction
+  [_ {:keys [transaction items] :as context}]
+  (reset! transaction nil)
+  (reset! items nil)
+  (get-items context))
+
+(defn- save-transaction
+  [{:keys [transaction] :as context}]
+  (-> @transaction
+      (transform-transaction context)
+      (transactions/create #(handle-saved-transaction % context)
                            notify/danger)))

-(defn- transaction-form []
-  (when @working-transaction
+(defn- transaction-form
+  [{:keys [transaction] :as context}]
+  (when @transaction
     [:div.panel.panel-primary
      [:div.panel-heading
-      [:h2.panel-title (if (:id @working-transaction)
+      [:h2.panel-title (if (:id @transaction)
                          "Edit Transaction"
                          "New Transaction")]]

      [:div.panel-body
-      [bind-fields trx-form working-transaction]
+      [bind-fields trx-form transaction]
       (util/button "Save"
-                   #(save-transaction)
+                   #(save-transaction context)
                    {:class "btn btn-primary"
                     :icon :ok
                     :title "Click here to save the transaction"})]]))

 (defn- show-account
   [id]
-  (reset! transaction-items nil)
-  (accounts/get-all (:id @state/current-entity)
-                    #(reset! *accounts* (-> % nest unnest))
-                    notify/danger)
-  (accounts/get-one id
-                    (fn [a]
-                      (reset! account a)
-                      (get-items))
-                    notify/danger)
-  (with-layout
-    [:section
-     [:div.row
-      [:div.col-md-12
-       [account-header]]]
-     [:div.row
-      [:div.col-md-6
-       [transaction-form]]
-      [:div.col-md-6
-       [:div.panel.panel-default
-        [:div.panel-heading
-         [:h2.panel-title "Transaction Items"]]
-        [:div.panel-body {:style {:height "40em" :overflow "auto"}}
-         [items-table transaction-items]]]]]]))
+  (let [context {:account (r/atom nil)
+                 :transaction (r/atom nil)
+                 :items (r/atom nil)}]
+    (accounts/get-all (:id @state/current-entity)
+                      #(reset! *accounts* (-> % nest unnest))
+                      notify/danger)
+    (accounts/get-one id
+                      (fn [a]
+                        (update-in context [:account] #(reset! % a))
+                        (get-items context))
+                      notify/danger)
+    (with-layout
+      [:section
+       [:div.row
+        [:div.col-md-12
+         [account-header context]]]
+       [:div.row
+        [:div.col-md-6
+         [transaction-form context]]
+        [:div.col-md-6
+         [:div.panel.panel-default
+          [:div.panel-heading
+           [:h2.panel-title "Transaction Items"]]
+          [:div.panel-body {:style {:height "40em" :overflow "auto"}}
+           [items-table context]]]]]])))

 (secretary/defroute new-account-path "/accounts/new" []
   (r/render [new-account] (app-element)))


Clean productions properly before sending them over the wire

--- src/cljs/mdr2/productions/encoded.cljs
+++ src/cljs/mdr2/productions/encoded.cljs
@@ -52,8 +52,7 @@
   ::save-production
   (fn [{:keys [db]} [_ id]]
     (let [production (get-in db [:productions :encoded id])
-          cleaned (-> production
-                      (select-keys [:untranslated :uncontracted :contracted :type :homograph-disambiguation]))]
+          cleaned (dissoc production :uuid)]
       {:db (notifications/set-button-state db id :save)
        :http-xhrio (as-transit
                     {:method          :put


make backpack optional, change download url

--- src/cljs/salava/badge/ui/exporter.cljs
+++ src/cljs/salava/badge/ui/exporter.cljs
@@ -13,7 +13,7 @@
             [salava.core.i18n :refer [t]]))

 (defn email-options [state]
-  (map #(hash-map :value % :title %) (:emails @state)))
+  (map #(hash-map :value % :title %) (map #(:email %) (:emails @state))))

 (defn visibility-options []
   [{:value "all" :title (t :badge/All)}
@@ -49,46 +49,47 @@
         (not= (.indexOf (.toLowerCase (:name element)) (.toLowerCase (:search @state))) -1))))

 (defn grid-element [element-data state]
-  (let [{:keys [id image_file name description visibility assertion_url issuer_content_name issuer_content_url]} element-data]
+  (let [{:keys [id image_file name description visibility assertion_url issuer_content_name issuer_content_url]} element-data
+        obf_url (session/get :factory-url)]
     ;[:div {:class "col-xs-12 col-sm-6 col-md-4" :key id}
-     [:div {:class "media grid-container" :key id}
-      [:div.media-content
-        [:div.visibility-icon
-           (case visibility
-             "private" [:i {:class "fa fa-lock"}]
-             "internal" [:i {:class "fa fa-group"}]
-             "public" [:i {:class "fa fa-globe"}]
-             nil)]
-       (if image_file
-         [:div.media-left
-          [:a {:href (path-for (str "/badge/info/" id))}[:img {:src (str "/" image_file)
-                 :alt name}]]])
-       [:div.media-body
-        [:div.media-heading
-         [:a.badge-link {:href (path-for (str "/badge/info/" id))}
-          name]]
-      [:div.media-issuer
-         [:a {:href issuer_content_url
-              :target "_blank"
-              :title issuer_content_name} issuer_content_name]]]]
-      [:div {:class "media-bottom"}
-       [:div.row
-        [:div.col-xs-9
-         (let [checked? (boolean (some #(= id %) (:badges-selected @state)))]
-           [:div.checkbox
-            [:label {:for (str "checkbox-" id)}
-             [:input {:type "checkbox"
-                      :id (str "checkbox-" id)
-                      :on-change (fn []
-                                   (if checked?
-                                     (swap! state assoc :badges-selected (remove #(= % id) (:badges-selected @state)))
-                                     (swap! state assoc :badges-selected (conj (:badges-selected @state) id))))
-                      :checked checked?}]
-
-             (t :badge/Exporttobackpack)]])]
-        [:div {:class "col-xs-3 text-right"}
-         [:a {:href (str "https://backpack.openbadges.org/baker?assertion=" (js/encodeURIComponent assertion_url)) :class "badge-download"}
-          [:i {:class "fa fa-download"}]]]]]]))
+    [:div {:class "media grid-container" :key id}
+     [:div.media-content
+      [:div.visibility-icon
+       (case visibility
+         "private" [:i {:class "fa fa-lock"}]
+         "internal" [:i {:class "fa fa-group"}]
+         "public" [:i {:class "fa fa-globe"}]
+         nil)]
+      (if image_file
+        [:div.media-left
+         [:a {:href (path-for (str "/badge/info/" id))}[:img {:src (str "/" image_file)
+                                                              :alt name}]]])
+      [:div.media-body
+       [:div.media-heading
+        [:a.badge-link {:href (path-for (str "/badge/info/" id))}
+         name]]
+       [:div.media-issuer
+        [:a {:href issuer_content_url
+             :target "_blank"
+             :title issuer_content_name} issuer_content_name]]]]
+     [:div {:class "media-bottom"}
+      [:div.row
+       [:div.col-xs-9
+        (let [checked? (boolean (some #(= id %) (:badges-selected @state)))]
+          [:div.checkbox
+           [:label {:for (str "checkbox-" id)}
+            [:input {:type "checkbox"
+                     :id (str "checkbox-" id)
+                     :on-change (fn []
+                                  (if checked?
+                                    (swap! state assoc :badges-selected (remove #(= % id) (:badges-selected @state)))
+                                    (swap! state assoc :badges-selected (conj (:badges-selected @state) id))))
+                     :checked checked?}]
+
+            (t :badge/Exporttobackpack)]])]
+       [:div {:class "col-xs-3 text-right"}
+        [:a {:href (str obf_url "/c/receive/download?url="(js/encodeURIComponent assertion_url)) :class "badge-download"}
+         [:i {:class "fa fa-download"}]]]]]]))

 (defn badge-grid [state]
   [:div {:class "row wrap-grid"
@@ -181,10 +182,11 @@
            [:button {:class    "btn btn-primary"
                      :on-click #(select-all state)}
             (if (:badges-all @state) (t :badge/Clearall) (t :badge/Selectall))]
-           [:button {:class    "btn btn-primary"
-                     :on-click #(export-badges state)
-                     :disabled (= 0 (count (:badges-selected @state)))}
-            (t :badge/Exportselected)]
+           (if (not (nil? (:backpack_id (first (filter #(= (:email %) (:email-selected @state)) (:emails @state))))))
+             [:button {:class    "btn btn-primary"
+                       :on-click #(export-badges state)
+                       :disabled (= 0 (count (:badges-selected @state)))}
+              (t :badge/Exportselected)])
            [:button {:class "btn btn-primary"
                      :on-click #(do (.preventDefault %)
                                      (swap! state assoc :pdf-option "default")
@@ -199,8 +201,8 @@
   (ajax/GET
     (path-for "/obpv1/badge/export" true)
     {:handler (fn [{:keys [badges emails]} data]
-                (let [exportable-badges (filter #(some (fn [e] (= e (:email %))) emails) badges)]
-                  (swap! state assoc :badges exportable-badges :emails emails :email-selected (first emails) :initializing false :permission "success")))}
+                (let [exportable-badges (filter #(some (fn [e] (= e (:email %))) (map :email emails)) badges)]
+                  (swap! state assoc :badges exportable-badges :emails emails :email-selected (:email (first emails)) :initializing false :permission "success")))}
     (fn [] (swap! state assoc :permission "error"))))

 (defn handler [site-navi]


Split error directive main logic in separate function.

--- src/clojure/catacumba/impl/routing.clj
+++ src/clojure/catacumba/impl/routing.clj
@@ -103,17 +103,23 @@
                   (^void handle [_ ^Context ctx]
                     (.byMethod ctx (hp/fn->action (partial callback ctx))))))))

+(defn attach-server-error-handler
+  [^Chain chain handler]
+  (letfn [(callback [context throwable]
+            (let [response (handler context throwable)]
+              (when (satisfies? hs/IHandlerResponse response)
+                (hs/-handle-response response context))))
+          (on-register [^RegistrySpec rspec]
+            (->> (reify ServerErrorHandler
+                   (error [_ ctx throwable]
+                     (hs/hydrate-context ctx #(callback % throwable))))
+                 (.add rspec ServerErrorHandler)))]
+    (.register chain ^Action (hp/fn->action on-register))))
+
+
 (defmethod attach-route :error
   [^Chain chain [_ error-handler]]
-  (letfn [(on-register [^RegistrySpec rspec]
-            (let [ehandler (reify ServerErrorHandler
-                             (error [_ ctx throwable]
-                               (hs/hydrate-context ctx (fn [^DefaultContext context]
-                                                         (let [response (error-handler context throwable)]
-                                                           (when (satisfies? hs/IHandlerResponse response)
-                                                             (hs/-handle-response response context)))))))]
-              (.add rspec ServerErrorHandler ehandler)))]
-    (.register chain ^Action (hp/fn->action on-register))))
+  (attach-server-error-handler chain error-handler))

 (defmethod attach-route :setup
   [^Chain chain [_ ^String path setup]]


Rezoom map to fit the markers on the map automatically. Adjusted throttling speed

--- src/cljs/travel_site/components/city.cljs
+++ src/cljs/travel_site/components/city.cljs
@@ -178,6 +178,7 @@
                                               :strokeOpacity 0.6
                                               :geodesic true
                                               :strokeWeight (nth widths index)}
+                        :preserveViewport true
                         :suppressInfoWindows true
                         :suppressMarkers true}) ]
     (.setMap renderer google-map)
@@ -280,7 +281,20 @@
                         transit-journey
                         (make-transit-journey waypoints journey partial-directions)))))))))))))

-(def throttled-update-journey-plan (util-funcs/throttle update-journey-plan 1000))
+(defn fit-map-to-markers [google-map markers]
+  (.fitBounds
+    google-map
+    (reduce
+      (fn [partial-bounds marker]
+        (if (some? (.getPosition marker))
+          (.extend
+            partial-bounds
+            (.getPosition marker)))
+        partial-bounds)
+      (js/google.maps.LatLngBounds.)
+      markers)))
+
+(def throttled-update-journey-plan (util-funcs/throttle update-journey-plan 3000))

 (defn attraction-map-view [[current-city journey transit-journey show-vehicle-icons] owner]
   (reify
@@ -304,7 +318,8 @@
           (om/set-state! owner :google-map google-map)
           (om/set-state! owner :google-directions-service google-directions-service)
           (gen-new-renderers owner transit-journey show-vehicle-icons)
-          (gen-new-markers owner transit-journey))))
+          (gen-new-markers owner transit-journey)
+          (fit-map-to-markers (om/get-state owner :google-map) (om/get-state owner :all-markers)))))

     ;; recompute the route upon journey update
     om/IDidUpdate
@@ -315,7 +330,8 @@
             (remove-old-markers owner)
             (remove-old-renderers owner)
             (gen-new-renderers owner transit-journey show-vehicle-icons)
-            (gen-new-markers owner transit-journey)))
+            (gen-new-markers owner transit-journey)
+            (fit-map-to-markers (om/get-state owner :google-map) (om/get-state owner :all-markers))))
         (if-not (= (-> city :city :data :center :coordinates) (-> prev-city :city :data :center :coordinates))
           (.setCenter (om/get-state owner :google-map) (geojson->goog-latlng (-> current-city :city :data :center :coordinates))))))


Re-implement core to gain performance and simplify code #44

--- test/flatgui/core_test.clj
+++ test/flatgui/core_test.clj
@@ -401,6 +401,7 @@
                      :position-matrix (m/translation 2 1)
                      :viewport-matrix m/IDENTITY-MATRIX
                      :clip-size (m/defpoint 10 10)
+                     :visible true
                      :evolvers {:a a-evolver}
                      :children {:c1 {:id :c1
                                      :popup false
@@ -408,7 +409,8 @@
                                      :look-vec []
                                      :clip-size (m/defpoint 5 5)
                                      :position-matrix (m/translation 3 2)
-                                     :viewport-matrix m/IDENTITY-MATRIX}}})
+                                     :viewport-matrix m/IDENTITY-MATRIX
+                                     :visible 1}}})
         ui-app (FGAWTAppContainer. container 1)
         _ (.initialize ui-app)
         ;container-accessor (.getContainerAccessor ui-app)


helper text for tags

helper text for tags

--- src/cljs/swarmpit/component/service/form_settings.cljs
+++ src/cljs/swarmpit/component/service/form_settings.cljs
@@ -37,6 +37,7 @@
     (composite/autocomplete
       {:options        suggestions
        :textFieldProps {:label           "Tag"
+                        :helperText      "Specify image tag or leave empty for latest"
                         :InputLabelProps {:shrink true}}
        :onChange       #(state/update-value [:repository :tag] (-> % .-value) form-value-cursor)
        :placeholder    "Search a tag"})))


extending the pgobject as mentioned in the yesql issue 54

https://github.com/krisajenkins/yesql/issues/54

--- src/bitfondue/database.clj
+++ src/bitfondue/database.clj
@@ -1,5 +1,17 @@
 (ns bitfondue.database
-  (:require [yesql.core :refer [defquery]]))
+  (:require [cheshire.core :as cheshire]
+            [yesql.core :refer [defquery]]
+            [clojure.java.jdbc :as jdbc])
+  (:import [org.postgresql.util PGobject]))
+
+(extend-type org.postgresql.util.PGobject
+  jdbc/IResultSetReadColumn
+  (result-set-read-column [val rsmeta idx]
+    (let [colType (.getColumnTypeName rsmeta idx)]
+      (if (or (= colType "json")
+              (= colType "jsonb"))
+        (cheshire/parse-string (.getValue val) true)
+        val))))

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