fix z position bugs

fix z position bugs

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -189,9 +189,9 @@
   (concat
     (when-let [z-drive (:z-drive event)]
       (let [z (:z event)]
-        (when (and (:use-autofocus event) (not= z (@state :last-z-position)))
+        (when (or (:use-autofocus event) (not= z (@state :last-z-position)))
           (list [z-drive #(set-stage-position z-drive z)]))))
-    (for [[axis pos] (get-in event [:position :axes])]
+    (for [[axis pos] (get-in event [:position :axes]) :when pos]
       [axis #(apply set-stage-position axis pos)])
     (for [prop (get-in event [:channel :properties])]
       [(prop 0) #(core setProperty (prop 0) (prop 1) (prop 2))])
@@ -259,15 +259,15 @@
            (or (:slice event) 0)
            (if (:relative-z event)
              (or (get (@state :z-corrections) (get-in event [:position :label]))
-                 (@state :last-z-position))
+                 (@state :init-z-position))
              0)))
-      (assoc-in [:postion :axes z-drive] nil))
+      (assoc-in [:position :axes z-drive] nil))
     event))

 (defn make-event-fns [event out-queue]
   (let [event (compute-z-position event)]
     (list
-      ;#(log event)
+      #(log event)
       #(run-actions (create-presnap-actions event))
       #(await-for 10000 (device-agents (core getCameraDevice)))
       #(when-let [wait-time-ms (event :wait-time-ms)]


handle missing position list properly

handle missing position list properly

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -760,7 +760,10 @@

 ;; generic metadata

-(defn convert-settings [^SequenceSettings settings ^PositionList position-list]
+(defn convert-settings
+  ([^SequenceSettings settings]
+    (convert-settings settings nil))
+  ([^SequenceSettings settings ^PositionList position-list]
   (def seqSettings settings)
   (into (sorted-map)
         (-> settings
@@ -782,13 +785,14 @@
                    :channels (vec (filter :use-channel
                                           (map #(ChannelSpec-to-map (.channelGroup settings) %)
                                                (.channels settings))))
-                   :positions (vec (range (if (.usePositionList settings)
-                                            (.getNumberOfPositions position-list)
-                                            0)))
+                   :positions (when position-list
+                                (vec (range (if (.usePositionList settings)
+                                              (.getNumberOfPositions position-list)
+                                              0))))
                    :slices (vec (.slices settings))
                    :default-exposure (core getExposure)
                    :custom-intervals-ms (vec (.customIntervalsMs settings)))
-            )))
+            ))))

 (defn get-IJ-type [depth]
   (get {1 ImagePlus/GRAY8 2 ImagePlus/GRAY16 4 ImagePlus/COLOR_RGB 8 64} depth))


Fix validation form errors rendering.

Fix validation form errors rendering.

--- src/uxbox/ui/forms.cljs
+++ src/uxbox/ui/forms.cljs
@@ -5,11 +5,10 @@

 (defn input-error
   [errors field]
-  (when-let [errors (get errors field)]
+  (when-let [error (get errors field)]
     (html
      [:ul.form-errors
-      (for [error errors]
-        [:li {:key error} (tr error)])])))
+      [:li {:key error} (tr error)]])))

 (defn error-class
   [errors field]


Layout manager #41

Layout manager #41

--- src/flatgui/samples/forms/layoutdemopanel2.clj
+++ src/flatgui/samples/forms/layoutdemopanel2.clj
@@ -11,6 +11,8 @@
             [flatgui.base :as fg]
             [flatgui.awt :as awt]
             [flatgui.theme]
+            [flatgui.layout]
+            [flatgui.widgets.label :as label]
             [flatgui.widgets.window :as window]
             [flatgui.widgets.abstractbutton :as abtn]
             [flatgui.widgets.textfield :as textfield]
@@ -26,7 +28,7 @@

 (fg/defevolverfn :layout
   (if (and
-        (= (fg/get-reason) [:config :scroll :content-pane :textfield])
+        (= (fg/get-reason) [:config :apply])
         (abtn/button-pressed? (get-property [:config :apply] :pressed-trigger)))
     (read-string (get-property [:config :scroll :content-pane :textfield] :text))
     old-layout))
@@ -35,8 +37,8 @@
   (fg/defcomponent
     window/window
     :layoutdemo
-    {:clip-size (m/defpoint 7.125 5.5)
-     :position-matrix (m/translation 6 0.25)
+    {:clip-size (m/defpoint 5 3.5)
+     :position-matrix (m/translation 4.0 0.25)
      :layout layout-cfg
      :text "Layout"
      :evolvers {:layout layout-evolver}}
@@ -61,20 +63,44 @@
     (fg/defcomponent button/button :o {:text ":o"})
     (fg/defcomponent button/button :p {:text ":p"})))

+(def text-model (textfield/create-multi-line-model
+                  (mapcat identity [["["] (mapv str layout-cfg) ["]"]])))
+
+(fg/defevolverfn :config-valid
+  (let [cfg-str (get-property [:this :scroll :content-pane :textfield] :text)]
+    (if cfg-str
+      (try ;For now, there is no better way to check config validity
+        (let [cfg (read-string cfg-str)
+              layout-cfg (flatgui.layout/coord-map-evolver
+                           (assoc (get-in (:root-container component) [:children :layoutdemo]) :layout cfg))]
+          (if layout-cfg true false))
+        (catch Exception e (do (println "Config invalid: " (.getMessage e)) false)))
+      false)))
+
+;;; Allow entering only what's releavant for this sample layout config
+(defn sample-only-text-suplier [component]
+  (let [key (textfield/textfield-dflt-text-suplier component)]
+    (if (#{"a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "m" "n" "o" "p"
+           " " "[" "]"
+           ":" "-" "|" "<" ">" "'" "."} key) key "")))
+
 (def layout-window
   (fg/defcomponent
     window/window
     :config
-    {:clip-size (m/defpoint 5.125 5.5)
+    {:clip-size (m/defpoint 3.5 3.5)
      :position-matrix (m/translation 0.25 0.25)
-     :text "Config"}
+     :text "Config"
+     :config-valid true
+     :layout [[[:scroll :-|]]
+              [[:validity-indicator :-]]
+              [[:apply :-]]]
+     :evolvers {:config-valid config-valid-evolver}}

     (fg/defcomponent
       scrollpanel/scrollpanel
       :scroll
-      {:clip-size (m/defpoint 4.875 4.375)
-       :position-matrix (m/translation 0.125 0.5)
-       :children {:content-pane (fg/defcomponent
+      {:children {:content-pane (fg/defcomponent
                                   scrollpanel/scrollpanelcontent
                                   :content-pane
                                   {:evolvers {:content-size (fg/accessorfn (get-property component [:this :textfield] :clip-size))
@@ -82,16 +108,24 @@
                                    :children {:textfield (fg/defcomponent
                                                            textfield/textfield
                                                            :textfield
-                                                           {:clip-size (m/defpoint 4.875 4.375)
-                                                            :position-matrix (m/translation 0 0)
-                                                            :multiline true
+                                                           {:multiline true
                                                             :auto-size true
-                                                            :paint-border false})}})}})
+                                                            :paint-border false
+                                                            :model text-model
+                                                            :text-supplier sample-only-text-suplier
+                                                            :text (:text text-model)})}})}})

-    (fg/defcomponent button/button :apply
-      {:text "Apply"
-       :position-matrix (m/translation 0.125 5.0)
-       :clip-size (m/defpoint 4.875 0.375)})))
+    (fg/defcomponent label/label :validity-indicator
+      {:text "Valid"
+       :foreground (awt/color 64 255 64)
+       :evolvers {:text (fg/accessorfn (if (get-property component [] :config-valid)
+                                         "Valid"
+                                         "Not valid"))
+                  :foreground (fg/accessorfn (if (get-property component [] :config-valid)
+                                               (awt/color 64 255 64)
+                                               (awt/color 255 64 64)))}})
+
+    (fg/defcomponent button/button :apply {:text "Apply"})))

 (def root-panel
   (fg/defcomponent
@@ -100,7 +134,6 @@
     {:theme flatgui.theme/dark
      :clip-size (m/defpoint 40 20)
      :background (awt/color 9 17 26)
-     :font "bold 14px sans-serif"

      ;; TODO this should be a part defroot probably
      :closed-focus-root true


[#2964] Revert unnecesary change

[#2964] Revert unnecesary change

--- backend/src/akvo/lumen/postgres/filter.clj
+++ backend/src/akvo/lumen/postgres/filter.clj
@@ -101,7 +101,7 @@

 (defmethod filter-sql "isEmpty"
   [{:keys [column operation]}]
-  (if (or (= (:type column) "option") (= (:type column) "text"))
+  (if (= (:type column) "text")
     (format "coalesce(%s, '') %s ''"
             (column :columnName)
             (if (= operation "keep") "=" "<>"))


Selecting any rebuild action with update text to 'Rebuilding'

This way the user will get some feedback before we switch to
the next build.

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -1211,45 +1211,46 @@
             [:div.build-head
              (om/build build-sub-head-v2 data)]]])))))

-(defrender rebuild-actions-v2 [{:keys [build project]} owner]
-  (let [build-id (build-model/id build)
-        build-num (:build_num build)
-        vcs-url (:vcs_url build)
-        actions {:rebuild        {:text "Rebuild"
-                                  :args {:data-loading-text "Rebuilding",
-                                         :title             "Retry the same tests",
-                                         :on-click #(raise! owner [:retry-build-clicked {:build-id build-id
-                                                                                :vcs-url vcs-url
-                                                                                :build-num build-num
-                                                                                :no-cache? false}])}}
-                 :without_cache  {:text "without Cache"
-                                  :args {:data-loading-text "Rebuilding",
-                                         :title             "Retry without cache",
-                                         :on-click #(raise! owner [:retry-build-clicked {:build-id build-id
-                                                                                :vcs-url vcs-url
-                                                                                :build-num build-num
-                                                                                :no-cache? true}])}}
-                 :with_ssh       {:text "with SSH"
-                                  :args {:data-loading-text "Rebuilding",
-                                         :title             "Retry with SSH in VM",
-                                         :on-click #(raise! owner [:ssh-build-clicked {:build-id build-id
-                                                                                :vcs-url vcs-url
-                                                                                :build-num build-num}])}}}]
-    (html
-      [:div.btn-group.build-action.rebuild
-       (forms/managed-button
-         [:button.btn.rebuild-btn (-> actions :rebuild :args) (-> actions :rebuild :text)])
-       [:button.btn.dropdown-toggle {:data-toggle "dropdown"}
-        [:img {:src (common/icon-path "UI-ArrowChevron")}]]
-       [:ul.dropdown-menu
-        [:li
-         (forms/managed-button
-           [:a (-> actions :without_cache :args) (-> actions :without_cache :text)])]
-        ;; XXX Temporarily remove the ssh button for OSX builds
-        (when (not (feature/enabled-for-project? project :osx))
-          [:li
-           (forms/managed-button
-             [:a (-> actions :with_ssh :args) (-> actions :with_ssh :text)])])]])))
+(defn rebuild-actions-v2 [{:keys [build project]} owner]
+  (reify
+    om/IInitState
+    (init-state [_]
+      (let [rebuild-args  {:build-id  (build-model/id build)
+                           :vcs-url   (:vcs_url build)
+                           :build-num (:build_num build)}
+            rebuild!      #(do (raise! owner %)
+                               (om/set-state! owner [:actions :rebuild :text] "Rebuilding"))]
+        {:actions
+         {:rebuild
+          {:text  "Rebuild"
+           :title "Retry the same tests"
+           :action #(rebuild! [:retry-build-clicked (merge rebuild-args {:no-cache? false})])}
+
+          :without_cache
+          {:text  "without Cache"
+           :title "Retry without cache"
+           :action #(rebuild! [:retry-build-clicked (merge rebuild-args {:no-cache? true})])}
+
+          :with_ssh
+          {:text  "with SSH"
+           :title "Retry with SSH in VM",
+           :action #(rebuild! [:ssh-build-clicked rebuild-args])}}}))
+    om/IRenderState
+    (render-state [_ {:keys [actions]}]
+      (let [text-for    #(-> actions % :text)
+            action-for  #(-> actions % :action)]
+        (html
+          [:div.btn-group.build-action.rebuild
+           [:button.btn.rebuild-btn {:on-click (action-for :rebuild)} (text-for :rebuild)]
+           [:button.btn.dropdown-toggle {:data-toggle "dropdown"}
+            [:img {:src (common/icon-path "UI-ArrowChevron")}]]
+           [:ul.dropdown-menu
+            [:li
+             [:a {:on-click (action-for :without_cache)} (text-for :without_cache)]]
+            ;; XXX Temporarily remove the ssh button for OSX builds
+            (when (not (feature/enabled-for-project? project :osx))
+              [:li
+               [:a {:on-click (action-for :with_ssh)} (text-for :with_ssh)]])]])))))

 (defn build-head-actions
   [data owner]


Don't require the core namespace, we deleted it

--- test/petulant_life/core_test.clj
+++ test/petulant_life/core_test.clj
@@ -1,6 +1,5 @@
 (ns petulant-life.core-test
-  (:require [clojure.test :refer :all]
-            [petulant-life.core :refer :all]))
+  (:require [clojure.test :refer :all]))

 (deftest a-test
   (testing "FIXME, I fail."


Remove duplicate test-element-meta

Remove duplicate test-element-meta

--- test/sablono/normalize_test.cljc
+++ test/sablono/normalize_test.cljc
@@ -104,15 +104,6 @@
     [:div ["a" "b"]] ["div" {} ["a" "b"]]))

 (deftest test-element-meta
-  (let [[tag attrs content]
-        (normalize/element
-         '[:span
-           ^:inline (constantly 1)
-           2
-           ^:inline (constantly 3)])]
-    (is (= (map (comp  :inline meta) content) [true nil true]))))
-
-(deftest test-element-meta
   (are [element expected]
       (= (->> (nth (normalize/element element) 2)
               (map (comp map? meta))))


removed dependency on a local file

removed dependency on a local file

--- src/warc_cc/example.clj
+++ src/warc_cc/example.clj
@@ -31,11 +31,11 @@
 ;; this turns a tsv file with only one column containing known english words
 ;; if you dont have it, simply dont use has-known-words, or make it a constant
 ;; true
-(def eng-words?
-  (into #{}
-        (rest
-         (map #(first (clojure.string/split % #"\t"))
-              (file-lines "/home/shlomiv/Downloads/dictionaryWords.tsv")))))
+(def eng-words? (constantly true))
+#_(into #{}
+      (rest
+       (map #(first (clojure.string/split % #"\t"))
+            (file-lines "/home/shlomiv/Downloads/dictionaryWords.tsv"))))

 (defn has-known-words [percent ts]
   (< (quot (count ts) percent) (count (filter eng-words? ts))))


extract out function run-index-all

extract out function run-index-all

--- src/wb_es/bulk/core.clj
+++ src/wb_es/bulk/core.clj
@@ -111,6 +111,196 @@

 (defn- scheduler-retry! [& args] (apply dq/retry! args))

+(defn- scheduler-stats [] (dq/stats q))
+
+
+(defn run-index-sample [db]
+  ;; schedule something for testing
+  (let [eids (get-eids-by-type db :analysis/id)
+        jobs (make-batches 1000 :analysis eids)]
+    (doseq [job jobs]
+      (scheduler-put! job)))
+  )
+
+(defn run-index-all [db]
+  (do
+    ;; add jobs to scheduler in sequence
+
+    (let [eids (get-eids-by-type db :gene/id)
+          jobs (make-batches 100 :gene eids)]  ; smaller batch for slower ones
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :analysis/id)
+          jobs (make-batches 1000 :analysis eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :anatomy-term/id)
+          jobs (make-batches 1000 :anatomy-term eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :antibody/id)
+          jobs (make-batches 1000 :antibody eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :cds/id)
+          jobs (make-batches 1000 :cds eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :clone/id)
+          jobs (make-batches 1000 :clone eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :construct/id)
+          jobs (make-batches 1000 :construct eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :expression-cluster/id)
+          jobs (make-batches 1000 :expression-cluster eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :expr-pattern/id)
+          jobs (make-batches 1000 :expr-pattern eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :expr-profile/id)
+          jobs (make-batches 1000 :expr-profile eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :do-term/id)
+          jobs (make-batches 1000 :do-term eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :feature/id)
+          jobs (make-batches 1000 :feature eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :gene-class/id)
+          jobs (make-batches 1000 :gene-class eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :gene-cluster/id)
+          jobs (make-batches 1000 :gene-cluster eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :go-term/id)
+          jobs (make-batches 1000 :go-term eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :homology-group/id)
+          jobs (make-batches 1000 :homology-group eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :interaction/id)
+          jobs (make-batches 1000 :interaction eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :laboratory/id)
+          jobs (make-batches 1000 :laboratory eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :life-stage/id)
+          jobs (make-batches 1000 :life-stage eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :molecule/id)
+          jobs (make-batches 1000 :molecule eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :microarray-results/id)
+          jobs (make-batches 1000 :microarray-results eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :motif/id)
+          jobs (make-batches 1000 :motif eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :oligo/id)
+          jobs (make-batches 1000 :oligo eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :operon/id)
+          jobs (make-batches 1000 :operon eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :paper/id)
+          jobs (make-batches 1000 :paper eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :person/id)
+          jobs (make-batches 1000 :person eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :pcr-product/id)
+          jobs (make-batches 1000 :pcr-product eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :phenotype/id)
+          jobs (make-batches 1000 :phenotype eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :picture/id)
+          jobs (make-batches 1000 :picture eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :position-matrix/id)
+          jobs (make-batches 1000 :position-matrix eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :protein/id)
+          jobs (make-batches 1000 :protein eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :pseudogene/id)
+          jobs (make-batches 1000 :pseudogene eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :rearrangement/id)
+          jobs (make-batches 1000 :rearrangement eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :rnai/id)
+          jobs (make-batches 1000 :rnai eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :sequence/id)
+          jobs (make-batches 1000 :sequence eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :strain/id)
+          jobs (make-batches 1000 :strain eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :structure-data/id)
+          jobs (make-batches 1000 :structure-data eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :transcript/id)
+          jobs (make-batches 1000 :transcript eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :transgene/id)
+          jobs (make-batches 1000 :transgene eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :transposon/id)
+          jobs (make-batches 1000 :transposon eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :transposon-family/id)
+          jobs (make-batches 1000 :transposon-family eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :wbprocess/id)
+          jobs (make-batches 1000 :wbprocess eids)]
+      (doseq [job jobs]
+        (scheduler-put! job)))
+    (let [eids (get-eids-by-type db :variation/id)
+          jobs (make-batches 100 :variation eids)] ; smaller batch for slower ones
+      (doseq [job jobs]
+        (scheduler-put! job)))
+
+    ))
+

 (defn run [& {:keys [db index-revision-number index-id skip-create-snapshot]
               :or {db (d/db datomic-conn)
@@ -141,6 +331,7 @@
         (dotimes [i n-threads]
           (go
             (loop []
+              (>! logger (scheduler-stats))
               (if-let [job-ref (scheduler-take! 600000 nil)]
                 ;; normal batches won't be nil
                 ;; only get nil when channel is closed
@@ -156,183 +347,10 @@
                     (recur)))
                 (close! logger)))))

-        (do
-          ;; add jobs to scheduler in sequence
-
-          (let [eids (get-eids-by-type db :gene/id)
-                jobs (make-batches 100 :gene eids)]  ; smaller batch for slower ones
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :analysis/id)
-                jobs (make-batches 1000 :analysis eids)]
-            (doseq [job jobs]
-               (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :anatomy-term/id)
-                jobs (make-batches 1000 :anatomy-term eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :antibody/id)
-                jobs (make-batches 1000 :antibody eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :cds/id)
-                jobs (make-batches 1000 :cds eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :clone/id)
-                jobs (make-batches 1000 :clone eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :construct/id)
-                jobs (make-batches 1000 :construct eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :expression-cluster/id)
-                jobs (make-batches 1000 :expression-cluster eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :expr-pattern/id)
-                jobs (make-batches 1000 :expr-pattern eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :expr-profile/id)
-                jobs (make-batches 1000 :expr-profile eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :do-term/id)
-                jobs (make-batches 1000 :do-term eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :feature/id)
-                jobs (make-batches 1000 :feature eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :gene-class/id)
-                jobs (make-batches 1000 :gene-class eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :gene-cluster/id)
-                jobs (make-batches 1000 :gene-cluster eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :go-term/id)
-                jobs (make-batches 1000 :go-term eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :homology-group/id)
-                jobs (make-batches 1000 :homology-group eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :interaction/id)
-                jobs (make-batches 1000 :interaction eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :laboratory/id)
-                jobs (make-batches 1000 :laboratory eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :life-stage/id)
-                jobs (make-batches 1000 :life-stage eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :molecule/id)
-                jobs (make-batches 1000 :molecule eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :microarray-results/id)
-                jobs (make-batches 1000 :microarray-results eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :motif/id)
-                jobs (make-batches 1000 :motif eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :oligo/id)
-                jobs (make-batches 1000 :oligo eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :operon/id)
-                jobs (make-batches 1000 :operon eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :paper/id)
-                jobs (make-batches 1000 :paper eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :person/id)
-                jobs (make-batches 1000 :person eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :pcr-product/id)
-                jobs (make-batches 1000 :pcr-product eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :phenotype/id)
-                jobs (make-batches 1000 :phenotype eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :picture/id)
-                jobs (make-batches 1000 :picture eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :position-matrix/id)
-                jobs (make-batches 1000 :position-matrix eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :protein/id)
-                jobs (make-batches 1000 :protein eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :pseudogene/id)
-                jobs (make-batches 1000 :pseudogene eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :rearrangement/id)
-                jobs (make-batches 1000 :rearrangement eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :rnai/id)
-                jobs (make-batches 1000 :rnai eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :sequence/id)
-                jobs (make-batches 1000 :sequence eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :strain/id)
-                jobs (make-batches 1000 :strain eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :structure-data/id)
-                jobs (make-batches 1000 :structure-data eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :transcript/id)
-                jobs (make-batches 1000 :transcript eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :transgene/id)
-                jobs (make-batches 1000 :transgene eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :transposon/id)
-                jobs (make-batches 1000 :transposon eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :transposon-family/id)
-                jobs (make-batches 1000 :transposon-family eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :wbprocess/id)
-                jobs (make-batches 1000 :wbprocess eids)]
-            (doseq [job jobs]
-              (scheduler-put! job)))
-          (let [eids (get-eids-by-type db :variation/id)
-                jobs (make-batches 100 :variation eids)] ; smaller batch for slower ones
-            (doseq [job jobs]
-              (scheduler-put! job)))
-
-          )
+        (run-index-all db)
+        ;;(run-index-sample db)
+        (prn (scheduler-stats))
+
         )

       (if-not skip-create-snapshot


Update boot.clj

Update boot.clj

--- src/meta/boot.clj
+++ src/meta/boot.clj
@@ -108,8 +108,7 @@
   "Build project for release."
   []
   (boot/task-options!
-    impl/info  {:message "Running Workflow...: compile"}
-    njs/nodejs {:init-fn 'app.server/init})
+    impl/info  {:message "Running Workflow...: compile"})
   (comp
     (info)
     (standup)
@@ -124,8 +123,7 @@
     impl/info   {:message "Running Workflow...: develop"}
     ver/version {:develop true :pre-release 'degree9.boot-semver/snapshot}
     server      {:develop true}
-    client      {:develop true}
-    njs/nodejs  {:init-fn 'app.server/init})
+    client      {:develop true})
   (comp
     (info)
     (sync-repo)
@@ -159,8 +157,7 @@
   (boot/task-options!
     impl/info  {:message "Running Workflow...: microservice"}
     ver/version {:develop true :pre-release 'degree9.boot-semver/snapshot}
-    server      {:develop true}
-    njs/nodejs  {:init-fn 'app.server/init})
+    server      {:develop true})
   (comp
     (info)
     (sync-repo)


Thread it

Thread it

--- samples/what-is-my-ip.clj
+++ samples/what-is-my-ip.clj
@@ -2,4 +2,7 @@

 (clojr/dep cheshire "5.3.1" cheshire.core)

-(println (:ip (parse-string (slurp "http://ip.jsontest.com") true)))
+(-> (slurp "http://ip.jsontest.com")
+    (parse-string true)
+    :ip
+    println)


ensure cljs.core and cljs.user are setup

--- src/main/clojure/clojure/tools/analyzer/js.clj
+++ src/main/clojure/clojure/tools/analyzer/js.clj
@@ -55,9 +55,12 @@

 (def ^:dynamic *ns* 'cljs.user)

+(defonce core-env (atom {}))
+
 (defn global-env []
-  (atom {:namespaces          '{goog {:mappings {}, :js-namespace true, :ns goog}
-                                Math {:mappings {}, :js-namespace true, :ns Math}}
+  (atom {:namespaces          (merge '{goog {:mappings {}, :js-namespace true, :ns goog}
+                                       Math {:mappings {}, :js-namespace true, :ns Math}}
+                                     @core-env)
          :js-dependency-index (deps/js-dependency-index {})}))

 (defn empty-env
@@ -517,4 +520,12 @@
                       (recur))))))))
         (get-in @*env* [::analyzed-cljs path])))))

-(require 'cljs.core)
+(defn setup-rt []
+  (when-not (seq @core-env)
+    (require 'cljs.core)
+    (env/with-env (global-env)
+      (analyze-ns 'cljs.core)
+      (analyze '(ns cljs.user))
+      (reset! core-env (select-keys (:namespaces (env/deref-env)) '[cljs.core cljs.user])))))
+
+(setup-rt)


wait till es is started before indexing

wait till es is started before indexing

--- src/wb_es/bulk/core.clj
+++ src/wb_es/bulk/core.clj
@@ -11,6 +11,7 @@
             [wb-es.datomic.db :refer [datomic-conn]]
             [wb-es.env :refer [es-base-url release-id]]
             [wb-es.mappings.core :refer [create-index]]
+            [wb-es.web.setup :refer [es-connect]]
             [wb-es.snapshot.core :refer [connect-snapshot-repository save-snapshot get-next-snapshot-id]]))

 (defn format-bulk
@@ -353,6 +354,7 @@
   "I don't do a whole lot ... yet."
   [& args]
   (do
+    (es-connect)
     (println "Indexer starting!")
     (mount/start)
     (if-let [index-revision-number (first args)]


Add checkerboard sketch.

Add checkerboard sketch.

--- Quil/checkerboard/src/checkerboard/core.clj
+++ Quil/checkerboard/src/checkerboard/core.clj
@@ -2,33 +2,37 @@
   (:require [quil.core :as q]
             [quil.middleware :as m]))

+(def WIDTH 500)
+(def HEIGHT 500)
+
+(def ROWS 10)
+(def COLS 10)
+
 (defn setup []
-  {:color 0
-   :angle 0})
+  {})

 (defn update [state]
-  ; Update sketch state by changing circle color and position.
-  {:color (mod (+ (:color state) 0.7) 255)
-   :angle (+ (:angle state) 0.1)})
+  state)

 (defn draw [state]
-  ; Clear the sketch by filling it with light-grey color.
-  (q/background 240)
-  ; Set circle color.
-  (q/fill (:color state) 255 255)
-  ; Calculate x and y coordinates of the circle.
-  (let [angle (:angle state)
-        x (* 150 (q/cos angle))
-        y (* 150 (q/sin angle))]
-    ; Move origin point to the center of the sketch.
-    (q/with-translation [(/ (q/width) 2)
-                         (/ (q/height) 2)]
-      ; Draw the circle.
-      (q/ellipse x y 100 100))))
+  ; Clear the sketch by filling it with black color.
+  (q/background 0)
+  ; Set color.
+  (q/fill 255)
+  (let [col-width (/ WIDTH (float COLS))
+        row-height (/ HEIGHT (float ROWS))]
+    (doseq [row (range 0 ROWS)
+            col (range 0 COLS)
+            :when (or (and (even? row) (even? col))
+                      (and (odd? row) (odd? col)))
+            :let [x (* col-width col)
+                  y (* row-height row)]]
+      (q/rect x y col-width row-height)))
+  )

 (q/defsketch checkerboard
-  :title "You spin my circle right round"
-  :size [500 500]
+  :title "Checkerboard"
+  :size [WIDTH HEIGHT]
   ; setup function called only once, during sketch initialization.
   :setup setup
   ; update is called on each iteration before draw is called.


cleaned source

cleaned source

--- spec/untangled/client/data_fetch_spec.cljs
+++ spec/untangled/client/data_fetch_spec.cljs
@@ -509,9 +509,7 @@
       (assertions
         @simple-state-atom => {:obj {1 {:boo [[:x 1]]}}}
         @maptarget-state-atom => {:obj {1 {:boo [[:x 1]]}}}
-        @vectarget-state-atom => {:obj {1 {:boo [[:x 1]]}}}
-        )))
-  )
+        @vectarget-state-atom => {:obj {1 {:boo [[:x 1]]}}}))))

 (specification "Splits items to load by join key / ident kind."
   (let [q-a-x {::dfi/query [{:a [:x]}]}


Makes saving consistent

Makes saving consistent

--- src/wordsmith/core.cljs
+++ src/wordsmith/core.cljs
@@ -116,7 +116,7 @@
        (and (.-metaKey %)
             (= 83 (.-keyCode %)))
        (.preventDefault %)
-       (save-document app))))
+       (put! (:channel @app) [:save nil]))))

 (defn wordsmith-app [app owner]
   (reify


Improves formatting of docstrings

Improves formatting of docstrings

--- src/wordsmith/core.cljs
+++ src/wordsmith/core.cljs
@@ -59,7 +59,7 @@

 (defn new-button
   "Component that renders the 'add new' button and handles triggering new
-   document state on app."
+  document state on app."
   [app owner]
   (reify
     om/IRender
@@ -77,7 +77,7 @@

 (defn saved?
   "Determines whether or not the app state has changed since last
-   save."
+  save."
   [{:keys [input last-input title last-title]}]
   (and
     (= input last-input)
@@ -85,8 +85,8 @@

 (defn save-button
   "Component that renders the save button. The button is disabled
-   when there are no changes to title or input. Clicking the save
-   button triggers the app state to update and saves to localStorage."
+  when there are no changes to title or input. Clicking the save
+  button triggers the app state to update and saves to localStorage."
   [app owner]
   (reify
     om/IRender
@@ -109,7 +109,7 @@

 (defn delete-click
   "Shows a prompt asking the user for confirmation. If confirmation
-   is true, sends a :remove command on the app channel."
+  is true, sends a :remove command on the app channel."
   [title app]
   (let [response (js/confirm "Are you sure?")]
     (when response
@@ -117,9 +117,9 @@

 (defn left-menu
   "Component that renders the left-menu containing all the documents
-   available in localStorage. Clicking on a title triggers an app state
-   change by sending a :change command on the app channel. Clicking on
-   a delete button does that same with the :remove command."
+  available in localStorage. Clicking on a title triggers an app state
+  change by sending a :change command on the app channel. Clicking on
+  a delete button does that same with the :remove command."
   [app owner]
   (reify
     om/IRender
@@ -149,8 +149,8 @@

 (defn editor
   "Component that renders the editor and preview. Compiles the app state input
-   to markdown and dangerously sets it to output-area. Editing the input-area
-   triggers an update to the app state."
+  to markdown and dangerously sets it to output-area. Editing the input-area
+  triggers an update to the app state."
   [input owner]
   (reify
     om/IRender
@@ -184,8 +184,8 @@

 (defn change-document
   "Changing between documents requires fetching the new document
-   from localStorage and updating both input/title and last-input/last-title
-   to the new document state."
+  from localStorage and updating both input/title and last-input/last-title
+  to the new document state."
   [app title]
   (let [input (p/get-document title)]
     (update-many! app [:input :last-input] input)
@@ -193,8 +193,8 @@

 (defn save-document
   "If title is the same as last-title it renames the document. Then
-   updates :last-input and :last-title to the current input and title.
-   Finally refreshes the :titles with the latest results from localStorage."
+  updates :last-input and :last-title to the current input and title.
+  Finally refreshes the :titles with the latest results from localStorage."
   [app]
   (let [{:keys [title input last-title last-input]} @app]
     (when-not (= title last-title)
@@ -206,8 +206,8 @@

 (defn remove-document
   "Removes a document from localStorage and updates app state. If the
-   removed document was the current document, also triggers a document
-   state reset."
+  removed document was the current document, also triggers a document
+  state reset."
   [app title]
   (p/remove-document title)
   (om/update! app :titles (p/get-all-titles))
@@ -225,7 +225,7 @@

 (defn listen-to-hotkeys
   "Listens to KEYDOWN events using goog.events and checks for Ctrl+S or
-   Cmd+S. When identified, sends a :save command on app channel."
+  Cmd+S. When identified, sends a :save command on app channel."
   [app]
   (events/listen js/document EventType/KEYDOWN
     #(when
@@ -238,14 +238,14 @@

 (defn wordsmith-app
   "The starting point of the wordsmith app. Implements will-mount and
-   render."
+  render."
   [app owner]
   (reify
     om/IWillMount
     (will-mount [_]
       "Fetches document titles and starts the asynchronous command event
-       dispatch loop which handles all major app state changing events.
-       Also attaches a KEYDOWN event listener to the page, for hot keys."
+      dispatch loop which handles all major app state changing events.
+      Also attaches a KEYDOWN event listener to the page, for hot keys."
       (listen-to-hotkeys app)
       (om/update! app :titles (p/get-all-titles))
       (let [channel (:channel app)]


fixed a bug where owner was not passed to a event in insights

--- src-cljs/frontend/components/insights.cljs
+++ src-cljs/frontend/components/insights.cljs
@@ -134,7 +134,7 @@
 (defn visualize-insights-bar! [plot-info el builds {:keys [on-focus-build on-mouse-move]
                                                     :or {on-focus-build (constantly nil)
                                                          on-mouse-move (constantly nil)}
-                                                    :as events}]
+                                                    :as events} owner]
   (let [[y-pos-max y-neg-max] (->> [:build_time_millis :queued_time_millis]
                                    (map #(->> builds
                                               (map %)
@@ -143,7 +143,7 @@
                 (.select el)
                 (.select "svg")
                 ;; Set the SVG up to redraw itself when it resizes.
-                (.property "redraw-fn" (constantly #(visualize-insights-bar! plot-info el builds events)))
+                (.property "redraw-fn" (constantly #(visualize-insights-bar! plot-info el builds events owner)))
                 (.on "mousemove" #(on-mouse-move (d3.mouse el))))
         svg-bounds (-> svg
                        ffirst
@@ -355,11 +355,11 @@
     (did-mount [_]
       (let [el (om/get-node owner)]
         (insert-skeleton plot-info el)
-        (visualize-insights-bar! plot-info el builds (select-keys params [:on-focus-build :on-mouse-move]))))
+        (visualize-insights-bar! plot-info el builds (select-keys params [:on-focus-build :on-mouse-move]) owner)))
     om/IDidUpdate
     (did-update [_ prev-props prev-state]
       (let [el (om/get-node owner)]
-        (visualize-insights-bar! plot-info el builds (select-keys params [:on-focus-build :on-mouse-move]))))
+        (visualize-insights-bar! plot-info el builds (select-keys params [:on-focus-build :on-mouse-move]) owner)))
     om/IRender
     (render [_]
       (html


Use the ubuntu user so we avoid a password prompt

--- src/circle/backend/build/inference/rails.clj
+++ src/circle/backend/build/inference/rails.clj
@@ -109,8 +109,7 @@
     (->> {:test
           {:adapter adapter
            :database "circle_test"
-           :username "circle"
-           :password nil}}
+           :username "ubuntu"}}
          ((var clj-yaml.core/stringify))
          (.dump yaml))))


Fixed load file regression

Fixed load file regression

--- src/clj/pinkgorilla/events/storage_file.cljs
+++ src/clj/pinkgorilla/events/storage_file.cljs
@@ -33,9 +33,7 @@
                          (map (fn [x] {:text    x
                                        :desc    (str "
" x "
")
                                        ;; For now, we have to take/return db due to clojuredocs sync window.open
-                                       :handler (fn [db]
-                                                  (routes/nav! (str "/edit?source=file&filename=" x))
-                                                  db)})))
+                                       :handler [:nav (str "/edit?source=file&filename=" x) db]})))
          palette (:palette db)]
      (assoc-in db [:palette] (merge palette {:all-items     file-items
                                              :visible-items file-items


min-date works as a pikaday-attr but not as an atom

--- src/cljs/early_vote_site/election/views.cljs
+++ src/cljs/early_vote_site/election/views.cljs
@@ -7,8 +7,6 @@
 (defn state-select-row
   [state]
   [:option {:value (:fips-code state) :key (:fips-code state)} (:state-name state)])
-
-(def today (ratom/atom (js/Date.)))

 (defn form []
   (let [state (re-frame/subscribe [:election-form/state])
@@ -27,10 +25,9 @@
       [:div {:class "form-group mx-sm-3"}
        [:label {:for "date" :style {:padding-right 10}} "Date"]
        [pikaday/date-selector {:class "form-control"
-                               :min-date-atom today
                                :date-atom date
                                :pikaday-attrs
-                               {:min-date today}}]]
+                               {:min-date (js/Date.)}}]]
       [:button.button {:on-click #(re-frame/dispatch [:election-form/save])
                        :disabled @(re-frame/subscribe [:create-disabled?])}
        "add"]]


Allow user to go back to deployment view

--- src/cljs/onyx_dashboard/components/jobs.cljs
+++ src/cljs/onyx_dashboard/components/jobs.cljs
@@ -15,18 +15,23 @@
                    (t/table {:striped? true :bordered? false :condensed? true :hover? true}
                           ;; (dom/thead (dom/tr (dom/th "ID") (dom/th "Time")))
                           (dom/tbody
-                            (for [job (reverse (sort-by :created-at (vals jobs)))]
-                              (let [job-id (:id job)
-                                    selected? (= job-id selected-job)]
-                                (dom/tr {:class "job-entry"
-                                         :on-click (fn [_]
-                                                     (put! (om/get-shared owner :api-ch)
-                                                           [:select-job job-id]))}
-                                        (dom/td (dom/i {:class (if selected? "fa fa-dot-circle-o" "fa fa-circle-o")}))
-                                        (dom/td {}
-                                                (dom/a {:href "#"} (str job-id)))
-                                        (dom/td {}
-                                                (.fromNow (js/moment (str (js/Date. (:created-at job))))))))))))))
+                            (cons (dom/tr {:class "job-entry"
+                                           :on-click (fn [_] (put! (om/get-shared owner :api-ch) [:select-job nil]))}
+                                          (dom/td (dom/i {:class (if (nil? selected-job) "fa fa-dot-circle-o" "fa fa-circle-o")}))
+                                          (dom/td {} (dom/a {:href "#"} "None"))
+                                          (dom/td {}))
+                                  (for [job (reverse (sort-by :created-at (vals jobs)))]
+                                    (let [job-id (:id job)
+                                          selected? (= job-id selected-job)]
+                                      (dom/tr {:class "job-entry"
+                                               :on-click (fn [_]
+                                                           (put! (om/get-shared owner :api-ch)
+                                                                 [:select-job job-id]))}
+                                              (dom/td (dom/i {:class (if selected? "fa fa-dot-circle-o" "fa fa-circle-o")}))
+                                              (dom/td {}
+                                                      (dom/a {:href "#"} (str job-id)))
+                                              (dom/td {}
+                                                      (.fromNow (js/moment (str (js/Date. (:created-at job)))))))))))))))

 (defcomponent task-table [tasks owner]
   (render [_]


static line -> render only on change

static line -> render only on change

--- src/cljs/swarmpit/component/service/log.cljs
+++ src/cljs/swarmpit/component/service/log.cljs
@@ -32,6 +32,18 @@
                    (state/update-value [:fetching] false cursor)
                    (state/update-value [:data] response cursor))}))

+(defn log-append-handler
+  [service from-timestamp]
+  (handler/get
+    (routes/path-for-backend :service-logs (select-keys service [:id]))
+    {:on-call    (state/update-value [:fetching] true cursor)
+     :params     {:from from-timestamp}
+     :on-success (fn [response]
+                   (state/update-value [:fetching] false cursor)
+                   (state/update-value [:data] (-> (state/get-value cursor)
+                                                   :data
+                                                   (concat response)) cursor))}))
+
 (defn- init-state
   []
   (state/set-value {:filter      {:predicate ""}
@@ -45,12 +57,22 @@
   (mixin/refresh
     (fn [service]
       (when (not (:fetching (state/get-value cursor)))
-        (log-handler service)))))
+        (log-append-handler service (-> (state/get-value cursor)
+                                        :data
+                                        (last)
+                                        :timestamp))))))

 (def init-state-mixin
   (mixin/init
     (fn [_]
       (init-state))))
+
+(rum/defc line < rum/static [item timestamp]
+  [:div
+   (when timestamp
+     [:span.log-timestamp (:timestamp item)])
+   [:span.log-info (str (:taskName item) "." (subs (:task item) 0 12) "@" (:taskNode item))]
+   [:span.log-body (str " " (:line item))]])

 (rum/defc form < rum/reactive
                  init-state-mixin
@@ -88,9 +110,4 @@
         [:span "There are no logs available for the service."]
         (map
           (fn [item]
-            [:span
-             (when timestamp
-               [:span.log-timestamp (:timestamp item)])
-             [:span.log-info (str (:taskName item) "." (subs (:task item) 0 12) "@" (:taskNode item))]
-             [:span.log-body (str " " (:line item))]
-             [:br]]) filtered-items))]]))
+            (line item timestamp)) filtered-items))]]))


fix indention

fix indention

--- storm-netty/project.clj
+++ storm-netty/project.clj
@@ -3,12 +3,10 @@

 (defproject storm/storm-netty VERSION
   :dependencies [[storm/storm-core "0.9.0-wip17"]
-  		 [io.netty/netty "3.6.3.Final"]
-                 ]
-
+                 [io.netty/netty "3.6.3.Final"]]
+
   :java-source-paths ["src/jvm"]
   :test-paths ["test/clj"]
-
+
   :profiles {:release {}}
-
-  :aot :all)
+  :aot :all)


[#2296] Refactor

[#2296] Refactor

--- backend/src/akvo/lumen/component/keycloak.clj
+++ backend/src/akvo/lumen/component/keycloak.clj
@@ -422,7 +422,7 @@

 (defmethod ig/init-key :akvo.lumen.component.keycloak/authorization-service  [_ {:keys [credentials public-client max-user-ids-cache monitoring] :as opts}]
   (log/info "Starting keycloak")
-  (let [issuer (format "%s/realms/%s" (:url public-client) (:realm public-client))
+  (let [issuer (:issuer public-client)
         connection-manager (http.client/new-connection-manager {:timeout 10 :threads 10 :default-per-route 10})
         openid-config      (fetch-openid-configuration issuer {})]
     (log/info "Successfully got openid-config from provider.")


Corrected hiccup.util/url docstring (fixes #47)

--- src/hiccup/util.clj
+++ src/hiccup/util.clj
@@ -82,7 +82,7 @@
   (url-encode [x] (url-encode (to-str x))))

 (defn url
-  "Creates a URL string from a variable list of arguments and an optional
+  "Creates a URI instance from a variable list of arguments and an optional
   parameter map as the last argument. For example:
     (url \"/group/\" 4 \"/products\" {:page 9})
     => \"/group/4/products?page=9\""


set timeout to 1hr

set timeout to 1hr

--- src/trackif/core.clj
+++ src/trackif/core.clj
@@ -89,5 +89,5 @@
   (loop []
     (doseq [url (all-urls)]
       (>!! c url))
-    (<!! (timeout 10000))
+    (<!! (timeout 3600000))
     (recur)))


Simplify `pattern-sequence` now that it doesn't have to check there are enough tokens left.

--- src/isla/parser.clj
+++ src/isla/parser.clj
@@ -89,15 +89,11 @@
     nil)) ;; no alternatives match - return

 (defn pattern-sequence [tokens patterns collected]
-  (let [pattern (first patterns)
-        token (first tokens)] ;;;;;;;;;;;;;;;;; need to fix - sub patterns shd manage own toks
-    (if (nil? pattern)
-      {:nodes collected :left-tokens tokens} ;; pattern matched - return
-      (if (nil? token) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ditto
-        nil ;; pattern match failure - not enough tokens
-        (if-let [{node :node left-tokens :left-tokens} (pattern tokens)] ;; matched token
-          (pattern-sequence left-tokens (rest patterns) (conj collected node)) ;; round again
-          nil))))) ;; pattern match failure token match failure - return
+  (if-let [pattern (first patterns)]
+    (if-let [{node :node left-tokens :left-tokens} (pattern tokens)] ;; matched token
+      (pattern-sequence left-tokens (rest patterns) (conj collected node)) ;; round again
+      nil) ;; pattern sequence element match failure - return
+    {:nodes collected :left-tokens tokens})) ;; pattern matched - return

 (defn one-token-pattern [tokens matcher tag & args]
   (if-let [token (first tokens)]


Change to generic pubsub

Change to generic pubsub

--- src/angelic/search/implicit/dash_astar.clj
+++ src/angelic/search/implicit/dash_astar.clj
@@ -21,42 +21,31 @@

 ;; TODO: tests !

-;; TODO: SP has hash table from (state-abstracted context) input set to stub (?).
-
-
-;; TODO first: propagate subsumption links.
-;; TODO second: add pessimistic variant. (primitives shared!)
-
-;; TODO: bounding of pessimistic descriptions ? (assume consistency for now).
-
-;; One basic kinds of subsumption propagation:
-;;   X --> Y ==> for all child keys k, child(X, k) --> child(Y, k)
-;;   This taken into account for atomic, not pairs now.
-
-;; --> TODO: every SP should watch all subsuming SPs for children with matching
-;;     names, add these as subsumption parents.
-;; (Except any direct parents)
-
-;; TODO: investigate plan seq  normalization. (flattening)
-;; TODO: don't release children until they have lower reward or are primitive? \
-
-
-;; TODO: smarter choose-leaf?
+;;;;; Subsumption
+;; TODO: propagate subsumption links
+;; TODO: wait on subsumption parent(s)?
+
+;;;;; Pessimistic
+;; TODO: add pessimistic variants (shared primitives)
+;; TODO: bounding pressimistic descritpions (assume consistency for now)
+
+;;;;; Tree construction
+;; TODO: smarter output-collector (semantic) -- problems here though.
 ;; TODO: don't always split-left?
-;; TODO: smarter output-collector (semantic) -- problems here though.
+;; TODO: don't release children until they have lower reward or are primitive?
+;; TODO: make sure dead stuff can be GC'd

 ;;;;; Summaries and solving
 ;; TODO: lazy/pseudo-solve (regular seems impossible; bounds mean apparent decrease may be increase.
 ;;    I.e., live decrease -50 to -49, now blocked sibling becomes best; above is -50 TDB;
 ;; TODO: smarter summary updates (i.e., pass child)
+;; TODO: smarter choose-leaf?

 ;;;;; SP caching
 ;; TODO: tail (i.e., pair) caching? -- Only help for >2 len refs...
 ;; TODO: cache refine-inputs?
 ;; TODO: cache children of output-collector? ~15 examples >1 in dm 4-3...
-
-;;;;; Misc
-;; TODO: make sure dead stuff can be GC'd
+;; TODO: investigate plan seq  normalization. (flattening)

 (set! *warn-on-reflection* true)
@@ -87,6 +76,21 @@
 (defmethod print-method angelic.search.implicit.dash_astar.TreeSummarizer [s o]
   (print-method (format "#<TS %s>" (print-str (ts-sp s))) o))

+;;;;;;;;;;;;;;;;;;;;;;;;;;         PubSubHub          ;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defrecord PubSubHub [^ArrayList subscribers ^ArrayList publications])
+(defn make-pubsubhub [] (PubSubHub. (ArrayList.) (ArrayList.)))
+
+(defn publications [psh] (doall (seq (:publications psh))))
+
+(defn publish!     [psh pub]
+  (.add ^ArrayList (:publications psh) pub)
+  (doseq [sub (doall (seq (:subscribers psh)))] (sub pub)))
+
+(defn subscribe!   [psh sub]
+  (.add ^ArrayList (:subscribers psh) sub)
+  (doseq [pub (doall (seq (:publications psh)))] (sub pub)))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;      Change Scheduling      ;;;;;;;;;;;;;;;;;;;;;;;;;;

 (def *increases* (ArrayList.))
@@ -127,20 +131,22 @@

   (get-output-set      [s]  "Return output or nil")
   (add-output-watcher! [s w] "Add watcher to be notified of self when has output.")
+  (set-output-set!     [s o] "Internal. Set output set. ")

   (get-children        [s]  "List current outputs, for debugging only.")
   (add-child-watcher!  [s w] "Add a watcher to be notified of all child sps.")
+  (add-sp-child!       [s o up?] "O is a subproblem child, possibly without output yet.
+                                  Updates cost if up? and child must be held before publishing.")
+
+  (publish-sp-child!   [s o] "Internal. O is a subproblem with output.  s must have output too.")
+  (get-all-children [s] "Internal.  Get children, including unpublished ones.")

   (subsuming-sps       [s] "subproblems with same name, >= inp-set")
   (add-subsuming-sp!   [s subsuming-sp])

-  (refine-input        [s refined-input-set] "Return a child sp. Must have output.")
+  (refine-input        [s refined-input-set] "Return a child sp. Must have output."))

-  ;; Internal interface
-  (add-sp-child!*      [s o] "O is a subproblem with output.  s must have output too.")
-  (set-output-set!    [s o] "Set output set. "))
-
 (defn get-output-set! [sp] (let [o (get-output-set sp)] (assert o) o))

 (defn terminal? [sp]
@@ -159,21 +165,29 @@

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  Generic Trait  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(def *out-count* (atom 1))
-
+;(def *out-count* (atom 1))
+
+;; Canonical SPs are Atomic and Pair; wrappers use TS of inner SP.
 (defn canonicalize [sp] (ts-sp (sp-ts sp)))
 (defn canonical? [sp] (identical? sp (ts-sp (sp-ts sp))))

 (defn notify-output-set! [w s] #_ (println "NO" s w) (w))
 (defn notify-child! [w s c] #_ (println "NC" s c w) (swap! *out-count* inc) (w c))
+
+
+;; Note subsumption following is a bit tricky, since we want access to all children
+;; (including unpublished ones).
+;; TODO: remove all-children if it doesn't help?
+;; What we need is a 3-way dependence:
+;; Child, sub child, sub link.?
+

 (traits/deftrait simple-subproblem
   [nm inp-set wrapped-ts eval!-fn ri-fn]
   [                 ts-atom          (atom wrapped-ts)
-   ^ArrayList       output-watchers  (ArrayList.)
-                    out-set-atom     (atom nil)
-   ^ArrayList       child-watchers   (ArrayList.)
-   ^ArrayList       child-list       (ArrayList.)
+   ^PubSubHub       output-ps        (make-pubsubhub)
+   ^PubSubHub       child-ps         (make-pubsubhub)
+   ^PubSubHub       all-child-ps     (make-pubsubhub)
    ^IdentityHashMap subsuming-sp-set (IdentityHashMap.)]
   [summaries/simple-cached-node]
   Subproblem
@@ -182,26 +196,38 @@
   (sp-ts               [s] (or @ts-atom (reset! ts-atom (make-tree-summarizer s))))
   (evaluate!           [s] (eval!-fn s))

-  (get-output-set      [s] @out-set-atom)
-  (add-output-watcher! [s w] (if @out-set-atom (notify-output-set! w s) (.add output-watchers w)))
-  (set-output-set!    [s o]
-    (util/print-debug 2 "SO" s)
-    (assert (nil? @out-set-atom))
-    (reset! out-set-atom o)
-    (doseq [w output-watchers] (notify-output-set! w s)))
+  (get-output-set      [s] (first (publications output-ps)))
+  (add-output-watcher! [s w] (subscribe! output-ps w))
+  (set-output-set!    [s o] (assert (not (get-output-set s))) (publish! output-ps o))

-  (get-children        [s] (doall (seq child-list)))
-  (add-child-watcher!  [s w]
-    (.add child-watchers w)
-    (when (get-output-set s)) (doseq [c (get-children s)] (notify-child! w s c)))
-  (add-sp-child!*      [s c]
+  (get-children        [s] (publications child-ps))
+  (add-child-watcher!  [s w] (subscribe! child-ps w))
+  (add-sp-child!       [sp child-sp up?] ;; TODO: subsumption should prevent child from gettong output before parent ??
+   (util/print-debug 2 "AC" sp child-sp)
+   (when (canonical? sp)
+     (schedule-subsumption! (sp-ts sp) (sp-ts child-sp))
+     (publish! all-child-ps child-sp)
+     (when *propagate-subusmption* #_ ::TODO) ;; TODO!!
+     )
+   (if (and (get-output-set sp) (get-output-set child-sp))
+    (publish-sp-child! sp child-sp)
+    (do (summaries/connect! sp (sp-ts child-sp))
+        (add-output-watcher! sp
+          (fn [_] (add-output-watcher! child-sp
+                   (fn [_] (publish-sp-child! sp child-sp)
+                           (summaries/disconnect! sp (sp-ts child-sp))
+                           (schedule-decrease! sp)))))
+        (when up? (schedule-increase! sp)))))
+  (publish-sp-child!      [s c]
     (util/assert-is (and (not (identical? s c)) (get-output-set s) (get-output-set c)))
-    (.add child-list c)
     (when (canonical? s)
       (summaries/connect! (sp-ts s) (sp-ts c))
       (schedule-increase! (sp-ts s)))
-    (doseq [w (doall (seq child-watchers))] (swap! *out-count* inc) (w c)))
-
+    (publish! child-ps c))
+
+  (get-all-children    [s] (publications all-child-ps))
+
+
   (subsuming-sps [s] (keys subsuming-sp-set))
   (add-subsuming-sp! [s subsuming-sp]
     (util/assert-is (canonical? s))
@@ -210,7 +236,11 @@
     (util/assert-is (not (identical? s subsuming-sp)))
     (when-not (.containsKey subsuming-sp-set subsuming-sp)
       (.put subsuming-sp-set subsuming-sp true)
-      (schedule-subsumption! (sp-ts subsuming-sp) (sp-ts s))))
+      (schedule-subsumption! (sp-ts subsuming-sp) (sp-ts s))
+      (when *propagate-subusmption*
+        #_ (add-child-watcher! )) ;; TODO!!
+
+      ))

   (refine-input    [s ni] (let [ret (ri-fn s ni)] (util/assert-is (= nm (sp-name ret))) ret)))

@@ -224,29 +254,10 @@

 (defn- connect-and-watch-ts! [p c out-f]
   (summaries/connect! p (sp-ts c))
-  (if (get-output-set c)
-    (do (out-f) false)
-    (do (add-output-watcher! c out-f) true)))
-
-;; TODO: subsumption should prevent child from gettong output before parent ??
-(defn- add-sp-child! [sp child-sp up?]
-   (util/print-debug 2 "AC" sp child-sp)
-;  (println sp child-sp) (Thread/sleep 100)
-   (when (canonical? sp)
-     (schedule-subsumption! (sp-ts sp) (sp-ts child-sp))
-    ;; TODO: propagate!
-     )
-   (if (and (get-output-set sp) (get-output-set child-sp))
-    (add-sp-child!* sp child-sp)
-    (do (summaries/connect! sp (sp-ts child-sp)) ;; Be safe; child could have children before we get output.
-        (add-output-watcher! sp
-          (fn [] (add-output-watcher! child-sp
-                   (fn [] (util/assert-is (get-output-set sp) "%s" [sp child-sp])
-;                     (assert (empty? (get-children child-sp)))
-                     (add-sp-child!* sp child-sp)
-                     (summaries/disconnect! sp (sp-ts child-sp))
-                     (schedule-decrease! sp)))))
-        (when up? (schedule-increase! sp)))))
+  (add-output-watcher! c out-f))
+
+
+

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  Constructors  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

@@ -258,7 +269,7 @@
              [summaries/or-summarizable
               (simple-subproblem nm inp-set (sp-ts inner-sp) noeval ri-fn)])]
     (connect-and-watch! ret inner-sp
-      (fn [] (set-output-set! ret (output-wrap (get-output-set! inner-sp))))
+      (fn [o] (set-output-set! ret (output-wrap o)))
       (fn [inner-child] (child-watch ret inner-child)))
     ret))

@@ -307,7 +318,7 @@
            (set-output-set! s out-set)
            (if-let [subsuming-sps (seq (filter #(not (terminal? %)) (subsuming-sps s)))]
              (connect-and-watch! s (apply min-key (comp summaries/get-bound sp-ts) subsuming-sps)
-               (fn ignore-output [] nil)
+               (fn ignore-output [_] nil)
                (fn [sub-out] (add-sp-child! s (refine-input sub-out inp-set) true)))
              (doseq [ref-name (refinement-names fs inp-set)] #_ (println fs ref-name)
                (add-sp-child! s (get-subproblem ref-name inp-set) false)))
@@ -350,7 +361,7 @@
                        (summaries/disconnect! ss (sp-ts @right-sp))
                        (add-child-watcher! left-sp (fn [c] (def *bad* [s c]) (throw (RuntimeException. "Solved and children."))))
                        (connect-and-watch! ss @right-sp
-                         (fn ignore-output [] nil)
+                         (fn ignore-output [_] nil)
                          (fn right-child [right-child] (add-sp-child! s (make-pair-subproblem left-sp right-child) true)))
                        (summaries/summary-changed-local! ss))
            ret (make-simple-subproblem nm (input-set left-sp) ri-fn
@@ -365,9 +376,8 @@
                        (summaries/or-summary s))))]
        (summaries/connect! ret ss)
        (connect-and-watch! ss left-sp
-         (fn left-output []
-           (connect-and-watch-ts! ss @right-sp
-             (fn [] (set-output-set! ret (get-output-set! @right-sp))))
+         (fn left-output [_]
+           (connect-and-watch-ts! ss @right-sp (fn [o] (set-output-set! ret o)))
            (schedule-decrease! ss))
          (fn left-child [left-child]
            (add-sp-child! ret (make-pair-subproblem left-child right-name #(refine-input @right-sp %)) true)))
@@ -410,8 +420,8 @@
    identity
    (fn child-watch [sp child-sp] ;     (println sp child-sp (def *bad* [sp child-sp]))
      (if (=-state-sets (get-output-set! inner-sp) (get-output-set! child-sp))
-       (do (schedule-increase! sp) (connect-and-watch! sp child-sp nil #(child-watch sp %))) ;; TODO: ???
-       (add-sp-child! sp (make-output-collecting-subproblem fs inp-key child-sp) false)))
+       (do (schedule-increase! sp) (connect-and-watch! sp child-sp nil #(child-watch sp %)))
+       (add-sp-child! sp (make-output-collecting-subproblem fs inp-key child-sp) :irrelevant)))
    (fn refine-input [s ni]
      (let [ninp-key (get-input-key fs ni)]
        (if (= inp-key ninp-key)
@@ -445,9 +455,8 @@
 (defn- make-eager-state-abstracted-subproblem [fs inner-sp inp-set]
   (make-wrapped-subproblem
    (sa-name (sp-name inner-sp)) inp-set #{:OC} inner-sp
-   #(do ;      (assert (= (state/current-context %) (fs/precondition-context-set fs inp-set)))
-        (state/transfer-effects inp-set %))
-   (fn [sp child-sp] (add-sp-child! sp (make-eager-state-abstracted-subproblem fs child-sp inp-set) false))
+   #(do (state/transfer-effects inp-set %))
+   (fn [sp child-sp] (add-sp-child! sp (make-eager-state-abstracted-subproblem fs child-sp inp-set) :irrelevant))
    (fn [sp ni] (if (=-state-sets ni inp-set) sp (make-eager-state-abstracted-subproblem fs (refine-input inner-sp ni) ni)))))


Implemented blobstore deletes.

Implemented blobstore deletes.

--- src/appengine_magic/services/blobstore.clj
+++ src/appengine_magic/services/blobstore.clj
@@ -14,13 +14,19 @@
   @*blobstore-service*)

+(defn- make-blob-key [x]
+  (if (instance? BlobKey x)
+      x
+      (BlobKey. x)))
+
+
 (defn upload-url [success-path]
   (.createUploadUrl (get-blobstore-service) success-path))

-(defn delete! [& args]
-  ;; TODO: Implement this.
-  )
+(defn delete! [& blobs]
+  (let [blobs (map make-blob-key blobs)]
+    (.delete (get-blobstore-service) (into-array blobs))))

 (defn fetch-data [^:BlobKey blob-key, start-index, end-index]
@@ -29,12 +35,6 @@

 (defn byte-range [^:HttpServletRequest request]
   (.getByteRange (get-blobstore-service) request))
-
-
-(defn- make-blob-key [x]
-  (if (instance? BlobKey x)
-      x
-      (BlobKey. x)))

 (defn- serve-helper


add support for escape char in $ variables

--- src/keypin/util.clj
+++ src/keypin/util.clj
@@ -127,7 +127,8 @@
   "Variable substitution for EDN. Symbols and keywords starting with '$' (e.g. $foo.bar or :$foo.bar) are looked up and
   substituted by their respective values. Symbol variables are looked up as string keys (e.g. $foo.bar is replaced by
   the value of key \"foo.bar\"), whereas keyword variables are looked up as keyword keys (e.g. :$foo.bar is replaced by
-  the value of key :foo.bar) - missing keys cause IllegalArgumentException to be thrown."
+  the value of key :foo.bar) - missing keys cause IllegalArgumentException to be thrown. You can escape the marker char
+  '$' using '$$' (interpreted as '$') to avoid lookup."
   ([data]
     (clojurize-subst data data))
   ([lookup data]
@@ -142,15 +143,24 @@
                     (throw (IllegalArgumentException. (format "Variable '%s' has no defined value" named)))))
           subst (fn [named] (let [kname (nname named)]
                               (cond
-                                ;; '$' as first character of name implies a variable
-                                (= "$" kname)    (i/expected "valid variable name starting with '$'" named)
-                                (= \$
-                                  (first kname)) (let [kname (subs kname 1)]
-                                                   (cond
-                                                     (symbol?  named) (swapv kname named)
-                                                     (keyword? named) (swapv (keyword kname) named)
-                                                     :otherwise       named))
-                                :otherwise       named)))]
+                                ;; '$' as first character of name implies a variable, '$$' is escaped '$'
+                                (= "$" kname)     (i/expected "valid variable name starting with '$'" named)
+                                (= "$$" kname)    '$  ; escape request for '$'
+                                (= [\$ \$]            ; escape request for entire named entity
+                                  (take 2 kname)) (condp apply [named]
+                                                    symbol?  (symbol (subs kname 1))
+                                                    keyword? (keyword (subs kname 1))
+                                                    named)
+                                (= \$ (first
+                                        kname))   (let [kname (subs kname 1)]
+                                                    (condp apply [named]
+                                                      symbol?  (swapv (if (= \: (first kname))   ; symbol of form $:foo
+                                                                        (keyword (subs kname 1)) ; treat as keyword
+                                                                        kname)
+                                                                 named)
+                                                      keyword? (swapv (keyword kname) named)
+                                                      named))
+                                :otherwise        named)))]
       (cond
         (map?     data) (reduce-kv (fn [m k v] (assoc m
                                                  (clojurize-subst lookup k)


fix docstring typo

fix docstring typo

--- src/keypin/util.clj
+++ src/keypin/util.clj
@@ -210,7 +210,7 @@
 (defn str->vec
   "Given a delimited text, tokenize it and return a vector of tokens. By default, the delimiter is a comma.
   Example:
-  => (str-vec :foo \"a, b, c\")
+  => (str->vec :foo \"a, b, c\")
   [\"a\" \"b\" \"c\"]"
   ([tokenizer the-key text]
     (str->coll tokenizer identity the-key text))


Mistake

Mistake

--- src/korhal/core.clj
+++ src/korhal/core.clj
@@ -61,7 +61,7 @@
   (for [unit (.getMyUnits (:api @this))]
     (when (= (.getTypeID unit) (.getID jnibwapi.types.UnitType$UnitTypes/Zerg_Drone))
       (when (and (.isIdle unit) (not (= (.getID unit) (:pool-drone @this))))
-        (let [mineral? (fn [unit] (= (.getTypeID unit) (.getID jnibwapi.types.UnitType$UnitTypes/Mineral_Field)))
+        (let [mineral? (fn [unit] (= (.getTypeID unit) (.getID jnibwapi.types.UnitType$UnitTypes/Resource_Mineral_Field)))
               mineral (first (filter mineral? (.getNeutralUnits (:api @this))))]
         (.rightClick (.getID unit) (.getID mineral)))))))


Remove spec validation from config.

Remove spec validation from config.

--- src/uxbox/config.clj
+++ src/uxbox/config.clj
@@ -20,18 +20,11 @@
   []
   (let [builtin (io/resource *default-config-path*)
         local (io/resource *local-config-path*)
-        external (io/file (:uxbox-config env))
-        config (deep-merge (edn/read-string (slurp builtin))
-                           (when local (edn/read-string (slurp local)))
-                           (when (and external (.exists external))
-                             (edn/read-string (slurp external))))]
-    (if (s/valid? ::config config)
-      config
-      (let [message (s/explain-str ::config config)]
-        ;; (println message)
-        (ex/raise :type :unexpected
-                  :code ::invalid
-                  :message message)))))
+        external (io/file (:uxbox-config env))]
+    (deep-merge (edn/read-string (slurp builtin))
+                (when local (edn/read-string (slurp local)))
+                (when (and external (.exists external))
+                  (edn/read-string (slurp external))))))

 (defn read-test-config
   []


More small fix goliat

More small fix goliat

--- src/clj_simple_chart/ncs/goliatdiagram.clj
+++ src/clj_simple_chart/ncs/goliatdiagram.clj
@@ -7,7 +7,7 @@

 (def data goliat/top-ten-plus-goliat)

-(def domain (map :fldName data))
+(def domain (mapv :fldName data))

 (def marg 15)

@@ -16,7 +16,7 @@
              :left   (Math/round (+ marg 6 (axis/domain-max-width domain)))
              :right  (Math/round (+ marg (/ (axis/domain-max-width ["4000"]) 2)))})

-(def width (Math/round (double (- (/ 1024 2) (:left margin) (:right margin)))))
+(def width (Math/round (double (- 512 (:left margin) (:right margin)))))
 (def height (Math/round (double (- 400 (:top margin) (:bottom margin)))))

 (def x (scale {:type        :linear


Fix admintool in gallery/badge_view

Fix admintool in gallery/badge_view

--- src/cljs/salava/gallery/ui/badge_view.cljs
+++ src/cljs/salava/gallery/ui/badge_view.cljs
@@ -7,6 +7,7 @@
             [salava.gallery.ui.badge-content :refer [badge-content]]
             [salava.core.ui.share :refer [share-buttons]]
             [salava.admin.ui.admintool :refer [admintool]]
+            [reagent-modals.modals :as m]
             ;[salava.admin.ui.reporttool :refer [reporttool]]
             [salava.core.i18n :refer [t]]))

@@ -14,6 +15,7 @@
   (let [{content :content badge-content-id :badge-content-id} @state
         {{name :name} :badge} content]
     [:div {:id "badge-gallery-view"}
+     [m/modal-window]
      [:div.panel
       [:div.panel-body
        (admintool badge-content-id "badges")


Adapt catacumba sessions to ratpack promise changes.

--- src/clojure/catacumba/handlers/session.clj
+++ src/clojure/catacumba/handlers/session.clj
@@ -29,7 +29,7 @@
             [buddy.core.nonce :as nonce]
             [buddy.core.codecs :as codecs]
             [catacumba.impl.atomic :as atomic]
-            [catacumba.impl.helpers :as helpers]
+            [catacumba.impl.helpers :as ch]
             [catacumba.impl.handlers :as handlers]
             [catacumba.impl.context :as context])
   (:import clojure.lang.IAtom
@@ -37,7 +37,7 @@
            clojure.lang.Counted
            clojure.lang.IFn
            clojure.lang.ISeq
-           ratpack.exec.Fulfiller
+           ratpack.exec.Downstream
            ratpack.exec.Promise
            ratpack.handling.Context
            ratpack.http.ResponseMetaData))
@@ -176,14 +176,12 @@
         cookies (handlers/get-cookies context)
         cookie (get cookies (keyword cookie-name) nil)
         sid (:value cookie)]
-    (.promise ctx (helpers/action
-                   (fn [^Fulfiller ff]
-                     (if sid
-                       (let [data (read-session storage sid)]
-                         (p/then (read-session storage sid)
-                                 #(.success ff [sid (->session sid %)])))
-                       (let [sid (codecs/bytes->safebase64 (nonce/random-nonce 48))]
-                         (.success ff [sid (->session sid)]))))))))
+    (ch/async resolve
+      (if sid
+        (-> (read-session storage sid)
+            (p/then #(resolve [sid (->session sid %)])))
+        (let [sid (codecs/bytes->safebase64 (nonce/random-nonce 48))]
+          (resolve [sid (->session sid)]))))))

 (defn session
   "A session chain handler constructor."
@@ -194,18 +192,17 @@
    (let [storage (lookup-storage storage)
          options (assoc options :storage storage)]
      (fn [context]
-       (let [^Promise prom (context->session context options)]
-         (.then prom (helpers/action
-                      (fn [[sid session]]
-                        (context/before-send context (fn [^ResponseMetaData response]
-                                                       (cond
-                                                         (empty? session)
-                                                         (let [cookie (-> (make-cookie sid options)
-                                                                          (assoc :max-age 0))]
-                                                           (handlers/set-cookies! context {cookie-name cookie}))
-
-                                                         (modified? session)
-                                                         (let [cookie (make-cookie sid options)]
-                                                           (write-session storage sid @session)
-                                                           (handlers/set-cookies! context {cookie-name cookie})))))
-                        (context/delegate context {:session session})))))))))
+       (-> (context->session context options)
+           (p/then (fn [[sid session]]
+                     (context/before-send context (fn [^ResponseMetaData response]
+                                                    (cond
+                                                      (empty? session)
+                                                      (let [cookie (-> (make-cookie sid options)
+                                                                         (assoc :max-age 0))]
+                                                        (handlers/set-cookies! context {cookie-name cookie}))
+
+                                                      (modified? session)
+                                                      (let [cookie (make-cookie sid options)]
+                                                        (write-session storage sid @session)
+                                                        (handlers/set-cookies! context {cookie-name cookie})))))
+                     (context/delegate context {:session session}))))))))


Support process-request on gql network

Support process-request on gql network

--- src/com/wsscode/pathom/fulcro/network.cljs
+++ src/com/wsscode/pathom/fulcro/network.cljs
@@ -98,12 +98,14 @@
                          [k (:result v)]
                          [k v]))))))

-(defn query [{::keys [url q] :as input}]
+(defn query [{::keys [url q gql-process-request] :as input}]
   (go-catch
-    (let [[res text] (-> (http #::{:url     url
-                                   :method  "post"
-                                   :headers {"content-type" "application/json"}
-                                   :body    (js/JSON.stringify #js {:query (gql/query->graphql q {::gql/js-name js-name})})})
+    (let [req (cond-> #::{:url     url
+                          :method  "post"
+                          :headers {"content-type" "application/json"}
+                          :body    (js/JSON.stringify #js {:query (gql/query->graphql q {::gql/js-name js-name})})}
+                gql-process-request (gql-process-request))
+          [res text] (-> (http req)
                          <?)]
       (if (gobj/get res "error")
         (throw (ex-info (gobj/get res "error") {:query q}))
@@ -121,12 +123,13 @@
     c))

 (defn gql-network-query [{::keys [url q
+                                  gql-process-request
                                   gql-process-query
                                   gql-process-env]
                           :or    {gql-process-query identity
                                   gql-process-env   identity}}]
   (go-catch
-    (let [json   (-> (query #::{:url url :q (gql-process-query q)}) <? ::response-data)
+    (let [json   (-> (query #::{:url url :q (gql-process-query q) :gql-process-request gql-process-request}) <? ::response-data)
           errors (gobj/get json "errors")
           data   (gobj/get json "data")]
       (-> (gql-process-env {::p/entity       data


Fixed a bug in substitute

Fixed a bug in substitute

which has to unpack a dl-expression, if one is given.

These are too many bugs in here...

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

--- src/conexp/contrib/dl/framework/syntax.clj
+++ src/conexp/contrib/dl/framework/syntax.clj
@@ -242,7 +242,10 @@
   "Substitues in sexp-1 every occurence of a key in names by its value."
   [sexp-1 names]
   (cond
-   (some #{sexp-1} (keys names)) (names sexp-1),
+   (some #{sexp-1} (keys names)) (let [new (names sexp-1)]
+				   (if (dl-expression? new)
+				     (expression new)
+				     new)),
    (sequential? sexp-1) (walk #(substitute-syntax % names) identity sexp-1),
    :else sexp-1))


Fix missing chars in zprint-file-str.

Fix missing chars in zprint-file-str.

--- src/zprint/core.cljc
+++ src/zprint/core.cljc
@@ -1480,7 +1480,7 @@
              [out-str error-vec] (process-multiple-forms pmf-options
                                              zprint-str-internal
                                              zprint-specifier
-
+                                             forms)
              _ (dbg-pr new-options "zprint-file-str: out-str:" out-str)
 	     error-vec (when (not (empty? error-vec)) error-vec)
 	     ; Get rid of any added comment-api lines on the front of


restore logic to reduce the number of prices imported

--- src/clj/clj_money/import/gnucash.clj
+++ src/clj/clj_money/import/gnucash.clj
@@ -295,21 +295,41 @@
         (update-in [:child-content] push-child-content child-content))))

 (defn- dispatch-record-type
-  [record]
+  [record & _]
   (-> record meta :record-type))

 (defmulti ^:private emit-record? dispatch-record-type)

 (defmethod ^:private emit-record? :default
-  [_]
+  [& _]
   true)

 (defmethod ^:private emit-record? :declaration
-  [record]
+  [record _]
   (not= :book (:record-type record)))

-(def ^:private filter-records
-  (filter emit-record?))
+(defmethod ^:private emit-record? :price
+  [record filter-state]
+  (let [trade-date (-> record :time :date parse-date)
+        trade-date-key ((juxt :space :id) (:commodity record))
+        last-trade-date (get-in @filter-state
+                                [:trade-dates trade-date-key]
+                                (t/local-date 1900 1 1))
+        cut-off (t/plus last-trade-date (t/months 1))]
+    (when (t/after? trade-date cut-off)
+      (swap! filter-state #(assoc-in % [:trade-dates trade-date-key] trade-date))
+      true)))
+
+(defn- filter-records
+  [xf]
+  (let [state (atom {})]
+    (fn
+      ([] (xf))
+      ([acc] (xf acc))
+      ([acc record]
+       (if (emit-record? record state)
+         (xf acc record)
+         acc)))))

 (defmulti ^:private process-record dispatch-record-type)

@@ -567,26 +587,6 @@
      :file-name file-name
      :output-folder output-folder}))

-(defmulti ^:private keep-record?
-  (fn [record _]
-    (-> record meta :record-type)))
-
-(defmethod ^:private keep-record? :default
-  [_ _]
-  true)
-
-(defmethod ^:private keep-record? :price
-  [{:keys [trade-date] :as record} filter-state]
-  (let [key-fn (juxt :exchange :symbol)
-        trade-date-key (key-fn record)
-        last-trade-date (get-in @filter-state
-                                [:trade-dates trade-date-key]
-                                (t/local-date 1900 1 1))
-        cut-off (t/plus last-trade-date (t/months 1))]
-    (when (< 0 (compare trade-date cut-off))
-      (swap! filter-state #(assoc-in % [:trade-dates trade-date-key] trade-date))
-      true)))
-
 (defn- evaluate-output
   "Evaluates the output for the chunking process
   and writes the file and resets the record buffer if the


Nil-guard prep-for-syntaxhighlighter

Nil-guard prep-for-syntaxhighlighter

--- src/clj/clojuredocs/pages/common.clj
+++ src/clj/clojuredocs/pages/common.clj
@@ -308,10 +308,11 @@
       nil)))

 (defn prep-for-syntaxhighligher [s]
-  (-> s
-      (str/replace #"
" "
")
-      (str/replace #"
" "
")
-      (str/replace #"
" "
")))
+  (when s
+    (-> s
+        (str/replace #"
" "
")
+        (str/replace #"
" "
")
+        (str/replace #"
" "
"))))

 (when config/cache-markdown?
   (def memo-markdown-file (memoize memo-markdown-file)))


Reformatted format_datetime.clj by zprint

--- src/clj_calendar/format_datetime.clj
+++ src/clj_calendar/format_datetime.clj
@@ -11,65 +11,63 @@
 ;

 (ns clj-calendar.format-datetime
-    "Namespace that contains various functions for handling calendar and dates.")
+  "Namespace that contains various functions for handling calendar and dates.")

 (defn one?
-    "Predicate that is especially useful in this namespace."
-    [n]
-    (== n 1))
+  "Predicate that is especially useful in this namespace."
+  [n]
+  (== n 1))

 (defn format-time
-    "Format a given time unit into human readable format."
-    [amount unit]
-    (format "%d %s ago" amount unit))
+  "Format a given time unit into human readable format."
+  [amount unit]
+  (format "%d %s ago" amount unit))

 (defn format-time-
-    "Format time into human readable format."
-    [amount1 amount2 unit1 unit2]
-    (if (one? amount1)
-        (cond
-            (zero? amount2) (format "one %s ago" unit1)
+  "Format time into human readable format."
+  [amount1 amount2 unit1 unit2]
+  (if (one? amount1)
+      (cond (zero? amount2) (format "one %s ago" unit1)
             (one? amount2)  (format "one %s and one %s ago" unit1 unit2)
             :else           (format "one %s and %d %ss ago" unit1 amount2 unit2))
-        (cond
-            (zero? amount2) (format "%d %ss ago" amount1 unit1)
+      (cond (zero? amount2) (format "%d %ss ago" amount1 unit1)
             (one? amount2)  (format "%d %ss and one %s ago" amount1 unit1 unit2)
             :else           (format "%d %ss and %d %ss ago" amount1 unit1 amount2 unit2))))

 (defn format-day
-    "Format days/hours in case the given build is younger than one month."
-    [days hours]
-    (format-time- days hours "day" "hour"))
+  "Format days/hours in case the given build is younger than one month."
+  [days hours]
+  (format-time- days hours "day" "hour"))

 (defn format-hours
-    "Format hours/minutes in case the given build is younger than one day."
-    [hours minutes]
-    (format-time- hours minutes "hour" "minute"))
+  "Format hours/minutes in case the given build is younger than one day."
+  [hours minutes]
+  (format-time- hours minutes "hour" "minute"))

 (defn format-minutes
-    "Format minutes/seconds in case the given build is younger than one hour"
-    [minutes seconds]
-    (format-time- minutes seconds "minute" "second"))
+  "Format minutes/seconds in case the given build is younger than one hour"
+  [minutes seconds]
+  (format-time- minutes seconds "minute" "second"))

 (defn format-seconds
-    "Format seconds into human readable format."
-    [seconds]
-    (if (one? seconds)
-        (format "one second ago")
-        (format "%d seconds ago" seconds)))
+  "Format seconds into human readable format."
+  [seconds]
+  (if (one? seconds)
+    (format "one second ago")
+    (format "%d seconds ago" seconds)))

 (defn format-one-month
-    "Format month into human readable format."
-    [days]
-    (cond (zero? days) "one month ago"
-          (>  days 1)  (format "one month and %d days ago" days)
-          :else        (format "one month and one day ago")))
+  "Format month into human readable format."
+  [days]
+  (cond (zero? days) "one month ago"
+        (> days 1) (format "one month and %d days ago" days)
+        :else      (format "one month and one day ago")))

 (defn format-month
-    "Format month into human readable format."
-    [months days]
-    (cond (zero? months) (format-day days 0)
-          (> months 1)   (format "%d months ago" months)
-          :else          (format-one-month days)))
+  "Format month into human readable format."
+  [months days]
+  (cond (zero? months) (format-day days 0)
+        (> months 1) (format "%d months ago" months)
+        :else        (format-one-month days)))


[CODESTYLE] Place closing '}' on last line of hash contents

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -372,8 +372,7 @@
    "SECTIONAL TEACHING"         "ST",
    "TUTORIAL"                   "T",
    "TUTORIAL TYPE 2"            "T2",
-   "TUTORIAL TYPE 3"            "T3"
-   })
+   "TUTORIAL TYPE 3"            "T3"})

 (def ^{:doc     "Converts a long form lesson type to a nicer looking string"
        :private true}


[REFACTOR] Remove redundant `(not (nil?))` test

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -679,7 +679,7 @@
                          (>= startTime timeIdx))
                     ttLessonInfo

-                    (and (not (nil? selectedTTLessonInfo))
+                    (and selectedTTLessonInfo
                          (>= startTime timeIdx)
                          (< startTime (:startTime selectedTTLessonInfo)))
                     ttLessonInfo


Make rendering faster

Make rendering faster

--- src/cljs/robinson/webglterminal.cljs
+++ src/cljs/robinson/webglterminal.cljs
@@ -134,7 +134,7 @@
       (clj->js {:width width
                 :height height}))
     (-> ctx
-      (canvas/fill-style "#191d21")
+      (canvas/fill-style "#000000")
       (canvas/fill-rect {:x 0 :y 0 :w 600 :h 600}))
     (doseq [line character-layout]
       (doseq [[c x y] line]
@@ -239,48 +239,38 @@
                                               2))))
           vertex-position-attribute (shaders/get-attrib-location gl shader-prog "aVertexPosition")
           texture-coord-attribute   (shaders/get-attrib-location gl shader-prog "aTextureCoord")
-
+          uMVMatrix                 (.getUniformLocation gl shader-prog, "uMVMatrix")
+          last-uvs-buffer           (atom nil)
+          last-fg-color             (atom nil)
+          last-bg-color             (atom nil)
           ;; Draws character c at position [x y] on the terminal canvas using gl.
           draw-character   (fn [c x y]
-                             (let [uvs        (character->uvs (get c :character))
-                                   uvs-buffer (square-texture-buffer-fn uvs)]
-                             ;(log/info "character->pos" (str character->pos))
-                             ;(log/info "Drawing character" (str c) "uvs" (str uvs))
-                             (.bindBuffer gl buffer-object/array-buffer, uvs-buffer)
-                             (.enableVertexAttribArray gl 1)
-                             (.vertexAttribPointer gl 1, 2, data-type/float, false, 0, 0)
-                             (.uniformMatrix4fv gl (.getUniformLocation gl shader-prog, "uMVMatrix"), nil, (get-position-matrix [x y -1.0]))
-                             (.drawArrays gl draw-mode/triangle-strip, 0, 4)
-
-                             #_(buffers/draw!
-                               gl
-                               :shader shader-prog
-                               :draw-mode draw-mode/triangle-strip
-                               :count (.-numItems square-vertex-buffer)
-                               :attributes [{:buffer square-vertex-buffer :location vertex-position-attribute}
-                                            {:buffer (square-texture-buffer-fn uvs) :location texture-coord-attribute}]
-                               :uniforms [{:name "uPMatrix" :type :mat4 :values (get-ortho-matrix gl)}
-                                          {:name "uMVMatrix" :type :mat4 :values (get-position-matrix [x y -1.0])}]
-                               :textures [{:name "uSampler" :texture characters-texture}]))
-                             #_(let [glyph-image                       (.createImage component char-width char-height)
-                                   offscreen-graphics-2d ^Graphics2D (.getGraphics glyph-image)
-                                   x                                 0
-                                   y                                 (long (- char-height (.getDescent font-metrics)))
-                                   fg-color                          (if highlight
-                                                                       (get c :bg-color)
-                                                                       (get c :fg-color))
-                                   bg-color                          (if  highlight
-                                                                       (get c :fg-color)
-                                                                       (get c :bg-color))
-                                   s                                 (str (get c :character))
-                                   style                             (get c :style)]
+                             (let [highlight (= [x y] @cursor-xy)
+                                   fg-color  (if highlight
+                                               (get c :bg-color)
+                                               (get c :fg-color))
+                                   bg-color  (if  highlight
+                                               (get c :fg-color)
+                                               (get c :bg-color))
+                                   s         (str (get c :character))
+                                   style     (get c :style)]
                                ;(println "filling rect" (* col char-width) (* row char-height) char-width char-height bg-color)
-                               (when (not= s " ")
+                               (when-not (and (= s " " )
+                                              (= bg-color default-bg-color))
                                  ;(println "drawing" s "@" x y fg-color bg-color)
-                                 (doto offscreen-graphics-2d
-                                   (.setColor fg-color)
-                                   (.drawString s x y)))
-                               (when (contains? style :underline)
+                                 ;(.setColor fg-color)
+                                 (let [uvs        (character->uvs (get c :character))
+                                       uvs-buffer (square-texture-buffer-fn uvs)]
+                                 ;(log/info "character->pos" (str character->pos))
+                                 ;(log/info "Drawing character" (str c) "uvs" (str uvs))
+                                   (when (not= @last-uvs-buffer uvs-buffer)
+                                     (reset! last-uvs-buffer uvs-buffer)
+                                     (.bindBuffer gl buffer-object/array-buffer, uvs-buffer)
+                                     (.vertexAttribPointer gl 1, 2, data-type/float, false, 0, 0))
+                                   (.uniformMatrix4fv gl uMVMatrix, nil, (get-position-matrix [x y -1.0]))
+                                   (.drawArrays gl draw-mode/triangle-strip, 0, 4)))
+
+                               #_(when (contains? style :underline)
                                  (let [y (dec  char-height)]
                                    (doto offscreen-graphics-2d
                                      (.setColor fg-color)
@@ -349,6 +339,7 @@
                   _        (.bindBuffer gl buffer-object/array-buffer, square-vertex-buffer)
                   _        (.enableVertexAttribArray gl 0)
                   _        (.vertexAttribPointer gl 0, 3, data-type/float, false, 0, 0)
+                  _        (.enableVertexAttribArray gl 1)

                   _        (.activeTexture gl texture-unit/texture0)
                   _        (.bindTexture gl texture-target/texture-2d characters-texture)