Remove unnecessary required namespaces.

Remove unnecessary required namespaces.

--- src/videotest/hex/hex.clj
+++ src/videotest/hex/hex.clj
@@ -1,8 +1,6 @@
 (ns videotest.hex.hex
   (:require
-   [quil.applet :as qa :refer [applet-close]]
-   [quil.core :as q]
-   [quil.middleware :as m]))
+   [quil.core :as q]))

 (defn grid-coords [col-bins row-bins]


Add 'comment to core to show how to initialize the DB with the Aspire tables.

--- src/aspire/core.clj
+++ src/aspire/core.clj
@@ -1,6 +1,12 @@
-(ns aspire.core)
+(ns aspire.core
+  (:require [jdbc-pg-init.core :as jpi]
+            [clojure.edn :as edn]))

-(defn foo
-  "I don't do a whole lot."
-  [x]
-  (println x "Hello, World!"))
+(def schema (edn/read-string (slurp "schema.edn")))
+
+(comment
+  (use '[clojure.tools.namespace.repl :only (refresh)])
+  (def db (edn/read-string (slurp "sample-config.edn")))
+  (def db (assoc db :password "" :subname "//kirk.office.vlacs.org/moodletest2_vlacs_org"))
+  (jpi/init! db schema)
+  )


Corrected a bug

Corrected a bug

lobos.config/db was not called as a function

--- src/lobos/migrations.clj
+++ src/lobos/migrations.clj
@@ -22,10 +22,10 @@
                     (drop (table :types) :cascade)))

 (defmigration add-basic-types
-              (up [] (sql/insert! lobos.config/db :types
+              (up [] (sql/insert! (lobos.config/db) :types
                                   {:id 1 :name "Unknown"}
                                   {:name "Bar"}
                                   {:name "Pub"}
                                   {:name "Take Away"} ))
-              (down [] (sql/delete! lobos.config/db :types [])))
+              (down [] (sql/delete! (lobos.config/db) :types [])))


cleanup

cleanup

--- src/babel/over.cljc
+++ src/babel/over.cljc
@@ -1,23 +1,42 @@
 (ns babel.over
-  (:refer-clojure :exclude [get get-in resolve find parents])
+  (:refer-clojure :exclude [get-in])
   (:require
    [babel.exception :refer [exception]]
-   [babel.lexiconfn :refer [get-fail-path]]
-   [clojure.string :as string]
    #?(:clj [clojure.tools.logging :as log])
    #?(:cljs [babel.logjs :as log])
-   [dag_unify.core :refer [copy fail-path get-in unify unifyc
+   [dag_unify.core :refer [copy get-in unify
                            ;; temporary: until we move (truncate) from here to dag_unify, we
                            ;; need these three:
-                           deserialize dissoc-paths serialize
-]]))
-
-;; TODO: need better debugging throughout this file to diagnose generation failures.
-;; using (get-fail-path) is one example.
+                           deserialize dissoc-paths serialize]]))

 ;; use map or pmap.
 (def ^:const mapfn pmap)
-(def ^:dynamic *extra-diagnostics* false)
+
+(declare overc)
+(declare overh)
+(declare overhc)
+
+;; TODO: distinguish between when:
+;; 1) called with only a child1 (no child2),
+;; 2) called with both a child1 and a child2, but child2's supplied value is nil:
+;;    should be treated the same as empty list.
+(defn over [parents child1 & [child2]]
+  (cond (map? parents)
+        (over (list parents) child1 child2)
+
+        true
+        (mapcat
+         (fn [parent]
+           (let [[head comp] (if (= (:first parent) :head)
+                               [child1 child2]
+                               [child2 child1])]
+             (overhc parent head comp)))
+         parents)))
+
+(defn overhc [parent head comp]
+  (-> parent
+      (overh head)
+      (overc comp)))

 (defn overh
   "add given head as the head child of the phrase: parent."
@@ -65,51 +84,8 @@
                                                                                "(no pred for comp)"))))
          (list result))))))

-(defn overhc [parent head comp]
-  (-> parent
-      (overh head)
-      (overc comp)))
-
-;; TODO: distinguish between when:
-;; 1) called with only a child1 (no child2),
-;; 2) called with both a child1 and a child2, but child2's supplied value is nil:
-;;    should be treated the same as empty list.
-(defn over [parents child1 & [child2]]
-  (cond (map? parents)
-        (over (list parents) child1 child2)
-
-        true
-        (mapcat
-         (fn [parent]
-           (let [[head comp] (if (= (:first parent) :head)
-                               [child1 child2]
-                               [child2 child1])]
-             (overhc parent head comp)))
-         parents)))
-
-(defn show-bolt [bolt language-model]
-  (if (nil? bolt)
-    (exception (str "don't call show-bolt with bolt=null."))
-    (let [morph (:morph language-model)]
-      (if (nil? morph)
-        (exception (str "don't call show-bolt with morph=null."))
-        (str "[" (get-in bolt [:rule])
-             " "
-             (let [head-bolt (get-in bolt [:head])]
-               (if (not (nil? head-bolt))
-                 (let [rest-str (show-bolt (get-in bolt [:head]) language-model)]
-                   (if (not (nil? rest-str))
-                     (str " -> " rest-str)))))
-             "]")))))
-
-(defn subpath? [path1 path2]
-  "return true if path1 is subpath of path2."
-  (if (empty? path1)
-    true
-    (if (= (first path1) (first path2))
-      (subpath? (rest path1)
-                (rest path2))
-      false)))
+(declare show-bolt)
+(declare subpath?)

 (defn truncate [input truncate-paths language-model]
   (log/debug (str "truncating@" truncate-paths ":" (show-bolt input language-model)))
@@ -138,3 +114,28 @@
 (defn truncate-expressions [expressions truncate-paths language-model]
   (map #(truncate % truncate-paths language-model)
        expressions))
+
+
+(defn show-bolt [bolt language-model]
+  (if (nil? bolt)
+    (exception (str "don't call show-bolt with bolt=null."))
+    (let [morph (:morph language-model)]
+      (if (nil? morph)
+        (exception (str "don't call show-bolt with morph=null."))
+        (str "[" (get-in bolt [:rule])
+             " "
+             (let [head-bolt (get-in bolt [:head])]
+               (if (not (nil? head-bolt))
+                 (let [rest-str (show-bolt (get-in bolt [:head]) language-model)]
+                   (if (not (nil? rest-str))
+                     (str " -> " rest-str)))))
+             "]")))))
+
+(defn subpath? [path1 path2]
+  "return true if path1 is subpath of path2."
+  (if (empty? path1)
+    true
+    (if (= (first path1) (first path2))
+      (subpath? (rest path1)
+                (rest path2))
+      false)))


add more head pre-checks

add more head pre-checks

--- src/babel/over.cljc
+++ src/babel/over.cljc
@@ -98,6 +98,12 @@
   (or
    (fail? (unifyc (get-in parent [:head :synsem :infl] :top)
                   (get-in child [:synsem :infl] :top)))
+   (fail? (unifyc (get-in parent [:head :synsem :subcat] :top)
+                  (get-in child [:synsem :subcat] :top)))
+   (fail? (unifyc (get-in parent [:head :phrasal] :top)
+                  (get-in child [:phrasal] :top)))
+   (fail? (unifyc (get-in parent [:head :synsem :sem :reflexive] :top)
+                  (get-in child [:synsem :sem :reflexive] :top)))
    (fail? (unifyc (get-in parent [:head :synsem :sem :tense] :top)
                   (get-in child [:synsem :sem :tense] :top)))
    (fail? (unifyc (get-in parent [:synsem :cat] :top)
@@ -124,8 +130,9 @@
   (let [morph (if morph morph (fn [x] x))]
     (log/trace (str "moreover-head (candidate) parent: [" (get-in parent [:rule]) "] '" (morph parent) "' sem:    " (strip-refs (get-in parent '(:synsem :sem) :no-semantics))))
     (log/trace (str "moreover-head (candidate) head child: [" (get-in parent [:child]) "] '" (morph child) "' sem:" (strip-refs (get-in child '(:synsem :sem) :top))))
-    (let [result
-          (if (head-pre-checks parent child)
+    (let [head-pre-checks (head-pre-checks parent child)
+          result
+          (if head-pre-checks
             :fail
             (unify
              (copy parent)
@@ -147,6 +154,9 @@

         ;; else: attempt to put head under parent failed: provide diagnostics through log/debug messages.
         (do
+          (if (not (= true head-pre-checks))
+            (log/warn (str "moreover-head: pre-checked missed: fail-path-between:"
+                           (fail-path-between parent {:head child}))))
           (if (= *extra-diagnostics* true)
             (let [fail-path (get-fail-path (get-in parent [:head]) child)]
               (log/trace (str "moreover-head: failed to add head: '" (morph child) "' to parent: " (get-in parent [:rule])))


added wait state as camera initializes

added wait state as camera initializes

--- src/cellf/core.cljs
+++ src/cellf/core.cljs
@@ -61,11 +61,14 @@
 (defn inversions [grid]
   (let [cells (order grid)]
     (->>
-      (range (count grid))
+      grid
+      count
+      range
       (map
         (fn [n]
           (->>
-            (drop n cells)
+            cells
+            (drop n)
             (filter #(< % (nth cells n)))
             count)))
       (reduce +))))
@@ -86,7 +89,8 @@

 (defn make-cell-list [size]
   (->
-    (sq size)
+    size
+    sq
     dec
     range
     vec
@@ -284,6 +288,7 @@

 (defn get-camera! []
+  (swap! app-state assoc :camera-waiting? true)
   (take!
     (media/get-media)
     (fn [{:keys [status data]}]
@@ -336,7 +341,7 @@

 (defn modal [{:keys [stream media-error show-about? result-gif cells win-state
-                     grid-size tick-ms gif-building?] :as app}]
+                     grid-size tick-ms gif-building? camera-waiting?] :as app}]
   (let [winner?    (and cells (= cells win-state))
         no-stream? (not stream)]
     (dom/div
@@ -350,7 +355,10 @@
             (if (= media-error :denied)
               (:cam-denied strings)
               (:cam-failed strings))
-            (dom/button #js {:onClick get-camera!} "try again")
+            (apply dom/button
+              (if camera-waiting?
+                [#js {:className "wait"} "hold on"]
+                [#js {:onClick get-camera!} "try again"]))
             (dom/button #js {:onClick #(js/open source-url)} "view cellf source"))

         no-stream?
@@ -358,7 +366,10 @@
             (dom/h1 nil "Hi")
             (dom/p nil (:intro1 strings))
             (dom/p nil (:intro2 strings))
-            (dom/button #js {:onClick get-camera!} "✔ ok"))
+            (apply dom/button
+              (if camera-waiting?
+                [#js {:className "wait"} "hold on"]
+                [#js {:onClick get-camera!} "✔ ok"])))

         result-gif
           (dom/div nil


added missing import

added missing import

--- src/cellf/core.cljs
+++ src/cellf/core.cljs
@@ -1,7 +1,7 @@
 (ns ^:figwheel-always cellf.core
   (:require [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
-            [cljs.core.async :refer [<! >! take! put! chan timeout]]
+            [cljs.core.async :refer [<! >! take! put! alts! chan timeout]]
             [cellf.media :as media]
             [cellf.strings :refer [strings]])
   (:require-macros [cljs.core.async.macros :refer [go go-loop]]))


Rendering possible game placements

Rendering possible game placements

- the possible game function is slow and needs to be memoized/optimized

--- src/cljs/board.cljs
+++ src/cljs/board.cljs
@@ -43,8 +43,7 @@

 (defn render-ghosts
   [game]
-  (for [valid-placement [[:black [10 10]]
-                         [:white [10 9]]]]
+  (for [valid-placement (game/possible-placements @game)]
     [render-ghost game valid-placement]))

 (defn render


Fixing `test-conexp`

Fixing `test-conexp`

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

--- src/conexp/base.clj
+++ src/conexp/base.clj
@@ -109,17 +109,38 @@
 (require 'clojure.test)

 (defn test-conexp
-  "Runs tests for conexp. If with-contrib? is given and true, tests
-  conexp.contrib.tests too."
-  ([] (test-conexp false))
-  ([with-contrib?]
-     (if with-contrib?
-       (do (require 'conexp.tests
-                    'conexp.contrib.tests)
-           (clojure.test/run-tests 'conexp.tests
-                                   'conexp.contrib.tests))
-       (do (require 'conexp.tests)
-           (clojure.test/run-tests 'conexp.tests)))))
+  "Runs tests for conexp-clj."
+  ([]
+   (let [nss '[conexp.tests.base
+               conexp.tests.math.optimize
+               conexp.tests.math.statistics
+               conexp.tests.fca.contexts
+               conexp.tests.fca.exploration
+               conexp.tests.fca.implications
+               conexp.tests.fca.lattices
+               conexp.tests.fca.many-valued-contexts
+               conexp.tests.fca.misc
+               conexp.tests.io.contexts
+               conexp.tests.io.lattices
+               conexp.tests.io.layouts
+               conexp.tests.io.many-valued-contexts
+               conexp.tests.io.util
+               conexp.tests.layouts.base
+               conexp.tests.layouts.common
+               conexp.tests.layouts.force
+               conexp.tests.layouts.freese
+               conexp.tests.layouts.layered
+               conexp.tests.layouts.util
+               conexp.contrib.tests.algorithms
+               conexp.contrib.tests.algorithms.concepts
+               conexp.contrib.tests.algorithms.generators
+               conexp.contrib.tests.algorithms.titanic
+               conexp.contrib.tests.factor-analysis
+               conexp.contrib.tests.fuzzy.sets
+               conexp.contrib.tests.retracts
+               conexp.contrib.tests.util.general-sorted-sets]]
+     (apply require nss)
+     (apply clojure.test/run-tests nss))))

 (defmacro with-testing-data
   "Expects for all bindings the body to be evaluated to true. bindings


Make kibit happy. Thanks kibit!

Make kibit happy. Thanks kibit!

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -150,7 +150,7 @@
 (defn- periods-for-metric
   "Given the specified metric, return a sequence of all the periods in the data for that metric, sorted by most recent."
   [metric data]
-  (when-let [periods (vec (filter #(= (:slug %) (:slug metric)) data))]
+  (when-let [periods (filterv #(= (:slug %) (:slug metric)) data)]
     (reverse (sort-by :period periods))))

 (defn growth-metrics [topic currency]


Use concat instead of conj to create the notification url to make sure the order is mantained.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -663,7 +663,7 @@
                       :team-id (:team-id org)} ;; Let's read the team-id from the org to avoid problems on multiple org users
         id-token (jwt/generate-id-token token-claims config/passphrase)
         url-parts (cond-> [origin-url org-url-part]
-                    board-url-part (conj board-url-part)
+                    board-url-part (concat [board-url-part])
                     entry-uuid (concat ["post" entry-uuid])
                     interaction-id (concat ["comment" interaction-id]))
         base-url (s/join "/" url-parts)


make connect! and disconnect! thread-binding friendly

--- src/main/clojure/powderkeg/core.clj
+++ src/main/clojure/powderkeg/core.clj
@@ -67,12 +67,17 @@

 (declare ^:dynamic ^:powderkeg/no-sync ^org.apache.spark.api.java.JavaSparkContext *sc*)

+(defn- alter-var [v f & args]
+  (if (thread-bound? v)
+        (var-set v (apply f @v args))
+        (apply alter-var-root v f args)))
+
 (defn connect!
   "Connects to a spark cluster. Closes existing connection.
    The no-arg version will uses the default settings (as set for example by spark-submit)."
   ([] (connect! nil))
   ([master-url]
-    (alter-var-root #'*sc*
+    (alter-var #'*sc*
       (fn [sc]
         (try
           (.close sc)
@@ -95,7 +100,7 @@
           (org.apache.spark.api.java.JavaSparkContext. conf))))))

 (defn disconnect! []
-  (alter-var-root #'*sc*
+  (alter-var #'*sc*
     (fn [sc]
       (try
         (.close sc)


did a bit more cleanup. Up through progress control

--- src/main/untangled/ui/elements.cljc
+++ src/main/untangled/ui/elements.cljc
@@ -273,26 +273,6 @@
                        (dissoc :size :state :kind))]
     (dom/input (clj->js attrs))))

-
-(defn ui-icon-bar
-  "Render an icon bar using a vector of icons (each a map of attributes).
-   Can optionally render vertically and/or shifting.
-   Normal HTML/React attributes can be included, and should be a cljs map (not a js object).
-
-   `:orientation` :vertical or :horizontal (default)
-   `:shifting` :true or :false (default)
-
-   all parameters are optional
-   "
-  [{:keys [className orientation shifting] :as props :or {className ""}} & children]
-  (let [user-classes    (get props :className "")
-        top-level-class (cond-> (str user-classes " c-iconbar")
-                          (= orientation :vertical) (str " c-iconbar--rail")
-                          (= shifting :true) (str " c-iconbar--shifting"))]
-    (dom/div #js {}
-      (apply dom/nav #js {:className top-level-class} children))))
-
-
 (defn ui-icon
   "Render an icon. Normal HTML/React attributes can be included, and should be a cljs map (not a js object).

@@ -317,19 +297,47 @@
                                  (icon glyph)
                                  child)))))

+(defn ui-icon-bar
+  "Render an icon bar using a vector of icons (each a map of attributes).
+   Can optionally render vertically and/or shifting.
+   Normal HTML/React attributes can be included, and should be a cljs map (not a js object).
+
+   `:orientation` :vertical or :horizontal (default)
+   `:shifting` true or false (default)
+
+   TODO: Example, talk about children
+
+   all parameters are optional
+   "
+  [{:keys [className orientation shifting] :as props :or {className ""}} & children]
+  (let [user-classes    (get props :className "")
+        top-level-class (cond-> (str user-classes " c-iconbar")
+                          (= orientation :vertical) (str " c-iconbar--rail")
+                          shifting (str " c-iconbar--shifting"))]
+    (dom/div #js {:className top-level-class}
+      (apply dom/nav #js {:className top-level-class} children))))
+
+(defn ui-icon-bar-item
+  "TODO: "
+  ([{:keys [className glyph label active] :as props :or {className "" label ""}}]
+   (ui-icon-bar-item props (ui-icon {:glyph glyph})))
+  ([{:keys [className label active] :as props :or {className ""}} icon-child]
+   (let [attrs (clj->js {(str className " c-iconbar__item " (when active "is-active"))})]
+     (dom/button attrs
+       icon-child
+       (dom/span #js {:className "c-iconbar__label"} label)))))

 (defn ui-label
   "Render the given children within a label. Normal HTML/React attributes can be included, and should be a cljs map (not a js object).

-  `:color` :none (default), :positive, :informative, :informative-alt, :neutral, :live, :alterable, :negative
+  `:color` :none (default), :primary, :accent
   "
   [{:keys [className color] :as props :or {className ""}} & children]
   (let [legal-colors #{:primary :accent}
         classes      (cond-> className
                        :always (str " c-label")
                        (contains? legal-colors color) (str " c-label--" (name color)))
-        props        (-> props
-                       (dissoc :color)
+        props        (-> (dissoc props :color)
                        (assoc :className classes))]
     (apply dom/span (clj->js props) children)))

@@ -341,22 +349,20 @@
   [{:keys [className color] :as props :or {className ""}}]
   (let [legal-colors #{:primary :accent}
         user-classes (get props :className "")
-        classes      (cond-> user-classes
-                       :always (str " c-loader")
+        classes      (cond-> (str user-classes " c-loader")
                        (contains? legal-colors color) (str " c-loader--" (name color)))
-        props        (cond-> props
-                       :always (assoc :className classes)
-                       :always (dissoc :color))]
+        props        (-> props
+                       (assoc :className classes)
+                       (dissoc :color))]
     (dom/div (clj->js props))))
-

 (defn ui-message
   "Render the given children within a message. Normal HTML/React attributes can be included, and should be a cljs map (not a js object).

-  `:color` :none (default), :neutral, :alert, :success, :warning
+  `:color` :none(default), :alert, :success, :warning, :informative
   "
   [{:keys [className color] :as props :or {className ""}} & children]
-  (let [legal-colors #{:neutral :alert :success :warning}
+  (let [legal-colors #{:informative :alert :success :warning}
         classes      (cond-> (str className " c-message")
                        (contains? legal-colors color) (str "--" (name color)))
         props        (-> props
@@ -364,38 +370,34 @@
                        (dissoc :color))]
     (apply dom/div (clj->js props) children)))

-
 (defui ModalTitle
   Object
   (render [this]
     (dom/div #js {:className "c-modal__title"} (om/children this))))
-

 (def ui-modal-title
   "Render a notification title. Should only be used in a ui-modal"
   (om/factory ModalTitle))

-
 (defui ModalBody
   Object
   (render [this]
     (dom/div #js {:className "c-modal__content"} (om/children this))))
+
 (def ui-modal-body
   "Render a notification body. Should only be used in a ui-modal"
   (om/factory ModalBody))

-
 (defui ModalActions
   Object
   (render [this]
     (dom/div #js {:className "c-modal__actions"} (om/children this))))
-

 (def ui-modal-actions
   "Render a notification action area. Should only be used in a ui-modal"
   (om/factory ModalActions))

-
+; TODO: Rename to Dialog, modal as a boolean attribute?
 (defui Modal
   Object
   (render [this]
@@ -407,7 +409,6 @@
           state        (when active " is-active")
           user-classes (get props :className "")
           classes      (-> (str user-classes " c-modal" state))]
-
       (dom/div #js {}
         (dom/div #js {:className classes}
           (dom/div #js {:className "c-modal__card"}
@@ -416,7 +417,6 @@
             (when actions actions)))
         (dom/div #js {:className (str "c-backdrop" state)})))))

-
 (def ui-modal
   "Render a modal. Normal HTML/React attributes can be included, and should be a cljs map (not a js object).

@@ -430,7 +430,6 @@
   The `title-nodes` can be any inline DOM (or just a string), as can body-nodes.  Action-notes must include at least one button that
   closes the modal or redirects the user."
   (om/factory Modal))
-

 (defui NotificationTitle
   Object
@@ -478,33 +477,33 @@
 (def ui-notification
   "Render a notification. Normal HTML/React attributes can be included, and should be a cljs map (not a js object).

+  `:onClose` (optional) - A function to call when the notification's close button is pressed
   `:type` :none (default), :success, :warning, :error, :informative
   `:size` :normal (default), :wide

   You should include two children of this node:

-  (ui-notification {}
-    (ui-notification-title {} title-nodes)
-    (ui-notification-body {} body-nodes))
+  (when show-notification?
+    (ui-notification {:onClose (fn [] (om/transact! this `[(my-close-notification-mutation)]))}
+      (ui-notification-title {} title-nodes)
+      (ui-notification-body {} body-nodes)))

   The `title-nodes` can be any inline DOM (or just a string), as can body-nodes."
   (om/factory Notification))

-
 (defn ui-progress
-  "Render a progress element. Props is a normal clj(s) map with React/HTML attributes plus:
+  "Render an HTML progress element. Props is a normal clj(s) map with React/HTML attributes plus:

   `:className` - additional class stylings to apply to the progress element
-  `:id` - Name of the progress control
-  "
-  [{:keys [id style] :or {id ""} :as attrs}]
-  (let [user-classes (get attrs :className "")
-        classes      (cond-> (str user-classes " c-progress "))
-        attrs        (cond-> attrs
-                       :always (assoc :className classes)
-                       :always (assoc :id (name id)))]
+  `:max` - The integer value that we're targeting for completion
+  `:value` - The integer value of where we're at
+
+  If neither max or value are given, it will render as an indeterminate progress (in progress, but not complete).
+  "
+  [{:keys [max value className] :or {className ""} :as props}]
+  (let [classes (str className " c-progress ")
+        attrs   (assoc props :className classes)]
     (dom/progress (clj->js attrs))))
-

 (defn ui-radio
   "Render a radio (not the label). Props is a normal clj(s) map with React/HTML attributes plus:


docstrig for make-interpreter, core-stacks

--- src/push/interpreter.clj
+++ src/push/interpreter.clj
@@ -3,18 +3,25 @@

 (defrecord Interpreter [program stacks])

-(def core-stacks {:boolean '()
-                  :char '()
-                  :code '()
-                  :input '()
-                  :integer '()
-                  :exec '()
-                  :float '()
-                  :string '()
-                  })
+
+(def core-stacks
+  "the basic types central to the Push language"
+    {:boolean '()
+    :char '()
+    :code '()
+    :input '()
+    :integer '()
+    :exec '()
+    :float '()
+    :string '()
+    })
+

 (defn make-interpreter
-  "creates a new Interpreter record"
+  "creates a new Interpreter record
+  If no arguments are given, the Interpreter has an empty :program and ony core :stacks;
+  if a program is given, it is stored;
+  if a hashmap of stack values is given, that is merged onto the core empty stacks."
   ([] (make-interpreter []))
   ([program] (->Interpreter program core-stacks))
   ([program stacks] (->Interpreter program (merge core-stacks stacks)))


Improve internal errors.

Improve internal errors.

--- src/re_frame/events.cljc
+++ src/re_frame/events.cljc
@@ -14,21 +14,21 @@
 (defn- flatten-and-remove-nils
   "`interceptors` might have nested collections, and contain nil elements.
   return a flat collection, with all nils removed.
-  This function is 9/10 about giving good error messages"
+  This function is 9/10 about giving good error messages."
   [id interceptors]
   (let [make-chain  #(->> % flatten (remove nil?))]
     (if-not debug-enabled?
       (make-chain interceptors)
       (do    ;; do a whole lot of development time checks
         (when-not (coll? interceptors)
-          (console :error (str "re-frame: when registering " id ", expected a collection of interceptors, got:") interceptors))
+          (console :error "re-frame: when registering " id ", expected a collection of interceptors, got: " interceptors))
         (let [chain (make-chain interceptors)]
           (when (empty? chain)
-            (console :error (str "re-frame: when registering" id ", given an empty interceptor chain")))
+            (console :error "re-frame: when registering " id ", given an empty interceptor chain"))
           (when-let [not-i (first (remove interceptor/interceptor? chain))]
             (if (fn? not-i)
-              (console :error (str "re-frame: when registering " id ", got a function instead of an interceptor. Did you provide old style middleware by mistake? Got:") not-i)
-              (console :error (str "re-frame: when registering " id ", expected interceptors, but got:") not-i)))
+              (console :error "re-frame: when registering " id ", got a function instead of an interceptor. Did you provide old style middleware by mistake? Got: " not-i)
+              (console :error "re-frame: when registering " id ", expected interceptors, but got: " not-i)))
           chain)))))

@@ -39,7 +39,8 @@
    at any level,so process this structure into a simple, nil-less vector
    before registration.

-   An `event handler` will likely be at the end of the chain (wrapped in an interceptor)."
+   Typically, an `event handler` will be at the end of the chain (wrapped
+   in an interceptor)."
   [id interceptors]
   (register-handler kind id (flatten-and-remove-nils id interceptors)))

@@ -50,12 +51,12 @@
 (def ^:dynamic *handling* nil)    ;; remember what event we are currently handling

 (defn handle
-  "Given an event vector, look up the associated intercepter chain, and execute it."
+  "Given an event vector `event-v`, look up the associated interceptor chain, and execute it."
   [event-v]
   (let [event-id  (first-in-vector event-v)]
     (if-let [interceptors  (get-handler kind event-id true)]
       (if *handling*
-        (console :error (str "re-frame: while handling \"" *handling* "\", dispatch-sync was called for \"" event-v "\". You can't call dispatch-sync within an event handler."))
+        (console :error "re-frame: while handling \"" *handling* "\", dispatch-sync was called for \"" event-v "\". You can't call dispatch-sync within an event handler.")
         (binding [*handling*  event-v]
           (trace/with-trace {:operation event-id
                              :op-type   kind


make run-queue more compact

make run-queue more compact

--- src/re_frame/router.cljs
+++ src/re_frame/router.cljs
@@ -111,15 +111,13 @@
   ;; Be aware that events might have metadata which will pause processing.
   (-run-queue
     [this]
-    (let [queue-length (count queue)]
-      (loop [n queue-length]
-        (if (zero? n)
-          (-fsm-trigger this :finish-run nil)
-          (let [event-v (peek queue)]
-            (if-let [later-fn (some later-fns (keys (meta event-v)))]
-              (-fsm-trigger this :pause-run later-fn)
-              (do (-process-1st-event this)
-                  (recur (dec n)))))))))
+    (loop [n (count queue)]
+      (if (zero? n)
+        (-fsm-trigger this :finish-run nil)
+        (if-let [later-fn (some later-fns (-> queue peek meta keys))]
+          (-fsm-trigger this :pause-run later-fn)
+          (do (-process-1st-event this)
+              (recur (dec n)))))))

   (-pause-run
     [this later-fn]


Update routing sub

Update routing sub

--- src/re_view/routing.cljs
+++ src/re_view/routing.cljs
@@ -75,7 +75,7 @@
   A final view may be supplied as a default/catch-all view."
   [& pairs]
   (fn
-    [this _ st-key]
+    [this st-key]
     (let [pairs (if (even? (count pairs)) pairs (concat (drop-last pairs) (list "*" (last pairs))))
           compiled-routes (atom (compile-routes pairs))
           current-match #(match-route @compiled-routes (get-token))


Add documentation for the EventStore protocol

This change documents the requirements for new implementations of the
EventStore protocol. I'm hoping this will help identify areas of
interest and potential problems when investigating new backing stores.

--- src/rill/event_store.clj
+++ src/rill/event_store.clj
@@ -1,10 +1,68 @@
 (ns rill.event-store)

 (defprotocol EventStore
-  (retrieve-events-since [this stream-id cursor wait-for-seconds])
-  (append-events [this stream-id from-version events]))
+  "The basic abstraction for storage and retrieval in rill.
+
+  A backing store (or client code talking to a backing store, in a multi-process
+  setup) only has to implement this basic protocol.
+
+  Many transformation mechanisms (like message upcasting/migrating) can be
+  specified using a middleware approach where the transforming code implements
+  the EventStore protocol, wrapping around a lower-level EventStore instance to
+  provide storage.
+
+  Currently, rill Repositories take a hybrid approach in that they implement
+  both EventStore using a wrapper strategy and extended it by implenting an
+  additional Repository protocol."
+
+  (retrieve-events-since
+   [this stream-id cursor wait-for-seconds]
+   "Returns a sequence of the events in stream `stream-id', starting from the
+    given cursor. If there are no more events at that cursor, wait for
+    `wait-for-seconds' to see if anything new shows up.
+
+    The initial cursor for retrieving a complete event stream is -1. See also
+    `rill.event-store/retrieve-events'. Valid cursors for retrieval from a
+    specific part of a stream can be achieved by calling `rill.message/cursor'
+    on an earlier message in the stream, which will give a cursor useful for
+    retrieving the next event onwards.
+
+    The stream-id `rill.event-stream/all-events-stream-id' can be used for
+    retrieving a read-only stream that contains all events in the event store.
+
+    Note that the `wait-for-seconds' behaviour is intended to be used in
+    applications where you're continuously listening for new events but don't
+    want to overload the server with polls, and EventStores can implement the
+    behaviour in whatever way is convenient technically, including just calling
+    System/sleep before returning empy streams.")
+  (append-events
+   [this stream-id from-version events]
+   "Appends `events' to stream `stream-id' at position `from-version'. Returns
+    `true' if successful or `false' for failure.
+
+    EventStore implementations must make it impossible to append events in
+    positions that are already taken, and should make it impossible to append
+    events in any position except the one immediately following the last taken
+    position. If multiple events are provided, all events in the chunk must be
+    stored in the given order with no other events intermingled.
+
+    It should be possible to append to multiple streams concurrently; this
+    should not normally result in failure. Concurrent appends to the same stream
+    may result in failure of at least one of the append-events calls.
+
+    Retrieving events from a stream should eventually return all successfully
+    committed events in the committed order, with `rill.message/number'
+    providing the event's position. Failed appends should never result in
+    retrievable events.
+
+    The `from-version' to use for committing the first event in a stream is -1.
+    Using -2 as the `from-version' will append the given events at whatever is
+    the \"current\" position."))

 (defn retrieve-events
+  "Returns a sequence of all events in stream `stream-id' from the start. Will
+  not wait for new events to arrive; if the stream is empty, returns an empty
+  stream."
   [store stream-id]
   (retrieve-events-since store stream-id -1 0))


only show user as "org" for the GH user

only show user as "org" for the GH user

--- src-cljs/frontend/components/add_projects.cljs
+++ src-cljs/frontend/components/add_projects.cljs
@@ -152,7 +152,8 @@
                  ;; in this order (rather than e.g. putting the whole thing into a set)
                  ;; so that new ones don't jump up in the middle as they're loaded.
                  (filter (partial select-vcs-type vcs-type)
-                         (concat (if (= "github" vcs-type) [(assoc user :vcs_type vcs-type)])
+                         (concat [(when (= "github" vcs-type)
+                                    (assoc user :vcs_type "github"))]
                                  (:organizations user)
                                  (let [org-names (->> user
                                                       :organizations


Revert to original run_query code

Revert to original run_query code

--- backend/src/akvo/lumen/admin/stats/run_query.clj
+++ backend/src/akvo/lumen/admin/stats/run_query.clj
@@ -8,49 +8,13 @@
 ;; Same env vars as the rest of admin scripts

 ;; Run query for comma separated list of tenant-labels
-;; Run query for comma separated list of tenant-labels
-#_(defn -main [tenant-labels query]
-    (let [tenant-labels (s/split tenant-labels #",")
-          uris (->> ["SELECT label as \"tenant-label\", db_uri as \"db-uri\" FROM tenants"]
-                    (jdbc/query (util/db-uri {:database "lumen"}))
-                    (filter #((set tenant-labels) (:tenant-label %))))]
-      (json/generate-stream
-       (for [{:keys [db-uri tenant-label]} uris]
-         (jdbc/with-db-transaction [conn db-uri {:read-only? true}]
-           [tenant-label (jdbc/query conn [query])]))
-       *out*)))
-
-(defn number-of-datasets [uris date]
-  (let [query (format "SELECT COUNT(id) FROM history.data_source WHERE lower(_validrange) < '%s'::DATE AT TIME ZONE 'UTC';" date)
-        r (for [{:keys [db-uri tenant-label]} uris]
-            (jdbc/with-db-transaction [conn db-uri {:read-only? true}]
-              (jdbc/query conn [query])))]
-    {:number-of-datasets (reduce (fn [n v]
-                                   (+ n (-> v first :count)))
-                                 0 r)}))
-
-(defn number-of-dashboards [uris date]
-  (let [query (format "SELECT COUNT(id) FROM history.dashboard WHERE lower(_validrange) < '%s'::DATE AT TIME ZONE 'UTC';" date)
-        r (for [{:keys [db-uri tenant-label]} uris]
-            (jdbc/with-db-transaction [conn db-uri {:read-only? true}]
-              (jdbc/query conn [query])))]
-    {:number-of-dashboards (reduce (fn [n v]
-                                     (+ n (-> v first :count)))
-                                   0 r)}))
-
-(defn fetch-uris [tenant-labels]
-  (->> ["SELECT label as \"tenant-label\", db_uri as \"db-uri\" FROM tenants"]
-       (jdbc/query (util/db-uri {:database "lumen"}))
-       (filter #((set tenant-labels) (:tenant-label %)))))
-
-(defn -main
-  ([tenant-labels]
-   (-main tenant-labels
-          (.format (java.text.SimpleDateFormat. "yyyy-MM-dd") (new java.util.Date))))
-  ([tenant-labels date]
-   (let [tenant-labels (s/split tenant-labels #",")
-         uris (fetch-uris tenant-labels)]
-     (prn
-      (merge {:at-date date}
-             (number-of-datasets uris date)
-             (number-of-dashboards uris date))))))
+(defn -main [tenant-labels query]
+  (let [tenant-labels (s/split tenant-labels #",")
+        uris (->> ["SELECT label as \"tenant-label\", db_uri as \"db-uri\" FROM tenants"]
+                  (jdbc/query (util/db-uri {:database "lumen"}))
+                  (filter #((set tenant-labels) (:tenant-label %))))]
+    (json/generate-stream
+     (for [{:keys [db-uri tenant-label]} uris]
+       (jdbc/with-db-transaction [conn db-uri {:read-only? true}]
+         [tenant-label (jdbc/query conn [query])]))
+     *out*)))


Add old lua version of bl-edit target, for reference

--- src/backloggery/data/backloggery.clj
+++ src/backloggery/data/backloggery.clj
@@ -7,7 +7,8 @@

 (register-flags ["--bl-name" "backloggery username"]
                 ["--bl-pass" "backloggery password"]
-                ["--bl-stealth" "use 'stealth add' and 'stealth edit' when updating backloggery" :flag true])
+                ["--bl-stealth" "use 'stealth add' and 'stealth edit' when updating backloggery"
+                 :flag true :default true])

 (defn- tag-seq [tag body]
   (filter #(= tag (:tag %)) (xml-seq body)))
@@ -164,5 +165,82 @@

 ;; Editing games

+; we need the following fields for edit
+; name console complete - filled in from game list
+; own note wishlist playing - *can be* filled in from game list, but currently not
+; comp orig_console region achieve1 achieve2 online rating comments - must be filled in from details page
+
+; function bl:details(game)
+;     assert(type(game) == "number", 'invalid argument to bl:details')
+
+;     game = assert(self:games()[game], 'no game with id '..game)
+
+;     if game._details then return game end
+
+;     local body = assert(request(self, { user = self.user, gameid = game.id }, "GET", "http://backloggery.com/update.php"))
+
+;     local function set(key, value)
+;         if not game[key] then
+;             game[key] = value
+;         end
+;     end
+
+;     -- name, console, complete, note, wishlist, and playing were already
+;     -- filled in by the initial loading of the game list
+;     -- FIXME own should be as well
+
+;     -- this leaves: comp, orig_console, region
+;     -- achieve1, achieve2, online
+;     -- rating, comments
+
+;     set("comp", body:Find("input", "name", "comp").value)
+
+;     set("orig_console", body:Find("select", "name", "orig_console"):Find("option", "selected", true).value)
+;     set("_orig_console_str", bl.platforms[game.orig_console])
+
+;     set("region", tonumber(body:Find("select", "name", "region"):Find("option", "selected", true).value))
+;     set("_region_str", bl.regions[game.region])
+
+;     set("achieve1", tonumber(body:Find("input", "name", "achieve1").value) or "")
+;     set("achieve2", tonumber(body:Find("input", "name", "achieve2").value) or "")
+
+;     set("online", body:Find("input", "name", "online").value)
+;     set("comments", body:Find("textarea", "name", "comments"):Content())
+
+;     -- set the "details" flag on this game, recording that all fields are filled in
+;     set("_details", true)
+
+;     return game
+; end
+
+; -- upload the changes we've made to a game structure to the server
+; function bl:editgame(game)
+;     assert(type(game) == "number", 'invalid argument to bl:editgame')
+
+;     game = assert(self:games()[game], 'no game with id '..game)
+
+;     -- fill in any missing fields
+;     self:details(game.id)
+
+;     -- the _ derived fields override the original ones
+;     game.console = bl.rplatforms[game._console_str]
+;     game.orig_console = bl.rplatforms[game._orig_console_str]
+;     game.region = bl.rregions[game._region_str] or 0
+;     game.rating = game._stars - 1; if game.rating < 0 then game.rating = 8 end
+;     game.complete = bl.completecode(game._complete_str)
+;     game.submit2 = "Stealth Save"
+
+;     -- create request
+;     local r,e = request(self, game, "POST", "http://backloggery.com/update.php?user="..self.user.."&gameid="..game.id)
+
+;     -- update internal structures
+;     self:games()[game.id] = game
+
+;     return game
+; end
+
+(defmethod read-games "backloggery-edit" [_]
+  (println "No support for editing games yet."))
+
 (defmethod write-games "backloggery-edit" [_ games]
   (println "No support for editing games yet."))


In admin view show the count of the table data

This is so that we can start to get the data syncing working properly

--- src/webapp/framework/client/components/admin.cljs
+++ src/webapp/framework/client/components/admin.cljs
@@ -77,7 +77,7 @@
       (c/div {:style {:color  "blue"}}
              (c/container
                (c/inline "50%" (c/text (str "count" )))
-               (c/inline "50%" (c/text (count aaa)))
+               (c/inline "50%" (c/text (count table-data)))
                )
       (c/div nil (str "table-data: " table-data))
              ))))


CMR-1308 Adds info to GMD namespace docstring

--- spatial-lib/src/cmr/spatial/encoding/gmd.clj
+++ spatial-lib/src/cmr/spatial/encoding/gmd.clj
@@ -1,6 +1,11 @@
 (ns cmr.spatial.encoding.gmd
   "Functions for encoding and decoding between spatial geometries and
-  gmd:geographicElement elements."
+  gmd:geographicElement elements.
+
+  GMD is the Geographic MetaData schema for describing geographic
+  information in ISO XML documents.
+
+  see: http://www.isotc211.org/schemas/2005/gmd/"
   (:require [clojure.data.xml :as x]
             [cmr.common.xml :as cx]
             [cmr.spatial.encoding.gml :as gml]


Fixed args for moving average usage in clean-probs

--- src/clj/forma/postprocess/output.clj
+++ src/clj/forma/postprocess/output.clj
@@ -64,8 +64,7 @@
   integer 0->100"
   [coll]
   (let [window 3]
-    [(vec (-> coll
-              (backward-looking-mavg window)
+    [(vec (-> (backward-looking-mavg window coll)
               (mono-inc)
               (dec->int100)))]))


`shift-lesson-to-row!` - Correct indentation

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

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -1224,16 +1224,14 @@
    The parameter `augTTLessonInfo` is a `TimetableLessonInfo` object augmented
    with the `:day` and `:rowNum` keys."
   [destinationRowNum augTTLessonInfo $divElem]
-  (let [day                     (:day augTTLessonInfo)
-        sourceRowNum            (:rowNum augTTLessonInfo)
-        startTime               (:startTime augTTLessonInfo)
-        endTime                 (:endTime augTTLessonInfo)
-        slotsOccupied           (- endTime startTime)
-
+  (let [day           (:day augTTLessonInfo)
+        sourceRowNum  (:rowNum augTTLessonInfo)
+        startTime     (:startTime augTTLessonInfo)
+        endTime       (:endTime augTTLessonInfo)
+        slotsOccupied (- endTime startTime)
         $sourceTd     (html-timetable-get-td day sourceRowNum startTime)
         $destTd       (html-timetable-get-td day destinationRowNum startTime)
-
-        ttLessonInfo            (dissoc augTTLessonInfo :day :rowNum)]
+        ttLessonInfo  (dissoc augTTLessonInfo :day :rowNum)]
     (.log js/console (str "day = " day ", sourceRowNum = " sourceRowNum ", destinationRowNum = " destinationRowNum))
     ; Transfer lesson <div> to the destination <td>
     (.append $destTd $divElem)


[REFACTOR] Rename `moduleCodes` to `moduleCodesWithLesson`

Because we are not yet handling any modules without lessons.

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

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -1526,12 +1526,13 @@
         moduleInfoFinal
         (get-module-info-from-url-hash-module-info modWithLessonExistent)

-        moduleCodes        (distinct (map #(:moduleCode %1) moduleInfoFinal))]
+        moduleCodesWithLesson
+        (distinct (map #(:moduleCode %1) moduleInfoFinal))]

     (.log js/console (str "modWithLessonExistent = " (.stringify js/JSON (clj->js modWithLessonExistent))))
     (.log js/console (str "moduleInfoFinal = " (.stringify js/JSON (clj->js moduleInfoFinal))))

-    (doseq [moduleCode moduleCodes]
+    (doseq [moduleCode moduleCodesWithLesson]
       (add-to-ModulesSelectedOrder! moduleCode)
       (add-module-to-exam-timetable! moduleCode
                                      (get moduleToColorsMap moduleCode)))


[TEMP COMMIT] getting into `start` event handler

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

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -456,6 +456,19 @@
       {:day day, :rowNum rowNum, :startTime startTime, :endTime endTime,
        :divElem $divElem})))

+(defn- lesson-draggable-start-evt-handler-maker
+  "Returns a function that can be used as the `start` event handler for a
+   draggable lesson.
+
+   Details of the returned function can be found here:
+
+       http://api.jqueryui.com/draggable/#event-start"
+  [moduleCode lessonType lessonGroup]
+  (let []
+    (fn [evt ui])
+    )
+  )
+
 (defn- add-module-lesson-group
   "Adds a lesson group of a module to the timetable."
   [moduleCode lessonType lessonLabel bgColorCssClass
@@ -492,10 +505,17 @@
                 (select2/select2-box-set-val
                   select2/$Select2-Box
                   (get-selected-module-codes-as-js-array))))
-
+
           ; And Drag event handler
           (doseq [$divElem $divElemSeq]
-            (.draggable $divElem))))))
+            (.draggable $divElem
+                        (js-obj
+                          "zIndex" 100
+                          ; TODO: Replace this `revert` function
+                          "revert" (fn [] true)
+                          "start"  (lesson-draggable-start-evt-handler-maker
+                                     moduleCode lessonType lessonLabel)
+                                )))))))

 (defn add-module
   "Adds a module to the timetable.


Fix bug with removing nil's from parts

Fix bug with removing nil's from parts

--- src/cljs/movement/pages/session.cljs
+++ src/cljs/movement/pages/session.cljs
@@ -483,7 +483,10 @@
       [:div
        [menu-component]
        (if-let [session (session/get :movement-session)]
-         (let [session (assoc session :parts (vec (remove #(or (nil? %) (= nil (:name %))) (:parts session))))] ;remove nil movements or movements without a name (dukker av eller annen grunn noen ganger opp fra server)
+         ;remove nil movements or movements without a name (dukker av eller annen grunn noen ganger opp fra server)
+         (let [session (assoc session :parts
+                                      (vec (for [p (:parts session)]
+                                             (vec (remove #(or (nil? %) (= nil (:name %))) p)))))]
            [:div.content {:style {:margin-top 100}}
             [:a {:style      {:float 'right :margin-right 20 :margin-top 20
                               :color (:graphic (:activity session)) :opacity 1}


improve search

improve search

--- src/cljs/phonecat_re_frame/core.cljs
+++ src/cljs/phonecat_re_frame/core.cljs
@@ -43,10 +43,12 @@
    [:p (:snippet @phone)]])

 (defn matches-query?
-  [search-input phone]
-  (if (= "" search-input)
-    true
-    (= (:name phone) search-input)))
+ [search-input phone]
+ (if (= "" search-input)
+   true
+   (boolean (or
+             (re-find (re-pattern search-input) (:name phone))
+             (re-find (re-pattern search-input) (:snippet phone))))))

 (defn phones-component
   []


add clojure functions to get ImageInputStreams by url/file

--- src/clojure/clj_image2ascii/core.clj
+++ src/clojure/clj_image2ascii/core.clj
@@ -1,10 +1,11 @@
 (ns clj-image2ascii.core
   (:import (javax.imageio ImageIO)
+           (javax.imageio.stream ImageInputStream)
+           (java.awt RenderingHints Graphics2D)
            (java.awt.image BufferedImage)
            (java.net URL)
-           (java.io File)
-           (java.awt RenderingHints Graphics2D)
-           (clj_image2ascii.java ImageToAscii)))
+           (java.io File InputStream)
+           (clj_image2ascii.java ImageToAscii AnimatedGif ImageFrame)))

 (defn get-image-by-url
   "returns a BufferedImage loaded from the URL specified, or null if an error occurs"
@@ -18,6 +19,19 @@
   (^BufferedImage [^File file]
    (try
      (ImageIO/read file)
+     (catch Exception ex))))
+
+(defn get-image-stream-by-url
+  (^ImageInputStream [^URL url]
+   (try
+     (let [^InputStream stream (.openStream url)]
+       (ImageIO/createImageInputStream stream))
+     (catch Exception ex))))
+
+(defn get-image-stream-by-file
+  (^ImageInputStream [^File file]
+   (try
+     (ImageIO/createImageInputStream file)
      (catch Exception ex))))

 (defn scale-image


Fix issue where expt followed by division could result in error.

We should not assume that the numbers in the stack at any given
time can be cast directly to a BigDecimal, because some operations,
(like expt) may return a double or something, and then suddenly
one of the operands is not castable.

Instead, in the division function, explicitly create BigDecimals
from the operands and work with those.

--- src/clojure/warreq/kea/calc/math.clj
+++ src/clojure/warreq/kea/calc/math.clj
@@ -12,7 +12,7 @@
    (rpn e '()))
   ([e s]
    (if (empty? e)
-      s
+     s
      (if (number? (first e))
        (recur (rest e)
               (conj s (first e)))
@@ -20,10 +20,12 @@
               (conj (drop 2 s) (reduce (first e) (reverse (take 2 s)))))))))

 (defn floating-division [x y]
-  (if (not= ^BigDecimal y BigDecimal/ZERO)
-    (.divide ^BigDecimal x ^BigDecimal y 2 java.math.RoundingMode/HALF_EVEN)
-    (do (u/vibrate! 500)
-        (toast "Cannot divide by 0."))))
+  (let [x (bigdec x)
+        y (bigdec y)]
+    (if (not= y BigDecimal/ZERO)
+      (.divide x y 2 java.math.RoundingMode/HALF_EVEN)
+      (do (u/vibrate! 500)
+          (toast "Cannot divide by 0.")))))

 (defn op-alias [op]
   (case op


Temporarily remove the SSH button/info for iOS builds

We can't support it with the number of VMs we have right now.

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -336,6 +336,7 @@
             usage-queue-data (:usage-queue-data build-data)
             run-queued? (build-model/in-run-queue? build)
             usage-queued? (build-model/in-usage-queue? build)
+            project (get-in data [:project-data :project])
             plan (get-in data [:project-data :plan])
             config-data (:config-data build-data)]
         (html
@@ -366,7 +367,9 @@
                                                        :stop (or (:start_time build) (:stop_time build))})
                    ")"])]])

-            (when (has-scope :write-settings data)
+            ;; XXX Temporarily remove the ssh info for OSX builds
+            (when (and (has-scope :write-settings data)
+                       (not (get-in project [:feature_flags :osx])))
               [:li {:class (when (= :ssh-info selected-tab) "active")}
                [:a {:on-click #(raise! owner [:build-header-tab-clicked {:tab :ssh-info}])}
                 "SSH info"]])
@@ -416,6 +419,7 @@
             usage-queue-data (:usage-queue-data build-data)
             run-queued? (build-model/in-run-queue? build)
             usage-queued? (build-model/in-usage-queue? build)
+            project (get-in data [:project-data :project])
             plan (get-in data [:project-data :plan])
             user (:user data)
             logged-in? (not (empty? user))
@@ -526,14 +530,16 @@
                                                                    :clear-cache? true}])}
                   "& clear cache"])

-                (forms/managed-button
-                 [:button.ssh_build
-                  {:data-loading-text "Rebuilding",
-                   :title "Retry with SSH in VM",
-                   :on-click #(raise! owner [:ssh-build-clicked {:build-id build-id
-                                                                 :vcs-url vcs-url
-                                                                 :build-num build-num}])}
-                  "& enable ssh"])])
+                ;; XXX Temporarily remove the ssh button for OSX builds
+                (when (not (get-in project [:feature_flags :osx]))
+                  (forms/managed-button
+                   [:button.ssh_build
+                    {:data-loading-text "Rebuilding",
+                     :title "Retry with SSH in VM",
+                     :on-click #(raise! owner [:ssh-build-clicked {:build-id build-id
+                                                                   :vcs-url vcs-url
+                                                                   :build-num build-num}])}
+                    "& enable ssh"]))])
              [:div.actions
               (when logged-in? ;; no intercom for logged-out users
                 [:button.report_build


Display info, not danger if build passed without JUnit results

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -623,7 +623,8 @@
             tests (when (:tests tests-data)
                     (map-indexed #(assoc %2 :i %1) (:tests tests-data)))
             sources (reduce (fn [s test] (conj s (test-model/source test))) #{} tests)
-            failed-tests (filter #(contains? #{"failure" "error"} (:result %)) tests)]
+            failed-tests (filter #(contains? #{"failure" "error"} (:result %)) tests)
+            build-succeeded? (= "success" (get-in data [:build :status]))]
         (html
          [:div.test-results
           (if-not tests
@@ -655,8 +656,9 @@
                            " tests in " (string/join ", " (map test-model/pretty-source sources)) " with "
                            [:strong "0 failures"]]

-              :else [:div.alert.alert-danger.iconified
-                     [:div [:img.alert-icon {:src (common/icon-path "Info-Error")}]]
+              :else [:div.alert.iconified {:class (if build-succeeded? "alert-info" "alert-danger")}
+                     [:div [:img.alert-icon {:src (common/icon-path
+                                                    (if build-succeeded? "Info-Info" "Info-Error"))}]]
                      (tests-ad owner)]))])))))

 (defn circle-yml-ad []


update Configuration links

update Configuration links

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -569,8 +569,9 @@

 (defn circle-yml-ad []
   [:div
-   [:p "We didn't find a circle.yml for this build. You can specify deployment or override our inferred test steps from a circle.yml checked in to your repo's root directory."]
-   [:p "More information " [:a {:href "https://circleci.com/docs/configuration/"} "in our docs"] "."]])
+   [:p "We couldn't find a configuration file for this build.  Specify deployment or test steps by creating a configuration file in the root directory of your repository."]
+   [:p "See CircleCI's "[:a {:href "https://circleci.com/docs/1.0/introduction/"} "Getting Started 1.0 documentation "] "for instructions for CircleCI 1.0 builds."]
+   [:p "See CircleCI's "[:a {:href "https://circleci.com/docs/2.0/about-circleci/"} "Getting Started 2.0 documentation "] "for instructions for CircleCI 2.0 builds."]])

 (defn build-config [{:keys [config-string build build-data]} owner opts]
   (reify


Add TODO on #17

Add TODO on #17

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -912,6 +912,13 @@
   `scan` results.

   Ref. http://goo.gl/KLwnn (official parallel scan documentation)."
+
+  ;; TODO GitHub #17:
+  ;; http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html
+  ;; In a parallel scan, a Scan request that includes ExclusiveStartKey must
+  ;; specify the same segment whose previous Scan returned the corresponding
+  ;; value of LastEvaluatedKey.
+
   [client-opts table total-segments & [opts]]
   (let [opts (assoc opts :total-segments total-segments)]
     (->> (mapv (fn [seg] (future (scan client-opts table (assoc opts :segment seg))))


Reduce chances of leaps and octave leaps a bit

--- src/tenor/constructs.clj
+++ src/tenor/constructs.clj
@@ -101,7 +101,7 @@

 (defn make-move [scale degree]
   (let [movements '(up-step down-step up-leap down-leap up-octave down-octave)
-        current-move (weighted-choose movements '(0.35 0.35 0.1 0.1 0.05 0.05))
+        current-move (weighted-choose movements '(0.38 0.38 0.08 0.08 0.04 0.04))
         temp-degree ((resolve current-move) degree)]
     (if (and (> temp-degree 0) (>= (count scale) temp-degree))
       temp-degree


Setting confidence to 1 if support is 0

Setting confidence to 1 if support is 0

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

--- src/conexp/fca/association_rules.clj
+++ src/conexp/fca/association_rules.clj
@@ -32,18 +32,26 @@
   (.context ar))

 (defn support
-  "Computes the support of the set of attributes B in context ctx."
-  [B ctx]
-  (/ (count (attribute-derivation ctx B))
-     (count (objects ctx))))
+  "Computes the support of the set of attributes B in context ctx. If
+  an association rule is given, returns the support of the association
+  rule in its context."
+  ([B ctx]
+     (/ (count (attribute-derivation ctx B))
+        (count (objects ctx))))
+  ([ar]
+     (/ (count (attribute-derivation (context ar) (union (premise ar) (conclusion ar))))
+        (count (objects (context ar))))))

 (defn confidence
-  "Computes the confidence of the association rule ar."
+  "Computes the confidence of the association rule ar. If the premise
+  of ar zero support, returns 1."
   [ar]
-  (/ (support (union (premise ar) (conclusion ar))
-              (context ar))
-     (support (premise ar)
-              (context ar))))
+  (if (zero? (support (premise ar) (context ar)))
+    1
+    (/ (support (union (premise ar) (conclusion ar))
+                (context ar))
+       (support (premise ar)
+                (context ar)))))

 (defmethod print-method Association-Rule [ar out]
   (.write out


Nix keyboard interactions.

Nix keyboard interactions.

--- src/mash_commander/nix/nix_mode.cljs
+++ src/mash_commander/nix/nix_mode.cljs
@@ -1,8 +1,11 @@
 (ns mash-commander.nix.nix-mode
-  (:require [mash-commander.freestyle.command :as command]
+  (:require [clojure.string :as str]
+            [mash-commander.freestyle.command :as command]
             [mash-commander.mode :as mode]
             [mash-commander.nix.filesystem :as fs]
             [mash-commander.nix.command :as nix-command]
+            [mash-commander.state :as mash-state]
+            [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]))

 ;; Register `nix` as a freestyle command
@@ -16,11 +19,37 @@
 ;; Mode methods
 (defmethod mode/dispatch-keydown :nix
   [line owner key]
-  (print key))
+  (om/transact!
+   (om/observe owner (mash-state/lines))
+   #(let [trie (:command-trie (:active %))
+          stack (:command-trie-stack (:active %))
+          letters (:letters (:active %))]
+      (cond
+        ;; Backspace
+        (and (= "Backspace" key) (not (empty? letters)))
+        (as-> % c
+          (assoc-in c [:active :letters] (rest letters))
+          (assoc-in c [:active :command-trie] (first stack))
+          (assoc-in c [:active :command-trie-stack] (rest stack)))
+        ;; Valid transition
+        (contains? (:command-trie (:active %)) key)
+        (as-> % c
+          (assoc-in c [:active :command-trie-stack] (cons trie stack))
+          (assoc-in c [:active :command-trie] (get trie key))
+          (assoc-in c [:active :letters] (cons key letters)))
+        ;; Ignore everything else
+        :default %))))
+

 (defmethod mode/line-render-state :nix
   [line owner state]
-  [(dom/span nil "nix line")])
+  (let [words (str/split (str/join (reverse (:letters line))) " ")
+        prompt (dom/span #js {:style #js {:color "#33f"
+                                          :fontWeight "bold"}}
+                         (str/join "/" (concat ["nix "] (:cwd line) [" $ "])))
+        cursor (dom/span #js {:style #js {:color "#900"}} "\u2588")
+        rendered-words (dom/span nil words)]
+    [prompt words cursor]))

 (defmethod mode/initial-line-state :nix
   [state]


Validate defcommand arguments like we do in the other macros

--- src/main/workflo/macros/command.clj
+++ src/main/workflo/macros/command.clj
@@ -59,9 +59,12 @@
   ([name forms]
    (defcommand* name forms nil))
   ([name forms env]
-   (let [args        (s/conform
-                      :workflo.macros.specs.command/defcommand-args
-                      [name forms])
+   (let [args-spec   :workflo.macros.specs.command/defcommand-args
+         args        (if (s/valid? args-spec [name forms])
+                       (s/conform args-spec [name forms])
+                       (throw (Exception.
+                               (s/explain-str args-spec
+                                              [name forms]))))
          description (:description (:forms args))
          inputs      (:inputs (:forms args))
          impl        (:implementation (:forms args))


Fix a bug exposed by tests.

Fix a bug exposed by tests.

--- src/re_frame_async_flow_fx/core.cljs
+++ src/re_frame_async_flow_fx/core.cljs
@@ -36,16 +36,16 @@
                   :any-events-seen? any-events-seen?}]
     (->> rules
          (map-indexed (fn [index {:keys [when events dispatch]}]
-                        (let [w #(when->fn when)
-                              _  (if-not w (js/console.error "aync-flow: found illegal value for :when: " when))]
-                        {:id        index
-                         :when      w
-                         :events    (if (seq events) (set events) #{events})
-                         :disptach  (cond
-                                      (vector? dispatch)  (list dispatch)
-                                      (list? dispatch)    (map (fn [d] (if (= d :halt) halt-event d) dispatch))
-                                      (= :halt dispatch)  (list halt-event)
-                                      :else  (js/console.error "aync-flow: dispatch value not valid: " dispatch))}))))))
+                        (let [w  (when->fn when)
+                              _  (assert (some? w) (str "aync-flow: found illegal value for :when: " when))]
+                          {:id        index
+                           :when      w
+                           :events    (if (coll? events) (set events) #{events})
+                           :dispatch  (cond
+                                        (vector? dispatch)  (list dispatch)
+                                        (coll? dispatch)    (map (fn [d] (if (= d :halt) halt-event d)) dispatch)
+                                        (= :halt dispatch)  (list halt-event)
+                                        :else  (js/console.error "aync-flow: dispatch value not valid: " dispatch))}))))))

 (defn make-flow-event-handler


Fix misplaced paren

Fix misplaced paren

--- src/re_frame_async_flow_fx/core.cljs
+++ src/re_frame_async_flow_fx/core.cljs
@@ -95,7 +95,7 @@
               ;;   3. stop the events forwarder
               :halt {:db (dissoc db db-path)
                      :event-forwarder {:unregister id}
-                     :deregister-event-handler id})
+                     :deregister-event-handler id}

               ;; A new event has been forwarded to this handler. What does it mean?
               ;;  1. does this new event mean we need to dispatch another
@@ -107,7 +107,7 @@
                     ready-task-ids     (->> ready-tasks (map :id) set)
                     new-started-tasks  (set/union started-tasks ready-task-ids)]
                 {:db       (set-state db new-seen-events new-started-tasks)
-                 :dispatch (concat (map :dispatch ready-tasks))}))))
+                 :dispatch (concat (map :dispatch ready-tasks))})))))

 ;; -- Register handler with re-frame


Modify `make-conn-pool` for common-use case: nil pool-opts now gives default pool

This previously gave a degenerate pool which is a pretty uncommon desire. The
`{}` conn idiom now gives more sensible behavior by default.

A degenerate pool can still be created by using `:none` for the pool opts.

--- src/taoensso/carmine/connections.clj
+++ src/taoensso/carmine/connections.clj
@@ -99,7 +99,7 @@
 (def ^:private make-conn-pool*
   (memoize
    (fn [opts]
-     (if (nil? opts) (NonPooledConnectionPool.)
+     (if (= opts :none) (NonPooledConnectionPool.)
        (let [defaults {:test-while-idle?              true
                        :num-tests-per-eviction-run    -1
                        :min-evictable-idle-time-ms    60000
@@ -113,7 +113,7 @@
   [opts] (if (instance? ConnectionPool opts) opts
              (make-conn-pool* opts)))

-(comment (make-conn-pool nil) (make-conn-pool {}))
+(comment (make-conn-pool :none) (make-conn-pool {}))

 (defn- parse-uri [uri]
   (when uri


Don't load tests in production

Don't load tests in production

--- backend/src/circle/env.clj
+++ backend/src/circle/env.clj
@@ -12,6 +12,10 @@
 (def local? (= env :local))
 (throw-if-not (= 1 (count (filter true? [production? staging? local?]))))

+(when production?
+  (alter-var-root (var midje.semi-sweet/*include-midje-checks*) (constantly false))
+  (alter-var-root (var clojure.test/*load-tests*) (constantly false)))
+
 (defn last-local-commit []
   (->
    (sh "git" "log" "-1" "--pretty=format:%H")


:fire: Remove unused file.

:fire: Remove unused file.

--- backend/src/uxbox/test.clj
+++ backend/src/uxbox/test.clj
@@ -1,3 +0,0 @@
-(ns uxbox.test)
-
-(defn kaka [] 1)


bug fix for direct message

bug fix for direct message

--- src/goodbot/bot.clj
+++ src/goodbot/bot.clj
@@ -39,7 +39,7 @@

 (defn schedule-tasks [bot plugins]
   "Schedule all plugin tasks"
-  (def warm-up-delay 7000)
+  (def warm-up-delay 10000)
   (def task-scheduler-pool (at/mk-pool))
   (doseq [plugin plugins]
     (doseq [task (get plugin :tasks)]
@@ -63,7 +63,7 @@
       (irclj/message bot (get channels channel) message))))

 (defn message-nick [bot nick message]
-  (irclj/message bot (str "@" nick) message))
+  (irclj/message bot nick message))

 (defn start [plugins & {:keys [host port nick password ssl?
                                channels server-password


tab closes after tab->close->save

tab closes after tab->close->save

--- src/gui/handler.clj
+++ src/gui/handler.clj
@@ -294,7 +294,7 @@
                        :option-type :yes-no-cancel
                        :content "The tab you want to close has unsaved changes. Save now?"
                        :no-fn (fn [_] (remove-tab tab-index))
-                       :success-fn (fn [_] (handler-save nil)))]
+                       :success-fn (fn [_] (handler-save nil) (remove-tab tab-index)))]
           (-> q-diag pack! show!))
         (remove-tab tab-index)))))


clojure.string/starts-with? isn't in clojure 1.7

--- src/main/clojure/clojure/test/check/clojure_test/assertions.cljc
+++ src/main/clojure/clojure/test/check/clojure_test/assertions.cljc
@@ -1,7 +1,6 @@
 (ns clojure.test.check.clojure-test.assertions
   #?(:cljs (:require-macros [clojure.test.check.clojure-test.assertions.cljs]))
-  (:require [clojure.string :as str]
-            #?(:clj [clojure.test :as t]
+  (:require #?(:clj [clojure.test :as t]
                :cljs [cljs.test :as t])
             [clojure.test.check.results :as results]))

@@ -9,10 +8,10 @@
    (defn test-context-stacktrace [st]
      (drop-while
        #(let [class-name (.getClassName ^StackTraceElement %)]
-          (or (clojure.string/starts-with? class-name "java.lang")
-              (clojure.string/starts-with? class-name "clojure.test$")
-              (clojure.string/starts-with? class-name "clojure.test.check.clojure_test$")
-              (clojure.string/starts-with? class-name "clojure.test.check.clojure_test.assertions")))
+          (or (.startsWith class-name "java.lang")
+              (.startsWith class-name "clojure.test$")
+              (.startsWith class-name "clojure.test.check.clojure_test$")
+              (.startsWith class-name "clojure.test.check.clojure_test.assertions")))
        st)))

 #?(:clj


fix c3p0 pool size warning

fix c3p0 pool size warning

--- src/main/clojure/com/xebia/visualreview/persistence/database.clj
+++ src/main/clojure/com/xebia/visualreview/persistence/database.clj
@@ -27,6 +27,7 @@
                (.setUser (:user spec))
                (.setPassword (:password spec))
                (.setMaxPoolSize (:max-pool-size spec))
+               (.setMinPoolSize (:min-pool-size spec))
                (.setInitialPoolSize (:init-pool-size spec))
                ;; expire excess connections after 30 minutes of inactivity:
                (.setMaxIdleTimeExcessConnections (* 30 60))
@@ -48,6 +49,7 @@
                  :user           user
                  :password       pass
                  :init-pool-size 1
+                 :min-pool-size  1
                  :max-pool-size  1}
         conn (alter-var-root #'conn (constantly (pooled-datasource db-spec)))]
     (do


adding semantic global styles

adding semantic global styles

--- src/strictly_specking/ansi_util.clj
+++ src/strictly_specking/ansi_util.clj
@@ -10,10 +10,46 @@

 (def ansi-code? ansi/ANSI-CODES)

+(def ^:dynamic *print-styles*
+  {:highlight   [:bright]
+   :good        [:green]
+   :good-pred   [:green]
+   :bad         [:red]
+   :bad-value   [:red]
+   :error-key   [:red]
+   :focus-key   [:bright]
+   :correct-key [:green]
+   :header      [:cyan]
+   :footer      [:cyan]
+   :warning-key [:bright]
+   :focus-path  [:magenta]
+   :message     [:magenta]
+   :pointer     [:magenta]})
+
+(defmacro black-and-white [body]
+  (binding [*print-styles* {}]
+    ~body))
+
+(defn resolve-styles [styles]
+  (if-let [res (not-empty
+                  (mapcat #(or
+                            (when-let [res (*print-styles* %)]
+                              res)
+                            [%])
+                          styles))]
+    res
+    ;; fall back to bright
+    [:bright]))
+
+#_(resolve-styles [:highlight :green])
+
+(defn color [s & styles]
+  (apply ansi/style s (resolve-styles styles)))
+
 (defmacro print-color-text [codes body]
   `(if ansi/*use-ansi*
      (do
-       (.write ^java.io.Writer *out* (apply str (map ansi/ansi ~codes)))
+       (.write ^java.io.Writer *out* (apply str (map ansi/ansi (resolve-styles ~codes))))
        ~body
        (.write ^java.io.Writer *out* (ansi/ansi :reset)))
      ~body))


Mocking up wormhole assumptions

Mocking up wormhole assumptions

--- EkekoAspectJ/src/damp/ekeko/aspectj/assumptions.clj
+++ EkekoAspectJ/src/damp/ekeko/aspectj/assumptions.clj
@@ -87,5 +87,36 @@
     (pointcut-concretizedby ?concpointcut1 ?concpointcut2)))

+;;Assumption this aspect implements a wormhole
+;; -- the naive version
+;; MOCK IMPLEMENTATION - DOES NOT WORK
+(defn
+  naivewormhole-aspect-entry-exit
+  [?aspect ?entryadvice ?exitadvice]
+  (all
+    (aspect-advice ?aspect ?entryadvice)
+    (aspect-field ?aspect ?instvar)
+    (advice-writesto ?entryadvice ?instvar) ;NOT IMPLEMENTED YET
+    (aspect-advice ?aspect ?exitadvice)
+    (advice-readsfrom ?exitadvice ?instvar)));NOT IMPLEMENTED YET

+;;Assumption this aspect implements a wormhole
+;; -- percflow of naive
+;; MOCK IMPLEMENTATION - DOES NOT WORK
+(defn
+  wormhole-aspect-entry-exit
+  [?aspect ?entryadvice ?exitadvice]
+  (all
+    (naivewormhole-aspect-entry-exit ?aspect ?entryadvice ?exitadvice)
+    (percflowaspect ?aspect)));NOT IMPLEMENTED YET
+
+;;Assumption this aspect implements a wormhole
+;; -- naive + execution path from entry to exit without interruptions of other advice of the same aspect
+;; MOCK IMPLEMENTATION - DOES NOT WORK
+(defn
+  confidentwormhole-aspect-entry-exit
+  [?aspect ?entryadvice ?exitadvice]
+  (all
+    (naivewormhole-aspect-entry-exit ?aspect ?entryadvice ?exitadvice)
+    (consecutiveexec-aspect-advice1-advice2 ?aspect ?entryadvice ?exitadvice)));NOT IMPLEMENTED YET


Working assumptions wormhole|naive-entry-exit-field, wormhole|path-entry-exit-field. Need to update to newer version of EkekoPlugin first.

--- EkekoAspectJ/src/damp/ekeko/aspectj/assumptions.clj
+++ EkekoAspectJ/src/damp/ekeko/aspectj/assumptions.clj
@@ -84,7 +84,7 @@
          (intertype|method ?itmethod)
          (fails
            (l/all
-             (ajsoot/intertype|method-sootmethod ?itmethod ?sootmethod)
+             (ajsoot/intertype|method-soot|method ?itmethod ?sootmethod)
              (jsoot/soot-method-called-by-method ?sootmethod ?caller)))))

@@ -98,57 +98,50 @@
     (pointcutdefinition-concretizedby ?concpointcut1 ?concpointcut2)))

-(clojure.core/declare advice-writesto)
-(clojure.core/declare advice-readsfrom)
 (clojure.core/declare percflowaspect)
 (clojure.core/declare consecutiveexec-aspect-advice1-advice2)

 ;;Assumption this aspect implements a wormhole
 ;; -- the naive version
-;; MOCK IMPLEMENTATION - DOES NOT WORK
-(defn
-  naivewormhole-aspect-entry-exit
-  [?aspect ?entryadvice ?exitadvice]
-  (l/fresh [?instvar]
-    (aspect-advice ?aspect ?entryadvice)
-    (type-field ?aspect ?instvar)
-    (advice-writesto ?entryadvice ?instvar) ;NOT IMPLEMENTED YET
-    (aspect-advice ?aspect ?exitadvice)
-    (advice-readsfrom ?exitadvice ?instvar)));NOT IMPLEMENTED YET
+(defn
+  wormhole|naive-entry-exit-field
+  [?aspect ?advice|entry ?advice|exit ?field]
+  (l/all
+    (aspect-advice ?aspect ?advice|entry)
+    (type-field ?aspect ?field)
+    (ajsoot/advice|writes-field ?advice|entry ?field)
+    (l/!= ?advice|exit ?advice|entry)
+    (aspect-advice ?aspect ?advice|exit)
+    (ajsoot/advice|reads-field ?advice|exit ?field)))

 ;;Assumption this aspect implements a wormhole
 ;; -- percflow of naive
 ;; MOCK IMPLEMENTATION - DOES NOT WORK
 (defn
-  wormhole-aspect-entry-exit
-  [?aspect ?entryadvice ?exitadvice]
-  (l/all
-    (naivewormhole-aspect-entry-exit ?aspect ?entryadvice ?exitadvice)
+  wormhole-aspect-entry-exit-field
+  [?aspect ?entryadvice ?exitadvice ?field]
+  (l/all
+    (wormhole|naive-entry-exit-field ?aspect ?entryadvice ?exitadvice ?field)
     (percflowaspect ?aspect)));NOT IMPLEMENTED YET

 ;;Assumption this aspect implements a wormhole
-;; -- naive + execution path from entry to exit without interruptions of other advice of the same aspect
-;; MOCK IMPLEMENTATION - DOES NOT WORK
-(defn
-  confidentwormhole-aspect-entry-exit
-  [?aspect ?entryadvice ?exitadvice]
-  (l/all
-    (naivewormhole-aspect-entry-exit ?aspect ?entryadvice ?exitadvice)
-    (consecutiveexec-aspect-advice1-advice2 ?aspect ?entryadvice ?exitadvice)));NOT IMPLEMENTED YET
-
-
-(defn
-  assigns-field
-  [?unit ?field]
-  (l/fresh [?lhs]
-    (jsoot/soot-unit-assign-leftop ?unit ?lhs)
-    (jsoot/soot-value :JInstanceFieldRef ?lhs)
-    (equals ?field (.getField  ?lhs))))
-
+;; -- naive + execution path from entry to exit
+;;TODO: without interruptions of other advice of the same aspect
+(defn
+  wormhole|path-entry-exit-field
+  [?aspect ?advice|entry ?advice|exit ?field]
+  (l/all
+    (wormhole|naive-entry-exit-field ?aspect ?advice|entry ?advice|exit ?field)
+    (one
+      (ajsoot/advice-reachable|advice ?advice|entry ?advice|exit))))
+
+
+(comment
+;TODO: start icfg traversal from callers of advice
 ;eventueel (qwhile [?soot|method ?soot|unit] q=>
 ;finds possibly broken implementations of wormhole idiom, where the field is written to in between entry and exit
 (defn
-  brokenwormhole-entry-exit-field
+  wormhole|broken-entry-exit-field
   [?aspect ?advice|entry ?advice|exit ?field]
   (aspect ?aspect)
   (type-field ?aspect ?field)
@@ -167,17 +160,17 @@
                       (damp.qwal/q=>*)
                       (damp.qwal/qcurrent [[?soot|method ?soot|unit]]
                                           (l/== ?soot|method|entry ?soot|method)
-                                          (assigns-field ?soot|unit ?soot|field))
+                                          (jsoot/soot|unit|writes-soot|field ?soot|unit ?soot|field))
                       (damp.qwal/q=>+)
                       (damp.qwal/qcurrent [[?soot|method ?soot|unit]]
                                           (l/!= ?soot|method|entry ?soot|method)
-                                          (assigns-field ?soot|unit ?field))
+                                          (jsoot/soot|unit|writes-soot|field ?soot|unit ?soot|field))
                       (damp.qwal/q=>+)
                       (damp.qwal/qcurrent [[?soot|method ?soot|unit]]
-                                          ;(l/== ?soot|method|exit ?soot|method)
-                                          ;(reads-field ?soot|unit ?soot|field)
+                                          (l/== ?soot|method|exit ?soot|method)
+                                          (jsoot/soot|unit|reads-soot|field ?soot|unit ?soot|field)
                                           )))))
-
+)

 ;; does not work due to issue #6
 ;; code is in AJ-LMP-RefineUsedPointcut


Improved conf reading to handle nil gateway

--- src/varstar/dbc/conf.clj
+++ src/varstar/dbc/conf.clj
@@ -70,7 +70,9 @@
   [user gateway]
   (spit "Capfile"
         (str "set :user, \"" user "\"\n"
-             "set :gateway, \"" gateway "\"\n"
+             (if (nil? gateway)
+               ""
+               (str "set :gateway, \"" gateway "\"\n"))
              "set :current_path, \"\"\n")))

 (defn- build-roles!


use reify in place of proxy

use reify in place of proxy

--- dada-swt/src/main/clojure/org/dada/swt/nattable.clj
+++ dada-swt/src/main/clojure/org/dada/swt/nattable.clj
@@ -5,6 +5,7 @@
    [org.dada core]
    )
   (:import
+   [java.io Serializable]
    [java.util ArrayList Collection HashMap List Map]
    [org.eclipse.swt SWT]
    [org.eclipse.swt.layout GridData GridLayout]
@@ -154,18 +155,17 @@
 	sorted-list (SortedList. event-list nil)

 	column-property-accessor
-	(proxy
-	    [IColumnPropertyAccessor]
-	    []
-	  ;; IColumnAccessor<T>
-	  (^Object getDataValue [^Mutable rowObject columnIndex] (.get ^Getter (nth getters columnIndex) (.getDatum rowObject)))
-	  (getColumnCount [] (count property-names))
-	  ;; public void setDataValue(T rowObject, int columnIndex, Object newValue);
+	(reify
+	 IColumnPropertyAccessor
+	 ;; IColumnAccessor<T>
+	 (getDataValue [_ rowObject columnIndex] (.get ^Getter (nth getters columnIndex) (.getDatum rowObject)))
+	 (getColumnCount [_] (count property-names))
+	 ;; public void setDataValue(T rowObject, int columnIndex, Object newValue);

-	  ;;IColumnPropertyResolver
-	  (^String getColumnProperty [columnIndex] (nth property-names columnIndex))
-	  (getColumnIndex [^String propertyName] (property-name-to-index propertyName))
-	  )
+	 ;;IColumnPropertyResolver
+	 (getColumnProperty [_ columnIndex] (nth property-names columnIndex))
+	 (^int getColumnIndex [_ ^String propertyName] (property-name-to-index propertyName))
+	 )

 	config-registry (ConfigRegistry.)
 	body-data-provider (ListDataProvider. sorted-list column-property-accessor)
@@ -175,17 +175,19 @@
 	blink-layer (BlinkLayer.
 		     glazed-lists-event-layer
 		     body-data-provider
-		     (proxy [IRowIdAccessor][](^Serializable getRowId [^Mutable row] (.get pk-getter (.getDatum row))))
+		     (reify IRowIdAccessor (^Serializable getRowId [_ row] (.get pk-getter (.getDatum row))))
 		     column-property-accessor
 		     config-registry)
 	dummy (do
 		(.registerConfigAttribute config-registry
 					  (BlinkConfigAttributes/BLINK_RESOLVER)
-					  (proxy [IBlinkingCellResolver][]
-                                            (resolve
-                                              ([cell configRegistry oldValue newValue] (into-array String ["up"]))
-                                              ([oldValue newValue] (into-array String ["up"]))))
+					  (reify
+					   IBlinkingCellResolver
+					   (resolve [_ cell configRegistry oldValue newValue] (into-array String ["up"]))
+					   (resolve [_ oldValue newValue] (into-array String ["up"])))
 					  (DisplayMode/NORMAL))
+
+
 		(.registerConfigAttribute
 		 config-registry
 		 (CellConfigAttributes/CELL_STYLE)
@@ -200,12 +202,13 @@
 	column-header-layer (ColumnHeaderLayer. column-header-data-layer body-layer-stack (.getSelectionLayer body-layer-stack))
 	column-header-layer-stack (proxy [AbstractLayerTransform] [])

-	view (proxy [View][]
-	       (^void update [^Collection insertions ^Collection alterations ^Collection deletions]
-		      (.asyncExec
-		       display
-		       (fn []
-			 (apply-updates pk-getter version-comparator event-list index glazed-lists-event-layer property-names getters insertions alterations deletions)))))
+	view (reify
+	      View
+	      (^void update [_ ^Collection insertions ^Collection alterations ^Collection deletions]
+		     (.asyncExec
+		      display
+		      (fn []
+			  (apply-updates pk-getter version-comparator event-list index glazed-lists-event-layer property-names getters insertions alterations deletions)))))
 	data (register model view)
 	]
     ;; initial update
@@ -248,13 +251,13 @@
 	;; deregister view on disposal
 	(.registerCommandHandler
 	 grid-layer
-	 (proxy [ILayerCommandHandler] []
-		(^Class getCommandClass [] ILayerCommand)
-		(^Boolean doCommand [^ILayer targetLayer ^ILayerCommand command]
-			  (if (instance? SelectCellCommand command) (handle-select-cell metadata nattable command data-layer sorted-list drilldown-fn))
-			  (if (instance? DisposeResourcesCommand command) (.detach model view))
-			  false)))
-
+	 (reify
+	  ILayerCommandHandler
+	  (^Class getCommandClass [_] ILayerCommand)
+	  (^boolean doCommand [_ ^ILayer targetLayer ^ILayerCommand command]
+		    (if (instance? SelectCellCommand command) (handle-select-cell metadata nattable command data-layer sorted-list drilldown-fn))
+		    (if (instance? DisposeResourcesCommand command) (.detach model view))
+		    false)))
 	(doto nattable
 	  (.setConfigRegistry config-registry)
 	  (.addConfiguration (DefaultNatTableStyleConfiguration.))
@@ -266,7 +269,7 @@
 	  (.addConfiguration (DefaultSelectionStyleConfiguration.))
 	  (.configure)

-	  ;;(.addLayerListener (proxy [ILayerListener][](handleLayerEvent [event] (handle-layer-event sorted-list nattable event data-layer drilldown-fn))))
+	  ;;(.addLayerListener (reify ILayerListener (handleLayerEvent [_ event] (handle-layer-event sorted-list nattable event data-layer drilldown-fn))))

 	  (.setLayoutData (GridData. (SWT/FILL) (SWT/FILL) true true))
 	  (.pack))))))


PLATFORM-2817: fixed image extension replace in Content-Disposition

--- src/vignette/util/image_response.clj
+++ src/vignette/util/image_response.clj
@@ -75,7 +75,7 @@
      (let [target-filename
            (if-let [requested-path
                     (when image-object (extension-for-name (content-type image-object)))]
-                      (if (re-matches #"\.\w+$" filename)
+                      (if (re-find #"\.\w+$" filename)
                         (string/replace filename #"\.\w+$" requested-path)
                         (str filename requested-path))
                       filename)]


Fix thorny classloader issue.

Fix thorny classloader issue.

Evidently the MIDI event dispatch threads were coming from the Humatic
extension with a different classpath which lacked access to Java3d, and
perhaps other important classes. Re-dispatch them on one of my own
threads.

--- src/afterglow/midi.clj
+++ src/afterglow/midi.clj
@@ -1,10 +1,11 @@
 (ns afterglow.midi
   "Handles MIDI communication, including syncing a show metronome to MIDI clock pulses."
   (:require [afterglow.rhythm :refer :all]
+            [clojure.core.async :refer [chan go <! >!! thread]]
             [amalloy.ring-buffer :refer [ring-buffer]]
             [overtone.at-at :refer [now]]
             [overtone.midi :as midi]
-            [taoensso.timbre :refer [error]])
+            [taoensso.timbre :refer [info error]])
   (:import [java.util.regex Pattern]))

 (def ^:private max-clock-intervals
@@ -59,28 +60,54 @@
   (doseq [handler (vals (get-in @control-mappings [(:name (:device msg)) (:channel msg) (:note msg)]))]
     (handler msg)))

-(defn- incoming-message-handler
-  "Attached to all midi input devices we manage. Fields incoming MIDI
+(defonce ^:private ^{:doc "The channel used to hand MIDI events from
+  the extension thread to our world, since there seem to be
+  classloader compatibility issues, and the Java3d classes are not
+  available to threads that are directly dispatching MIDI events."}
+  channel
+  (atom nil))
+
+(defn- delegated-message-handler
+  "Takes incoming MIDI events from the core.async channel on a thread
+  with access to all Afterglow classes. Fields incoming MIDI
   messages, looks for registered interest in them (metronome sync,
   variable mappings, etc.) and dispatches to the appropriate specific
   handler."
+  []
+  (go
+    (loop [msg (<! @channel)]
+      (when msg
+        ;; First call the global message handlers
+        (doseq [handler @global-handlers]
+          (try
+            (handler msg)
+            (catch Throwable t
+              (error t "Problem runing global MIDI event handler"))))
+
+        ;; Then call any registered port listeners for the port on which
+        ;; it arrived
+
+        ;; Finally, call specific message handlers
+        (try
+          (case (:status msg)
+            (:timing-clock :start :stop) (clock-message-handler msg)
+            :control-change (cc-message-handler msg)
+            nil)
+          (catch Throwable t
+            (error t "Problem running MIDI event handler")))
+        (recur (<! @channel))))
+    ;; The channel has been closed.
+    (reset! channel nil)))
+
+(defn- incoming-message-handler
+  "Attached to all midi input devices we manage. Puts the message on a
+  core.async channel so it can be processed by one of our own threads,
+  which have access to all the classes that Afterglow needs."
   [msg]
-
-  ;; First call the global message handlers
-  (doseq [handler @global-handlers]
-    (try
-      (handler msg)
-      (catch Exception e
-        (error e "Problem runing global MIDI event handler"))))
-
-  ;; Then call any registered port listeners for the port on which
-  ;; it arrived
-
-  ;; Finally, call specific message handlers
-  (case (:status msg)
-    (:timing-clock :start :stop) (clock-message-handler msg)
-    :control-change (cc-message-handler msg)
-    nil))
+  (try
+    (thread (>!! @channel msg))
+    (catch Throwable t
+      (error t "Problem trasferring MIDI event to core.async channel"))))

 (defn- connect-midi-in
   "Open a MIDI input device and cause it to send its events to
@@ -131,11 +158,21 @@
             (not (mmj-descriptions (:name device))))))
     identity))

+(defn- create-channel
+  "Creates the core.async channel used to deliver MIDI events when needed."
+  [old-channel]
+  (or old-channel
+      (let [c (chan 32)]
+        (info "Created MIDI dispatch channel.")
+        (future (delegated-message-handler))
+        c)))
+
 ;; TODO: This and open-outputs will have to change once hot-plugging works.
 (defn open-inputs-if-needed!
   "Make sure the MIDI input ports are open and ready to distribute events.
   Returns the opened inputs."
   []
+  (swap! channel create-channel)
   (let [port-filter (create-midi-port-filter)
         result (swap! midi-inputs #(if (empty? %)
                                      (map connect-midi-in


Fixed bug when where clause is empty.

Fixed bug when where clause is empty.

--- src/cmr/metadata_db/data/oracle/concepts.clj
+++ src/cmr/metadata_db/data/oracle/concepts.clj
@@ -241,7 +241,8 @@
             table (tables/get-table-name provider-id concept-type)
             stmt (su/build (select [:*]
                                    (from table)
-                                   (where (find-params->sql-clause params))))]
+                                   (when-not (empty? params)
+                                     (where (find-params->sql-clause params)))))]
         (doall (map (partial db-result->concept-map concept-type conn provider-id)
                     (j/query conn stmt))))))

@@ -257,7 +258,8 @@
                       table (tables/get-table-name provider-id concept-type)
                       istmt (select [:*]
                                     (from table)
-                                    (where (find-params->sql-clause params))
+                                    (when-not (empty? params)
+                                      (where (find-params->sql-clause params)))
                                     (order-by :concept-id))]
                   (doall (map (partial db-result->concept-map concept-type conn provider-id)
                               (sql-utils/find-batch conn istmt start-index batch-size))))))


match on lowercase tags

match on lowercase tags

--- iwaswhere-web/src/clj/iwaswhere_web/graph.clj
+++ iwaswhere-web/src/clj/iwaswhere_web/graph.clj
@@ -67,12 +67,12 @@
 (defn get-tags-mentions-matches
   "Extract matching timestamps for query."
   [g query]
-  (let [t-matched (map #(set (map :dest (uber/find-edges g {:src          {:tag %}
-                                                            :relationship :CONTAINS})))
-                       (:tags query))
-        m-matched (map #(set (map :dest (uber/find-edges g {:src          {:mention %}
-                                                            :relationship :CONTAINS})))
-                       (:mentions query))]
+  (let [mapper (fn [tag-type]
+                 (fn [tag]
+                   (set (map :dest (uber/find-edges g {:src          {tag-type tag}
+                                                       :relationship :CONTAINS})))))
+        t-matched (map (mapper :tag) (map s/lower-case (:tags query)))
+        m-matched (map (mapper :mention) (map s/lower-case (:mentions query)))]
     (apply set/intersection
            (concat t-matched m-matched))))

@@ -119,15 +119,19 @@
   "Finds all hashtags used in entries by finding the edges that originate from the
   :hashtags node."
   [current-state]
-  (let [g (:graph current-state)]
-    (set (map #(-> % :dest :tag) (uber/find-edges g {:src :hashtags})))))
+  (let [g (:graph current-state)
+        ltags (map #(-> % :dest :tag) (uber/find-edges g {:src :hashtags}))
+        tags (map #(:val (uber/attrs g {:tag %})) ltags)]
+    (set tags)))

 (defn find-all-mentions
   "Finds all hashtags used in entries by finding the edges that originate from the
   :hashtags node."
   [current-state]
-  (let [g (:graph current-state)]
-    (set (map #(-> % :dest :mention) (uber/find-edges g {:src :mentions})))))
+  (let [g (:graph current-state)
+        lmentions (map #(-> % :dest :mention) (uber/find-edges g {:src :mentions}))
+        mentions (map #(:val (uber/attrs g {:mention %})) lmentions)]
+    (set mentions)))

 (defn get-basic-stats
   "Generate some very basic stats about the graph size for display in UI."
@@ -166,11 +170,12 @@
   [graph entry]
   (let [tags (:tags entry)]
     (reduce (fn [acc tag]
-              (let [tag (s/lower-case tag)]
+              (let [ltag (s/lower-case tag)]
                 (-> acc
-                    (uber/add-nodes :hashtags {:tag tag})
-                    (uber/add-edges [{:tag tag} (:timestamp entry) {:relationship :CONTAINS}]
-                                    [:hashtags {:tag tag} {:relationship :IS}]))))
+                    (uber/add-nodes :hashtags)
+                    (uber/add-nodes-with-attrs [{:tag ltag} {:val tag}])
+                    (uber/add-edges [{:tag ltag} (:timestamp entry) {:relationship :CONTAINS}]
+                                    [:hashtags {:tag ltag} {:relationship :IS}]))))
             graph
             tags)))

@@ -180,12 +185,13 @@
   [graph entry]
   (let [mentions (:mentions entry)]
     (reduce (fn [acc mention]
-              (let [mention (s/lower-case mention)]
+              (let [lmention (s/lower-case mention)]
                 (-> acc
-                    (uber/add-nodes :mentions {:mention mention})
+                    (uber/add-nodes :mentions)
+                    (uber/add-nodes-with-attrs [{:mention lmention} {:val mention}])
                     (uber/add-edges
-                      [{:mention mention} (:timestamp entry) {:relationship :CONTAINS}]
-                      [:mentions {:mention mention} {:relationship :IS}]))))
+                      [{:mention lmention} (:timestamp entry) {:relationship :CONTAINS}]
+                      [:mentions {:mention lmention} {:relationship :IS}]))))
             graph
             mentions)))

@@ -255,7 +261,8 @@
         old-entry (when (uber/has-node? graph ts) (uber/attrs graph ts))
         tags-not-in-new (set/difference (:tags old-entry) (:tags entry))
         mentions-not-in-new (set/difference (:mentions old-entry) (:mentions entry))
-        remove-tag-edges (fn [g tags k] (reduce #(uber/remove-edges %1 [(:timestamp entry) {k %2}]) g tags))]
+        remove-tag-edges (fn [g tags k]
+                           (reduce #(uber/remove-edges %1 [(:timestamp entry) {k %2}]) g tags))]
     (-> current-state
         (update-in [:graph] #(uber/add-nodes-with-attrs % [ts (merge old-entry entry)]))
         (update-in [:graph] remove-tag-edges tags-not-in-new :tag)


+[babel.writer :as writer]

+[babel.writer :as writer]

--- test/babel/test/korma.clj
+++ test/babel/test/korma.clj
@@ -2,7 +2,8 @@
 ;; - it uses korma, but it is not itself korma.
 (ns babel.test.korma
   (:refer-clojure :exclude [test update])
-  (:require [clj-time.coerce :as c]
+  (:require [babel.writer :as writer]
+            [clj-time.coerce :as c]
             [clojure.string :as string]
             [clojure.test :refer :all]
             [clojure.tools.logging :as log]


Fix 20-second slowdown in bytes= conversion.

WUT

--- test/blocks/core_test.clj
+++ test/blocks/core_test.clj
@@ -54,7 +54,7 @@
   (let [block (block/read! "frobblenitz")
         baos (ByteArrayOutputStream.)]
     (block/write! block baos)
-    (is (bytes= "frobblenitz" (.toByteArray baos)))))
+    (is (bytes= (.getBytes "frobblenitz") (.toByteArray baos)))))

 (deftest block-loading


Add tests for testing the generated completers.

--- test/cli4clj/test/cli.clj
+++ test/cli4clj/test/cli.clj
@@ -12,7 +12,8 @@
   cli4clj.test.cli
   (:use clojure.test
         cli4clj.cli
-        clj-assorted-utils.util))
+        clj-assorted-utils.util)
+  (:import (java.util ArrayList)))

 (deftest simple-options-merging-test
   (let [user-options {:cmds {:foo {:fn 123}}}
@@ -161,3 +162,18 @@
     (is (vector? completers))
     (is (= 2 (count completers)))))

+(deftest create-arg-hint-completers-completion-proposal-test
+  (let [cmd-map {:a {:fn-args [['x 'y 'z]]}
+                 :b {:fn-args "my args"
+                     :completion-hint "test hint"}}
+        completers (create-arg-hint-completers cmd-map)
+        arr-lst (ArrayList.)]
+    (is (= 2 (.complete (nth completers 0) "a " 2 arr-lst)))
+    (is (= 2 (.size arr-lst)))
+    (is (= "Arguments: [[x y z]]" (.get arr-lst 0)))
+    (.clear arr-lst)
+    (is (= 2 (.complete (nth completers 1) "b " 2 arr-lst)))
+    (is (= 3 (.size arr-lst)))
+    (is (= "Arguments: my args" (.get arr-lst 0)))
+    (is (= "test hint" (.get arr-lst 1)))))
+


:bug: Fix unexpected behavior on selection controls on non-rect like shapes.

--- frontend/src/uxbox/main/ui/workspace/selection.cljs
+++ frontend/src/uxbox/main/ui/workspace/selection.cljs
@@ -122,7 +122,7 @@

 (mf/defc controls
   [{:keys [shape zoom on-resize on-rotate] :as props}]
-  (let [{:keys [x y width height rotation]} shape
+  (let [{:keys [x y width height rotation]} (geom/shape->rect-shape shape)
         radius (if (> (max width height) handler-size-threshold) 6.0 4.0)
         transform (geom/rotation-matrix shape)]
     [:g.controls {:transform transform}


CMR-2250: Remove empty line

CMR-2250: Remove empty line

--- search-app/src/cmr/search/services/query_execution/highlight_results_feature.clj
+++ search-app/src/cmr/search/services/query_execution/highlight_results_feature.clj
@@ -5,7 +5,6 @@
             [cmr.search.models.results :as r]
             [cmr.search.data.query-to-elastic :as qte]
             [clojure.string :as str]
-
             [cmr.common.util :as util]))

 (defn get-keyword-conditions