make esm a little more configurable

make esm a little more configurable

--- src/main/shadow/build/targets/esm.clj
+++ src/main/shadow/build/targets/esm.clj
@@ -23,7 +23,7 @@
 (defn str-prepend [x y]
   (str y x))

-(s/def ::runtime #{:node :browser :react-native})
+(s/def ::runtime #{:node :browser :react-native :custom})

 (s/def ::exports
   (s/map-of simple-ident? qualified-symbol? :min-count 1))
@@ -159,6 +159,9 @@
                     (and build-worker? default? (= :browser runtime))
                     (update :entries shared/prepend '[shadow.cljs.devtools.client.browser])

+                    (and build-worker? default? (= :custom runtime) (:client-ns devtools))
+                    (update :entries shared/prepend [(:client-ns devtools)])
+
                     (and (seq preloads) (= :dev mode))
                     (update :entries shared/prepend preloads)

@@ -307,33 +310,29 @@
     ::build/keys [config]
     :as state}]

-  (let [{:keys [runtime]
-         :or {runtime :browser}}
-        config]
-
-    (->> ["globalThis.CLOSURE_DEFINES = " (output/closure-defines-json state) ";"
-          "globalThis.CLOSURE_NO_DEPS = true;"
-          ;; the global must be overriden in goog/base.js since it contains some
-          ;; goog.define(...) which would otherwise be exported to "this"
-          ;; but we need it on $CLJS
-          (-> (data/get-output! state {:resource-id output/goog-base-id})
-              (get :js)
-              ;; FIXME: this is using the compiled variant of goog/base.js
-              ;; don't use goog-global-snippet, that is used for uncompiled goog/base.js
-              ;; keeping both variants for now until I can make this cleaner
-              (str/replace "goog.global = this || self;" "goog.global = globalThis;"))
-
-          "globalThis.goog = goog;"
-          "globalThis.shadow$provide = {};"
-          "globalThis.shadow_esm_import = function(x) { return import(x.startsWith(\"./\") ? \".\" + x : x); }"
-          "let $CLJS = globalThis.$CLJS = globalThis;"
-          (slurp (io/resource "shadow/boot/esm.js"))
-
-          (when (seq polyfill-js)
-            (str polyfill-js "\n"
-                 "globalThis.$jscomp = $jscomp;\n"))]
-         (remove nil?)
-         (str/join "\n"))))
+  (->> ["globalThis.CLOSURE_DEFINES = " (output/closure-defines-json state) ";"
+        "globalThis.CLOSURE_NO_DEPS = true;"
+        ;; the global must be overriden in goog/base.js since it contains some
+        ;; goog.define(...) which would otherwise be exported to "this"
+        ;; but we need it on $CLJS
+        (-> (data/get-output! state {:resource-id output/goog-base-id})
+            (get :js)
+            ;; FIXME: this is using the compiled variant of goog/base.js
+            ;; don't use goog-global-snippet, that is used for uncompiled goog/base.js
+            ;; keeping both variants for now until I can make this cleaner
+            (str/replace "goog.global = this || self;" "goog.global = globalThis;"))
+
+        "globalThis.goog = goog;"
+        "globalThis.shadow$provide = {};"
+        "globalThis.shadow_esm_import = function(x) { return import(x.startsWith(\"./\") ? \".\" + x : x); }"
+        "let $CLJS = globalThis.$CLJS = globalThis;"
+        (slurp (io/resource "shadow/boot/esm.js"))
+
+        (when (seq polyfill-js)
+          (str polyfill-js "\n"
+               "globalThis.$jscomp = $jscomp;\n"))]
+       (remove nil?)
+       (str/join "\n")))

 (defn flush-dev [{::build/keys [config] :keys [build-modules] :as state}]
   (when-not (seq build-modules)


Don't rely on a config file at compile time.

--- src/shale/core.clj
+++ src/shale/core.clj
@@ -62,7 +62,7 @@
              :nrepl (if-let [nrepl-port (or (conf :nrepl-port) 5001)]
                       (new-repl-server nrepl-port))])))

-(def shale-system (get-shale-system (get-config)))
+(def shale-system nil)

 (defn run []
   (alter-var-root #'shale-system component/start))
@@ -71,6 +71,7 @@
   (alter-var-root #'shale-system component/stop))

 (defn init []
+  (set! shale-system (get-shale-system (get-config)))
   (.addShutdownHook (Runtime/getRuntime) (Thread. destroy)))

 (defn -main [& args]


gen-class required for core, so uberjar will run.

--- src/cavm/core.clj
+++ src/cavm/core.clj
@@ -8,7 +8,8 @@
   (:require [clj-time.core :refer [now]])
   (:require [noir.server :as server])
   (:require [me.raynes.fs :as fs])
-  (:require [clojure.tools.cli :refer [cli]]))
+  (:require [clojure.tools.cli :refer [cli]])
+  (:gen-class))

 (defn- tabbed [line]
   (string/split line #"\t"))


Builder mechanics.

Builder mechanics.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -50,6 +50,7 @@
                                             (get cursor "beats")
                                             (repeat id))]
                            (om/build-all cell-view cursors {:state state})))))
+                (dom/td #js {:style #js {:color "#999" :paddingRight "10px"}} "{~}")
                 (dom/td nil
                         (when (= "grid" (get cursor "type"))
                           (let [id (get cursor "id")
@@ -59,57 +60,83 @@

 (declare track-builder)

-(defn play-builder [{:keys [cursor id grid]} _]
+(defn play-builder [{:keys [cursor id grid-state]} _]
   (reify
     om/IRender
     (render [_]
+      (print "play-builder")
       (dom/p #js {:style #js {:color "#999"}}
-             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "{")
+             (dom/span #js {:onClick #(om/set-state! grid-state :builder-fn track-builder)} "{-")
              (dom/span nil " play options ")
-             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "}")))))
+             (dom/span nil "}")))))

-(defn synth-builder [{:keys [cursor id grid]} _]
+(defn synth-builder [{:keys [cursor id grid-state]} _]
   (reify
     om/IRender
     (render [_]
+      (print "synth-builder")
       (dom/p #js {:style #js {:color "#999"}}
-             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "{")
+             (dom/span #js {:onClick #(om/set-state! grid-state :builder-fn track-builder)} "{-")
              (dom/span nil " synth options ")
-             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "}")))))
+             (dom/span nil "}")))))

-(defn sample-builder [{:keys [cursor id grid]} _]
+(defn sample-builder [{:keys [cursor id grid-state]} _]
   (reify
     om/IRender
     (render [_]
+      (print "sample-builder")
       (dom/p #js {:style #js {:color "#999"}}
-             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "{")
+             (dom/span #js {:onClick #(om/set-state! grid-state :builder-fn track-builder)} "{-")
              (dom/span nil " sample options ")
-             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "}")))))
+             (dom/span nil "}")))))

-(defn track-builder [{:keys [cursor id grid]} owner]
+(defn type-builder [{:keys [cursor id grid-state]} _]
   (reify
-    om/IInitState
-    (init-state [_]
-      {:track-builder-expanded false})
-    om/IRenderState
-    (render-state [_ state]
-      (if-not (:track-builder-expanded state)
-        (dom/p #js {:onClick #(om/set-state! owner :track-builder-expanded true)
-                    :style #js {:color "#999"}}
-               "{}")
+    om/IRender
+    (render [_]
+      (print "type-builder")
+      (let [merge-fn #(merge %3 {:builder-fn %1 :builder-type %2})
+            set-type #(om/update-state! grid-state (partial merge-fn %1 %2))]
         (dom/p #js {:style #js {:color "#999"}}
-               (dom/span #js {:onClick #(om/set-state! owner :track-builder-expanded false)} "{")
-               (dom/span #js {:onClick #(om/set-state! grid :builder play-builder)} " play ")
-               (dom/span #js {:onClick #(om/set-state! grid :builder synth-builder)} " synth ")
-               (dom/span #js {:onClick #(om/set-state! grid :builder sample-builder)} " sample ")
-               (dom/span #js {:onClick #(om/set-state! owner :track-builder-expanded false)} "}"))))))
+               (dom/span #js {:onClick #(om/set-state! grid-state :builder-fn track-builder)} "{-")
+               (dom/span #js {:onClick #(set-type play-builder "play")} " play ")
+               (dom/span #js {:onClick #(set-type synth-builder "synth")} " synth ")
+               (dom/span #js {:onClick #(set-type sample-builder "sample")} " sample ")
+               (dom/span nil "}"))))))
+
+(defn width-builder [{:keys [cursor id grid-state]} _]
+  (reify
+    om/IRender
+    (render [_]
+      (print "width-builder")
+      (let [merge-fn #(merge %2 {:builder-fn type-builder :builder-width %1})
+            set-width #(om/update-state! grid-state (partial merge-fn %))]
+        (dom/p #js {:style #js {:color "#999"}}
+               (dom/span #js {:onClick #(om/set-state! grid-state :builder-fn track-builder)} "{-")
+               (dom/span #js {:onClick #(set-width 1)} " 1 ")
+               (dom/span #js {:onClick #(set-width 2)} " 2 ")
+               (dom/span #js {:onClick #(set-width 4)} " 4 ")
+               (dom/span #js {:onClick #(set-width 8)} " 8 ")
+               (dom/span #js {:onClick #(set-width 16)} " 16 ")
+               (dom/span #js {:onClick #(set-width 32)} " 32 ")
+               (dom/span #js {:onClick #(set-width 64)} " 64 ")
+               (dom/span nil "}"))))))
+
+(defn track-builder [{:keys [cursor id grid-state]} _]
+  (reify
+    om/IRender
+    (render [_]
+      (print "track-builder")
+      (dom/p #js {:style #js {:color "#999"}}
+             (dom/span #js {:onClick #(om/set-state! grid-state :builder-fn width-builder)} "{+}")))))

 (defn grid-view [id owner]
   (reify
     om/IInitState
     (init-state [_]
-      {:grid-expanded false
-       :builder track-builder})
+      {:grid-expanded true ;; false
+       :builder-fn track-builder
+       :builder-state {}})
     om/IRenderState
     (render-state [_ state]
       (let [cursor (get (om/observe owner (grids)) id)]
@@ -129,8 +156,7 @@
                                                       (get cursor "tracks")
                                                       (repeat id))]
                                      (om/build-all track-view cursors {:state state})))
-                            (om/build (:builder state) {:cursor cursor :id id :grid owner}
-                                      {:state state}))))))))
+                            (om/build (:builder-fn state) {:cursor cursor :id id :grid-state owner}))))))))

 (defn app-view [cursor _]
   (reify


re-order so that atomic values are checked first

--- src/babel/over.cljc
+++ src/babel/over.cljc
@@ -68,7 +68,6 @@
 (defn head-pre-checks [parent child]
   (or
    (check-vals parent child [:head :synsem :infl]       [:synsem :infl])
-   (check-vals parent child [:head :synsem :subcat]     [:synsem :subcat])
    (check-vals parent child [:head :phrasal]            [:phrasal])
    (check-vals parent child [:head :synsem :agr]        [:synsem :agr])
    (check-vals parent child [:head :synsem :sem]        [:synsem :sem])
@@ -76,8 +75,7 @@
    (check-vals parent child [:head :synsem :cat]        [:synsem :cat])
    (check-vals parent child [:head :synsem :pronoun]    [:synsem :pronoun])
    (check-vals parent child [:head :synsem :propernoun] [:synsem :propernoun])
-   (check-vals parent child [:head :synsem :subcat :1]  [:synsem :subcat :1])
-   (check-vals parent child [:head :synsem :subcat :2]  [:synsem :subcat :2])))
+   (check-vals parent child [:head :synsem :subcat]     [:synsem :subcat])))

 (defn comp-pre-checks [parent child]
   (or


rewrite (comp-pre-checks) and (head-pre-checks)

--- src/babel/over.cljc
+++ src/babel/over.cljc
@@ -45,49 +45,51 @@
 (def ^:dynamic *check-parent-and-head-child-cat-equal* true)
 (def ^:dynamic *check-infl* true)

+(defn check-vals [m1 m2 p1 p2]
+  (let [v1 (get-in m1 p1 :top)
+        v2 (get-in m2 p2 :top)
+        result
+        (cond (= :top v1)
+              false
+              (= :top v2)
+              false
+              (= :fail v1)
+              true
+              (= :top v2)
+              true
+              (and (map? m1)
+                   (map? m2))
+              (fail? (unifyc v1 v2))
+
+              true
+              (not (= v1 v2)))]
+    (if (= result true)
+      (log/debug (str "CAUGHT ONE: p1=" p1 "; p2=" p2)))
+    result))
+
 (defn head-pre-checks [parent child]
-  (log/trace (str "head-pre-checks PH: " (strip-refs (get-in parent [:head]))))
-  (log/trace (str "head-pre-checks H: " (dissoc (strip-refs child) :serialized)))
   (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 :synsem :agr] :top)
-                  (get-in child [:synsem :agr] :top)))
-   (fail? (unifyc (get-in parent [:head :phrasal] :top)
-                  (get-in child [:phrasal] :top)))
-   (fail? (unifyc (get-in parent [:head :synsem :sem] :top)
-                  (get-in child [:synsem :sem] :top)))
-   (fail? (unifyc (get-in parent [:head :synsem :aux] :top)
-                  (get-in child [:synsem :aux] :top)))
-   (fail? (unifyc (get-in parent [:head :synsem :cat] :top)
-                  (get-in child [:synsem :cat] :top)))
-   (fail? (unifyc (get-in parent [:head :synsem :pronoun] :top)
-                  (get-in child [:synsem :pronoun] :top)))
-   (fail? (unifyc (get-in parent [:head :synsem :propernoun] :top)
-                  (get-in child [:synsem :propernoun] :top)))
-   (fail? (unifyc (get-in parent [:head :synsem :subcat :1] :top)
-                  (get-in child [:synsem :subcat :1] :top)))
-   (fail? (unifyc (get-in parent [:head :synsem :subcat :2] :top)
-                  (get-in child [:synsem :subcat :2] :top)))))
+   (check-vals parent child [:head :synsem :infl]       [:synsem :infl])
+   (check-vals parent child [:head :synsem :subcat]     [:synsem :subcat])
+   (check-vals parent child [:head :phrasal]            [:phrasal])
+   (check-vals parent child [:head :synsem :agr]        [:synsem :agr])
+   (check-vals parent child [:head :synsem :sem]        [:synsem :sem])
+   (check-vals parent child [:head :synsem :aux]        [:synsem :aux])
+   (check-vals parent child [:head :synsem :cat]        [:synsem :cat])
+   (check-vals parent child [:head :synsem :pronoun]    [:synsem :pronoun])
+   (check-vals parent child [:head :synsem :propernoun] [:synsem :propernoun])
+   (check-vals parent child [:head :synsem :subcat :1]  [:synsem :subcat :1])
+   (check-vals parent child [:head :synsem :subcat :2]  [:synsem :subcat :2])))

 (defn comp-pre-checks [parent child]
   (or
-   (fail? (unifyc (get-in parent [:comp :synsem :cat] :top)
-                  (get-in child [:synsem :cat] :top)))
-   (fail? (unifyc (get-in parent [:comp :synsem :agr] :top)
-                  (get-in child [:synsem :agr] :top)))
-   (fail? (unifyc (get-in parent [:comp :synsem :case] :top)
-                  (get-in child [:synsem :case] :top)))
-   (fail? (unifyc (get-in parent [:comp :synsem :sem] :top)
-                  (get-in child [:synsem :sem] :top)))
-   (fail? (unifyc (get-in parent [:comp :synsem :reflexive] :top)
-                  (get-in child [:synsem :reflexive] :top)))
-   (fail? (unifyc (get-in parent [:comp :synsem :pronoun] :top)
-                  (get-in child [:synsem :pronoun] :top)))
-   (fail? (unifyc (get-in parent [:comp :synsem :subcat] :top)
-                  (get-in child [:synsem :subcat] :top)))))
+   (check-vals parent child [:comp :synsem :cat]       [:synsem :cat])
+   (check-vals parent child [:comp :synsem :agr]       [:synsem :agr])
+   (check-vals parent child [:comp :synsem :case]      [:synsem :case])
+   (check-vals parent child [:comp :synsem :sem]       [:synsem :sem])
+   (check-vals parent child [:comp :synsem :reflexive] [:synsem :reflexive])
+   (check-vals parent child [:comp :synsem :pronoun]   [:synsem :pronoun])
+   (check-vals parent child [:comp :synsem :subcat]    [:synsem :subcat])))

 (defn moreover-head [parent child & [morph]]
   (let [morph (if morph morph (fn [x] (strip-refs (dissoc x :serialized))))]
@@ -118,7 +120,7 @@
         ;; 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 "
+            (log/warn (str "moreover-head: pre-check missed: fail-path-between "
                            "parent:'" (get-in parent [:rule]) "' and child:"
                            (get-in child [:rule] (get-in child [:synsem :sem :pred] :nopred)) ".")))
           (if (= *extra-diagnostics* true)


DM+CM #7 - add 404 response for view question

--- src/objective8/handlers/front_end.clj
+++ src/objective8/handlers/front_end.clj
@@ -164,5 +164,5 @@
                                                  :question question-to-display
                                                  :signed-in (signed-in?)
                                                  :uri uri})
-      (= status ::http-api/not-found) {:status 404}
+      (= status ::http-api/not-found) (error-404-response t' locale)
       :else {:status 500})))


replace option for schedule job

replace option for schedule job

--- src/twarc/core.clj
+++ src/twarc/core.clj
@@ -141,10 +141,10 @@
               :name (-> var meta :name str))))

 (defn schedule-job
-  [scheduler var arguments & {:keys [job trigger]}]
+  [scheduler var arguments & {:keys [job trigger replace] :or {replace false}}]
   (let [job (job-from-var var (assoc job :arguments arguments))
         trigger (make-trigger trigger)]
-    (.scheduleJob (::quartz scheduler) job trigger)))
+    (.scheduleJob (::quartz scheduler) job #{trigger} replace)))

 (defmacro defjob
   [n binding & body]


Move tests appropriately

Move tests appropriately

--- test/desdemona/query_test.clj
+++ test/desdemona/query_test.clj
@@ -28,6 +28,21 @@
 (deftest infix->dsl-tests
   (is (= '(= (:ip x) "10.0.0.1")
          (q/infix->dsl "ip(x) = 10.0.0.1"))))
+
+(deftest find-free-vars-tests
+  (are [expected query] (= expected (#'q/find-free-vars query))
+    #{}
+    '()
+
+    #{'x}
+    (#'q/dsl->logic '(= (:ip x) "10.0.0.1"))
+
+    #{'x}
+    (#'q/dsl->logic '(= (:type x) "egress"))
+
+    #{'x}
+    (#'q/dsl->logic '(and (= (:ip x) "10.0.0.1")
+                          (= (:type x) "egress")))))

 (def dsl->logic
   @#'desdemona.query/dsl->logic)
@@ -145,16 +160,3 @@
       (are [n-results] (= results (#'q/run-logic-query n-results query events))
         1
         10))))
-
-(deftest find-free-vars-tests
-  (are [expected query] (= expected (#'q/find-free-vars query))
-    #{}
-    '()
-
-    #{'x}
-    '(clojure.core.logic/featurec x {:ip "10.0.0.1"})))
-
-    ;; #{'x}
-    ;; '(clojure.core.logic/conde
-    ;;   [(clojure.core.logic/featurec x {:ip "10.0.0.1"})
-    ;; (clojure.core.logic/featurec x {:type "egress"})])


run-logic-query assumes correctly annotated syms

--- test/desdemona/query_test.clj
+++ test/desdemona/query_test.clj
@@ -161,11 +161,15 @@
     'l/fail
     []

-    '(l/featurec x {:ip "10.0.0.1"})
+    (list clojure.core.logic/featurec
+          (#'q/free-sym 'x)
+          {:ip "10.0.0.1"})
     [[{:ip "10.0.0.1"}]])
   (testing "explicit maximum number of results"
     (let [results [[{:ip "10.0.0.1"}]]
-          query '(l/featurec x {:ip "10.0.0.1"})]
+          query (list clojure.core.logic/featurec
+                      (#'q/free-sym 'x)
+                      {:ip "10.0.0.1"})]
       (are [n-results] (= results (#'q/run-logic-query n-results query events))
         1
         10))))


Fix for my last commit

Fix for my last commit

--- src/ctia/init.clj
+++ src/ctia/init.clj
@@ -19,8 +19,8 @@
             [ctia.stores.memory.ttp :as mt]))

 (defn init-auth-service! []
-  (let [auth-service-name (get-in @properties/properties [:auth :service :name])]
-    {case auth-service-name
+  (let [auth-service-type (get-in @properties/properties [:auth :service :type])]
+    {case auth-service-type
       :allow-all (reset! auth/auth-service (allow-all/->AuthService))
       :threatgrid (reset! auth/auth-service (threatgrid/make-auth-service
                                               (threatgrid/make-whoami-service)))


First version of direct SQL working :)

First version of direct SQL working :)

The first time I have seen it working, returns an array of records in
any UI component

--- src/webapp/framework/client/coreclient.clj
+++ src/webapp/framework/client/coreclient.clj
@@ -602,13 +602,20 @@
                                                                              ~'path
                                                                              ~'ui-state)

-          ~'data-order  (~'-> ~'data :order)                                                            ]
-
-             (comment ~'map (~'fn[~'x] (~'get ~'data-order ~'x)) (~'range (:start ~position) (~'inc
+          ~'data-order  (~'-> ~'data :order)
+
+
+
+          ]
+
+
+
+     (into [] (~'map
+               (~'fn[~'x] (~'get-in ~'data [:values (~'get ~'data-order ~'x) :value]))
+               (~'range (:start ~position) (~'inc
                                                                                (~'min (:end ~position) (~'-> ~'data :count) )
-                                                                                )))
-
-     ~'data
+                                                                                ))))
+     ;~'data
      ))

 ;(macroexpand-1 '(data-view-v2 "aa" {:relative-path [:a]} {} (div )))
@@ -768,8 +775,8 @@
         list-of-sql        (map (fn[x]
                                   (if (.startsWith (str x)
                                                    "(quote ") (apply str "'" (rest x)) x)
-                                  ) (butlast (butlast sql-args)))
-        main-params       (last (butlast   sql-args))
+                                  ) (butlast sql-args))
+        main-params       (last   sql-args)

         sql-as-a-string   (str command " " (apply str (for [arg (into []
                                                                     (apply list list-of-sql))] (str arg " ") ) ))
@@ -867,7 +874,7 @@

 (defmacro select-debug [& select-args]
         (let [
-              main-sql          (butlast(butlast   select-args))
+              main-sql          (butlast (butlast   select-args))
               main-params       (last (butlast   select-args))
               dataview-map      (merge main-params {:debug true})
               code              (last  select-args)
@@ -886,7 +893,7 @@
         ]
     (cond
       (= (type type-of-last-arg)  (type {}))
-      `(remote-sql-parser  "select" ~@select-args)
+      `(remote-sql-parser  "realtime" ~@select-args) ; direct SQL is always treated as realtime

       :else
     `(sql-parser  "select" ~@select-args)
@@ -900,7 +907,7 @@
         ]
     (cond
       (= (type type-of-last-arg)  (type {}))
-      `(remote-sql-parser "realtime " ~@select-args)
+      `(remote-sql-parser "realtime" ~@select-args)

       :else
       `(sql-parser  "realtime" ~@select-args)


fix reloading of the whole project on change in code

--- src/status_im/utils/js_resources.cljs
+++ src/status_im/utils/js_resources.cljs
@@ -1,4 +1,4 @@
-(ns ^:figwheel-always status-im.utils.js-resources
+(ns status-im.utils.js-resources
   (:require-macros [status-im.utils.slurp :refer [slurp]])
   (:require [status-im.utils.types :refer [json->clj]]))


Reformatted db_spec.clj by zprint

Reformatted db_spec.clj by zprint

--- src/zg/db_spec.clj
+++ src/zg/db_spec.clj
@@ -11,12 +11,12 @@
 ;

 (ns zg.db-spec
-    "Namespace that contains configuration of all JDBC sources.")
+  "Namespace that contains configuration of all JDBC sources.")

 (def zg-db
-    "Specification for SQLite database used for storing all dictionaries."
-    {:classname   "org.sqlite.JDBC"
-     :subprotocol "sqlite"
-     :subname     "zg.db"
-    })
+  "Specification for SQLite database used for storing all dictionaries."
+  {:classname   "org.sqlite.JDBC"
+   :subprotocol "sqlite"
+   :subname     "zg.db"
+  })


+(defn head-pre-checks)

+(defn head-pre-checks)

--- src/babel/over.cljc
+++ src/babel/over.cljc
@@ -94,30 +94,31 @@
 (def ^:dynamic *check-parent-and-head-child-cat-equal* true)
 (def ^:dynamic *check-infl* true)

+(defn head-pre-checks [parent child]
+  (not
+   (or
+    (fail? (unify (get-in parent [:head :synsem :infl] :top)
+                  (get-in child [:synsem :infl] :top)))
+    (fail? (unify (get-in parent [:head :synsem :sem :tense] :top)
+                  (get-in child [:synsem :sem :tense] :top)))
+    (fail? (unify (get-in parent [:synsem :cat])
+                  (get-in child [:synsem :cat]))))))
+
 (defn moreover-head [parent child lexfn-sem-impl morph]
   (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 (or (and
-                   *check-parent-and-head-child-cat-equal*
-                   (not (= (get-in parent [:synsem :cat])
-                           (get-in child [:synsem :cat]))))
-                  (and
-                   *check-infl*
-                   (or (fail? (unify (get-in parent [:head :synsem :infl] :top)
-                                     (get-in child [:synsem :infl] :top)))
-                       (fail? (unify (get-in parent [:head :synsem :sem :tense] :top)
-                                     (get-in child [:synsem :sem :tense] :top))))))
-               :fail
-               (unify
-                (merge
-                 (copy parent)
-                 {:surface (str
-                            (get-in parent [:rule]) " -> " (get-in child [:surface]) "")})
-                 (unify {:head (copy child)
-                         :head-filled true}
-                        {:head {:synsem {:sem (lexfn-sem-impl (copy (get-in child '(:synsem :sem) :top)))}}})))]
+          (if (head-pre-checks parent child)
+            :fail
+            (unify
+             (merge
+              (copy parent)
+              {:surface (str
+                         (get-in parent [:rule]) " -> " (get-in child [:surface]) "")})
+             (unify {:head (copy child)
+                     :head-filled true}
+                    {:head {:synsem {:sem (lexfn-sem-impl (copy (get-in child '(:synsem :sem) :top)))}}})))]
       (if (not (fail? result))
         (let [debug (log/trace (str "moreover-head: " (get-in parent '(:rule)) " succeeded: " (get-in result [:rule])
                                     ":'" (morph result) "'"))
@@ -152,26 +153,25 @@
               (log/trace (str "  parent@" fail-path "="
                               (get-in parent (concat [:head] fail-path))))
               (log/trace (str "    head@" fail-path "="
-                              (get-in child fail-path)))))
-          (if (and (not (= (get-in parent [:synsem :cat])
-                           (get-in child [:synsem :cat])))
-                   (not *check-parent-and-head-child-cat-equal*))
-            (log/warn (str "moreover-head: CHILD CAT DIFFERS FROM HEAD CAT!")))
-          (if (fail? (unify (get-in parent [:head :synsem :subcat :1 :cat])
-                            (get-in child [:synsem :subcat :1 :cat])))
-            (log/trace (str "moreover-head: SUBCAT parent head subcat 1:" (get-in parent [:head :synsem :subcat :1 :cat]) ";"
-                            "moreover-head: SUBCAT        head subcat 1:" (get-in child [:synsem :subcat :1 :cat]))))
-          (if (= (get-in parent [:synsem :cat])
-                 (get-in child [:synsem :cat]))
-            (log/trace (str "moreover-head: failcat== " (strip-refs (get-in parent [:rule])) "; "
-                            "child: " (get-in child [:surface]) "")))
-          (if (and false ;; TODO (if no-pre-checks-have-caught-this ..)
-                   (get-in parent [:head :synsem :infl])
-                   (get-in comp [:synsem :infl]))
-            (log/debug (str "moreover-head: fail-path-between:"
-                            (fail-path-between parent {:head child}))))
-          (log/trace (str "moreover-head: failcat!= " (strip-refs (get-in parent [:rule])) "; "
-                          "child: " (get-in child [:surface]) ""))
+                              (get-in child fail-path)))
+              (if (and (not (= (get-in parent [:synsem :cat])
+                               (get-in child [:synsem :cat]))))
+                (log/warn (str "moreover-head: CHILD CAT DIFFERS FROM HEAD CAT!")))
+              (if (fail? (unify (get-in parent [:head :synsem :subcat :1 :cat])
+                                (get-in child [:synsem :subcat :1 :cat])))
+                (log/trace (str "moreover-head: SUBCAT parent head subcat 1:" (get-in parent [:head :synsem :subcat :1 :cat]) ";"
+                                "moreover-head: SUBCAT        head subcat 1:" (get-in child [:synsem :subcat :1 :cat]))))
+              (if (= (get-in parent [:synsem :cat])
+                     (get-in child [:synsem :cat]))
+                (log/trace (str "moreover-head: failcat== " (strip-refs (get-in parent [:rule])) "; "
+                                "child: " (get-in child [:surface]) "")))
+              (if (and false ;; TODO (if no-pre-checks-have-caught-this ..)
+                       (get-in parent [:head :synsem :infl])
+                       (get-in comp [:synsem :infl]))
+                (log/debug (str "moreover-head: fail-path-between:"
+                                (fail-path-between parent {:head child}))))
+              (log/trace (str "moreover-head: failcat!= " (strip-refs (get-in parent [:rule])) "; "
+                              "child: " (get-in child [:surface]) ""))))
           :fail)))))

 ;; Might be useful to set the following variable to true,


CMR-814: Add test for keyword searches containing double quotes

--- test/cmr/system_int_test/search/collection_keyword_search_test.clj
+++ test/cmr/system_int_test/search/collection_keyword_search_test.clj
@@ -60,7 +60,8 @@
         coll19 (d/ingest "PROV2" (dc/collection {:long-name "LNFoobar"}))
         coll20 (d/ingest "PROV2" (dc/collection {:projects pr1}))
         coll21 (d/ingest "PROV2" (dc/collection {:entry-title "coll21" :long-name "ABC!"}))
-        coll22 (d/ingest "PROV2" (dc/collection {:collection-data-type "NEAR_REAL_TIME"}))]
+        coll22 (d/ingest "PROV2" (dc/collection {:collection-data-type "NEAR_REAL_TIME"}))
+        coll23 (d/ingest "PROV1" (dc/collection {:entry-title "coll23" :long-name "\"Quoted\" collection" }))]

     (index/refresh-elastic-index)

@@ -215,8 +216,9 @@
            "*aser" [coll5 coll7 coll9 coll14]
            "p*ce" [coll6]
            "NEA*REA*IME" [coll22]
-           "nea*rea*ime" [coll22]))
-    (testing "search by keywords using wildcard ?."
+           "nea*rea*ime" [coll22]
+           "\"Quoted*" [coll23]))
+    (testing "earch by keywords using wildcard ?."
       (are [keyword-str items]
            (let [refs (search/find-refs :collection {:keyword keyword-str})
                  matches? (d/refs-match? items refs)]
@@ -254,4 +256,3 @@
            "Laser" "score" [coll14 coll5 coll7 coll9]
            "Laser" "+score" [coll5 coll7 coll9 coll14]
            "Laser" "-score" [coll14 coll5 coll7 coll9]))))
-


Aww man seriously!? Zzzz...

Aww man seriously!? Zzzz...

--- systems/ring/src/containium/systems/ring.clj
+++ systems/ring/src/containium/systems/ring.clj
@@ -78,7 +78,7 @@
                   (let [sorted (vec (sort-apps apps))
                         fn-form `(fn [~'sorted ~'request]
                                    (let [~'uri (:uri ~'request)
-                                         ~'host (-> ~'request headers (get "host"))]
+                                         ~'host (-> ~'request :headers (get "host"))]
                                      (or ~@(for [index (range (count sorted))
                                                  :let [app (get sorted index)]]
                                              `(when (matcher ~(:ring-conf app) ~'uri ~'host)


add facedown console test for Apex

add facedown console test for Apex

--- src/clj/test/cards-identities.clj
+++ src/clj/test/cards-identities.clj
@@ -1,4 +1,19 @@
 (in-ns 'test.core)
+
+(deftest apex-facedown-console
+  "Apex - Allow facedown install of a second console. Issue #1326"
+  (do-game
+    (new-game
+      (default-corp)
+      (make-deck "Apex: Invasive Predator" [(qty "Heartbeat" 2)]))
+    (take-credits state :corp)
+    (prompt-choice :runner "Done") ; no facedown install on turn 1
+    (play-from-hand state :runner "Heartbeat")
+    (is (= 1 (count (get-in @state [:runner :rig :hardware]))))
+    (take-credits state :runner)
+    (take-credits state :corp)
+    (prompt-select :runner (find-card "Heartbeat" (:hand (get-runner))))
+    (is (= 1 (count (get-in @state [:runner :rig :facedown]))) "2nd console installed facedown")))

 (deftest argus-security
   "Argus Security - Runner chooses to take 1 tag or 2 meat damage when stealing an agenda"


Also send viewd-by

Also send viewd-by

--- src/cljs/battle_console/game.cljs
+++ src/cljs/battle_console/game.cljs
@@ -251,9 +251,10 @@
         new-actions (conj current-actions action)
         game (state/get-state :raw-game-data)
         player-code (get-in game ["viewed-by" "player-code"])
-        player-context "p1"
+        player-context (get-in game ["viewed-by" "player-code"])
         game (-> game
                  (assoc :actions new-actions)
+                 (assoc :viewed-by {:player-code player-code})
                  (assoc :p2-focused-board (= player-code "p2"))
                  (assoc :action-focus player-code))
         jsgame (js/encodeURIComponent (.stringify js/JSON (clj->js game)))


renaming

renaming

--- src/cljs/triboard/view/frame.cljs
+++ src/cljs/triboard/view/frame.cljs
@@ -4,7 +4,7 @@
     [triboard.logic.turn :as turn]
     [triboard.view.board :as board]
     [triboard.view.interactions :as cb]
-    [triboard.view.menu :as panel]))
+    [triboard.view.menu :as menu]))

 (s/fdef main-frame
   :args (s/cat
@@ -15,6 +15,6 @@
 (defn main-frame
   [turn suggestions callbacks]
   [:div.game-panel
-   [panel/show-top-menu (:scores turn) (:player turn) callbacks]
+   [menu/show-top-menu (:scores turn) (:player turn) callbacks]
    [board/render-board (:board turn) suggestions callbacks]
    ])


en - update product with article

en - update product with article

--- resources/duckling/rules/en.measure.clj
+++ resources/duckling/rules/en.measure.clj
@@ -164,6 +164,13 @@
 	 :value 1
 	 :product (:value %2)}

+	 ; apple
+	"<product>"
+	[(dim :leven-product)]
+	{:dim :quantity
+	 :value 1
+	 :product (:value %1)}
+
 	; Stubs for corpus
 	"pounds"
 	#"pounds?"


Turn start-cli into a macro. This is a preparation for extracting function args for help hints.

--- src/cli4clj/cli.clj
+++ src/cli4clj/cli.clj
@@ -161,16 +161,16 @@

 (def ^:dynamic *read-factory* create-jline-read-fn)

-(defn start-cli
+(defmacro start-cli
   ([]
     (start-cli {}))
   ([user-options]
-    (let [options (get-cli-opts user-options)]
-      (repl
-        :eval ((options :eval-factory) (options :cmds) (options :allow-eval) (options :print-err))
-        :print (options :print)
-        :prompt (options :prompt-fn)
-        :read (*read-factory* (options :cmds) (options :prompt-string))))))
+    `(let [options# (get-cli-opts ~user-options)]
+       (repl
+         :eval ((options# :eval-factory) (options# :cmds) (options# :allow-eval) (options# :print-err))
+         :print (options# :print)
+         :prompt (options# :prompt-fn)
+         :read (*read-factory* (options# :cmds) (options# :prompt-string))))))


updating erlang for linux

updating erlang for linux

--- config/software/erlang.clj
+++ config/software/erlang.clj
@@ -17,30 +17,48 @@
 ;; limitations under the License.
 ;;

-(software "erlang" :source "otp_src_R14B02"
-          :steps [
-                  {:command "touch" :args ["lib/wx/SKIP"] }
-                  {:command "./configure"
-                   :args ["--prefix=/opt/opscode/embedded"
-                          "--enable-threads"
-                          "--enable-smp-support"
-                          "--enable-kernel-poll"
-                          "--enable-darwin-64bit"
-                          "--enable-dynamic-ssl-lib"
-                          "--enable-m64-build"
-                          "--without-javac"
-                          "--with-ssl=/opt/opscode/embedded"
-                          "--build=i686-apple-darwin10"
-                          "--disable-hipe"
-                          "--disable-debug"]
-                   :env { "CFLAGS" "-arch x86_64 -m64 -L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"
-                          "LDFLAGS" "-arch x86_64 -R/opt/opscode/embedded/lib -L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"
-                          }}
-                  {
-                   :env { "CFLAGS" "-arch x86_64 -m64 -L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"
-                          "LDFLAGS" "-arch x86_64 -R/opt/opscode/embedded/lib -L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include" }
-                   :command "make"
-                   }
-                  {:command "make" :args ["install"]}])
+(let [args (cond
+            (and (is-os? "darwin") (is-machine? "x86_64"))
+            ["--prefix=/opt/opscode/embedded"
+             "--enable-threads"
+             "--enable-smp-support"
+             "--enable-kernel-poll"
+             "--enable-darwin-64bit"
+             "--enable-dynamic-ssl-lib"
+             "--enable-m64-build"
+             "--without-javac"
+             "--with-ssl=/opt/opscode/embedded"
+             "--build=i686-apple-darwin10"
+             "--disable-hipe"
+             "--disable-debug"]
+            (is-os? "linux")
+            ["--prefix=/opt/opscode/embedded"
+             "--enable-threads"
+             "--enable-smp-support"
+             "--enable-kernel-poll"
+             "--enable-dynamic-ssl-lib"
+             "--enable-hipe"
+             "--without-javac"
+             "--with-ssl=/opt/opscode/embedded"
+             "--disable-debug"])
+      env (cond
+           (and (is-os? "darwin" (is-machine? "x86_64")))
+           { "CFLAGS" "-arch x86_64 -m64 -L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"
+             "LDFLAGS" "-arch x86_64 -R/opt/opscode/embedded/lib -L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"}
+           (is-os? "linux")
+           { "CFLAGS" "-L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"
+             "LDFLAGS" "-R/opt/opscode/embedded/lib -L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"}
+           )
+      ]
+  (software "erlang" :source "otp_src_R14B02"
+            :steps [
+                    {:command "touch" :args ["lib/wx/SKIP"] }
+                    {:command "./configure"
+                     :args args
+                     :env env}
+                    {
+                     :env env
+                     :command "make"
+                     }
+                    {:command "make" :args ["install"]}]))

-;;                          "--enable-hipe"


allow specifying a timestamp on the command line

the timestamp will be used when creating the 'current state'.
anything greater than or equal to the given timestamp will
be excluded from the data set.

--- src/deltalog/mr.clj
+++ src/deltalog/mr.clj
@@ -28,13 +28,24 @@

 (def out-tap (Hfs. (AvroScheme. (schema/avro-schema)) "example/output" true))

-(defn -main []
+(defn filter-ts-if
+  "If timestamp evaluates to true, then this will create a new
+  pipe that filters where the 'timestamp' field is greater than or equal
+  to the given timestamp value. Otherwise it returns pipe."
+  [pipe timestamp]
+  (if timestamp
+    (Each. pipe
+           (make-fields ["timestamp"])
+           (ExpressionFilter. (str "timestamp >= " timestamp) Long/TYPE))
+    pipe))
+
+(defn -main
+  [& args]
   (let [json-paths ["id" "timestamp" "is_delete" "data"]

         splitter-pipe (Each. "json_split" (make-splitter json-paths))
         tail-pipe (-> splitter-pipe
-                      ;(Each. (make-fields ["timestamp"])
-                      ;       (ExpressionFilter. "timestamp >= 1393542318" Long/TYPE))
+                      (filter-ts-if (first args))
                       (GroupBy. (make-fields ["id"])
                                 (make-fields ["timestamp"]))
                       (Every. Fields/ALL (Last.) Fields/RESULTS))


(PE-19130) Allow puppet conf file to be resources.

Change the puppetserver testutils to allow the sources of the temporary
puppet conf files set up by with-puppet-conf-files to be java.net.URLs
in addition to strings or java.io.Files, and to copy the sources to the
destination files by wrapping the sources in an input stream, which
works even when the source is a URL that points to a classpath resource
contained in a jar.

Together, these changes allow the conf file sources passed to
with-puppet-conf-files to be classpath resources distributed in a jar,
instead of requiring them to be files.

--- test/integration/puppetlabs/puppetserver/testutils.clj
+++ test/integration/puppetlabs/puppetserver/testutils.clj
@@ -1,17 +1,19 @@
 (ns puppetlabs.puppetserver.testutils
-  (:require [me.raynes.fs :as fs]
+  (:require [clojure.java.io :as io]
+            [me.raynes.fs :as fs]
             [schema.core :as schema]
             [cheshire.core :as json]
             [puppetlabs.http.client.sync :as http-client]
             [puppetlabs.kitchensink.core :as ks]
             [puppetlabs.puppetserver.ringutils :as ringutils])
-  (:import (java.io File)))
+  (:import (java.io File)
+           (java.net URL)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Schemas

 (def PuppetConfFiles
-  {schema/Str (schema/pred (some-fn string? #(instance? File %)))})
+  {schema/Str (schema/pred (some-fn string? #(instance? File %) #(instance? URL %)))})

 (def PuppetResource
   "Schema for a Puppet resource. Based on
@@ -97,8 +99,12 @@
   [puppet-conf-files :- PuppetConfFiles
    target-paths :- PuppetConfFiles]
   (doseq [filename (keys puppet-conf-files)]
-    (fs/copy+ (get puppet-conf-files filename)
-              (get target-paths filename))))
+    (let [dest (io/file (get target-paths filename))
+          dest-dir (.getParentFile dest)]
+      (when dest-dir
+        (ks/mkdirs! dest-dir))
+      (with-open [source (io/input-stream (get puppet-conf-files filename))]
+        (io/copy source dest)))))

 (schema/defn ^:always-validate cleanup-with-puppet-conf-files!
   "Deletes all of the files in the target-paths map."


CMR-1867 Makes realize-attributes private.

--- umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/xml_generator.clj
+++ umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/xml_generator.clj
@@ -30,7 +30,7 @@
   [content-generator _]
   (throw (Exception. (str "Unknown content generator type: " (pr-str content-generator)))))

-(defn realize-attributes
+(defn- realize-attributes
   "Returns map with function values replaced by the result of calling them."
   [m]
   (zipmap (keys m)


clojure: remove profiles.clj

clojure: remove profiles.clj

--- clojure/profiles.clj
+++ clojure/profiles.clj
@@ -1,3 +0,0 @@
-{:user {:plugins [[cider/cider-nrepl "0.10.1"]
-                  [lein-kibit "0.1.2"]]
-        :dependencies [[org.clojure/tools.nrepl "0.2.12"]]}}


Add markers for states

Add markers for states

--- src/constraint/core.cljs
+++ src/constraint/core.cljs
@@ -7,13 +7,28 @@
   [:svg:marker
    {:id "Triangle"
     :viewBox "0 0 10 10"
-    :refX "1"
+    :refX "3"
     :refY "5"
     :markerWidth "3"
     :markerHeight "3"
     :orient "auto"}
-   [:svg:path {:d "M0,0 L 10,5 L0,10 z"}]]
-  )
+   [:svg:path {:d "M0,0 L 10,5 L0,10 z"}]])
+
+
+(def circle-marker
+  [:svg:marker
+   {:id "Vertex"
+    :refX "2"
+    :refY "2"
+    :markerWidth "5"
+    :markerHeight "5"
+    :orient "auto"}
+   [:svg:circle
+    {:fill "black"
+     :stroke "none"
+     :cx 2 :cy 2
+     :r 2}]])
+

 (defn make-line-dirs [from to]
   (let [middle (map (comp #(/ % 2) +) from to)
@@ -28,20 +43,18 @@
     :stroke color
     :stroke-width "10px"
     :fill "none"
-    :marker-mid "url(#Triangle)"}])
+    :marker-start "url(#Vertex)"
+    :marker-mid "url(#Triangle)"
+    :marker-end "url(#Vertex)"}])

 (.appendChild (dommy.core/sel1 :.forsvg)
               (crate/html [:svg:svg {:width 1000 :height 1000}
-                           [:svg:defs triangle-marker]
+                           [:svg:defs
+                            triangle-marker
+                            circle-marker]
                            (line [100, 20] [200, 40] "#6666ff")
-                           (line [200, 40] [100, 80] "red")
-                           [:svg:circle {:id "button"
-                                         :fill "yellow"
-                                         :stroke "green"
-                                         :stroke-width 4
-                                         :cx 50 :cy 50
-                                         :r 50}]]))
+                           (line [200, 40] [100, 80] "red")]))

 (defn e->tid [e]
   (-> e


New version

New version


add tools.reader to deps

add tools.reader to deps


Version bump to 1.1.1

Version bump to 1.1.1


fix :license

fix :license


New version.

New version.


Bump clojure.tools.cli (#131)

Bump clojure.tools.cli (#131)


Replace environ by yogthos/config

Replace environ by yogthos/config


Add clojure-csv dependency

Add clojure-csv dependency


Doc update

Doc update

--- project.clj
+++ project.clj
@@ -1,6 +1,6 @@
 (defproject tutorial "0.1.0-SNAPSHOT"
-  :description "FIXME: write description"
-  :url "http://example.com/FIXME"
+  :description "AEOLIAN - Audio-ising code quality"
+  :url "https://github.com/andeemarks/aeolian"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :main aeolian.core


Version 1.0.0

Version 1.0.0

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject dda/dda-managed-vm "1.0.0-SNAPSHOT"
+(defproject dda/dda-managed-vm "1.0.0"
   :description "The managed vm desktop crate"
   :url "https://www.domaindrivenarchitecture.org"
   :license {:name "Apache License, Version 2.0"


Added missing argument

Added missing argument

--- src/cljs/salava/extra/application/ui/application.cljs
+++ src/cljs/salava/extra/application/ui/application.cljs
@@ -119,7 +119,7 @@
          [:div.rowcontent
           [:h1.uppercase-header name]
           [:div.badge-stats
-           (bh/issuer-label-image-link issuer_content_name issuer_content_url issuer_contact issuer_image)
+           (bh/issuer-label-image-link issuer_content_name issuer_content_url "" issuer_contact issuer_image)
            [:div
             description]
            (if-not (blank? criteria_url)


Tests

Tests

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -102,8 +102,8 @@
           (assert (= (count keys)) (inc (count children)))
           (assert (= (count keys) (count (set keys))))
           (assert (= (seq keys) (sort keys)))
-          (assert (every? #(<= lower %) keys))
-          (assert (every? #(>= upper %) keys))
+          (assert (every? #(<= lower %) keys) (pr-str lower keys))
+          (assert (every? #(>= upper %) keys) (pr-str upper keys))
           (if (nil? children)
             (do
               (assert (= lower (aget keys 0)) (pr-str lower keys))
@@ -262,6 +262,14 @@
      (dotimes [i 500000]
        (.assoc! tree i (* 2 i)))))

+  (defn f []
+    (time
+     (let [tree (tree 100)]
+       (dotimes [i 500000]
+         (.assoc! tree i (* 2 i))))))
+
+  (f)
+
   (let [tree (tree 3)
         iterator (iterator tree)]
     (.next iterator))


Just stop breaking key-lt/gt

Just stop breaking key-lt/gt

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -78,30 +78,10 @@
         false))))

 (defn ^boolean key-lt [as bs]
-  (let [as-len (alength as)
-        bs-len (alength bs)]
-    (assert (== as-len bs-len) (pr-str as bs))
-    (loop [i 0]
-      (if (< i as-len)
-        (let [a (aget as i)
-              b (aget bs i)]
-          (or (and (identical? (typeof a) (typeof b))
-                   (< a b))
-              (< (typeof a) (typeof b))))
-        false))))
+  (== -1 (key-compare as bs)))

 (defn ^boolean key-gt [as bs]
-  (let [as-len (alength as)
-        bs-len (alength bs)]
-    (assert (== as-len bs-len) (pr-str as bs))
-    (loop [i 0]
-      (if (< i as-len)
-        (let [a (aget as i)
-              b (aget bs i)]
-          (or (and (identical? (typeof a) (typeof b))
-                   (> a b))
-              (> (typeof a) (typeof b))))
-        false))))
+  (== 1 (key-compare as bs)))

 (defn ^boolean key-lte [as bs]
   (not (== 1 (key-compare as bs))))


Remove restart from core.

Remove restart from core.

--- src/incise/core.clj
+++ src/incise/core.clj
@@ -7,8 +7,7 @@
             [taoensso.timbre :refer [warn]]
             [clojure.string :as s]
             [clojure.tools.cli :refer [cli]]
-            [incise.server :refer [wrap-log-exceptions serve stop-server
-                                   defserver]]))
+            [incise.server :refer [wrap-log-exceptions serve]]))

 (def ^:private valid-methods #{"serve" "once" "deploy"})
 (defn- parse-method [method]
@@ -75,11 +74,4 @@
     (case (conf/get :method)
       :deploy (wrap-main deploy)
       :once (wrap-main once)
-      (serve))))
-
-(defn restart
-  "Stop a server if it is already started and start a new one."
-  [& args]
-  (stop-server)
-  (require :reload 'incise.server)
-  (apply defserver args))
+      ((wrap-pre serve conf/load)))))


Set method to serve in repl start-server.

--- src/incise/repl.clj
+++ src/incise/repl.clj
@@ -4,7 +4,11 @@
             [incise.config :as conf]
             [incise.core :refer :all]))

-(def start-server (wrap-pre start conf/load))
+(defn start-server []
+  (conf/load)
+  (conf/assoc :method :serve)
+  (start))
+
 (defn restart-server
   "Stop a server if it is already started and start a new one."
   [& args]


Attempt to be compatible with Safari.

Attempt to be compatible with Safari.

--- src/klangmeister/sound/music.cljs
+++ src/klangmeister/sound/music.cljs
@@ -2,7 +2,7 @@
   (:require [leipzig.temperament :as temperament]
             [klangmeister.sound.synthesis :as synthesis]))

-(defonce context (js/window.AudioContext.))
+(defonce context (or (js/window.AudioContext.) (js/window.webkitAudioContext.)))

 (defn play! [notes]
   (doseq [{:keys [time duration instrument] :as note} notes]


Add some docstrings to the high-level API

--- src/icecap/rest.clj
+++ src/icecap/rest.clj
@@ -17,6 +17,7 @@
             [ring.middleware.reload :refer [wrap-reload]]))

 (defn create-cap
+  "Creates a capability."
   [plan & {store :store kdf :kdf scheme :scheme}]
   (info plan)
   (let [cap (crypto/make-cap)
@@ -27,6 +28,7 @@
     (async/into {:cap cap} ch)))

 (defn get-cap
+  "Gets a capability."
   [cap & {store :store kdf :kdf scheme :scheme}]
   (go (let [{index :index key :key} (crypto/derive kdf cap)
             blob (<! (retrieve store index))
@@ -36,6 +38,7 @@
       (async/into {} sub-results))))

 (defn delete-cap
+  "Deletes a capability."
   [cap & {store :store}]
   (async/into {} (delete! store cap)))


Adjusted goal position

Adjusted goal position

--- src/divergence/core.cljs
+++ src/divergence/core.cljs
@@ -38,7 +38,7 @@
    (e/regular-block 380 520 stage)
    (e/horizontal-full-block 0 560 stage)
    (e/box 300 300 stage)
-   (e/goal 700 40 stage)
+   (e/goal 700 485 stage)
    (e/background stage)
    ])


Use out-dir instead of in-dir for manifest.json.

--- src/incise/once.clj
+++ src/incise/once.clj
@@ -14,7 +14,7 @@
   (conf/merge! config)
   (conf/avow!)
   (let [{:keys [out-dir precompiles stefon in-dir]} (conf/get)
-        manifest-file-path (.getPath (file in-dir "manifest.json"))]
+        manifest-file-path (.getPath (file out-dir "manifest.json"))]
     (info "Clearing out" (str \" out-dir \"))
     (delete-recursively (file out-dir))
     (with-options (merge {:mode :production


Track tot-entries metric in grouper.

Track tot-entries metric in grouper.

--- src/cbfg/grouper.cljs
+++ src/cbfg/grouper.cljs
@@ -1,21 +1,25 @@
 (ns cbfg.grouper
   (:require-macros [cbfg.act :refer [act-loop achan aclose aalts]]))

-(defn make-grouper [actx put-ch take-all-ch max-entries]
+(defn make-grouper [actx put-ch take-all-ch max-entries-per-take]
   "A grouper manages a put-ch, a take-all-ch, and a set of entries.
    Multiple producers can put entries to the put-ch, and a consumer
    can grab all the collected entries in one shot by a take on the
    take-all-ch.  During a put, an entry is a [key update-fn], so
    producers can merge or group entries, such as for de-dupe or
    piggy-backing requests.  Puts will block if there are more than
-   max-entries number of entries.  During a take-all, the received
+   max-entries-per-take number of entries.  During a take-all, the received
    entries is an associative map of key to update-fn-result.
    The grouper closes the take-all-ch after put-ch is closed
    and all the entries are taken."
   (act-loop grouper actx
-            [entries {} max-entries max-entries tot-puts 0 tot-takes 0]
+            [entries {}
+             max-entries-per-take max-entries-per-take
+             tot-puts 0
+             tot-takes 0
+             tot-entries 0] ; Can be < tot-puts if there's de-deupe.
             (let [n (count entries)
-                  chs0 (if (>= n max-entries)
+                  chs0 (if (>= n max-entries-per-take)
                          []        ; We're full, so ignore put'ers.
                          [put-ch]) ; We still have room, so accept puts.
                   chs1 (if (> n 0) ; We've entries, so try to fulfill takers.
@@ -25,9 +29,10 @@
                 (let [[m ch] (aalts grouper chs1)]
                   (if (= ch put-ch)
                     (if-let [[k f] m]
-                      (recur (update-in entries [k] f) max-entries
-                             (inc tot-puts) tot-takes)
-                      (recur entries -1 tot-puts tot-takes))
-                    (recur {} max-entries tot-puts (inc tot-takes))))
+                      (recur (update-in entries [k] f) max-entries-per-take
+                             (inc tot-puts) tot-takes tot-entries)
+                      (recur entries -1 tot-puts tot-takes tot-entries))
+                    (recur {} max-entries-per-take
+                           tot-puts (inc tot-takes) (+ tot-entries n))))
                 (aclose grouper take-all-ch)))))


fixing response keys

fixing response keys

--- src/celestial/api.clj
+++ src/celestial/api.clj
@@ -120,14 +120,14 @@
         (success {:msg "updated actions"}))

   (GET- "/action/by-target/:type" [^:string type] {:nickname "getActionsByTargetType" :summary "Gets actions that operate on a target type"}
-        (success (p/get-action-index :operates-on type)))
+        (success {:ids (p/get-action-index :operates-on type)}))

   (GET- "/action/:id" [^:int id] {:nickname "getActions" :summary "Gets actions descriptor"}
         (success (p/get-action id)))

   (DELETE- "/action/:id" [^:int id] {:nickname "deleteActions" :summary "Deletes an action set"}
            (p/delete-action id)
-           (success {:msg "deleted actions" :id id})))
+           (success {:msg "Deleted action" :id id})))

 (defroutes app-routes
   hosts types actions jobs (friend/wrap-authorize users admin) (friend/wrap-authorize quotas admin) (route/not-found "Not Found"))


Added streaming cancellations back in

Added streaming cancellations back in

I had to manually fool Clojure into garbage collecting our lazy
sequence.

--- src/cfpb/qu/views.clj
+++ src/cfpb/qu/views.clj
@@ -387,16 +387,17 @@
 (defn- ch->writer [ch]
   (io/writer (ch->outputstream ch)))

+(defn future-stream
+  [ch write-fn data]
+  (future (write-fn ch data)))
+
 (defn stream-data
   [request response data write-fn]
   (with-channel request ch
     (log/info "Channel opened")
     (send! ch response false)
-    (on-close ch (fn [status]
-                   (log/info "Channel closed" status)))
-    (write-fn ch data)
-
-    #_(let [ch-future (future (write-fn ch data))]
+
+    (let [ch-future (future-stream ch write-fn data)]
       (on-close ch (fn [status]
                      (log/info "Channel closed" status)
                      (if-not (= status :server-close)


remove master? option in favor of :version :master setting, and check if given version tag is valid

--- src/main/cljs_api_gen/catalog.clj
+++ src/main/cljs_api_gen/catalog.clj
@@ -104,8 +104,7 @@
     :keys [version
            catalog?
            skip-pages?
-           skip-parse?
-           master?]
+           skip-parse?]
     :or {version :latest
          catalog? false
          skip-pages? true
@@ -127,10 +126,14 @@
                            @@prev-result
                            @prev-result)

-        tags (if (= :latest version)
-               (cond-> @published-cljs-tags
-                 master? (concat ["master"]))
-               (concat (take-while (partial not= version) @published-cljs-tags) [version]))
+        tags (case version
+               :latest @published-cljs-tags
+               :master (concat @published-cljs-tags ["master"])
+               (if-not ((set @published-cljs-tags) version)
+                 (do
+                   (println (style "Unrecognized version tag" :red) version)
+                   (System/exit 1))
+                 (concat (take-while (partial not= version) @published-cljs-tags) [version])))
         last-tag (last tags)]

     ;; make cache directory


Add default om/transact! handler for commands called from views

--- src/main/workflo/macros/view.cljs
+++ src/main/workflo/macros/view.cljs
@@ -1,12 +1,19 @@
 (ns workflo.macros.view
-  (:require [om.next]
+  (:require [om.next :as om]
             [om.dom]))

 ;;;; Configuration options for the defview macro

+(defn default-handle-command
+  "Default command handler, generating an Om Next transaction
+   with a mutation and queries that correspond 1:1 to the
+   command, its parameters and the optional reads."
+  [cmd-name view params reads]
+  (om/transact! view `[(~cmd-name ~params) ~@(or reads [])]))
+
 (defonce +configuration+
   (atom {:wrapper-view nil
-         :handle-command nil}))
+         :handle-command default-handle-command}))

 (defn configure!
   "Configures the defview macro, usually before it is being used.
@@ -19,7 +26,9 @@
                      and a parameter map and an optional vector
                      of things to re-query after running the
                      command."
-  [{:keys [wrapper-view handle-command] :as options}]
+  [{:keys [wrapper-view
+           handle-command]
+    :or   {handle-command default-handle-command}}]
   (swap! +configuration+ assoc
          :wrapper-view wrapper-view
          :handle-command handle-command))


DM + CM #46 - remove redundant comment-query function

--- src/objective8/front_end/templates/page_furniture.clj
+++ src/objective8/front_end/templates/page_furniture.clj
@@ -113,18 +113,12 @@

 ;; COMMENT LIST

-(defn limit-query-string [request]
-  (when-let [limit (get-in request [:params :comments])]
-                       (str "?comments=" limit)))
-
 (defn comments-refer-uri [request]
   (str (:uri request)
-       (limit-query-string request)
        "%23comments"))

 (defn comment-refer-uri [request comment]
   (str (:uri request)
-       (limit-query-string request)
        "#comment-" (:_id comment)))

 (defn voting-actions-when-signed-in [{:keys [data ring-request] :as context} comment]
@@ -202,7 +196,7 @@
                                              (html/set-attr :action (str (get-in data [comment-target :uri]) "/annotations"))
                                              identity)
                   [:.clj-reason] (when (= :section comment-target) identity)
-                  [:.clj-refer] (html/set-attr :value (str (:uri ring-request) (limit-query-string ring-request)))
+                  [:.clj-refer] (html/set-attr :value (:uri ring-request))
                   [:.clj-comment-on-uri] (html/set-attr :value (get-in data [comment-target :uri]))
                   [:.clj-comment-form-label-title] (html/content (translations (keyword page-name "comment-box-label-title") ))
                   [:.clj-comment-form-label-helper] (html/content (translations (keyword page-name "comment-box-label-helper")))


update turn flag helpers

update turn flag helpers

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -121,16 +121,23 @@
   (swap! state assoc-in [:stack :current-run] nil)
   )

-(defn register-turn-flag! [state flag card]
-  (swap! state assoc-in [:register :current-turn flag] card)
+(defn register-turn-flag! [state flag condition card]
+  (let [stack (get-in @state [:stack :current-turn flag])]
+    (swap! state assoc-in [:stack :current-turn flag] (conj stack {:card card :condition condition})
+           ))
   )

-(defn turn-flag [state flag]
-  (get-in @state [:register :current-turn flag])
-  )
+(defn turn-flag? [state side card flag]
+  (empty?
+    (for [
+          condition (get-in @state [:stack :current-turn flag])
+          :let [result ((:condition condition) state side card)]
+          :when (not result)
+          ]
+      [result])))

 (defn clear-turn-register! [state]
-  (swap! state assoc-in [:register :current-turn] nil)
+  (swap! state assoc-in [:stack :current-turn] nil)
   )

 (defn register-suppress [state side events card]


Round text size to nearest multiple of 2

--- src/net/sekao/nightcode/utils.clj
+++ src/net/sekao/nightcode/utils.clj
@@ -151,8 +151,8 @@
 (defn normalize-text-size [n]
   (-> n
       (/ 2)
+      (Math/ceil)
       (* 2)
-      (Math/ceil)
       (max 12)
       (min 24)))


removes multilang-test

removes multilang-test

--- storm-core/test/clj/backtype/storm/multilang_test.clj
+++ storm-core/test/clj/backtype/storm/multilang_test.clj
@@ -1,66 +0,0 @@
-;; Licensed to the Apache Software Foundation (ASF) under one
-;; or more contributor license agreements.  See the NOTICE file
-;; distributed with this work for additional information
-;; regarding copyright ownership.  The ASF licenses this file
-;; to you under the Apache License, Version 2.0 (the
-;; "License"); you may not use this file except in compliance
-;; with the License.  You may obtain a copy of the License at
-;;
-;; http://www.apache.org/licenses/LICENSE-2.0
-;;
-;; Unless required by applicable law or agreed to in writing, software
-;; distributed under the License is distributed on an "AS IS" BASIS,
-;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;; See the License for the specific language governing permissions and
-;; limitations under the License.
-(ns backtype.storm.multilang-test
-  (:use [clojure test])
-  (:use [backtype.storm testing config])
-  (:use [backtype.storm.daemon common])
-  (:require [backtype.storm [thrift :as thrift]]))
-
-;; (deftest test-multilang-fy
-;;   (with-local-cluster [cluster :supervisors 4]
-;;     (let [nimbus (:nimbus cluster)
-;;           topology (thrift/mk-topology
-;;                       {"1" (thrift/mk-spout-spec (TestWordSpout. false))}
-;;                       {"2" (thrift/mk-shell-bolt-spec {"1" :shuffle} "fancy" "tester.fy" ["word"] :parallelism-hint 1)}
-;;                       )]
-;;       (submit-local-topology nimbus
-;;                           "test"
-;;                           {TOPOLOGY-WORKERS 20 TOPOLOGY-MESSAGE-TIMEOUT-SECS 3 TOPOLOGY-DEBUG true}
-;;                           topology)
-;;       (Thread/sleep 10000)
-;;       (.killTopology nimbus "test")
-;;       (Thread/sleep 10000)
-;;       )))
-
-
- (defn test-multilang
-       [executor file-extension]
-       (with-local-cluster [cluster :supervisors 4]
-         (let [nimbus (:nimbus cluster)
-               topology (thrift/mk-topology
-                  {"1" (thrift/mk-shell-spout-spec [executor (str "tester_spout." file-extension)] ["word"])}
-                  {"2" (thrift/mk-shell-bolt-spec {"1" :shuffle} [executor (str "tester_bolt." file-extension)] ["word"] :parallelism-hint 1)})]
-         (submit-local-topology nimbus
-               "test"
-               {TOPOLOGY-WORKERS 20 TOPOLOGY-MESSAGE-TIMEOUT-SECS 3 TOPOLOGY-DEBUG true}
-               topology)
-       (Thread/sleep 31000)
-       (.killTopology nimbus "test")
-       (Thread/sleep 11000)
-       )))
-
-
-(deftest test-python
-(test-multilang "python" "py")
-)
-
-(deftest test-ruby
-(test-multilang "ruby" "rb")
-)
-
-(deftest test-node
-(test-multilang "node" "js")
-)


append to existing doc file if already exists (instead of appending dots to filename)

This allows us to see functions/macros with duplicate names in the same
file.

--- src/core.clj
+++ src/core.clj
@@ -549,17 +549,14 @@
        (cljsdoc-section "Filename" (:filename item))
        (cljsdoc-section "Source" (:source item))
        (cljsdoc-section "Github" (:github-link item))
-       (cljsdoc-section "History" (join "\n" (map make-history-text (:history item))))])))
+       (cljsdoc-section "History" (join "\n" (map make-history-text (:history item))))
+       ""])))

 (defn dump-doc-file!
   [item]
-  (let [add-ext #(str % ".cljsdoc")
-        filename (loop [f (item-filename item)]
-                   (if (exists? (add-ext f))
-                     (recur (str f "."))
-                     (add-ext f)))
+  (let [filename (str (item-filename item) ".cljsdoc")
         cljsdoc-content (make-cljsdoc item)]
-    (spit filename cljsdoc-content)))
+    (spit filename cljsdoc-content :append true)))

 (defn dump-api-docs!
   [api]


Use a wider range of possible bitrates

Use a wider range of possible bitrates

--- src/mdr2/encode.clj
+++ src/mdr2/encode.clj
@@ -89,7 +89,7 @@

 (def bitrates
   "Possible bitrates for encoding a DTB"
-  [128 64 56 48])
+  [128 112 96 80 64 56 48])

 (defn ideal-bitrate
   "Calculate the ideal bitrate based on the size of a production and


селектор border: 1px solid;

селектор border: 1px solid;

--- src/ixinfestor/core.cljs
+++ src/ixinfestor/core.cljs
@@ -272,7 +272,7 @@
      [:div {:class "input-group-btn"}

       [:select {:id (name (xml-id :select-page-size id))
-                :style "float: left; width: 80px"
+                :style "float: left; width: 80px; border: 1px solid;"
                 :class "btn btn-default dropdown-toggle form-control"
                 :on-change #(this-as this (put! event-chan [id :page-size (js/parseInt (dommy/value this))]))}
        (let [selected-i (or (:page-size init-params) nil)]


[#431] No need to count null values separately

--- backend/src/akvo/lumen/lib/aggregation/pie.clj
+++ backend/src/akvo/lumen/lib/aggregation/pie.clj
@@ -4,19 +4,11 @@
             [akvo.lumen.lib.aggregation.utils :as utils]
             [clojure.java.jdbc :as jdbc]))

-(defn non-null-query [tenant-conn table-name column-name filter-sql]
+(defn run-query [tenant-conn table-name column-name filter-sql]
   (rest (jdbc/query tenant-conn
                     [(format "SELECT %s, count(*) FROM %s WHERE %s GROUP BY %s"
                              column-name table-name filter-sql column-name)]
                     {:as-arrays? true})) )
-
-(defn null-query [tenant-conn table-name column-name filter-sql]
-  (let [n (ffirst (rest (jdbc/query tenant-conn
-                                    [(format "SELECT count(*) FROM %s WHERE %s IS NULL AND %s"
-                                             table-name column-name filter-sql)]
-                                    {:as-arrays? true})) )]
-    (when-not (zero? n)
-      [[nil n]])))

 (defn query [tenant-conn dataset query]
   (let [columns (:columns dataset)
@@ -25,11 +17,7 @@
         bucket-column-name (get bucket-column "columnName")
         bucket-column-title (get bucket-column "title")
         table-name (:table-name dataset)
-        non-null-counts (non-null-query tenant-conn table-name bucket-column-name filter-sql)
-        null-counts (null-query tenant-conn table-name bucket-column-name filter-sql)
-        counts (if null-counts
-                 (concat non-null-counts null-counts)
-                 non-null-counts)]
+        counts (run-query tenant-conn table-name bucket-column-name filter-sql)]
     (http/ok {"metadata" {"bucketColumnTitle" bucket-column-title}
               "data" (mapv (fn [[bucket-value bucket-count]]
                              {"bucketValue" bucket-value


Clarify how we track the state in the DOM.

--- src-cljs/frontend/components/about.cljs
+++ src-cljs/frontend/components/about.cljs
@@ -170,7 +170,7 @@

 (defn validated-form-control [props owner]
-  (let [check-validation
+  (let [update-state
         (fn [input]
           (om/set-state! owner {:value (.-value input)
                                 :validation-message (.-validationMessage input)}))]
@@ -181,7 +181,8 @@
          :validation-message nil})
       om/IDidMount
       (did-mount [_]
-        (check-validation (om/get-node owner "control")))
+        ;; Update our state based on the DOM immediately (and later on-change).
+        (update-state (om/get-node owner "control")))
       om/IRenderState
       (render-state [_ {:keys [value validation-message]}]
         (html
@@ -190,7 +191,7 @@
             (merge (dissoc props :constructor)
                    {:value value
                     :ref "control"
-                    :on-change #(check-validation (.-target %))})]
+                    :on-change #(update-state (.-target %))})]
            (when validation-message
              [:div.validation-message validation-message])])))))


Use normal substring contains

Use normal substring contains

--- src-cljs/frontend/components/admin.cljs
+++ src-cljs/frontend/components/admin.cljs
@@ -19,6 +19,7 @@
             [frontend.state :as state]
             [frontend.utils :as utils :include-macros true]
             [frontend.utils.vcs-url :as vcs-url]
+            [goog.string :as gstring]
             [inflections.core :refer [pluralize]]
             [om.core :as om :include-macros true])
   (:require-macros [frontend.utils :refer [component element html]]))
@@ -330,23 +331,11 @@
                                 :type :shrink
                                 :cell-fn (projects/settings-cell-fn {:vcs-url-fn :vcs_url})}]}))))))

-(defn- noncontinuos-substring-match [to-match s]
-  "Returns a regexp that will match any string that has the characters of in the
-   input string in order. i.e. 'asd' would match 'asdf' or 'acghgsghghcdcggthtf'"
-  (let [to-escape #{\\ \^ \$ \* \+ \? \.  \( \) \|  \{ \}  \[ \]}
-        cmap (into {} (for [c to-escape] [c (str \\ c)]))
-        pattern (->> (str/escape to-match cmap)
-                     (interpose ".*")
-                     (apply str)
-                     re-pattern)]
-    (re-find pattern s)))
-
 (defn- filter-projects [projects filter-str]
-  (js/console.log filter-str)
   (if (seq filter-str)
-    (filter #(noncontinuos-substring-match
-               filter-str
-               (-> % :vcs_url (vcs-url/project-name)))
+    (filter #(gstring/caseInsensitiveContains
+               (-> % :vcs_url (vcs-url/project-name))
+               filter-str)
             projects)
     projects))


#47 alpha draft for composable states

#47 alpha draft for composable states

--- src/mount/core.cljc
+++ src/mount/core.cljc
@@ -248,6 +248,54 @@
     (dorun (map rollback! states))       ;; restore to origin from "start-with"
     {:stopped stopped}))

+;; composable set of states
+
+(defn only
+  ([states]
+   states)
+  ([states these]
+   (filter these states)))
+
+(defn with-args
+  ([args]
+   (with-args (find-all-states) args))
+  ([states args]
+    (reset! -args args)  ;; TODO localize
+    states))
+
+(defn except
+  ([states]
+   (except (find-all-states) states))
+  ([states these]
+   (remove these states)))
+
+(defn swap
+  ([with]
+   (swap (find-all-states) with))
+  ([states with]
+   (doseq [[from to] with]
+     (substitute! (var-to-str from)
+                  to :value))
+   states))
+
+(defn swap-states
+  ([with]
+   (swap-states (find-all-states) with))
+  ([states with]
+   (doseq [[from to] with]
+     (substitute! (var-to-str from)
+                  (var-to-str to) :state))
+   states))
+
+#_(-> (only #{1 2 3 4})
+      (with-args {})
+      (except #{2 1})
+      (swap {2 42 1 34})
+      (swap-states {4 "#'foo.bar/42"})
+      (start))
+
+;; explicit, not composable (subject to depreciate?)
+
 (defn stop-except [& states]
   (let [all (set (find-all-states))
         states (map var-to-str states)


change error message

change error message

--- src/leiningen/jslint.clj
+++ src/leiningen/jslint.clj
@@ -79,7 +79,7 @@
                             (apply invoke project sources))))
     (catch Throwable t
       (println
-       (joine (str "Can't execute jslint application: " (.getMessage t))
+       (joine (str "Can't execute JSLint: " (.getMessage t))
               "Something is wrong:"
               " - installation: npm install jslint -g"
               " - configuration: https://github.com/vbauer/lein-jslint"))


Fix a bug in cycle algorithm.

Fix a bug in cycle algorithm.

--- src/exp/sahucs_nc.clj
+++ src/exp/sahucs_nc.clj
@@ -173,7 +173,7 @@
 (defn expand-sa-node [node #^HashMap cache next-best state reward-to-state last-cutoff
                       #^IdentityHashMap stack-node-depths depth]
   (assert (not (.containsKey stack-node-depths node)))
-  (println "Entering " (env/action-name (:action node)) "at depth" depth)
+  (println "Entering " (env/action-name (:action node)) (map #(env/get-var state %) '[[atx] [aty]]) "at depth" depth ", " (count @(:result-map-atom node)) ", " last-cutoff reward-to-state)
   (.put stack-node-depths node depth)
   (let [good-queue (:queue node)
         bad-queue  (queues/make-graph-stack-pq)
@@ -190,10 +190,11 @@
                           new-results)]
           (swap! (:result-map-atom node) (partial merge-safe >=) (into {} clean))
           (doseq [entry (concat good-roots (map #(:entry (meta (key %))) dirtied))]
+            (assert (util/xor (not (:sanode entry)) (:cutoff (meta entry))))
             (queues/g-pq-replace! good-queue entry
-              (- 0 (:reward-to-state entry) (if-let [n  (:sanode entry)] (cutoff (:queue n)) 0))))
+              (or (:cutoff (meta entry)) (- (:reward-to-state entry))))) ;(if-let [n  (:sanode entry)] (cutoff (:queue n)) 0)
           (.remove stack-node-depths node) ;; TODO: catchup!!
-          (println "Returning from" (env/action-name (:action node)) "With cutoff" cut (cutoff good-queue) "and cdm" cutoff-depth-map "and states" (count new-results) (count catchup) "-" (count clean) (count dirtied) (count still-dirty) "and good roots" (count good-roots) (map :reward-to-state good-roots))
+          (println "Returning from" (env/action-name (:action node)) (map #(env/get-var state %) '[[atx] [aty]]) "With cutoff" cut (cutoff good-queue) "and cdm" cutoff-depth-map "and states" (count new-results) (count catchup) "-" (count clean) (count dirtied) (count still-dirty) "and good roots" (count good-roots) (map :reward-to-state good-roots))
           (PartialResult (stitch-effect-map
                            (into {} (map (fn [[s r]] [(vary-meta s assoc :cycle-depth
                                                         (final-cycle-depth r (or (:cycle-depth (:entry (meta s)))
@@ -202,19 +203,20 @@
                                          (concat new-results catchup)))
                            state reward-to-state)
                          cut (val (first cutoff-depth-map))))
-        (let [[entry neg-reward] (queues/pq-peek-min both-queue)
+        (let [[entry neg-reward] (queues/pq-remove-min-with-cost! both-queue)
               b-s (:state entry), b-rts (:reward-to-state entry),
               b-ra (:remaining-actions entry), b-sa (:sanode entry), b-cd (:min-cycle-depth entry)
               rec-next-best (- (max next-best (cutoff both-queue)) b-rts)]
           (if (empty? b-ra)
-              (do (queues/pq-remove-min-with-cost! both-queue)
-               (recur (assoc-safe new-results >=
+              (do (println "found state" (map #(env/get-var b-s %) '[[atx] [aty]]) "with reward" b-rts)
+                (recur (assoc-safe new-results >=
                                   (vary-meta (extract-effect b-s (:context node) (:opt (meta b-s))) assoc :entry entry) b-rts)
                       cutoff-depth-map good-roots))
-            (let [rec (if-let [stack-depth (.get stack-node-depths b-sa)]
-                           (PartialResult {} Double/NEGATIVE_INFINITY stack-depth)
-                         (expand-sa-node b-sa cache rec-next-best b-s b-rts (- 0 neg-reward b-rts)
-                                         stack-node-depths (inc depth)))
+            (let [[rec rcut] (if-let [stack-depth (.get stack-node-depths b-sa)]
+                            (do (println "Stack hit on" (env/action-name (:action b-sa)) (map #(env/get-var b-s %) '[[atx] [aty]]))
+                                [(PartialResult {} Double/NEGATIVE_INFINITY stack-depth) (- neg-reward)])
+                            [(expand-sa-node b-sa cache rec-next-best b-s b-rts (- 0 neg-reward b-rts)
+                                              stack-node-depths (inc depth)) (+ (cutoff (:queue b-sa)) b-rts)])
                   cd  (min b-cd (:min-cycle-depth rec))
                   result-nodes (for [[ss sr] (:result-map rec)
                                      :let [s-cd (min (:cycle-depth (meta ss)) b-cd)]]
@@ -229,16 +231,15 @@
                                           bad-nodes)]
               (doseq [n good-nodes]       (queues/g-pq-add! good-queue n (- (:reward-to-state n))))
               (doseq [n (concat nbn sbn)] (queues/g-pq-add! bad-queue  n (- (:reward-to-state n))))
-              (queues/pq-remove-min-with-cost! both-queue)
               (when (> (:cutoff rec) Double/NEGATIVE_INFINITY)
                 (queues/g-pq-replace! (if (< cd depth) bad-queue good-queue) entry (- 0 b-rts (:cutoff rec))))
               (recur new-results
                      (extend-cutoff-depth-map cutoff-depth-map (:cutoff rec) cd depth)
-                     (concat (when (and (>= b-cd depth) (< cd depth)) [entry])
+                     (concat (when (and (>= b-cd depth) (< cd depth)) [(vary-meta entry assoc :cutoff rcut)])
                              (doall (for [n sbn] (queues/g-pq-remove! good-queue n)))
                              good-roots)))))))))

-;; Need same fix as regular since in cycles we may still check cutoff.
+;; TODO: Now, problem is that when we look at cutoff of good-root directly we miss cached states we haven't seen.!

 ;; ALMOST: except suboptimal states may get cached at higher levels too.
 ;; Such bad states cannot be cached.


fix conditional

fix conditional

--- src/babel/francais/morphology/verbs.clj
+++ src/babel/francais/morphology/verbs.clj
@@ -25,7 +25,77 @@
         last-stem-char-is-e (re-find #"er$" infinitive)
         person (get-in word '(:agr :person))
         number (get-in word '(:agr :number))]
-    ;; QUI COMINCIA IL FUTURO FRANCESE
+    (cond
+
+     (and (= person :1st) (= number :sing) er-type)
+     (str stem "erais")
+     (and (= person :1st) (= number :sing) ir-type)
+     (str stem "irais")
+     (and (= person :1st) (= number :sing) re-type)
+     (str stem "rais")
+
+     (and (= person :2nd) (= number :sing) ir-type)
+     (str stem "erais")
+     (and (= person :2nd) (= number :sing) er-type)
+     (str stem "irais")
+     (and (= person :2nd) (= number :sing) re-type)
+     (str stem "rais")
+
+     (and (= person :3rd) (= number :sing) ir-type)
+     (str stem "erait")
+     (and (= person :3rd) (= number :sing) er-type)
+     (str stem "irait")
+     (and (= person :3rd) (= number :sing) re-type)
+     (str stem "rait")
+
+     (and (= person :1st) (= number :plur) er-type)
+     (str stem "erions")
+     (and (= person :1st) (= number :plur) ir-type)
+     (str stem "irions")
+     (and (= person :1st) (= number :plur) re-type)
+     (str stem "rions")
+
+     (and (= person :2nd) (= number :plur) er-type)
+     (str stem "eriez")
+     (and (= person :2nd) (= number :plur) ir-type)
+     (str stem "iriez")
+     (and (= person :2nd) (= number :plur) re-type)
+     (str stem "riez")
+
+     ;; </second person plural conditional>
+
+     ;; <third person plural conditional>
+     (and (= person :3rd) (= number :plur)
+          er-type)
+     (str stem "eraient")
+     (and (= person :3rd) (= number :plur)
+          ir-type)
+     (str stem "iraient")
+     (and (= person :3rd) (= number :plur)
+          re-type)
+     (str stem "raient")
+
+     ;; </third person plural conditional>
+     :else
+     (throw (Exception. (str "get-string-1: conditional regular inflection: don't know what to do with input argument: " (strip-refs word)))))))
+
+(defn future [word]
+  (let [infinitive (get-in word '(:français))
+        ar-type (try (re-find #"ar$" infinitive)
+                     (catch Exception e
+                       (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))
+        er-type (re-find #"[eé]r$" infinitive)
+        ir-type (re-find #"ir$" infinitive)
+        re-type (re-find #"re$" infinitive)
+        stem (string/replace infinitive #"[iaeé]r$" "")
+        stem (if re-type
+               ;; prendre -> prend
+               (string/replace infinitive #"re$" "")
+               stem)
+        last-stem-char-is-i (re-find #"ir$" infinitive)
+        last-stem-char-is-e (re-find #"er$" infinitive)
+        person (get-in word '(:agr :person))
+        number (get-in word '(:agr :number))]
     (cond

      (and (= person :1st) (= number :sing) er-type)
@@ -80,78 +150,6 @@
      :else
      (throw (Exception. (str "get-string: futuro regular inflection: don't know what to do with input argument: " (strip-refs word)))))))

-(defn future [word]
-  (let [infinitive (get-in word '(:français))
-        ar-type (try (re-find #"ar$" infinitive)
-                     (catch Exception e
-                       (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))
-        er-type (re-find #"[eé]r$" infinitive)
-        ir-type (re-find #"ir$" infinitive)
-        re-type (re-find #"re$" infinitive)
-        stem (string/replace infinitive #"[iaeé]r$" "")
-        stem (if re-type
-               ;; prendre -> prend
-               (string/replace infinitive #"re$" "")
-               stem)
-        last-stem-char-is-i (re-find #"ir$" infinitive)
-        last-stem-char-is-e (re-find #"er$" infinitive)
-        person (get-in word '(:agr :person))
-        number (get-in word '(:agr :number))]
-    ;; QUI COMINCIA IL FUTURO FRANCESE
-    (cond
-
-     (and (= person :1st) (= number :sing) er-type)
-     (str stem "erai")
-     (and (= person :1st) (= number :sing) ir-type)
-     (str stem "iré")
-     (and (= person :1st) (= number :sing) re-type)
-     (str stem "rai")
-
-     (and (= person :2nd) (= number :sing) ir-type)
-     (str stem "iras")
-     (and (= person :2nd) (= number :sing) er-type)
-     (str stem "eras")
-     (and (= person :2nd) (= number :sing) re-type)
-     (str stem "ras")
-
-     (and (= person :3rd) (= number :sing) ir-type)
-     (str stem "ira")
-     (and (= person :3rd) (= number :sing) er-type)
-     (str stem "era")
-     (and (= person :3rd) (= number :sing) re-type)
-     (str stem "ra")
-
-     (and (= person :1st) (= number :plur) er-type)
-     (str stem "erons")
-     (and (= person :1st) (= number :plur) ir-type)
-     (str stem "irons")
-     (and (= person :1st) (= number :plur) re-type)
-     (str stem "rons")
-
-     ;; <second person plural future>
-     (and (= person :2nd) (= number :plur) er-type)
-     (str stem "erez")
-     (and (= person :2nd) (= number :plur) ir-type)
-     (str stem "irez")
-     (and (= person :2nd) (= number :plur) re-type)
-     (str stem "rez")
-     ;; </second person plural future>
-
-     ;; <third person plural future>
-     (and (= person :3rd) (= number :plur)
-          er-type)
-     (str stem "eront")
-     (and (= person :3rd) (= number :plur)
-          ir-type)
-     (str stem "iront")
-     (and (= person :3rd) (= number :plur)
-          re-type)
-     (str stem "ront")
-     ;; </third person plural future>
-
-     :else
-     (throw (Exception. (str "get-string: futuro regular inflection: don't know what to do with input argument: " (strip-refs word)))))))
-
 (defn imperfect [word]
   (let [infinitive (get-in word '(:français))
         ar-type (try (re-find #"ar$" infinitive)


Minor fixup of acquisition engine logging

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -713,9 +713,9 @@
                                  (get-msp (@state :position-list) current-position)))
                         :when pos]
                     #(do
-                       (log "BEGIN move a stage to position")
+                       (log "BEGIN set position of stage" axis)
                        (apply set-stage-position axis pos)
-                       (log "END move a stage to position"))))
+                       (log "END set position of stage" axis))))
                 #(log "BEGIN channel properties and exposure")
                 (for [prop (get-in event [:channel :properties])]
                   #(set-property prop))


Add generation for function parameters, splitting for required and not

--- src/googlica/core.clj
+++ src/googlica/core.clj
@@ -27,12 +27,12 @@

 (def storage-object-get (-> storage-model :resources :objects :methods :get))

-(defn get-required-params
-  "Returns a map with only the required params"
+(defn split-required-params
+  "Returns a vector of two maps: first with the required params, second with the optional"
   [method]
   (->> (:parameters method)
-       (filter (fn [[k v]] (:required v)))
-       (into {})))
+       ((juxt filter remove) (fn [[k v]] (:required v)))
+       (mapv #(into {} %))))

 (defn generate-function-name
   "Generates a symbol in the form of 'verb-resource', from a method map."
@@ -46,7 +46,10 @@
        "\n")) ;; TODO: add description for parameters

 (defn generate-args [method]
-  '[arg1])
+  (let [[required optional] (->> method
+                                 split-required-params
+                                 (mapv (comp (partial mapv ->kebab-case-symbol) keys)))]
+    `[~@required {:keys ~optional}]))

 (defn generate-request [method]
   {:method "get"


Slightly nicer error message

Slightly nicer error message

--- src/greenyet/core.clj
+++ src/greenyet/core.clj
@@ -5,6 +5,8 @@
             [greenyet
              [status :as status]
              [view :as view]]))
+
+(import java.io.FileNotFoundException)

 (def ^:private hosts-with-status (atom {}))

@@ -50,7 +52,12 @@
               (format "  %s: '%s'" env-var value)))
        (map println)
        doall)
-  (start-polling))
+  (try
+    (start-polling)
+    (catch FileNotFoundException e
+      (binding [*out* *err*]
+        (println (.getMessage e)))
+      (System/exit 1))))

 (defn handler [x]
   {:body (view/render (vals @hosts-with-status))})


finish vector implementation

finish vector implementation

--- src/cljc/clj_money/x_platform/util.cljc
+++ src/cljc/clj_money/x_platform/util.cljc
@@ -41,33 +41,25 @@
                         (map #(string/join "=" %)))))

 (defmulti ^:private parse-key-segment
-  (fn [_ segment]
+  (fn [segment]
     (cond
       (re-find #"\[.+\]" segment) :keyword
       (re-find #"\[\]" segment) :index
       :else :default)))

 (defmethod ^:private parse-key-segment :keyword
-  [context segment]
-  (update-in context [:result] conj
-             (-> segment
-                 (string/replace #"\[|\]" "")
-                 keyword)))
+  [segment]
+  (-> segment
+      (string/replace #"\[|\]" "")
+      keyword))

 (defmethod ^:private parse-key-segment :index
-  [context segment]
-  (let [new-ctx (update-in context [:indexes (:result context)] (fnil inc -1))]
-
-    (pprint {:context context
-             :segment segment
-             :new-ctx new-ctx})
-
-    (-> new-ctx
-        (update-in [:result] conj (get-in new-ctx [:indexes (:result context)])))))
+  [segment]
+  ::index)

 (defmethod ^:private parse-key-segment :default
-  [context segment]
-  (update-in context [:result] conj (keyword segment)))
+  [segment]
+  (keyword segment))

 (defn- parse-key
   "Takes a query string key like user[first-name] and
@@ -80,15 +72,26 @@
   (->> (re-find #"([^\[\]]+)(\[[^\]]*\])*" k)
        rest              ; this first position holds the entire match
        (filter identity)
-       (reduce parse-key-segment
-               {:result []})
-       :result))
+       (map parse-key-segment)))
+
+(defn- assoc-in-x
+  "Like assoc-in except that it creates a vector (instead of a map) for a
+  non-existing container if the key is ::index"
+  [m [k & ks] v]
+  (let [target (or m (if (= k ::index)
+                       []
+                       {}))
+        wk (if (= k ::index)
+             (count target)
+             k)]
+    (if ks
+      (assoc target wk (assoc-in-x (get m k) ks v))
+      (assoc target wk v))))

 (defn- collapse-collections
   [key-value-pairs]
   (reduce (fn [result [k v]]
-            (let [k-vec (parse-key k)]
-              (assoc-in result k-vec v)))
+            (assoc-in-x result (parse-key k) v))
           {}
           key-value-pairs))


unburb content

unburb content

--- src/cljs/clj_money/views/scheduled.cljs
+++ src/cljs/clj_money/views/scheduled.cljs
@@ -119,7 +119,7 @@
    [:td.d-none.d-md-table-cell (format-date (:last-occurrence sched-tran))]
    [:td
     [:span.d-none.d-md-inline (format-date (:next-occurrence sched-tran))]
-    [:span.d-md-none] (format-date (:next-occurrence sched-tran) "M/d")]
+    [:span.d-md-none (format-date (:next-occurrence sched-tran) "M/d")]]
    [:td
     [:div.btn-group
      [:button.btn.btn-sm {:title "Click here to realize transactions for this schedule."


show started state on topic menu

show started state on topic menu

--- src/cljs/daveconservatoire/site/ui.cljs
+++ src/cljs/daveconservatoire/site/ui.cljs
@@ -79,7 +79,7 @@
               (::selected? props) (assoc :className "dc-bg-orange active"))
             (dissoc props ::r/handler))
     (link (select-keys props [::r/handler ::r/params])
-      (dom/i #js {:className "icon-chevron-right"}) content)))
+      (dom/i #js {:className (or (::icon props) "icon-chevron-right")}) content)))

 (om/defui ^:once Hero
   Object
@@ -355,17 +355,17 @@

 (om/defui ^:once TopicSideBarLink
   static om/IQuery
-  (query [_] [:topic/title :url/slug])
-
-  static om/Ident
-  (ident [_ props] (u/model-ident props))
-
-  Object
-  (render [this]
-    (let [{:keys [url/slug topic/title]} (om/props this)
+  (query [_] [:topic/title :topic/started? :url/slug])
+
+  static om/Ident
+  (ident [_ props] (u/model-ident props))
+
+  Object
+  (render [this]
+    (let [{:keys [url/slug topic/title topic/started?]} (om/props this)
           selected? (or (u/current-uri-slug? ::r/topic slug)
                         (= slug (om/get-computed this :ui/topic-slug)))]
-      (nav-item {::selected? selected?
+      (nav-item {::selected? selected? ::icon (if started? "icon-adjust")
                  ::r/handler ::r/topic ::r/params {::r/slug slug}}
         title))))


CMR-387: Removed center-point from orbit and refactored.

--- src/cmr/umm/test/generators/granule.clj
+++ src/cmr/umm/test/generators/granule.clj
@@ -59,12 +59,11 @@
                      (ext-gen/nil-if-empty (gen/vector instrument-refs 0 4))))

 (def spatial-coverages
-  (gen/fmap (partial apply g/->SpatialCoverage)
-            (gen/one-of
-              [(gen/tuple (gen/vector spatial-gen/geometries 1 5)
-                          (gen/return nil))
-               (gen/tuple (gen/return nil)
-                          spatial-gen/orbits)])))
+  (ext-gen/model-gen
+    g/map->SpatialCoverage
+    (gen/one-of
+      [(gen/hash-map :geometries (gen/vector spatial-gen/geometries 1 5))
+       (gen/hash-map :orbit spatial-gen/orbits)])))

 (def granules
   (ext-gen/model-gen


- typo fixed

- typo fixed

--- examples/sparkling.clj
+++ examples/sparkling.clj
@@ -2,11 +2,11 @@

 ;; **
 ;;; # Gorilla REPL
-;;;
+;;;
 ;;; Welcome to gorilla :-)
-;;;
+;;;
 ;;; Shift + enter evaluates code. Hit alt+g twice in quick succession or click the menu icon (upper-right corner) for more commands ...
-;;;
+;;;
 ;;; It's a good habit to run each worksheet in its own namespace: feel free to use the declaration we've provided below if you'd like.
 ;; **

@@ -36,7 +36,7 @@
 ;; @@

 ;; @@
-(require '[sparkling.serialization :as requirered-to-have-serializer-class-read])
+(require '[sparkling.serialization :as required-to-have-serializer-class-read])
 ;; @@

 ;; @@


Remove dead code

Remove dead code

--- src/io/aviso/rook.clj
+++ src/io/aviso/rook.clj
@@ -1,17 +1,12 @@
 (ns io.aviso.rook
   "Rook is a simple package used to map the functions of a namespace as web resources, following a naming pattern or explicit meta-data."
   (:require
-    [medley.core :as medley]
     [io.aviso.rook
      [dispatcher :as dispatcher]
-     [schema-validation :as v]
      [internals :as internals]
      [utils :as utils]]
     [ring.middleware params format keyword-params]
-    [clojure.tools.logging :as l]
-    [clojure.string :as str]
-    [compojure.core :as compojure]
-    [clout.core :as clout]))
+    [clojure.string :as str]))

 (defn build-map-arg-resolver
   "Builds a static argument resolver around the map of keys and values; the values are the exact resolved
@@ -67,14 +62,6 @@
   This reflects the default configuration, where `params*` is mapped to this function."
   [request]
   (internals/clojurized-params-arg-resolver request))
-
-#_
-(defn wrap-with-function-arg-resolvers
-  "Wraps the handler with a request that has the :arg-resolvers key extended with any
-  function-specific arg-resolvers (from the function's meta-data)."
-  [handler]
-  (fn [request]
-    (handler (update-in request [:rook :arg-resolvers] internals/prefix-with (-> request :rook :metadata :arg-resolvers)))))

 (defn wrap-with-standard-middleware
   "The standard middleware that Rook expects to be present before it is passed the Ring request."


Support configurable prefixes when writing RDF.

Should work with all supported formats.  A default set of prefixes is
supplied, but can be overriden.

Fixes #53

--- src/rdf-common/grafter/rdf/io.clj
+++ src/rdf-common/grafter/rdf/io.clj
@@ -377,6 +377,20 @@
           File   (filename->rdf-format (str dest)))
         (throw (ex-info "Could not infer file format, please supply a :format parameter" {:error :could-not-infer-file-format :object dest})))))

+(def default-prefixes
+  {
+   "dcat" "http://www.w3.org/ns/dcat#"
+   "dcterms" "http://purl.org/dc/terms/"
+   "owl" "http://www.w3.org/2002/07/owl#"
+   "qb" "http://purl.org/linked-data/cube#"
+   "rdf" "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   "rdfs" "http://www.w3.org/2000/01/rdf-schema#"
+   "sdmx" "http://purl.org/linked-data/sdmx/2009/concept#"
+   "skos" "http://www.w3.org/2004/02/skos/core#"
+   "void" "http://rdfs.org/ns/void#"
+   "xsd" "http://www.w3.org/2001/XMLSchema#"
+   })
+
 (defn rdf-serializer
   "Coerces destination into an java.io.Writer using
   clojure.java.io/writer and returns an RDFSerializer.
@@ -391,15 +405,21 @@
                    the file extension).  This should be a sesame RDFFormat
                    object.

-  - :encoding      The character encoding to be used (default: UTF-8)"
-
-  ([destination & {:keys [append format encoding] :or {append false
-                                                       encoding "UTF-8"}}]
-   (let [^RDFFormat format (resolve-format-preference destination format)]
-     (Rio/createWriter format
-                       (io/writer destination
-                                  :append append
-                                  :encoding encoding)))))
+  - :encoding      The character encoding to be used (default: UTF-8)
+
+  - :prefixes      A map of RDF prefix names to URI prefixes."
+
+  ([destination & {:keys [append format encoding prefixes] :or {append false
+                                                                encoding "UTF-8"
+                                                                prefixes default-prefixes}}]
+   (let [^RDFFormat format (resolve-format-preference destination format)
+         writer (Rio/createWriter format
+                                  (io/writer destination
+                                             :append append
+                                             :encoding encoding))]
+     (reduce (fn [acc [name prefix]]
+               (doto writer
+                 (.handleNamespace name prefix))) prefixes))))

 (def ^:no-doc format-supports-graphs #{RDFFormat/NQUADS
                                        RDFFormat/TRIX


Add window

Add window

--- src/play_clj/ui.clj
+++ src/play_clj/ui.clj
@@ -7,7 +7,7 @@
            [com.badlogic.gdx.scenes.scene2d.ui ButtonGroup CheckBox Dialog
             HorizontalGroup Image ImageButton ImageTextButton Label ScrollPane
             SelectBox Skin Slider Table TextButton TextField VerticalGroup
-            WidgetGroup]
+            WidgetGroup Window]
            [com.badlogic.gdx.scenes.scene2d.utils ActorGestureListener Align
             ChangeListener ClickListener DragListener FocusListener
             NinePatchDrawable SpriteDrawable TextureRegionDrawable
@@ -325,6 +325,20 @@
   [entity k & options]
   `(u/call! ^VerticalGroup (:object ~entity) ~k ~@options))

+(defn window*
+  [^String title arg children]
+  (create-group (Window. title arg) children))
+
+(defmacro window
+  [title arg children & options]
+  `(let [entity# (window* ~title ~arg ~children)]
+     (u/calls! ^Window (:object entity#) ~@options)
+     entity#))
+
+(defmacro window!
+  [entity k & options]
+  `(u/call! ^Window (:object ~entity) ~k ~@options))
+
 ; listeners

 (defn ^:private gesture-listener


Clear the asset manager on the GL thread

--- src/nightmod/sandbox.clj
+++ src/nightmod/sandbox.clj
@@ -79,7 +79,7 @@
   [path]
   (reset! u/error nil)
   (clear-ns! game-ns)
-  (asset-manager! manager :clear)
+  (on-gl (asset-manager! manager :clear))
   (-> (format "(do %s\n)" (slurp path))
       jail/safe-read
       sb