timelines only catch UnityEngine.MissingReferenceException, tween.core/abort! throws this to silently stop tweens

--- core.clj
+++ core.clj
@@ -1,7 +1,7 @@
 (ns tween.core
   (:import
     [UnityEngine Application MonoBehaviour WaitForSeconds Time Mathf
-     GameObject Color Vector4 Vector3 Vector2 Quaternion]
+     GameObject Color Vector4 Vector3 Vector2 Quaternion Debug]
     [System Object]
     [System.Collections IEnumerator]
     Wait MonoObj TimeLine
@@ -13,6 +13,8 @@
 (defonce THIS 'THYSELF)
 (defonce REGISTRY (atom {}))
 (def panic false)
+
+(def abort! #(throw (UnityEngine.MissingReferenceException. "tween.core/abort!")))

 (def ^System.Single -single (float 0.0))
 (def ^System.Int32  -short  (int 0))
@@ -81,7 +83,6 @@
 (defmacro WAIT [n] `(~'WaitForSeconds. ~n))

-
 (deftype TimeLineCursor [
   ^:volatile-mutable ^System.Int32    i
   ^:volatile-mutable ^boolean         v])
@@ -96,14 +97,13 @@
       (.StartCoroutine coro-root
         (reify IEnumerator
           (MoveNext [this]
-            (when-not panic
-              (try
-                (set! (.v cursor) (.invoke @current))
-                (if (.v cursor) TRUE
-                  (if (do (vreset! current (first @fns) )
-                          (vswap! fns rest) @current)
-                    TRUE FALSE))
-                (catch Exception e false))))
+            (try
+              (set! (.v cursor) (.invoke @current))
+              (if (.v cursor) TRUE
+                (if (do (vreset! current (first @fns) )
+                        (vswap! fns rest) @current)
+                  TRUE FALSE))
+              (catch UnityEngine.MissingReferenceException e false)))
           (get_Current [this] (.v cursor))))]
       (fn [] (if @current routine false)))))

@@ -131,7 +131,7 @@
                     (do (set! (.i cursor) (inc (.i cursor)))
                         (vreset! current ((aget fns (.i cursor))))
                         @current)))
-              (catch Exception e FALSE)))
+              (catch UnityEngine.MissingReferenceException e)))
           (get_Current [this] (.v cursor))))]
       (fn [] (if (.v cursor) routine FALSE)))))

@@ -324,12 +324,6 @@
    :get (.range this)
    :tag System.Single})

-(deftween [:velocity] [this]
-  {:get  (.velocity this)
-   :base (.GetComponent this UnityEngine.Rigidbody)
-   :base-tag UnityEngine.Rigidbody
-   :tag UnityEngine.Vector3})
-
 (comment
 (defn spit-pair [n t]
   (spit (str "Assets/tween/pairs/" n ".cs") (str


Restructuring icon-generating code

Restructuring icon-generating code

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

--- src/conexp/contrib/gui/editors/context_editor/context_editor.clj
+++ src/conexp/contrib/gui/editors/context_editor/context_editor.clj
@@ -127,7 +127,103 @@

 ;;; Creating context editor widgets

-(let [second-operand (atom nil)]
+(let [second-operand (atom nil)
+      icons   [["copy.png" "C"
+                "Copy the selected cells to clipboard",
+                #(copy-to-clipboard (get-table %)) :no-return]
+               ["cut.png" "X",
+                "Cut the selected cells to clipboard",
+                #(cut-to-clipboard (get-table %)) :no-return]
+               ["paste.png" "P",
+                "Paste the clipboard to the selected cell and its down-right neighbors",
+                #(paste-from-clipboard (get-table %)) :no-return]
+               ["second-op.png" "M+",
+                "Use a copy of this context as second operand",
+                #(reset! second-operand (get-context (get-ectx %))) :no-return]
+               ["add-attribute.png" "+A",
+                "Adds a new attribute column to the context",
+                add-new-attribute]
+               ["add-object.png" "+O",
+                "Adds a new object row to the context",
+                add-new-object]
+               :separator
+               ["keep-attribute.png" "8<A",
+                "Remove all non-selected attribute columns from the context",
+                keep-attributes]
+               ["keep-object.png" "8<O",
+                "Remove all non-selected object rows from the context",
+                keep-objects]
+               ["keep-both.png" "8<OA",
+                "Remove all non-selected rows and columns from the context",
+                keep-objects-attributes]
+               :separator
+               ["cut-attribute.png" "-A",
+                "Remove all selected attribute columns from the context",
+                cut-attributes]
+               ["cut-object.png" "-O",
+                "Remove all selected object rows from the context",
+                cut-objects]
+               ["cut-both.png" "-OA",
+                "Remove all selected rows and columns from the context",
+                cut-objects-attributes]
+               ["clarify-attribute.png" "cA",
+                "Clarify the attribute columns of the context",
+                (cc-1 clarify-attributes)]
+               ["clarify-object.png" "cO",
+                "Clarify the object rows of the context",
+                (cc-1 clarify-objects)]
+               ["clarify-both.png" "cOA",
+                "Clarify both objects and attributes of the context",
+                (cc-1 clarify-context)]
+               :separator
+               ["reduce-attribute.png" "rA",
+                "Reduce the attribute columns of the context",
+                (cc-1 reduce-attributes)]
+               ["reduce-object.png" "rO",
+                "Reduce the object rows of the context",
+                (cc-1 reduce-objects)]
+               ["reduce-both.png" "rOA",
+                "Reduce both objects and attributes of the context",
+                (cc-1 reduce-context)]
+               ["transitive-closure.png" "trans",
+                "Apply transitive closure to the context",
+                (cc-1 context-transitive-closure)]
+               :separator
+               ["dual-context.png" "dual",
+                "Flip objects and attributes",
+                (cc-1 dual-context)]
+               ["inverse-context.png" "inv",
+                "Flip all crosses",
+                (cc-1 invert-context)]
+               ["sum.png" "sum",
+                "Calculate the context sum of this context with the second operand context"
+                (cc-2 context-sum)]
+               ["product.png" "prod",
+                "Calculate the context product of this context with the second operand context"
+                (cc-2 context-product)]
+               ["semi-product.png" "semi",
+                "Calculate the context semiproduct of this context with the second operand context"
+                (cc-2 context-semiproduct)]
+               ["xia-product.png" "Xia",
+                "Calculate the context Xia product of this context with the second operand context"
+                (cc-2 context-xia-product)]
+               :separator
+               ["union.png" "union",
+                "Calculate the context union of this context with the second operand context"
+                (cc-2 context-union)]
+               ["intersection.png" "inter",
+                "Calculate the context intersection of this context with the second operand context"
+                (cc-2 context-intersection)]
+               :separator
+               ["composition.png" "comp",
+                "Calculate the context composition of this context with the second operand context"
+                (cc-2 context-composition)]
+               ["apposition.png" "ap",
+                "Calculate the context apposition of this context with the second operand context"
+                (cc-2 context-apposition)]
+               ["subposition.png" "sub",
+                "Calculate the context subposition of this context with the second operand context"
+                (cc-2 context-subposition)]]]

   (defn get-current-second-operand-context
     "Returns the current second operand."
@@ -138,138 +234,37 @@
     "Creates a control for editing contexts, starting with the initial
     context ctx."
     [ctx]
-    (let [table   (doto (make-table-control)
-                    (set-row-count 1)
-                    (set-column-count 1)),
-          ectx    (ref (make-editable-context ctx)),
-          toolbar (make-toolbar-control :horiz)
-          root    (top-bottom-split (get-widget toolbar)
-                                    (get-widget table)
-                                    :divider-location 86)
-          e-ctx   @ectx,
-          widget  (context-editor-widget. root table ectx),
-          keystroke-fill  (KeyStroke/getKeyStroke KeyEvent/VK_SPACE
-                                                  ActionEvent/CTRL_MASK false),
-
-          add-button-box (fn [toolbar & buttonlist]
-                           (let [box (Box/createHorizontalBox)]
-                             (doseq [button buttonlist]
-                               (if (contains? button :spacer)
-                                 (.add box (Box/createHorizontalStrut (:spacer button)))
-                                 (let [bctrl (make-tooltip-button (:tip button) (:name button))
-                                       handler #(do
-                                                  (if (contains? button :no-return)
-                                                    ((:no-return button) widget))
-                                                  (if (contains? button :f)
-                                                    (set-context @ectx ((:f button) widget))))]
-                                   (set-handler bctrl handler)
-                                   ;;(add-button toolbar bctrl)))
-                                   (.add box ^JComponent (get-widget bctrl)))))
-                             (.add ^JComponent (get-control toolbar) box)))]
+    (let [table          (doto (make-table-control)
+                           (set-row-count 1)
+                           (set-column-count 1)),
+          ectx           (ref (make-editable-context ctx)),
+          bar            (toolbar :orientation :horizontal
+                                  :floatable? false)
+          root           (top-bottom-split bar
+                                           (get-widget table)
+                                           :divider-location 43)
+          e-ctx          @ectx,
+          widget         (context-editor-widget. root table ectx),
+          keystroke-fill (KeyStroke/getKeyStroke KeyEvent/VK_SPACE
+                                                 ActionEvent/CTRL_MASK false),
+
+          add-button     (fn [toolbar button]
+                           (if (= button :separator)
+                             (.add toolbar (Box/createHorizontalStrut 3))
+                             (let [[path alt tip fun no-return] button
+                                   bctrl (make-tooltip-button
+                                          tip
+                                          (get-image-icon-or-string (str "context-editor/"
+                                                                         path)
+                                                                    alt))
+                                   handler #(if no-return
+                                              (fun widget)
+                                              (set-context @ectx (fun widget)))]
+                               (set-handler bctrl handler)
+                               (.add toolbar ^JComponent (get-widget bctrl)))))]
       (register-keyboard-action table fill-selection-with-X "Fill-X" keystroke-fill :focus)
-      (add-widget e-ctx widget)
-      (doto toolbar
-        (set-floatable false)
-        (add-button-box  { :name (get-image-icon-or-string "context-editor/copy.png" "C"),
-                          :tip  "Copy the selected cells to clipboard",
-                          :no-return #(copy-to-clipboard (get-table %)) }
-                         { :name (get-image-icon-or-string "context-editor/cut.png" "X"),
-                          :tip  "Cut the selected cells to clipboard",
-                          :no-return #(cut-to-clipboard (get-table %)) }
-                         { :name (get-image-icon-or-string "context-editor/paste.png" "P"),
-                          :tip  "Paste the clipboard to the selected cell and its down-right neighbors",
-                          :no-return #(paste-from-clipboard (get-table %)) }
-                         { :name (get-image-icon-or-string "context-editor/second-op.png" "M+"),
-                          :tip  "Use a copy of this context as second operand",
-                          :no-return #(reset! second-operand (get-context (get-ectx %))) }
-                         )
-        (add-button-box {:name (get-image-icon-or-string "context-editor/add-attribute.png" "+A"),
-                         :tip "Adds a new attribute column to the context",
-                         :f add-new-attribute}
-                        {:name (get-image-icon-or-string "context-editor/add-object.png" "+O"),
-                         :tip "Adds a new object row to the context",
-                         :f add-new-object}
-                        {:spacer 3}
-                        {:name (get-image-icon-or-string "context-editor/keep-attribute.png" "8<A"),
-                         :tip "Remove all non-selected attribute columns from the context",
-                         :f keep-attributes}
-                        {:name (get-image-icon-or-string "context-editor/keep-object.png" "8<O"),
-                         :tip "Remove all non-selected object rows from the context",
-                         :f keep-objects}
-                        {:name (get-image-icon-or-string "context-editor/keep-both.png" "8<OA"),
-                         :tip "Remove all non-selected rows and columns from the context",
-                         :f keep-objects-attributes}
-                        {:spacer 3}
-                        {:name (get-image-icon-or-string "context-editor/cut-attribute.png" "-A"),
-                         :tip "Remove all selected attribute columns from the context",
-                         :f cut-attributes}
-                        {:name (get-image-icon-or-string "context-editor/cut-object.png" "-O"),
-                         :tip "Remove all selected object rows from the context",
-                         :f cut-objects}
-                        {:name (get-image-icon-or-string "context-editor/cut-both.png" "-OA"),
-                         :tip "Remove all selected rows and columns from the context",
-                         :f cut-objects-attributes})
-        (add-button-box {:name (get-image-icon-or-string "context-editor/clarify-attribute.png"
-                                                         "cA"),
-                         :tip "Clarify the attribute columns of the context",
-                         :f (cc-1 clarify-attributes)}
-                        {:name (get-image-icon-or-string "context-editor/clarify-object.png" "cO"),
-                         :tip "Clarify the object rows of the context",
-                         :f (cc-1 clarify-objects)}
-                        {:name (get-image-icon-or-string "context-editor/clarify-both.png" "cOA"),
-                         :tip "Clarify both objects and attributes of the context",
-                         :f (cc-1 clarify-context)}
-                        {:spacer 3}
-                        {:name (get-image-icon-or-string "context-editor/reduce-attribute.png"
-                                                         "rA"),
-                         :tip "Reduce the attribute columns of the context",
-                         :f (cc-1 reduce-attributes)}
-                        {:name (get-image-icon-or-string "context-editor/reduce-object.png" "rO"),
-                         :tip "Reduce the object rows of the context",
-                         :f (cc-1 reduce-objects)}
-                        {:name (get-image-icon-or-string "context-editor/reduce-both.png" "rOA"),
-                         :tip "Reduce both objects and attributes of the context",
-                         :f (cc-1 reduce-context)})
-        (add-button-box {:name (get-image-icon-or-string "context-editor/transitive-closure.png"
-                                                         "trans"),
-                         :tip "Apply transitive closure to the context",
-                         :f (cc-1 context-transitive-closure)}
-                        {:spacer 3}
-                        {:name (get-image-icon-or-string "context-editor/dual-context.png" "dual"),
-                         :tip "Flip objects and attributes",
-                         :f (cc-1 dual-context)}
-                        {:name (get-image-icon-or-string "context-editor/inverse-context.png" "inv"),
-                         :tip "Flip all crosses",
-                         :f (cc-1 invert-context)})
-        (add-button-box {:name (get-image-icon-or-string "context-editor/sum.png" "sum"),
-                         :tip "Calculate the context sum of this context with the second operand context"
-                         :f (cc-2 context-sum)}
-                        {:name (get-image-icon-or-string "context-editor/product.png" "prod"),
-                         :tip "Calculate the context product of this context with the second operand context"
-                         :f (cc-2 context-product)}
-                        {:name (get-image-icon-or-string "context-editor/semi-product.png" "semi"),
-                         :tip "Calculate the context semiproduct of this context with the second operand context"
-                         :f (cc-2 context-semiproduct)}
-                        {:name (get-image-icon-or-string "context-editor/xia-product.png" "Xia"),
-                         :tip "Calculate the context Xia product of this context with the second operand context"
-                         :f (cc-2 context-xia-product)}
-                        {:spacer 3}
-                        {:name (get-image-icon-or-string "context-editor/union.png" "union"),
-                         :tip "Calculate the context union of this context with the second operand context"
-                         :f (cc-2 context-union)}
-                        {:name (get-image-icon-or-string "context-editor/intersection.png" "inter"),
-                         :tip "Calculate the context intersection of this context with the second operand context"
-                         :f (cc-2 context-intersection)}
-                        {:spacer 3}
-                        {:name (get-image-icon-or-string "context-editor/composition.png" "comp"),
-                         :tip "Calculate the context composition of this context with the second operand context"
-                         :f (cc-2 context-composition)}
-                        {:name (get-image-icon-or-string "context-editor/apposition.png" "ap"),
-                         :tip "Calculate the context apposition of this context with the second operand context"
-                         :f (cc-2 context-apposition)}
-                        {:name (get-image-icon-or-string "context-editor/subposition.png" "sub"),
-                         :tip "Calculate the context subposition of this context with the second operand context"
-                         :f (cc-2 context-subposition)}))
+      (doseq [icon icons]
+        (add-button bar icon))
       widget))

   nil)


add -destroy to reload_filter

add -destroy to reload_filter

--- migae-test/src/migae_test/reload_filter.clj
+++ migae-test/src/migae_test/reload_filter.clj
@@ -5,6 +5,7 @@
   (:gen-class :implements [javax.servlet.Filter]))

 (defn -init [^Filter this ^FilterConfig cfg])
+(defn -destroy [^Filter this])

 (defn -doFilter
   [^Filter this


diff tests

diff tests

--- test/rester/core_test.clj
+++ test/rester/core_test.clj
@@ -1,5 +1,5 @@
 (ns rester.core-test
-  (:require [clojure.data.xml :refer [sexp-as-element]]
+  (:require [clojure.data.xml :refer [indent-str sexp-as-element]]
             [clojure.test :refer :all]
             [rester.core :refer :all]))

@@ -19,4 +19,6 @@

   (testing "diff xmls"
     (is (nil? (diff* (sexp-as-element [:a {:name "abc" :other "10"} [:b [:c]] [:d]])
-                     (sexp-as-element [:a {:name "abc" :other "10" :more "zzz"} [:x] [:b [:c]] [:d]]))))))
+                     (sexp-as-element [:a {:name "abc" :other "10" :more "zzz"} [:x] [:b [:c]] [:d]]))))
+    (is (= [(sexp-as-element [:b [:c]])] (diff* (sexp-as-element [:a {:name "abc" :other "10"} [:b [:c]] [:d]])
+                            (sexp-as-element [:a {:name "abc" :other "10" :more "zzz"} [:x] [:d]]))))))


fix namespace

fix namespace

--- src/babel/italiano/lab.cljc
+++ src/babel/italiano/lab.cljc
@@ -227,7 +227,7 @@

 (defn parse-at [expression path]
   (map #(u/get-in % path ::none)
-       (mapcat :parses (parse expression))))
+       (mapcat :parses (italiano/parse expression))))

 (defn lexeme-at [lexeme path]
   (map #(u/get-in % path ::none)


make page-path subscription depend on open group

Without this, the path doesn't get updated when switching from group-a
inbox to group-b inbox, so the indicator stops working properly

--- src/braid/client/state.cljs
+++ src/braid/client/state.cljs
@@ -125,10 +125,12 @@

 (defmethod subscription :page-path
   [state _]
-  (let [page (subscription state [:page])]
+  (let [page (subscription state [:page])
+        open-group (subscription state [:open-group-id])]
     (reaction
-      ; depend on page, so when the page changes this sub updates too
+      ; depend on page & group, so when the page changes this sub updates too
       (do @page
+          @open-group
           (.getPath (.parse Uri js/window.location))))))

 (defmethod subscription :thread


add touch-action none

add touch-action none

--- src/braid/mobile/style.cljs
+++ src/braid/mobile/style.cljs
@@ -36,7 +36,10 @@
 (def styles
   (let [pad (vw 5)
         pads "5vw"]
-    (css [:.sidebar
+    (css  [:body
+           {:touch-action "none"}]
+
+         [:.sidebar
           {:background "red"}
           [:.content
            {:width "100%"


not returning saved type

not returning saved type

--- src/celestial/hosts_api.clj
+++ src/celestial/hosts_api.clj
@@ -111,7 +111,7 @@

   (POST- "/type" [& ^:type props] {:nickname "addType" :summary "Add type"}
          (p/add-type props)
-         (success {:msg "new type saved" :type props}))
+         (success {:msg "new type saved"}))

   (PUT- "/type" [& ^:type props] {:nickname "updateType" :summary "Update type"}
         (if-not (p/type-exists? (props :type))


google analytics for all

google analytics for all

--- src/clj/easynxc/handler.clj
+++ src/clj/easynxc/handler.clj
@@ -32,7 +32,8 @@
    (head)
    [:body
     [:div#app]
-    (include-js "/js/app.js")]))
+    (include-js "/js/app.js")
+    (include-js "/js/google-analytics.js")]))

 (defn song [url]
   (let [response (yt/download url)]


Use recur special form over actual recursion for efficiency

--- src/clj/minijava/interp.clj
+++ src/clj/minijava/interp.clj
@@ -101,9 +101,9 @@
 (defn build-label-map [stms map]
   (cond (empty? stms) map
         (= (type (first stms)) :minijava.ir/Label)
-          (build-label-map (rest stms)
-                           (assoc map (:lbl (first stms)) (rest stms)))
-        true (build-label-map (rest stms) map)))
+          (recur (rest stms)
+                 (assoc map (:lbl (first stms)) (rest stms)))
+        true (recur (rest stms) map)))

 ;; top-level eval for a sequence of statements
 (defn eval-prog [stms]


added auth checkin

added auth checkin

--- src/clj/swarmpit/server.clj
+++ src/clj/swarmpit/server.clj
@@ -1,9 +1,23 @@
 (ns swarmpit.server
   (:import (clojure.lang ExceptionInfo))
   (:use [org.httpkit.server :only [run-server]])
-  (:require [swarmpit.handler :refer [handler]]
-            [ring.middleware.json :as ring-json]
-            [cheshire.core :refer [parse-string]]))
+  (:require [ring.middleware.json :as ring-json]
+            [cheshire.core :refer [parse-string]]
+            [swarmpit.handler :refer [handler]]
+            [swarmpit.utils :refer [in?]]))
+
+(def unsecure ["/login"])
+
+(defn- secure?
+  [request]
+  (let [uri (:uri request)]
+    (not (in? unsecure uri))))
+
+(defn- json-response
+  [status response]
+  {:status  status
+   :headers {"Content-Type" "application/json"}
+   :body    {:error response}})

 (defn wrap-client-exception
   [handler]
@@ -12,9 +26,8 @@
       (handler request)
       (catch ExceptionInfo e
         (let [response (ex-data e)]
-          {:status  (:code response)
-           :headers {"Content-Type" "application/json"}
-           :body    {:error (:message response)}})))))
+          (json-response (:code response)
+                         (:message response)))))))

 (defn wrap-fallback-exception
   [handler]
@@ -24,8 +37,22 @@
       (catch Exception e
         {:status 500 :body e}))))

+(defn wrap-authentication
+  [handler]
+  (fn [request]
+    (if (secure? request)
+      (let [headers (:headers request)
+            token (get headers "authorization")]
+        (if (some? token)
+          (if true
+            (handler request)
+            (json-response 401 "Invalid token"))
+          (json-response 400 "Missing token")))
+      (handler request))))
+
 (def app
   (-> handler
+      wrap-authentication
       wrap-client-exception
       ring-json/wrap-json-response
       ring-json/wrap-json-params


Remove packet limit

Remove packet limit

--- src/cljs/demtools/core.cljs
+++ src/cljs/demtools/core.cljs
@@ -70,7 +70,7 @@
                (let [buf (.-result fr)
                      dem (js/tf2demo.Demo. buf)
                      parser (.getParser dem)
-                     packets (js/Array. 20000)
+                     packets (js/Array. 50000)
                      idx (atom 0)]
                  (.on parser "packet"
                       #(do (aset packets @idx %) (swap! idx inc)))
@@ -80,7 +80,7 @@
                  (when (< @idx (.-length packets))
                    (set! (.-length packets) @idx))

-                 (let [p (js->clj (.slice packets 0 5000))
+                 (let [p (js->clj packets)
                        x (js/console.log "done converting" (count p))]
                    (cb {:file/results (str "some file contents: "
                                            (.-name file)
@@ -169,8 +169,7 @@
           (dom/div nil (js/JSON.stringify (clj->js packet))))
         (when packets
           (dom/p nil
-                 (str "Loaded " packets-count " packets. Displaying: "
-                      (count packets))))
+                 (str "Loaded " packets-count " packets.")))
         (when file (file-view this results))
         (when file
           (jsx Table


point to newest worm mine

point to newest worm mine

--- src/cljs/gointermod/db.cljs
+++ src/cljs/gointermod/db.cljs
@@ -85,10 +85,10 @@
       :status {:status :na}
       :mine
        {:name "WormMine"
-  ;     :url "im-251.wormbase.org/tools/wormmine"
-  ;     :service {:root "im-251.wormbase.org/tools/wormmine"}}}
-       :url "intermine.wormbase.org/tools/wormmine"
-       :service {:root "intermine.wormbase.org/tools/wormmine"}}}
+       :url "im-253.wormbase.org/tools/wormmine"
+       :service {:root "im-253.wormbase.org/tools/wormmine"}}}
+  ;     :url "intermine.wormbase.org/tools/wormmine"
+  ;     :service {:root "intermine.wormbase.org/tools/wormmine"}}}
     :yeast
      {:id     :yeast
       :output? true


Add Duplicate Query

Add Duplicate Query

--- src/cljs/lens/workbook.cljs
+++ src/cljs/lens/workbook.cljs
@@ -107,6 +107,10 @@

 ;; ---- Headline --------------------------------------------------------------

+(defn collapsed-sign [collapsed]
+  (d/span {:class (str "fa fa-" (if collapsed "chevron-right" "chevron-down"))
+           :style {:margin-right "5px"}}))
+
 (defn remove-query-msg [idx]
   {:form-rel :lens/remove-query
    :params {:idx idx}
@@ -116,11 +120,28 @@
                                          (map-indexed (fn [i q] (assoc q :idx i)))
                                          (vec))))})

-(defn query-remove-button [owner idx]
-  (d/span {:class "fa fa-minus-circle"
+(defn remove-query-button [owner idx]
+  (d/span {:class "fa fa-minus-square-o"
+           :title "Remove Query"
            :role "button"
            :style {:margin-left "10px"}
            :on-click (h (bus/publish! owner ::tx (remove-query-msg idx)))}))
+
+(defn duplicate-query-msg [idx]
+  {:form-rel :lens/duplicate-query
+   :params {:idx idx}
+   :state-fn
+   (fn [version]
+     (update-in version [:queries] #(->> (concat (take (inc idx) %) (drop idx %))
+                                         (map-indexed (fn [i q] (assoc q :idx i)))
+                                         (vec))))})
+
+(defn duplicate-query-button [owner idx]
+  (d/span {:class "fa fa-files-o"
+           :title "Duplicate Query"
+           :role "button"
+           :style {:margin-left "10px"}
+           :on-click (h (bus/publish! owner ::tx (duplicate-query-msg idx)))}))

 (defcomponent headline [headline owner {:keys [idx collapsed]}]
   (render-state [_ {:keys [hover]}]
@@ -128,13 +149,12 @@
       (d/div {:class "col-md-12"
               :on-mouse-enter #(om/set-state! owner :hover true)
               :on-mouse-leave #(om/set-state! owner :hover false)}
-        (d/h4 {:class "text-uppercase text-muted"}
-          (d/span {:class (str "fa fa-" (if collapsed "chevron-right"
-                                                      "chevron-down"))
-                   :style {:margin-right "5px"}} )
+        (apply d/h4 {:class "text-uppercase text-muted"}
+          (collapsed-sign collapsed)
           headline
           (when hover
-            (query-remove-button owner idx)))))))
+            [(remove-query-button owner idx)
+             (duplicate-query-button owner idx)]))))))

 ;; ---- Query Grid ------------------------------------------------------------


Refactoring minor

Refactoring minor

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -185,9 +185,10 @@

 (defn greeting []
   [:h1 "Triboard"
-   [:div.scores
-    (for [[k v] @scores]
-      [:div.score (str (name k) ":" v)])]
+   (into [:div.scores]
+     (for [[k v] @scores]
+       ^{:key k}
+       [:div.score (str (name k) ":" v)]))
    (into
      [:svg#board
       {:view-box (str "0 0 " board-width " " board-height)}]


Minor optimization

Minor optimization

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -119,13 +119,15 @@
    :looser :empty
    :taken [pos]})

-(defn with-available-moves
+(defn with-available-moves ;; TODO - This should be optimized: much too slow (50-60 ms)
   "Compute all available moves on the board"
   [{:keys [board] :as game}]
   (merge game
     {:moves
      (into {}
-       (map (juxt identity #(available-moves-at board %)))
+       (comp
+         (filter #(= (get-in board %) :empty))
+         (map (juxt identity #(available-moves-at board %))))
        all-positions)}
     ))


allow an entry to omit source

allow an entry to omit source

--- src/cljs_api_gen/result.clj
+++ src/cljs_api_gen/result.clj
@@ -24,6 +24,13 @@
        (remove (comp removable? second))
        (into {})))

+(defn fix-source-lines
+  "Turn the line range into a single line if the end line is the same as the first."
+  [item]
+  (if (:source item)
+    (update-in item [:source :lines] (fn [[a b]] (if (= a b) [a] [a b])))
+    item))
+
 (defn transform-item
   [x]
   (as-> x $
@@ -43,7 +50,7 @@
                     :extra-sources])
     (update-in $ [:signature] #(mapv str %))
     (update-in $ [:name] str)
-    (update-in $ [:source :lines] (fn [[a b]] (if (= a b) [a] [a b])))
+    (fix-source-lines $)
     (assoc $ :full-name (str (:ns $) "/" (:name $)))
     (assoc $ :full-name-encode (encode-fullname (:full-name $)))
     (prune-map $)


fix integrations-jars tests

fix integrations-jars tests

--- test/clojars/test/integration/jars.clj
+++ test/clojars/test/integration/jars.clj
@@ -17,13 +17,11 @@
   (scp valid-ssh-key "test.jar" "test-0.0.3-SNAPSHOT/test.pom")
   (-> (session web/clojars-app)
       (visit "/fake/test")
-      (within [:article :h1]
+      (within [:h1 :span :a]
               (has (text? "fake/test")))
-      (within [:.lein :pre]
+      (within [:.lein-small :pre]
               (has (text? "[fake/test \"0.0.2\"]")))
       (within [:ul#versions]
-              (has (text? "0.0.3-SNAPSHOT0.0.20.0.1")))
-      (within [:.versions :ul]
               (has (text? "0.0.3-SNAPSHOT0.0.20.0.1")))))

 (deftest jars-with-only-snapshots-can-be-viewed
@@ -32,13 +30,13 @@
   (scp valid-ssh-key "test.jar" "test-0.0.3-SNAPSHOT/test.pom")
   (-> (session web/clojars-app)
       (visit "/fake/test")
-      (within [:article :h1]
+      (within [:h1 :span :a]
               (has (text? "fake/test")))
-      (within [:.lein :pre]
+      (within [:.lein-small :pre]
               (has (text? "[fake/test \"0.0.3-SNAPSHOT\"]")))
       (within [:span.commit-url]
               (has (text? " with this commit")))
-      (within [:.versions :ul]
+      (within [:ul#versions]
               (has (text? "0.0.3-SNAPSHOT")))))

 (deftest canonical-jars-can-be-viewed
@@ -49,9 +47,9 @@
   (scp valid-ssh-key "fake.jar" "fake-0.0.3-SNAPSHOT/fake.pom")
   (-> (session web/clojars-app)
       (visit "/fake")
-      (within [:article :h1]
+      (within [:h1 :span :a]
               (has (text? "fake")))
-      (within [:.lein :pre]
+      (within [:.lein-small :pre]
               (has (text? "[fake \"0.0.2\"]")))
       (within [:ul#versions]
               (has (text? "0.0.3-SNAPSHOT0.0.20.0.1")))))
@@ -65,9 +63,9 @@
   (-> (session web/clojars-app)
       (visit "/fake/test")
       (follow "0.0.3-SNAPSHOT")
-      (within [:article :h1]
+      (within [:h1 :span :a]
               (has (text? "fake/test")))
-      (within [:.lein :pre]
+      (within [:.lein-small :pre]
               (has (text? "[fake/test \"0.0.3-SNAPSHOT\"]")))
       (within [:ul#versions]
               (has (text? "0.0.3-SNAPSHOT0.0.20.0.1")))))
@@ -81,9 +79,9 @@
   (-> (session web/clojars-app)
       (visit "/fake")
       (follow "0.0.1")
-      (within [:article :h1]
+      (within [:h1 :span :a]
               (has (text? "fake")))
-      (within [:.lein :pre]
+      (within [:.lein-small :pre]
               (has (text? "[fake \"0.0.1\"]")))
       (within [:ul#versions]
               (has (text? "0.0.3-SNAPSHOT0.0.20.0.1")))))


Test if create-job check if the job already exists

--- test/emender_jenkins/rest_api_test.clj
+++ test/emender_jenkins/rest_api_test.clj
@@ -13,6 +13,7 @@
 (ns emender-jenkins.rest-api-test
   (:require [clojure.test :refer :all]
             [emender-jenkins.rest-api :refer :all]
+            [emender-jenkins.results  :as results]
             [clj-jenkins-api.jenkins-api :as jenkins-api]))

 ;
@@ -582,8 +583,6 @@
                       read-request-body      (fn [request] create-job-postdata-invalid-metadata-3)
                       reload-job-list        (fn [response request] response)
                       send-response          (fn [response request] response)]
-                      (println create-job-postdata-invalid-metadata-3)
-                      (println (body->results create-job-postdata-invalid-metadata-3))
                       (is (= (create-job default-request) {:status  400
                                                            :headers {"Content-Type" "application/json"}
                                                            :body "{\"status\":\"error\",\"command\":\"create_job\",\"message\":\"invalid input: branch not specified\"}"})))))
@@ -602,3 +601,18 @@
                                                            :headers {"Content-Type" "application/json"}
                                                            :body "{\"status\":\"error\",\"command\":\"create_job\",\"message\":\"invalid or missing input\"}"})))))

+(deftest test-create-existing-job
+    "Check the function emender-jenkins.rest-api/create-job."
+    (testing "the function emender-jenkins.rest-api/create-job."
+        (with-redefs [jenkins-api/create-job (fn [jenkins-url jenkins-auth include-jenkins-reply? job-name git-repo branch credentials-id metadata-directory metadata]
+                                                 (jenkins-api/ok-response-structure job-name "create_job" include-jenkins-reply? "created"))
+                      jenkins-api/start-job  (fn [jenkins-url jenkins-auth include-jenkins-reply? job-name]
+                                                 (jenkins-api/ok-response-structure job-name "build" include-jenkins-reply? "added to queue"))
+                      read-request-body      (fn [request] nil)
+                      results/job-exists?    (fn [job-name] true)
+                      reload-job-list        (fn [response request] response)
+                      send-error-response    (fn [response request http-code] response)]
+                      (is (= (create-job default-request) {:status  "error"
+                                                           :command "create_job"
+                                                           :message "invalid or missing input"})))))
+


More robust testing of Javascript numeric results

--- test/photon/current/functions_test.clj
+++ test/photon/current/functions_test.clj
@@ -35,15 +35,15 @@
  (fact "A simple function is correctly converted (javascript)"
        (let [f (:computable
                 (exec/generate-function "js-experimental" "function(prev,next) {return 0;}"))]
-         (f 0 0) => 0
-         (f 0 1) => 0
-         (f 5 0) => 0))
+         (int (f 0 0)) => 0
+         (int (f 0 1)) => 0
+         (int (f 5 0)) => 0))

  (fact "A less simple function is correctly converted (javascript)"
        (let [f (:computable
                 (exec/generate-function "js-experimental" "function(prev,next) {return prev + 1;}"))]
-         (f 4 0) => 5
-         (f 10 6) => 11))
+         (int (f 4 0)) => 5
+         (int (f 10 6)) => 11))

  (fact "A more complex function is correctly converted (javascript)"
        (let [f (:computable


renamed  to

renamed  to

--- test/push/design_spikes/dsl_macros.clj
+++ test/push/design_spikes/dsl_macros.clj
@@ -37,7 +37,7 @@
 ;    save the entire stack into `local` and clear it
 ;    raise an Exception if it's undefined

-; + `remember-calc [args fn :as local]
+; + `calculate [args fn :as local]
 ;    save the result of applying `fn` to the named `args` under key `local`

 ; + `remember-top [stackname :as local]`
@@ -153,7 +153,7 @@
     (get-stack-from-dslblob integer-added :boolean) => '(6)))

-(defn remember-calc
+(defn calculate
   [[interpreter scratch] args function & {:keys [as]}]
   (if (nil? as)
     (vector interpreter scratch)
@@ -161,19 +161,19 @@
       (vector interpreter (assoc scratch as result)))))

-(fact "remember-calc stores the result of a calculation in a named scratch"
+(fact "calculate stores the result of a calculation in a named scratch"
   (let [integer-added (-> [six-ints {}]
                           (consume-top-of :integer :as :int1)
                           (consume-top-of :integer :as :int2)
-                          (remember-calc [:int1 :int2] #(+ %1 %2) :as :sum))]
+                          (calculate [:int1 :int2] #(+ %1 %2) :as :sum))]
   (second integer-added) => {:int1 6, :int2 5, :sum 11}))

-(fact "remember-calc has no effect if :as is not specified"
+(fact "calculate has no effect if :as is not specified"
   (let [integer-added (-> [six-ints {}]
                         (consume-top-of :integer :as :int1)
                         (consume-top-of :integer :as :int2)
-                        (remember-calc [:int1 :int2] #(+ %1 %2)))]
+                        (calculate [:int1 :int2] #(+ %1 %2)))]
   (second integer-added) => {:int1 6, :int2 5}))

@@ -290,7 +290,7 @@

 (fact "replace-stack replaces the entire stack with the named value from scratch"
   (let [totally-made-up (-> [six-ints {}]
-                            (remember-calc [] #(list 1 2 3 5 8) :as :fibs)
+                            (calculate [] #(list 1 2 3 5 8) :as :fibs)
                             (replace-stack :integer :fibs))]
   (get-stack-from-dslblob totally-made-up :integer) => '(1 2 3 5 8)))

@@ -364,7 +364,7 @@
   (fn?
     (macroexpand-1
       (def-pushdsl
-        (remember-calc [] #(list 1 2 3 5 8) :as :fibs)
+        (calculate [] #(list 1 2 3 5 8) :as :fibs)
         (replace-stack :integer :fibs)))) => true)

 ;; integer_add
@@ -373,7 +373,7 @@
   (def-pushdsl
     (consume-top-of :integer :as :int1)
     (consume-top-of :integer :as :int2)
-    (remember-calc [:int1 :int2] #(+ %1 %2) :as :sum)
+    (calculate [:int1 :int2] #(+ %1 %2) :as :sum)
     (place :integer :sum)))

 (fact "that int-adder thing actually does the thing"
@@ -397,7 +397,7 @@
   (def-pushdsl
     (consume-top-of :integer :as :index)
     (count-of :float :as :how-many)
-    (remember-calc [:index :how-many] #(mod %1 %2) :as :which)
+    (calculate [:index :how-many] #(mod %1 %2) :as :which)
     (remember-nth :float :at :which :as :dup-me)
     (place :float :dup-me)
     ))
@@ -419,6 +419,9 @@
 (fact "that noop thing actually does not one thing"
   (exec-noop boring) => boring)

+
+;; current CLojush code:
+;
 ;; code-do*range
 ;
 ; (define-registered
@@ -455,9 +458,9 @@
     (consume-top-of :code :as :to-do)
     (consume-top-of :integer :as :current-index)
     (consume-top-of :integer :as :destination-index)
-    (remember-calc [:destination-index :current-index] #(compare %1 %2) :as :direction)
-    (remember-calc [:current-index :direction] #(+ %1 %2) :as :new-index)
-    (remember-calc
+    (calculate [:destination-index :current-index] #(compare %1 %2) :as :direction)
+    (calculate [:current-index :direction] #(+ %1 %2) :as :new-index)
+    (calculate
       [:direction :new-index :destination-index :to-do]
       #(if (zero? %1)
           (list)
@@ -491,7 +494,8 @@

 ;; collect the needs while we have the transaction

-(defn needs-of
+
+(defn needs-of-dsl-step
   [step]
   (let [cmd (first step)]
     (condp = cmd
@@ -511,10 +515,9 @@
 (defn count-needs
   [transaction]
   (apply (partial merge-with +)
-    (remove nil? (map needs-of transaction)))
+    (remove nil? (map needs-of-dsl-step transaction)))
   )

-; : foo, bar, baz, qux, quux, corge, grault, garply, waldo, fred, plugh, xyzzy, thud
 (fact "returns a combined of all the needs of all the DSL steps it sees"
   (count-needs
     '(
@@ -524,7 +527,7 @@
       (consume-top-of :qux :as :int1)
       (count-of :quux)
       (place :corge :ugh)
-      (remember-calc [] #(8) :as :ugh)
+      (calculate [] #(8) :as :ugh)
       (remember-nth :grault :as ugh :at 6)
       (remember-stack :garply :as :ugh)
       (remember-top :waldo :as :ugh)
@@ -551,4 +554,19 @@
       (replace-stack :fred :ugh)        ; +0
       )
     ) => {:foo 4, :bar 2, :baz 1,  :fred 0}
-  )+  )
+
+(fact "count-needs works on the instructions I've sketched"
+  (count-needs
+    '((consume-top-of :code :as :to-do)
+    (consume-top-of :integer :as :current-index)
+    (consume-top-of :integer :as :destination-index)
+    (calculate [:destination-index :current-index] #(compare %1 %2) :as :direction)
+    (calculate [:current-index :direction] #(+ %1 %2) :as :new-index)
+    (calculate
+      [:direction :new-index :destination-index :to-do]
+      #(if (zero? %1)
+          (list)
+          (list %2 %3 :code_quote %4 :code_do*range)) :as :continuation)
+    (place :exec :continuation)
+  )) => {:code 1, :exec 0, :integer 2})


Changed make-context for [::set ::set ::fn]

It now directly instanciates conexp.fca.Context and does not use
make-context for [::set ::set ::set] anymore. This avoids some double
work.

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

--- src/conexp/fca/contexts.clj
+++ src/conexp/fca/contexts.clj
@@ -9,7 +9,10 @@
 	conexp.base)
   (:require [clojure.contrib.graph :as graph]))

-(defn Context-init [objects attributes incidence]
+(defn Context-init
+  "Context initializer, types must be [PersistentHashSet
+  PersistentHashSet PersistentHashSep]."
+  [objects attributes incidence]
   [ [] {:objects objects :attributes attributes :incidence incidence} ])

 (defmulti objects
@@ -114,6 +117,8 @@
      (.hashCode (attributes this))
      (.hashCode (incidence this))))

+;;;
+
 (defn- type-of
   "Dispatch function for make-context. Sequences and sets are made to one thing."
   [thing]
@@ -142,9 +147,11 @@
     (conexp.fca.Context. objs atts inz)))

 (defmethod make-context [::set ::set ::fn] [objects attributes incidence]
-  (make-context objects attributes (set-of [x y] [x objects
-						  y attributes
-						  :when (incidence x y)])))
+  (conexp.fca.Context. (set objects)
+		       (set attributes)
+		       (set-of [x y] [x objects
+				      y attributes
+				      :when (incidence x y)])))

 (defmethod make-context :default [obj att inz]
   (illegal-argument "The arguments " obj ", " att " and " inz " are not valid for a Context."))


initial corpus setup

initial corpus setup

--- src/crawler/test_system.clj
+++ src/crawler/test_system.clj
@@ -1,72 +1,38 @@
-;;;; Soli Deo Gloria
-;;;; spalakod
+(ns crawler.test-system
+  "Test module."
+  (:use [crawler.main :as main]))

-(ns crawler.test-system
-  (:gen-class :main true)
-  (:require [clojure.tools.cli :as cli]
-            [crawler.dom :as dom]
-            [crawler.page :as page]
-            [crawler.rank :as rank]
-            [crawler.utils :as utils])
-  (:use     [clj-xpath.core :only [$x $x:node $x:node+ $x:text+]]))
+(def test-entry-points
+  [;; vbulletin
+   "http://photography-on-the.net/forum/"
+   "http://dgrin.com/"
+   "http://forum.vizrt.com/"
+   "http://advrider.com/forums/"

-;; positive examples : page contains enumeration
-(def *enumerate-positives*
-  [{:url   "http://www.fmylife.com"
-    :xpath "//html/body[contains(@id,'top')]/div[contains(@id,'background')]/div[contains(@id,'content')]/div[contains(@class,'wrapper')]/div[contains(@class,'pagination')]/ul[contains(@class,'left')]/li/a"}
+   ;; phpbb
+   "http://www.ilovephilosophy.com/index.php"
+   "http://phpbbarcade.jatek-vilag.com/index.php"
+   "http://seattlebubble.com/forum/"
+   "http://forum.joomla.org/"
+   "https://forum.librivox.org/index.php"
+
+   ;; ipboard
+   "http://forums.aceteam.cl/"
+   "http://www.dfwpilots.com/board/"
+   "http://forum.newburytoday.co.uk/"
+   "http://forums.dumpshock.com/index.php"

-   {:url   "https://boards.4chan.org/vg/"
-    :xpath "//html/body[contains(@class,'board')]/div[contains(@class,'pagelist')]/div[contains(@class,'pages')]/a"}
+   ;; mybb
+   "http://mybbmodding.net/forums/"
+   "http://historicshooting.com/mybb/index.php"
+   "https://amblesideonline.org/forum/"
+   "http://www.doctornerdlove.com/forums/"])

-   {:url   "https://www.phpbb.com/community/viewforum.php?f=69"
-    :xpath "//html/body[contains(@id,'phpbb') and contains(@class,'section')]/div[contains(@id,'wrap')]/div[contains(@id,'page')]/div[contains(@class,'topic')]/div[contains(@class,'pagination')]/span/a"}
+(defn test-site
+  []
+  (pmap
+   (fn [site]
+     (main/discussion-forum-crawler-3 site 100))
+   test-entry-points))

-   {:url   "https://www.phpbb.com/community/viewtopic.php?f=69&t=1870815"
-    :xpath "//html/body[contains(@id,'phpbb') and contains(@class,'section')]/div[contains(@id,'wrap')]/div[contains(@id,'page')]/div[contains(@class,'topic')]/div[contains(@class,'pagination')]/span/a"}

-   {:url   "http://stackoverflow.com/questions?pagesize=50&sort=newest"
-    :xpath "//html/body[contains(@class,'questions')]/div[contains(@class,'container')]/div[contains(@id,'content')]/div[contains(@id,'mainbar')]/div[contains(@class,'pager')]/a"}
-
-   {:url   "http://gis.stackexchange.com/questions?pagesize=50&sort=newest"
-    :xpath "//html/body[contains(@class,'questions')]/div[contains(@class,'container')]/div[contains(@id,'content')]/div[contains(@id,'mainbar')]/div[contains(@class,'pager')]/a"}
-
-   {:url   "http://carsandetc.tumblr.com/"
-    :xpath "//html/body/div[contains(@id,'wrapper')]/div[contains(@id,'content')]/div[contains(@id,'navigation')]/a"}
-
-   {:url   "http://www.topix.com/forum/city/carrizo-springs-tx/"
-    :xpath "//html/body[contains(@id,'stream')]/div[contains(@id,'content')]/div[contains(@id,'content') and contains(@class,'xtra')]/div[contains(@id,'onetwocombo')]/div[contains(@class,'onetwosub')]/div/div/a"}
-
-   {:url   "http://grails.1312388.n4.nabble.com/"
-    :xpath "//HTML/body/div[contains(@id,'nabble') and contains(@class,'nabble')]/span[contains(@class,'pages')]/span[contains(@class,'page')]/a"}])
-
-(def nabble-test-case
-  ["http://grails.1312388.n4.nabble.com/"
-   "http://postgresql.1045698.n5.nabble.com/"
-   "http://jenkins-ci.361315.n4.nabble.com/"
-   "http://lucene.472066.n3.nabble.com/"
-   "http://elasticsearch-users.115913.n3.nabble.com/"
-   "http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/"
-   "http://dojo-toolkit.33424.n3.nabble.com/"
-   "http://jmeter.512774.n5.nabble.com/"
-   "http://abaqus-users.1086179.n5.nabble.com/"])
-
-(def blogs-test-case
-  ["http://www.charitywater.org/blog/"
-   "http://www.hermanmiller.com/discover/"
-   "http://www.thesartorialist.com/"])
-
-(def tumblr-test-case
-  ["http://oldpeoplefacebook.tumblr.com/"
-   "http://anthonybourdain.tumblr.com/"
-   "http://1796foods.com/"
-   "http://efccooking.tumblr.com/"
-   "http://scandybars.tumblr.com/"
-   "http://gastrogirl.tumblr.com/"
-   "http://foodculturalist.tumblr.com/"
-   "http://sexiestfoods.tumblr.com/"
-   "http://artinmycoffee.com/"])
-
-(defn test-xpaths-hrefs-tokens
-  [url]
-  (let [body      (utils/download-with-cookie url)]
-    (dom/xpaths-hrefs-tokens body url)))


add react-key for each offender row in table (fixes #12)

--- src/deathrow/offenders.cljs
+++ src/deathrow/offenders.cljs
@@ -55,7 +55,7 @@
           (dom/th nil "Race")
           (dom/th nil "Age")))
       (dom/tbody nil
-        (om/build-all offender-row (:data state))))))
+        (om/build-all offender-row (:data state) {:key :executionNo})))))

 (defn offenders-component
   [state owner]


Fixed rendering to use immutable contents instead of atom, fixed syntax error in state transform

--- src/degree_planner/app.cljs
+++ src/degree_planner/app.cljs
@@ -5,15 +5,17 @@
 (defonce app-state (atom {:courses #{"CS135" "CS136" "MATH135" "MATH136"}
                       :new-course ""}))

-(defn transform-state [key transform]
-  (swap! app-state #((let [old-value (key %)]
-                       (assoc % key (transform old-value))))))
+(defn transform-state! [key transform]
+  (do
+    (swap! app-state #(let [old-value (key %)]
+                         (assoc % key (transform old-value))))
+    (rerender!)))

 (q/defcomponent CourseView [course]
   (d/div {:className "course"}
         (d/span nil course)
         (d/button {:className "btn btn-b btn-sm smooth"
-              :onClick (fn [e] (transform-state :courses #(disj % course)))} "Delete")))
+              :onClick (fn [e] (transform-state! :courses #(disj % course)))} "Delete")))

 (q/defcomponent CoursesView [courses]
   (d/div {:id "courses-view"}
@@ -21,11 +23,14 @@
          (d/div nil
                 (d/input {:type "text" :class "smooth" :ref "new-course"
                           :onKeyDown (fn [e] (let [v (.-value (.-target e))]
-                                               (transform-state :new-course (constantly v))))}))))
+                                               (transform-state! :new-course (constantly v))))}))))

 (q/defcomponent RootView [app]
   (d/div {:id "root"}
-         (CoursesView (:courses @app))))
+         (CoursesView (:courses app))))

-(q/render (RootView app-state)
-          (.getElementById js/document "my-app"))
+(defn rerender! []
+  (q/render (RootView @app-state)
+            (.getElementById js/document "my-app")))
+
+(rerender!)


make sure menory always has 16 cells

make sure menory always has 16 cells

Signed-off-by: Yen-Chin Lee <082d453d72dce940e12089a4ad48b97cfe1f3ec4@gmail.com>

--- src/emulator_4917/core.cljc
+++ src/emulator_4917/core.cljc
@@ -10,12 +10,11 @@

 (defn make-cpu
   ([& {:keys [memory r0 r1 ip is]
-       :or {memory  (vec (repeat 16 0))
-            r0 0
+       :or {r0 0
             r1 0
             ip 0
             is 0}}]
-   (State. memory r0 r1 ip is)))
+   (State. (take 16 (concat memory (repeat 16 0))) r0 r1 ip is)))

 (defn terminate-application!
   "Clojure/Clojurescript wrapper for terminate application."
@@ -35,7 +34,7 @@
 (defn cmd1
   [{:keys [memory r0 r1 ip is]}]
   (make-cpu
-   :memory memory :r0 (+ r0 r1) :r1 r1 :ip ip :is is))
+   :memory memory :r0 (+ r0 r1) :r1 r1 :ip (inc ip) :is 1))

 ;; cmd 2: R0 = R0 - R1
 (defn cmd2


Fix midi selector

Fix midi selector

--- src/fugue/midi_monitor.cljs
+++ src/fugue/midi_monitor.cljs
@@ -5,14 +5,14 @@
             [fugue.chords :as chords]))

 (defn midi-selector [midi-ctx on-change]
-  [:div
-   (if-let [mctx @midi-ctx]
-     (do
-       (on-change (second (first (::midi/ins mctx))))
-       [:select {:on-change #(on-change ((::midi/ins mctx) (.. % -target -value)))}
-        (for [[in-name] (::midi/ins mctx)]
-          [:option {:value in-name} in-name])])
-     "no midi ctx")])
+  (fn []
+    (if-let [mctx @midi-ctx]
+      (do
+        [:select {:on-change #(on-change ((::midi/ins mctx) (.. % -target -value)))}
+         [:option {:value nil} "Select an input"]
+         (for [[in-name] (::midi/ins mctx)]
+           [:option {:value in-name} in-name])])
+      [:p "no midi ctx"])))

 (defn note-on? [midi-msg]
   (and (= ::midi/note-on (::midi/type midi-msg))
@@ -24,37 +24,37 @@
     ::midi/note-on (= 0 (::midi/velocity midi-msg))
     false))

-(defn note-monitor [in-mult]
+(defn note-monitor-view [notes]
+  [:div
+   [:p (str notes)]
+   [:ul
+    (for [chord (chords/possible-chords notes)]
+      [:li (str chord)])]
+   [:hr]
+   [:ol
+    (for [chord (chords/contained-chords notes)]
+      [:li (str chord)])]])
+
+(defn monitor [midi-ctx]
   (let [msgs (r/atom {})
+        in-mult (r/atom nil)
         in-chan (async/chan)]
     (async/go-loop []
                    (let [msg (async/<! in-chan)]
+                     (print msg)
                      (cond
                        (note-on? msg)
                        (swap! msgs assoc (::midi/note msg) msg)
                        (note-off? msg)
                        (swap! msgs dissoc (::midi/note msg)))
                      (recur)))
-    (async/tap in-mult in-chan)
-    (fn []
-      (let [notes (keys @msgs)
-            possible-chords (chords/possible-chords notes)
-            contained-chords (chords/contained-chords notes)]
-        [:div
-         [:p (str notes)]
-         [:ul
-          (for [chord possible-chords]
-            [:li (str chord)])]
-         [:hr]
-         [:ol
-          (for [chord contained-chords]
-            [:li (str chord)])]]))))
-
-(defn monitor [midi-ctx]
-  (let [in-chan (r/atom nil)]
     (fn []
       [:div
-       [midi-selector midi-ctx (partial reset! in-chan)]
-       (if-let [in-chan @in-chan]
-         [note-monitor in-chan]
-         "no input selected")])))+       [midi-selector midi-ctx (fn [in]
+                                 (when-let [old-mult @in-mult]
+                                   (async/untap old-mult in-chan))
+                                 (reset! msgs {})
+                                 (when-let [new-mult in]
+                                   (async/tap new-mult in-chan))
+                                 (reset! in-mult in))]
+       [note-monitor-view (keys @msgs)]])))


Simplified execution

Simplified execution

--- src/hasta_la_vista/core.clj
+++ src/hasta_la_vista/core.clj
@@ -180,18 +180,14 @@
                     {:thread-name (.getName (Thread/currentThread)) :first_id (first ids) :time exec-time :perf perf})
                   (recur))))))

-      ;; reading stat-chan
-      (thread
-        (go-loop []
-          (let [stat (blocking-consumer stat-chan)] (log/info stat))
-          (recur)))
-
       ;; send in all of the ids batch-size amount a time
-      (doseq [r (client/lazy-query client design-document-name view-name query-options batch-size)]
-        (let [ids (map client/view-id r)]
-          (blocking-producer work-chan ids)))
-
-      ;; wait till the last message is read
+      (thread
+        (Thread/sleep 100)
+        (doseq [r (client/lazy-query client design-document-name view-name query-options batch-size)]
+          (let [ids (map client/view-id r)]
+            (blocking-producer work-chan ids))))
+
+      ;; wait till the last message is read in the main thread
       (while true
         (blocking-consumer
           (go


add row-hash function to help bigquery avoid duplicate streaming insert values

--- bigquery/src/gclouj/bigquery.clj
+++ bigquery/src/gclouj/bigquery.clj
@@ -1,5 +1,6 @@
 (ns gclouj.bigquery
-  (:import [com.google.gcloud.bigquery BigQueryOptions BigQuery$DatasetListOption DatasetInfo DatasetId BigQuery$TableListOption TableInfo TableId BigQuery$DatasetOption BigQuery$TableOption Schema Field Field$Type Field$Mode TableInfo$StreamingBuffer InsertAllRequest InsertAllRequest$RowToInsert InsertAllResponse BigQueryError]))
+  (:import [com.google.gcloud.bigquery BigQueryOptions BigQuery$DatasetListOption DatasetInfo DatasetId BigQuery$TableListOption TableInfo TableId BigQuery$DatasetOption BigQuery$TableOption Schema Field Field$Type Field$Mode TableInfo$StreamingBuffer InsertAllRequest InsertAllRequest$RowToInsert InsertAllResponse BigQueryError]
+           [com.google.common.hash Hashing]))

 (defprotocol ToClojure
   (to-clojure [_]))
@@ -109,17 +110,26 @@
         table-info (.build builder)]
     (to-clojure (.create service table-info (into-array BigQuery$TableOption [])))))

-(defn crc32 [])
+(defn row-hash
+  "Creates a hash suitable for identifying duplicate rows, useful when
+  streaming to avoid inserting duplicate rows."
+  [m & {:keys [bits] :or {bits 128}}]
+  (-> (Hashing/goodFastHash bits) (.hashUnencodedChars (pr-str m)) (.toString)))

 (defn insert-all
-  "Performs a streaming insert of rows. row-id can be a function to return the unique identity of the row. "
+  "Performs a streaming insert of rows. row-id can be a function to
+  return the unique identity of the row (e.g. row-hash). Template suffix
+  can be used to create tables according to a template."
   [service {:keys [project-id dataset-id table-id skip-invalid? template-suffix row-id] :as table} rows]
-  (->> (InsertAllRequest/builder (TableId/of project-id dataset-id table-id)
-                                 (map (fn [row]
-                                        (if row-id
-                                          (InsertAllRequest$RowToInsert/of (row-id row) row)
-                                          (InsertAllRequest$RowToInsert/of row)))
-                                      rows))
-       (.build)
-       (.insertAll service)
-       (to-clojure)))
+  (let [builder (InsertAllRequest/builder (TableId/of project-id dataset-id table-id)
+                                          (map (fn [row]
+                                                 (if row-id
+                                                   (InsertAllRequest$RowToInsert/of (row-id row) row)
+                                                   (InsertAllRequest$RowToInsert/of row)))
+                                               rows))]
+    (when template-suffix
+      (.templateSuffix builder template-suffix))
+    (->> builder
+         (.build)
+         (.insertAll service)
+         (to-clojure))))


Extract a-or-span to avoid repeating copy

--- src-cljs/frontend/components/pages/workflow.cljs
+++ src-cljs/frontend/components/pages/workflow.cljs
@@ -200,6 +200,11 @@
     (card/collection
      (map #(when % (run-row %)) runs))]))

+(defn a-or-span [flag href & children]
+  (if flag
+    [:a {:href href} children]
+    [:span children]))
+
 (defui ^:once RunList
   static om-next/IQuery
   (query [this]
@@ -218,16 +223,12 @@
             [:.page-info "Showing " [:span.run-numbers (inc offset) "–" (+ offset (count edges))]]
             (run-row-collection (map :edge/node edges))
             [:.list-pager
-             (if (pos? offset)
-               [:a {:href prev-page-href}
-                "← Newer workflow runs"]
-               [:span
-                "← Newer workflow runs"])
-             (if (> total-count (+ offset (count edges)))
-               [:a {:href next-page-href}
-                "Older workflow runs →"]
-               [:span
-                "Older workflow runs →"])]]))))))
+             (a-or-span (pos? offset)
+                        prev-page-href
+                        "← Newer workflow runs")
+             (a-or-span (> total-count (+ offset (count edges)))
+                        next-page-href
+                        "Older workflow runs →")]]))))))

 (def run-list (om-next/factory RunList))


Do a better job with archive names.

Do a better job with archive names.

--- support/fntest/src/main/clojure/fntest/jboss.clj
+++ support/fntest/src/main/clojure/fntest/jboss.clj
@@ -74,10 +74,19 @@
   []
   (api :operation "shutdown"))

+(defn deployment-name
+  "Determine the name for the deployment."
+  [name]
+  (if (.endsWith name ".ima")
+    name
+    (if (re-seq #".+\.clj$" name)
+      name
+      (str name ".clj"))))
+
 (defn descriptor
   "Return a File object representing the deployment descriptor"
   [name & [content]]
-  (let [fname (if (re-seq #".+\.clj$" name) name (str name ".clj"))
+  (let [fname (deployment-name name)
         file (io/file descriptor-root fname)]
     (when content
       (io/make-parents file)
@@ -99,6 +108,5 @@
 (defn undeploy
   "Undeploy the app named name"
   [name]
-  (let [fname (.getName (descriptor name))]
-    (api :operation "remove" :address ["deployment" fname])))
+  (api :operation "remove" :address ["deployment" (deployment-name name)]))


Correct timestamp error on value insert and modify the latest series data handler to return 404 if the series does not exist.

--- metlog-vault/src-server/metlog_vault/core.clj
+++ metlog-vault/src-server/metlog_vault/core.clj
@@ -51,7 +51,7 @@
     (log/debug "Inserting sample: " sample)
     (jdbc/insert! *db* :sample
                   {:series_id (intern-series-name (:series_name sample))
-                   :t (java.util.Date.)
+                   :t (:t sample)
                    :val (:val sample)})))

 (defn edn-response [data & [status]]
@@ -67,12 +67,12 @@

 (defn get-latest-data-for-series-name [ series-name ]
   (let [ series-id (get-series-id series-name) ]
-    (edn-response
-     (query-all *db* [(str "SELECT sample.series_id, sample.t, sample.val"
-                           " FROM sample"
-                           " WHERE sample.series_id = ?"
-                           "   AND sample.t = (SELECT MAX(t) FROM sample WHERE series_id=?)")
-                      series-id series-id]))))
+    (if-let [ val (query-first *db* [(str "SELECT sample.series_id, sample.t, sample.val"
+                                          " FROM sample"
+                                          " WHERE sample.series_id = ?"
+                                          "   AND sample.t = (SELECT MAX(t) FROM sample WHERE series_id=?)")
+                                     series-id series-id])]
+      (edn-response val))))

 (defn get-data-for-series-name [ series-name ]
   (edn-response


Don't show icon for author if there was none.

--- src-cljs/frontend/components/builds_table.cljs
+++ src-cljs/frontend/components/builds_table.cljs
@@ -163,8 +163,10 @@

         [:div.metadata-item.recent-user
          {:title (build-model/ui-user build)}
-          (dashboard-icon "Builds-Author")
-          (build-model/author build)]
+          (when-let [author (build-model/author build)]
+            (list
+              (dashboard-icon "Builds-Author")
+              author))]

         (if (or (not (:start_time build))
                 (= "not_run" (:status build)))


Explain what will happen when you cancel.

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -902,10 +902,17 @@
   (reify
     om/IRender
     (render [_]
-      (let [org-name (get-in app state/org-name-path)]
+      (let [org-name (get-in app state/org-name-path)
+            plan (get-in app state/org-plan-path)]
         (html
          [:div.org-cancel
           [:div.row-fluid [:fieldset [:legend "Cancel"]]]
+          [:p "If you cancel your plan, you'll stop being billed and no longer have acess to the "
+           (pluralize (pm/paid-containers plan) "paid container") " in your plan."]
+          (when (pm/freemium? plan)
+            [:p (str "However, your builds will still use your "
+                     (pluralize (pm/freemium-containers plan) "free container")
+                     " indefinitely.")])
           [:div.row-fluid
            [:h3
             {:data-bind "attr: {alt: cancelFormErrorText}"}


simplified logic for displaying pricing note

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -1436,9 +1436,8 @@
                                                                     :_fragment "osx-pricing"})} "Update OS X plan"]]
                   [:strong [:a {:href (routes/v1-org-settings-path {:org plan-org-name
                                                                     :vcs_type plan-vcs-type
-                                                                    :_fragment "osx-pricing"})} "Choose OS X plan"]])
-
-                 "."]
+                                                                    :_fragment "osx-pricing"})} "Choose OS X plan"]])]
+
                 [:fieldset
                  (when (and (pm/osx-trial-plan? plan) (not (pm/osx-trial-active? plan)))
                    [:p "The OS X trial you've selected has expired, please choose a plan below."])
@@ -1449,20 +1448,18 @@
             [:div
              [:h1 "No OS X plan selected"]
              [:p
-              (let [link [:strong [:a {:href (routes/v1-org-settings-path {:org plan-org-name
-                                                                                :vcs_type plan-vcs-type
-                                                                                :_fragment "osx-pricing"})} "Choose an OS X plan"] "."]]
-                (if (pm/grandfathered? plan)
-                  (list link
-                        " Note: changes to your billing will update your entire account"
-                        " (including Linux plans) off of our legacy plans to our current pricing model.")
-                  link))]])])))))
+              [:strong [:a {:href (routes/v1-org-settings-path {:org plan-org-name
+                                                                :vcs_type plan-vcs-type
+                                                                :_fragment "osx-pricing"})} "Choose an OS X plan"]]
+              (when (pm/grandfathered? plan)
+                [:p " Note: changes to your billing will update your entire account"
+                      " (including Linux plans) off of our legacy plans to our current pricing model."])]])])))))

 (defn github-marketplace-messaging []
   [:div "Current plan managed on "
    [:a {:href "https://github.com/marketplace/circleci"
         :target "_blank"}
-    "GitHub Marketplace"] "."])
+    "GitHub Marketplace"]])

 (defn displayed-linux-plan-info [{:keys [current-linux-cost containers trial-containers in-student-trial? github-marketplace-plan?]}]
   (if github-marketplace-plan?


Update underlying query when term is changed

--- src/cljs/cglossa/search_inputs/cwb/extended.cljs
+++ src/cljs/cglossa/search_inputs/cwb/extended.cljs
@@ -96,7 +96,7 @@
     (str/join \space parts)))

 (defn wrapped-term-changed [wrapped-query terms index term]
-  (.log js/console (construct-cqp-query (assoc terms index term))))
+  (swap! wrapped-query assoc :query (construct-cqp-query (assoc terms index term))))

 (defn- interval-input [wrapped-query wrapped-term index]
   [:input.form-control.interval {:type        "text"


Don't try to read and eval string from the property file

--- src/cloverage_jenkins_reporter/config_loader.clj
+++ src/cloverage_jenkins_reporter/config_loader.clj
@@ -32,7 +32,7 @@
     [properties]
     (into {}
         (for [[k v] properties]
-              [(keyword k) (read-string v)])))
+              [(keyword k) v])))

 (defn load-configuration-file
     [file-name]


Prevent style from leaking

Prevent style from leaking

--- src/braid/client/ui/styles/pages/channels.cljs
+++ src/braid/client/ui/styles/pages/channels.cljs
@@ -9,10 +9,11 @@
    [:.tags
     {:margin-top (em 1)
      :color vars/grey-text}
+
     [:.tag-info
      {:margin-bottom (em 1)}

-     [:.button
+     ["> .button"
       mixins/pill-button
       {:margin-left (em 1)}]]]


A few small changes based on code review.

--- src/clojure/clojurewerkz/cassaforte/client.clj
+++ src/clojure/clojurewerkz/cassaforte/client.clj
@@ -24,8 +24,8 @@
             [clojurewerkz.cassaforte.policies   :as cp]
             [clojurewerkz.cassaforte.conversion :as conv])
   (:import [com.datastax.driver.core Statement ResultSet ResultSetFuture Host Session Cluster
-            Cluster$Builder SimpleStatement PreparedStatement BoundStatement HostDistance PoolingOptions
-            JdkSSLOptions JdkSSLOptions$Builder ProtocolOptions$Compression ProtocolVersion]
+            Cluster$Builder SimpleStatement PreparedStatement HostDistance PoolingOptions
+            SSLOptions JdkSSLOptions ProtocolOptions$Compression ProtocolVersion]
            [com.datastax.driver.auth DseAuthProvider]
            [com.google.common.util.concurrent ListenableFuture Futures FutureCallback]
            [java.net URI]
@@ -160,7 +160,7 @@
       (.withAuthProvider builder (DseAuthProvider.)))
     (.build builder)))

-(defn- ^JdkSSLOptions build-ssl-options
+(defn- ^SSLOptions build-ssl-options
   [{:keys [keystore-path keystore-password cipher-suites]}]
   (let [keystore-stream   (io/input-stream keystore-path)
         keystore          (KeyStore/getInstance "JKS")
@@ -173,9 +173,10 @@
     (.init keymanager keystore password)
     (.init trustmanager keystore)
     (.init ssl-context (.getKeyManagers keymanager) (.getTrustManagers trustmanager) nil)
-    (if ssl-cipher-suites
-      (.. (JdkSSLOptions$Builder.) (withSSLContext ssl-context) (withCipherSuites ssl-cipher-suites) (build))
-      (.. (JdkSSLOptions$Builder.) (withSSLContext ssl-context) (build)))))
+    (.. (JdkSSLOptions/builder)
+        (withSSLContext ssl-context)
+        (withCipherSuites ssl-cipher-suites)
+        (build))))

 (defn- ^ProtocolOptions$Compression select-compression
   [compression]


[victoryw] #N/A reformate

[victoryw] #N/A reformate

--- go-visual/src/go_visual/static_pipeline_instance.clj
+++ go-visual/src/go_visual/static_pipeline_instance.clj
@@ -26,18 +26,22 @@

 (defn statis-pipeline-success-status
   [pipelines]
-  (sort-by :counter < (map (fn [pipeline]
-                            {:name (:name pipeline)
-                             :counter (:counter pipeline)
-                             :status  (every? #(and (true? (:scheduled %)) (= (str (:result %)) "Passed")) (:stages pipeline))})
-                       pipelines)))
+  (map
+   (fn [pipeline]
+     {:name (:name pipeline)
+      :counter (:counter pipeline)
+      :status  (every?
+                #(and
+                  (true? (:scheduled %))
+                  (= (str (:result %)) "Passed"))
+                (:stages pipeline))})
+   pipelines))

 (defn statis-pipeline-accumulate-success-counter
   [fn-get-last-success-rate last-accumulate-success-list pipeline-instance]
   (if (true? (:status pipeline-instance))
     (assoc pipeline-instance :success (+ 1 (fn-get-last-success-rate last-accumulate-success-list)))
     (assoc pipeline-instance :success 0)))
-

 (defn extract-last-pipeline-continue-failure-counter
   [last-result]
@@ -47,16 +51,16 @@
 (defn statis-accumulate-pipeline-failure-counter
   [pipelines]
   (flatten
-    (reduce
-      (fn [last-accumulate-result-list pipeline-instance]
-        (list
-          last-accumulate-result-list
-          (statis-pipeline-accumulate-success-counter
-            extract-last-pipeline-continue-failure-counter
-            last-accumulate-result-list
-            pipeline-instance)))
-      '()
-      pipelines)))
+   (reduce
+    (fn [last-accumulate-result-list pipeline-instance]
+      (list
+       last-accumulate-result-list
+       (statis-pipeline-accumulate-success-counter
+        extract-last-pipeline-continue-failure-counter
+        last-accumulate-result-list
+        pipeline-instance)))
+    '()
+    pipelines)))

 (defn statistic-each-pipeline-stage-run-time
   [url username password]
@@ -67,8 +71,9 @@
     (fn [statistic-pipeline status-pipeline]
       (assoc statistic-pipeline :status (:status status-pipeline)))
     (sort-by :counter <
-      (map
-        (comp  statistic-pipeline-instace extract-pipeline-instance-history)
-        pipelines))
-    (statis-pipeline-success-status pipelines))))
+             (map
+              (comp  statistic-pipeline-instace extract-pipeline-instance-history)
+              pipelines))
+    (sort-by :counter <
+             (statis-pipeline-success-status pipelines)))))


print authorization url also to stdout

print authorization url also to stdout

--- src/overtone/samples/freesound.clj
+++ src/overtone/samples/freesound.clj
@@ -86,11 +86,13 @@
     (reset! *access-token* r)))

 (defn authorization-instructions []
-  (println "Authorize in browser and paste code in Stdin.")
-  (clojure.java.browse/browse-url
-   (freesound-url "/oauth2/authorize/"
-                  {:client_id *client-id* :response_type "code"}))
-  (access-token (read-line)))
+  (let [url
+        (freesound-url "/oauth2/authorize/"
+                       {:client_id *client-id* :response_type "code"})]
+    (println "Authorize in browser and paste code in Stdin.")
+    (println url)
+    (clojure.java.browse/browse-url url)
+    (access-token (read-line))))

 (defmacro with-authorization-header [b]
   `(binding [*authorization-header*


Tweak

Tweak

--- 2-collectors/clojure-collector/src/snowplow/clojure_collector.clj
+++ 2-collectors/clojure-collector/src/snowplow/clojure_collector.clj
@@ -34,7 +34,7 @@
   (GET "/i"           {c :cookies} (send-cookie-and-pixel' c))
   (GET "/ice.png"     {c :cookies} (send-cookie-and-pixel' c)) ; ice.png is legacy name for i
   (GET "/healthcheck" request responses/send-200)
-  ;  + "/status" provided by expose-metrics-as-json
+  ;  + "/status"      provided by expose-metrics-as-json
   (compojure.route/not-found  responses/send-404))

 (def app


expose an Enterprise flag

expose an Enterprise flag

--- src-cljs/frontend/config.cljs
+++ src-cljs/frontend/config.cljs
@@ -1,4 +1,5 @@
-(ns frontend.config)
+(ns frontend.config
+  (:require [frontend.models.feature :as feature]))

 (defn env
   "The name of the server configuration environment.
@@ -9,7 +10,8 @@
 (defn enterprise?
   "True if this is an enterprise (as opposed to main public web) deployment."
   []
-  (boolean (aget js/window "renderContext" "enterprise")))
+  (or (boolean (aget js/window "renderContext" "enterprise"))
+      (feature/enabled? :enterprise-ui)))

 (defn pusher
   "Options to be passed to the Pusher client library."


Ensure elevio widget does not compress om app

This ensures the elevio widget overlays the om app instead of squeezing it

--- src-cljs/frontend/elevio.cljs
+++ src-cljs/frontend/elevio.cljs
@@ -27,6 +27,7 @@
               (aset "free" is-free))]
     (set-elev! "account_id" account-id)
     (set-elev! "user" user-info)
+    (set-elev! "pushin" "false")
     (set-elev! "translations"
           #js {"loading"
                #js {"loading_ticket" "Loading support request"


Подкоректировал фоновую прозрачность при отображении диалогов

--- src-cljs/ixinfestor/omut.cljs
+++ src-cljs/ixinfestor/omut.cljs
@@ -110,7 +110,7 @@
                       :style (if show?
                                #js {:display "block"
                                     :paddingLeft 0
-                                    :backgroundColor "#777"}
+                                    :backgroundColor "rgba(0, 0, 0, 0.8)"}
                                #js {:display "none" })
                       :className (if show? "modal in" "modal")
                       :role "dialog"
@@ -586,7 +586,8 @@

 (defn tr-sel [app owner {:keys [app-to-tds-seq-fn
-                                clear-selections-fn]
+                                clear-selections-fn
+                                on-select-fn]
                          :or {app-to-tds-seq-fn
                               (fn [row]
                                 (map
@@ -602,6 +603,8 @@
                                     (when clear-selections-fn
                                       (clear-selections-fn))
                                     (om/transact! app :tr-selected not)
+                                    (when on-select-fn
+                                      (on-select-fn @app))
                                     1)}
              (app-to-tds-seq-fn app) ))))

@@ -614,16 +617,20 @@
   (reify
     om/IRender
     (render [_]
-      (apply dom/tbody nil
-             (om/build-all tr-sel app
-                           {:opts (if (= selection-type :one)
-                                    (assoc opts
-                                           :clear-selections-fn
-                                           (fn [_]
-                                             (om/transact! app
-                                                           (fn [data]
-                                                             (vec (map #(assoc % :tr-selected false) data))))))
-                                    opts)})))))
+      (apply
+       dom/tbody nil
+       (om/build-all
+        tr-sel app
+        {:opts
+         (if (= selection-type :one)
+           (assoc opts
+                  :clear-selections-fn
+                  (fn [_]
+                    (om/transact!
+                     app
+                     (fn [data]
+                       (vec (map #(assoc % :tr-selected false) data))))))
+           opts)})))))

 ;; END table
@@ -1017,7 +1024,8 @@
           (go
             (while true
               (let [row (<! chan-init-row)]
-                (om/update! app :id (:id row))
+                (when-let [id (:id row)]
+                  (om/update! app :id id))
                 (fill-app-fn row)))))

         (when chan-save
@@ -1029,7 +1037,10 @@
                   ;; если указан то сохранять в сеть
                   (ixnet/get-data
                    uri-save
-                   (assoc (app-to-row-fn) :id (@app :id))
+                   (let [a (app-to-row-fn)]
+                     (if-let [id (@app :id)]
+                       (assoc a :id id)
+                       a))
                    (fn [result]
                      (when post-save-fn (post-save-fn result))))
                   ;; иначе альтернитиваная функция


fix docstring formatting of code snippets

--- src/re_frame/std_interceptors.cljc
+++ src/re_frame/std_interceptors.cljc
@@ -29,11 +29,11 @@
   can be slow. So, you won't want this interceptor present in production
   code. So condition it out like this :

-    (re-frame.core/reg-event-db
-       :evt-id
-       [(when ^boolean goog.DEBUG re-frame.core/debug)]  ;; <-- conditional
-       (fn [db v]
-         ...))
+      (re-frame.core/reg-event-db
+         :evt-id
+         [(when ^boolean goog.DEBUG re-frame.core/debug)]  ;; <-- conditional
+         (fn [db v]
+           ...))

   To make this code fragment work, you'll also have to set goog.DEBUG to
   false in your production builds - look in `project.clj` of /examples/todomvc.
@@ -95,8 +95,8 @@

   These handlers take two arguments;  `db` and `event`, and they return `db`.

-  (fn [db event]
-     ....)
+      (fn [db event]
+         ....)

   So, the interceptor wraps the given handler:
      1. extracts two `:coeffects` keys: db and event
@@ -127,9 +127,9 @@

   These handlers take two arguments;  `coeffects` and `event`, and they return `effects`.

-  (fn [coeffects event]
-     {:db ...
-      :dispatch ...})
+      (fn [coeffects event]
+         {:db ...
+          :dispatch ...})

    Wrap handler in an interceptor so it can be added to (the RHS) of a chain:
      1. extracts `:coeffects`
@@ -157,8 +157,9 @@
   "Returns an interceptor which wraps the kind of event handler given to `reg-event-ctx`.
   These advanced handlers take one argument: `context` and they return a modified `context`.
   Example:
-     (fn [context]
-        (enqueue context [more interceptors]))"
+
+      (fn [context]
+         (enqueue context [more interceptors]))"
   [handler-fn]
   (->interceptor
     :id     :ctx-handler
@@ -187,18 +188,19 @@
   you might give to clojure's `update-in`.

   Examples:
-    (path :some :path)
-    (path [:some :path])
-    (path [:some :path] :to :here)
-    (path [:some :path] [:to] :here)
+
+      (path :some :path)
+      (path [:some :path])
+      (path [:some :path] :to :here)
+      (path [:some :path] [:to] :here)

   Example Use:

-    (reg-event-db
-      :event-id
-      (path [:a :b])  ;; used here, in interceptor chain
-      (fn [b v]       ;; 1st arg is now not db. Is the value from path [:a :b] within db
-        ... new-b))   ;; returns a new value for that path (not the entire db)
+      (reg-event-db
+        :event-id
+        (path [:a :b])  ;; used here, in interceptor chain
+        (fn [b v]       ;; 1st arg is now not db. Is the value from path [:a :b] within db
+          ... new-b))   ;; returns a new value for that path (not the entire db)

   Notes:
     1. `path` may appear more than once in an interceptor chain. Progressive narrowing.
@@ -323,11 +325,11 @@

   Usage:

-  (defn my-f
-    [a-val b-val]
-    ... some computation on a and b in here)
-
-  (on-changes my-f [:c]  [:a] [:b])
+      (defn my-f
+        [a-val b-val]
+        ... some computation on a and b in here)
+
+      (on-changes my-f [:c]  [:a] [:b])

   Put this Interceptor on the right handlers (ones which might change :a or :b).
   It will:


Fix reader conditional.

Fix reader conditional.

--- src/replikativ/crdt/lwwr/core.cljc
+++ src/replikativ/crdt/lwwr/core.cljc
@@ -19,7 +19,7 @@
 (defn set-register
   "Sets register value"
   [lwwr register]
-  (let [now #?(:clj (java.util.Date.) (js/Date.))]
+  (let [now #?(:clj (java.util.Date.) :cljs (js/Date.))]
     (-> lwwr
        (assoc-in [:state :register] register)
        (assoc-in [:state :timestamp] now)


Applied request to 404 page, too.

Applied request to 404 page, too.

--- web/src/sound_effector/views/index.clj
+++ web/src/sound_effector/views/index.clj
@@ -2,7 +2,8 @@
   (:require [sound-effector.views.layout :as layout]))

 (defn index [request]
-  (layout/common request
-                 "Sound Effector"
-                 [:h1 "Sound Effector"]
-                 [:div "I don't know what to say! :D"]))
+  (layout/common
+    request
+    "Sound Effector"
+    [:h1 "Sound Effector"]
+    [:div "I don't know what to say! :D"]))


Extract function for readability

Extract function for readability

--- src/onyx/scheduling/percentage_job_scheduler.clj
+++ src/onyx/scheduling/percentage_job_scheduler.clj
@@ -36,10 +36,13 @@
         init-allocations (min-allocations jobs-to-use n-peers)]
     (into {} (map (fn [j] {(:job j) (:capacity j)}) init-allocations))))

+(defn job-peer-count [replica job]
+  (apply + (map count (vals (get-in replica [:allocations job])))))
+
 (defmethod cjs/sort-job-priority :onyx.job-scheduler/percentage
   [replica jobs]
   (sort-by (juxt #(.indexOf ^clojure.lang.PersistentVector (vec (:jobs replica)) %)
-                 (fn [job] (apply + (map count (vals (get-in replica [:allocations job]))))))
+                 (partial job-peer-count replica))
            (:jobs replica)))

 (defmethod cjs/claim-spare-peers :onyx.job-scheduler/percentage


fix circular dependency detection

fix circular dependency detection

--- src/main/clojure/clojure/tools/analyzer/js.clj
+++ src/main/clojure/clojure/tools/analyzer/js.clj
@@ -292,12 +292,12 @@
 (def ^:private ^:dynamic *deps-map* {:path [] :deps #{}})
 (declare analyze-ns)

-(defn ensure-loaded [ns env]
+(defn ensure-loaded [[ns {:keys [refer]}] env]
+  (assert (not (contains? (:deps *deps-map*) ns))
+          (str "Circular dependency detected :" (conj (:path *deps-map*) ns)))
   (binding [*deps-map* (-> *deps-map*
-                         (update-in [:path] conj lib)
-                         (update-in [:deps] conj lib))]
-    (assert (every? #(not (contains? (:deps *deps-map*) %)) deps)
-            (str "Circular dependency detected" (:path *deps-map*)))
+                         (update-in [:path] conj ns)
+                         (update-in [:deps] conj ns))]
     (or (-> (env/deref-env) :namespaces ns)
         (-> (env/deref-env) :js-dependency-index (get (name ns)))
         (analyze-ns ns))))


fix typo

fix typo

--- src/main/clojure/clojure/tools/analyzer/js.clj
+++ src/main/clojure/clojure/tools/analyzer/js.clj
@@ -86,7 +86,7 @@
                                        [:namespaces ns :macro-aliases (symbol sym-ns)])]
                 (ns-resolve full-ns (symbol (name sym)))
                 (ns-resolve (symbol sym-ns) (symbol (name sym))))
-              (get-in (env/deref-env) [:namespaces ns :mcacro-mappings sym]))]
+              (get-in (env/deref-env) [:namespaces ns :macro-mappings sym]))]
     (when (:macro (meta var))
       var)))

@@ -200,7 +200,7 @@
 (declare analyze-ns)
 (defn ensure-loaded [ns env]
   (or (-> (env/deref-env) :namespaces ns)
-      (analyze-ns ns env)))
+      (analyze-ns ns)))

 (defn populate-env
   [{:keys [import require require-macros refer-clojure]} ns-name env]
@@ -286,7 +286,7 @@
   ([form env opts]
      (prewalk (analyze form env opts) cleanup)))

-(defn analyze-ns [ns env]
+(defn analyze-ns [ns]
   (env/ensure (global-env)
     (let [res (ns-resource ns)]
       (assert res (str "Can't find " ns " in classpath"))


Remove try-contexts macro, fix passing merged contexts to subtests

--- src/main/clojure/com/stuartsierra/lazytest.clj
+++ src/main/clojure/com/stuartsierra/lazytest.clj
@@ -76,22 +76,11 @@
   (or (:after c)
       (some has-after? (:parents c))))

-(defmacro #^{:private true} try-contexts
-  "Creates a try/finally block that opens contexts, stores their state
-  in states, and finally closes contexts.  active is the current map
-  of opened contexts."
-  [active contexts states & body]
-  `(let [active# ~active
-         contexts# ~contexts
-         merged# (reduce open-context active# contexts#)
-         ~states (map merged# contexts#)]
-     (try
-      ~@body
-      (finally
-       (reduce close-context merged#
-               ;; Only close contexts that weren't active at start:
-               (filter #(not (contains? active# %))
-                       (reverse contexts#)))))))
+(defn- close-local-contexts [contexts merged active]
+  (reduce close-context merged
+          ;; Only close contexts that weren't active at start:
+          (filter #(not (contains? active %))
+                  (reverse contexts))))

 ;;; Assertion types

@@ -108,12 +97,14 @@
 (deftype ContextualAssertion [contexts pred] :as this
   TestInvokable
     (invoke-test [active]
-      (try-contexts active contexts states
-        (if (apply pred states)
-          (TestPassed this states)
-          (TestFailed this states))
-        (catch Throwable t
-          (TestThrown this states t)))))
+      (let [merged (reduce open-context active contexts)
+            states (map merged contexts)]
+        (try
+         (if (apply pred states)
+           (TestPassed this states)
+           (TestFailed this states))
+         (catch Throwable t (TestThrown this states t))
+         (finally (close-local-contexts contexts merged active))))))

 ;;; Container types
@@ -133,13 +124,14 @@
     (invoke [] (invoke-test this {}))
   TestInvokable
     (invoke-test [active]
-      (try-contexts active contexts states
-        (let [results (map #(invoke-test % active) children)]
-          ;; Force non-lazy evaluation when contexts need closing:
-          (when (some has-after? contexts) (dorun results))
-          (TestResults this results))
-        (catch Throwable t
-          (TestThrown this states t)))))
+      (let [merged (reduce open-context active contexts)]
+        (try
+         (let [results (map #(invoke-test % merged) children)]
+           ;; Force non-lazy evaluation when contexts need closing:
+           (when (some has-after? contexts) (dorun results))
+           (TestResults this results))
+         (catch Throwable t (TestThrown this nil t))
+         (finally (close-local-contexts contexts merged active))))))

 ;;; Public API


Various fixes and added robustness to bad arguments

--- src/acyclic/awstools/core.clj
+++ src/acyclic/awstools/core.clj
@@ -15,6 +15,10 @@
 (timbre/refer-timbre)

+(defonce all-normal-instances (atom #{}))
+(defonce all-requests (atom #{}))
+
+
 (def cred (read-string (slurp "AWS.clj")))
 (apply defcredential (map cred [:access-key :secret-key :endpoint]))

@@ -45,20 +49,23 @@
      (cons v (chan->seq c terminate?)))))

-
-
 (def my-ec2-info nil)
 (def my-req nil)
 (def my-sns-topic nil)
 (def my-sqs-url nil)
 (def my-region "us-east-1")
+(def my-sub-public)
+(def my-sub-private)
 (defn slurp-ec2-info [f]
   (let [i (read-string (slurp f))]
     (alter-var-root (var acyclic.awstools.core/my-ec2-info) #(do % i))
     (alter-var-root (var acyclic.awstools.core/my-req) #(do % (:req i)))
     (alter-var-root (var acyclic.awstools.core/my-region) #(do % (:region i)))
     (alter-var-root (var acyclic.awstools.core/my-sns-topic) #(do % (:sns-topic i)))
-    (alter-var-root (var acyclic.awstools.core/my-sqs-url) #(do % (:sqs-url i))))
+    (alter-var-root (var acyclic.awstools.core/my-sqs-url) #(do % (:sqs-url i)))
+    (alter-var-root (var acyclic.awstools.core/my-sqs-url) #(do % (:sqs-url i)))
+    (alter-var-root (var acyclic.awstools.core/my-sub-private) #(do % (:subnet-private i)))
+    (alter-var-root (var acyclic.awstools.core/my-sub-public) #(do % (:subnet-public i))))
   nil
   )

@@ -97,11 +104,12 @@
 (def ^{:private true} paths
   {:zone    [:launch-specification :placement :availability-zone]
    :itype   [:launch-specification :instance-type]
-   :subnet  [:launch-specification :instance-network-interface-specification 0 :subnet-id]
+   :subnet  [:launch-specification :network-interfaces 0 :subnet-id]
    :group   [:launch-specification :network-interfaces 0 :groups 0]
    :public? [:launch-specification :network-interfaces 0 :associate-public-ip-address]
    :price   [:spot-price]
    :n       [:instance-count]
+   :key     [:launch-specification :key-name]
    :udata   [s->b64 :launch-specification :user-data]})

@@ -136,7 +144,8 @@
 (defn instance-info-map
   "Returns map of instance-id to map of information about instance."
   [is]
-  (let [res   (:reservations (describe-instances :instance-ids is))
+  (let [is    (vec is)
+        res   (:reservations (describe-instances :instance-ids is))
         ims   (map #(get-in % [:instances 0]) res)
         xms   (map (fn [im] (m-section im
                       [:instance-id
@@ -150,53 +159,65 @@
 about the request.  If an instance-id is available, the instance-info-map data
 will be merged in."
   [ids]
-  (let [descs  (describe-spot-instance-requests :spot-instance-request-ids ids)
-        sirs   (:spot-instance-requests descs)
-        sirs   (map (fn [rm] (m-section rm [[:request-id :spot-instance-request-id] :state :instance-id])) sirs)
-        is     (filter string? (map :instance-id sirs))
-        ims    (instance-info-map is)
-        sirs   (map #(merge % (ims (:instance-id %))) sirs)]
-    (mseq->m sirs :request-id)))
-
-
-(defn request-instances [rs]
-  (let [d (describe-spot-instance-requests :spot-instance-request-ids rs)]
-    (map :instance-id (:spot-instance-requests d))))
+  (if-not (seq ids)
+    {}
+    (let [ids    (vec ids)
+          descs  (describe-spot-instance-requests :spot-instance-request-ids ids)
+          sirs   (:spot-instance-requests descs)
+          sirs   (map (fn [rm] (m-section rm [[:request-id :spot-instance-request-id] :state :instance-id])) sirs)
+          is     (filter string? (map :instance-id sirs))
+          ims    (instance-info-map is)
+          sirs   (map #(merge % (ims (:instance-id %))) sirs)]
+      (mseq->m sirs :request-id))))
+

 (defn request-spots [req & opts]
   (let [req    (apply ph-assoc req paths opts)
         args   (apply concat (seq req))
         _      (debug "Spot request" (pr-str args))
-        rs     (apply request-spot-instances args)]
-    (map :spot-instance-request-id  (:spot-instance-requests rs))))
+        rs     (apply request-spot-instances args)
+        rs     (map :spot-instance-request-id  (:spot-instance-requests rs))]
+    (debug "Requests:" (pr-str (vec rs)))
+    (swap! all-requests #(apply conj % rs))
+    rs))

 (defn terminate [is]
-  (let [t (terminate-instances :instance-ids is)]
-    (debug t)
-    t))
+  (when (seq is)
+    (let [is (vec is)
+          t (terminate-instances :instance-ids is)]
+      (debug t)
+      t)))

 (defn stop [is]
-  (let [t (stop-instances :instance-ids is)]
-    (debug t)
-    t))
+  (when (seq is)
+    (let [is (vec is)
+          t  (stop-instances :instance-ids is)]
+      (swap! all-normal-instances #(apply disj % is))
+      (debug t)
+      t)))

 (defn start [is]
-  (let [t (start-instances :instance-ids is)]
-    (debug t)
-    t))
+  (when (seq is)
+    (let [is (vec is)
+          t (start-instances :instance-ids is)]
+      (swap! all-normal-instances #(apply conj % is))
+      (debug t)
+      t)))

 (defn cancel-requests
   "Cancel the specified requests; if instance-id information is available, also stops the instances."
   [rs]
-  (let [ds (:spot-instance-requests (describe-spot-instance-requests :spot-instance-request-ids rs))
-        is (filter (complement nil?) (map :instance-id ds))
-        cr (:cancelled-spot-instance-requests (cancel-spot-instance-requests :spot-instance-request-ids rs))
-        ci (and (seq is) (terminate is))]
-    [cr ci]))
-
-
-(def ids->chs (atom {}))
+  (when (seq rs)
+    (let [rs (vec rs)
+          cr (:cancelled-spot-instance-requests (cancel-spot-instance-requests :spot-instance-request-ids rs))
+          ds (:spot-instance-requests (describe-spot-instance-requests :spot-instance-request-ids rs))
+          is (filter (complement nil?) (map :instance-id ds))
+          ci (and (seq is) (terminate is))]
+      (swap! all-requests #(apply disj % rs))
+      [cr ci])))
+
+(defonce ids->chs (atom {}))

 (defn- notify-chan
   "Return a channel that will receive status information extracted from send-up messages
@@ -256,8 +277,6 @@
        (every? string? vs)
        (every? pos? (map count vs))))

-
-
 (defn- really-up? [rs->info rs]
   (let [info (get rs->info rs)]
     (and
@@ -265,44 +284,54 @@
      (string? (:ip info))
      (pos? (count (:ip info))))))

+
 (defn bring-up-spots
   "Bring up at least nmin instances as specified by reqmap.  The sequence
 of cmds will be excecuted at startup.  Any other request-spot-instance arguments
 can be specified optionally."
   [reqmap nmin cmds & opts]
-  (let [id  (.toString (UUID/randomUUID))
+  (let [[opts [tot no-cancel?]] (extract-opts opts [:minutes :no-cancel])
+        _  (debug opts tot no-cancel?)
+        tot (or tot 5)
+        id  (.toString (UUID/randomUUID))
         cmd (str (send-up id) (clojure.string/join "\n" cmds) "\n")
         req (apply ph-assoc reqmap paths opts)
         req (ph-assoc req paths :udata cmd)
         n   (ph-get reqmap paths :n)
         req (if (<= nmin n) req (ph-assoc req paths :n nmin))
-        _   (debug "Requesting:" id req)
+        _   (debug "Requesting:" id (pr-str req))
         cl  (notify-chan id)
         rs  (request-spots req)
-        to  (timeout (* 5 60 1000))]
-    (debug "Spot requests:" rs)
+        to  (timeout (* tot 60 1000))]
     (async/go-loop [i 0]
       (if (>= i nmin)
-        (let [rs->info (request-info-map rs)
+        (let [_ (debug 1)
+              rs->info (request-info-map rs)
+              _ (debug rs->info)
               pred     (partial really-up? rs->info)
               rs-up    (filter pred rs)
+              _ (debug rs-up)
               rs-dn    (filter (complement pred) rs)]
+          (debug "Brought up" i "spots: "(pr-str [rs-up rs-dn rs->info]))
           (close-notify-chan! id)
           (cancel-requests rs-dn)
-          (map rs->info rs-up))
+          (m-section rs->info rs-up))
         (let [[v c] (async/alts! [cl to])]
           (cond
-           (= c to) (do (info "Timeout on spot request:" req)
+           (= c to) (when (not  no-cancel?)
+                      (info "Timeout on spot request:" req)
                       (close-notify-chan! id)
                       (cancel-requests rs)
                       nil)
            (= c cl) (recur (inc i))))))))

-(defn bring-up-instances [is]
-  (let [n  (count is)
+(defn bring-up-instances [is & opts]
+  (let [[_ [tot no-cancel?]] (extract-opts opts [:minutes :no-cancel])
+        tot (or tot 5)
+        n  (count is)
         id (.toString (UUID/randomUUID))
         cl (notify-chan id)
-        to (timeout (* 5 60 1000))]
+        to (timeout (* tot 5 60 1000))]
     (doseq [i is]
             (modify-instance-attribute :instance-id i :user-data (s->b64 (send-up id))))
     (start is)
@@ -311,11 +340,12 @@
         (instance-info-map is)
         (let [[v c] (async/alts! [cl to])]
           (cond
-           (= c to) (do (info "Timeout on instance request:" is)
+           (= c to) (do (when (not no-cancel?) "Timeout on instance request:" is)
                         (close-notify-chan! id)
                         (stop is)
                         nil)
-           (= c cl) (recur (dec i))))))))
+           (= c cl) (do (debug "Received" v)
+                        (recur (dec i)))))))))

 (def ag (ssh/ssh-agent {}))
@@ -385,4 +415,31 @@
     c))

-
+(defn clean-up-volumes []
+  (let [vols (:volumes (describe-volumes))
+        bad  (filter #(-> % :attachments seq not) vols)
+        ids  (map :volume-id bad)]
+    (when (seq ids)
+      (info "Deleting volumes:" ids)
+      (doseq [v ids]
+        (delete-volume :volume-id v)))))
+
+(defn clean-up []
+  (let [rs   (seq @all-requests)
+        is   (seq @all-normal-instances)]
+    (when (seq rs)
+      (info "Canceling/terminating:" rs)
+      (cancel-requests rs)
+      (reset! all-requests #{}))
+    (when (seq is)
+      (info "Stopping:" is)
+      (stop is)
+      (reset! all-normal-instances #{}))
+    (Thread/sleep 1000)
+    (clean-up-volumes)
+    (when-let [c (:sqs-listen @ids->chs)]
+      (info "Bringing down listener" c)
+      (close! c))
+    (reset! ids->chs {})))
+
+